Browse Source

[preprocessor] Minor optimization following r178671.

Don't bother looking for parameter index of 'B' token if 'A' is not a parameter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178699 91177308-0d34-0410-b5e6-96231b3b80d8
Argyrios Kyrtzidis 12 years ago
parent
commit
4ad33d0f97
1 changed files with 3 additions and 2 deletions
  1. 3 2
      lib/Lex/MacroInfo.cpp

+ 3 - 2
lib/Lex/MacroInfo.cpp

@@ -110,8 +110,9 @@ bool MacroInfo::isIdenticalTo(const MacroInfo &Other, Preprocessor &PP,
       // With syntactic equivalence the parameter names can be different as long
       // With syntactic equivalence the parameter names can be different as long
       // as they are used in the same place.
       // as they are used in the same place.
       int AArgNum = getArgumentNum(A.getIdentifierInfo());
       int AArgNum = getArgumentNum(A.getIdentifierInfo());
-      int BArgNum = Other.getArgumentNum(B.getIdentifierInfo());
-      if (AArgNum == -1 || AArgNum != BArgNum)
+      if (AArgNum == -1)
+        return false;
+      if (AArgNum != Other.getArgumentNum(B.getIdentifierInfo()))
         return false;
         return false;
       continue;
       continue;
     }
     }