]> granicus.if.org Git - clang/commitdiff
AttributeList: tweak the conditional order to avoid two strcmps
authorAlp Toker <alp@nuanti.com>
Thu, 5 Dec 2013 18:04:42 +0000 (18:04 +0000)
committerAlp Toker <alp@nuanti.com>
Thu, 5 Dec 2013 18:04:42 +0000 (18:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196518 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/AttributeList.cpp

index aa7f9df6bca73fe11e42b89f0ab85c4f0ef9ba58..023069c35b8a1c4d5971a1952a9e532a5fb9845d 100644 (file)
@@ -122,8 +122,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name,
   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;