forked from OSchip/llvm-project
Avoid two function calls of file() when not needed.
Reported by: ruiu llvm-svn: 228069
This commit is contained in:
parent
10797c5707
commit
836a635764
|
|
@ -83,12 +83,15 @@ DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) {
|
||||||
|
|
||||||
bool DefinedAtom::compareByPosition(const DefinedAtom *lhs,
|
bool DefinedAtom::compareByPosition(const DefinedAtom *lhs,
|
||||||
const DefinedAtom *rhs) {
|
const DefinedAtom *rhs) {
|
||||||
const File *lhsFile = &lhs->file();
|
const File *lhsFile;
|
||||||
const File *rhsFile = &rhs->file();
|
const File *rhsFile;
|
||||||
|
|
||||||
if (lhs == rhs)
|
if (lhs == rhs)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
lhsFile = &lhs->file();
|
||||||
|
rhsFile = &rhs->file();
|
||||||
|
|
||||||
if (lhsFile->ordinal() != rhsFile->ordinal())
|
if (lhsFile->ordinal() != rhsFile->ordinal())
|
||||||
return lhsFile->ordinal() < rhsFile->ordinal();
|
return lhsFile->ordinal() < rhsFile->ordinal();
|
||||||
assert(lhs->ordinal() != rhs->ordinal());
|
assert(lhs->ordinal() != rhs->ordinal());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue