r196518 - AttributeList: tweak the conditional order to avoid two strcmps

Alp Toker alp at nuanti.com
Thu Dec 5 10:04:42 PST 2013


Author: alp
Date: Thu Dec  5 12:04:42 2013
New Revision: 196518

URL: http://llvm.org/viewvc/llvm-project?rev=196518&view=rev
Log:
AttributeList: tweak the conditional order to avoid two strcmps

Modified:
    cfe/trunk/lib/Sema/AttributeList.cpp

Modified: cfe/trunk/lib/Sema/AttributeList.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/AttributeList.cpp?rev=196518&r1=196517&r2=196518&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/AttributeList.cpp (original)
+++ cfe/trunk/lib/Sema/AttributeList.cpp Thu Dec  5 12:04:42 2013
@@ -122,8 +122,8 @@ AttributeList::Kind AttributeList::getKi
   StringRef AttrName = Name->getName();
 
   // Normalize the attribute name, __foo__ becomes foo.
-  if (AttrName.startswith("__") && AttrName.endswith("__") &&
-      AttrName.size() >= 4)
+  if (AttrName.size() >= 4 && AttrName.startswith("__") &&
+      AttrName.endswith("__"))
     AttrName = AttrName.substr(2, AttrName.size() - 4);
 
   SmallString<64> Buf;





More information about the cfe-commits mailing list