]> granicus.if.org Git - clang/commitdiff
Tweak the ordering of a conditional to possibly avoid a few strcmps.
authorAaron Ballman <aaron@aaronballman.com>
Fri, 6 Dec 2013 16:26:55 +0000 (16:26 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Fri, 6 Dec 2013 16:26:55 +0000 (16:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196584 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Lex/PPMacroExpansion.cpp

index 954abe25d83ccb25eb83a8ced63f3b728c9f3b92..49acd2515d65df5439bfc90df16d936dc8e227ac 100644 (file)
@@ -1048,7 +1048,7 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) {
 static bool HasAttribute(const IdentifierInfo *II) {
   StringRef Name = II->getName();
   // Normalize the attribute name, __foo__ becomes foo.
-  if (Name.startswith("__") && Name.endswith("__") && Name.size() >= 4)
+  if (Name.size() >= 4 && Name.startswith("__") && Name.endswith("__"))
     Name = Name.substr(2, Name.size() - 4);
 
   // FIXME: Do we need to handle namespaces here?