Avoid two function calls of file() when not needed.

Reported by:	ruiu

llvm-svn: 228069
This commit is contained in:
Davide Italiano 2015-02-03 23:44:33 +00:00
parent 10797c5707
commit 836a635764
1 changed files with 5 additions and 2 deletions

View File

@ -83,12 +83,15 @@ DefinedAtom::ContentPermissions DefinedAtom::permissions(ContentType type) {
bool DefinedAtom::compareByPosition(const DefinedAtom *lhs,
const DefinedAtom *rhs) {
const File *lhsFile = &lhs->file();
const File *rhsFile = &rhs->file();
const File *lhsFile;
const File *rhsFile;
if (lhs == rhs)
return false;
lhsFile = &lhs->file();
rhsFile = &rhs->file();
if (lhsFile->ordinal() != rhsFile->ordinal())
return lhsFile->ordinal() < rhsFile->ordinal();
assert(lhs->ordinal() != rhs->ordinal());