r196584 - Tweak the ordering of a conditional to possibly avoid a few strcmps.

Aaron Ballman aaron at aaronballman.com
Fri Dec 6 08:26:55 PST 2013


Author: aaronballman
Date: Fri Dec  6 10:26:55 2013
New Revision: 196584

URL: http://llvm.org/viewvc/llvm-project?rev=196584&view=rev
Log:
Tweak the ordering of a conditional to possibly avoid a few strcmps.

Modified:
    cfe/trunk/lib/Lex/PPMacroExpansion.cpp

Modified: cfe/trunk/lib/Lex/PPMacroExpansion.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPMacroExpansion.cpp?rev=196584&r1=196583&r2=196584&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPMacroExpansion.cpp (original)
+++ cfe/trunk/lib/Lex/PPMacroExpansion.cpp Fri Dec  6 10:26:55 2013
@@ -1048,7 +1048,7 @@ static bool HasExtension(const Preproces
 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?





More information about the cfe-commits mailing list