diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-03-27 20:36:32 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-03-27 20:36:32 +0000 |
commit | 0702d02b319405f4d70a381034e21c9c62a0cbc3 (patch) | |
tree | ba1611e4987927b340c276d0539a71ffd193ba68 /clang/lib | |
parent | 5604a27788aa8d0e255284dc1cab78b7eebce823 (diff) | |
download | bcm5719-llvm-0702d02b319405f4d70a381034e21c9c62a0cbc3.tar.gz bcm5719-llvm-0702d02b319405f4d70a381034e21c9c62a0cbc3.zip |
Reverting r204952, while I figure out what's going on with the makefile build.
llvm-svn: 204955
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Basic/Attributes.cpp | 20 | ||||
-rw-r--r-- | clang/lib/Basic/CMakeLists.txt | 1 | ||||
-rw-r--r-- | clang/lib/Lex/PPMacroExpansion.cpp | 18 |
3 files changed, 15 insertions, 24 deletions
diff --git a/clang/lib/Basic/Attributes.cpp b/clang/lib/Basic/Attributes.cpp deleted file mode 100644 index 555c8f8789b..00000000000 --- a/clang/lib/Basic/Attributes.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "clang/Basic/Attributes.h" -#include "clang/Basic/IdentifierTable.h" -#include "llvm/ADT/StringSwitch.h" - -namespace clang { - -bool HasAttribute(AttrSyntax Syntax, const IdentifierInfo *Scope, - const IdentifierInfo *Attr, const llvm::Triple &T, - const LangOptions &LangOpts) { - StringRef Name = Attr->getName(); - // Normalize the attribute name, __foo__ becomes foo. - if (Name.size() >= 4 && Name.startswith("__") && Name.endswith("__")) - Name = Name.substr(2, Name.size() - 4); - -#include "clang/Basic/AttrHasAttributeImpl.inc" - - return false; -} - -} // end namespace clang diff --git a/clang/lib/Basic/CMakeLists.txt b/clang/lib/Basic/CMakeLists.txt index 0448fdb0d41..d248d3dc827 100644 --- a/clang/lib/Basic/CMakeLists.txt +++ b/clang/lib/Basic/CMakeLists.txt @@ -4,7 +4,6 @@ set(LLVM_LINK_COMPONENTS ) add_clang_library(clangBasic - Attributes.cpp Builtins.cpp CharInfo.cpp Diagnostic.cpp diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp index 62a89c03e18..917d434c483 100644 --- a/clang/lib/Lex/PPMacroExpansion.cpp +++ b/clang/lib/Lex/PPMacroExpansion.cpp @@ -13,7 +13,6 @@ //===----------------------------------------------------------------------===// #include "clang/Lex/Preprocessor.h" -#include "clang/Basic/Attributes.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" @@ -1048,6 +1047,20 @@ static bool HasExtension(const Preprocessor &PP, const IdentifierInfo *II) { .Default(false); } +/// HasAttribute - Return true if we recognize and implement the attribute +/// specified by the given identifier. +static bool HasAttribute(const IdentifierInfo *II, const llvm::Triple &T) { + StringRef Name = II->getName(); + // Normalize the attribute name, __foo__ becomes foo. + if (Name.size() >= 4 && Name.startswith("__") && Name.endswith("__")) + Name = Name.substr(2, Name.size() - 4); + + // FIXME: Do we need to handle namespaces here? + return llvm::StringSwitch<bool>(Name) +#include "clang/Lex/AttrSpellings.inc" + .Default(false); +} + /// EvaluateHasIncludeCommon - Process a '__has_include("path")' /// or '__has_include_next("path")' expression. /// Returns true if successful. @@ -1386,8 +1399,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) { // Check for a builtin is trivial. Value = FeatureII->getBuiltinID() != 0; } else if (II == Ident__has_attribute) - Value = HasAttribute(AttrSyntax::Generic, nullptr, FeatureII, - getTargetInfo().getTriple(), getLangOpts()); + Value = HasAttribute(FeatureII, getTargetInfo().getTriple()); else if (II == Ident__has_extension) Value = HasExtension(*this, FeatureII); else { |