From: Aaron Ballman Date: Fri, 6 Dec 2013 16:26:55 +0000 (+0000) Subject: Tweak the ordering of a conditional to possibly avoid a few strcmps. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24c144e4f672e33695e228260a182b3f60e2694c;p=clang Tweak the ordering of a conditional to possibly avoid a few strcmps. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196584 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Lex/PPMacroExpansion.cpp b/lib/Lex/PPMacroExpansion.cpp index 954abe25d8..49acd2515d 100644 --- a/lib/Lex/PPMacroExpansion.cpp +++ b/lib/Lex/PPMacroExpansion.cpp @@ -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?