diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-25 10:41:10 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-02-25 10:41:10 +0000 |
commit | 5297d71e8c85f9b04dc31c690e91c6a2f7eddb90 (patch) | |
tree | fe2bb53479b6b942a2beac20e8251e83fe29ce99 /lib/Sema/AttributeList.cpp | |
parent | d390de9c6312684c5e5b333f434199e193c7467a (diff) |
Accept __has_feature(__feature__) as a synonym for __has_feature(feature) (and
likewise for __has_extension). Patch by Jonathan Sauer!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151445 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/AttributeList.cpp')
-rw-r--r-- | lib/Sema/AttributeList.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Sema/AttributeList.cpp b/lib/Sema/AttributeList.cpp index a3791dedf7..9b74fc03ce 100644 --- a/lib/Sema/AttributeList.cpp +++ b/lib/Sema/AttributeList.cpp @@ -101,7 +101,8 @@ AttributeList::Kind AttributeList::getKind(const IdentifierInfo *Name) { StringRef AttrName = Name->getName(); // Normalize the attribute name, __foo__ becomes foo. - if (AttrName.startswith("__") && AttrName.endswith("__")) + if (AttrName.startswith("__") && AttrName.endswith("__") && + AttrName.size() >= 4) AttrName = AttrName.substr(2, AttrName.size() - 4); return llvm::StringSwitch<AttributeList::Kind>(AttrName) |