diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2017-10-26 12:19:02 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2017-10-26 12:19:02 +0000 |
commit | ffc43366655d0e8ff5c20f550231ba950416018c (patch) | |
tree | 4120f1eae6a08538b4a7401814035b383c1d83b7 /clang/utils/TableGen/ClangAttrEmitter.cpp | |
parent | 7f6e91074528d4a5a73c47867720d09f73e9b60f (diff) | |
download | bcm5719-llvm-ffc43366655d0e8ff5c20f550231ba950416018c.tar.gz bcm5719-llvm-ffc43366655d0e8ff5c20f550231ba950416018c.zip |
Add a new attribute definition spelling, Clang<"attr">, that expands to two attribute spellings: GNU<"attr"> and CXX11<"clang", "attr">. This is similar to how the GCC spelling works and is intended to be used for attributes introduced for Clang.
Changes all existing attributes that currently use GNU<"attr"> and CXX11<"clang", "attr> spellings to instead use the Clang<"attr"> spelling.
No additional tests are necessary because the existing tests already use both spellings for the attributes converted to the new spelling. No functional changes are expected.
llvm-svn: 316658
Diffstat (limited to 'clang/utils/TableGen/ClangAttrEmitter.cpp')
-rw-r--r-- | clang/utils/TableGen/ClangAttrEmitter.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp index effabcc6cb4..9284fe40814 100644 --- a/clang/utils/TableGen/ClangAttrEmitter.cpp +++ b/clang/utils/TableGen/ClangAttrEmitter.cpp @@ -56,8 +56,8 @@ public: V(Spelling.getValueAsString("Variety")), N(Spelling.getValueAsString("Name")) { - assert(V != "GCC" && "Given a GCC spelling, which means this hasn't been" - "flattened!"); + assert(V != "GCC" && V != "Clang" && + "Given a GCC spelling, which means this hasn't been flattened!"); if (V == "CXX11" || V == "C2x" || V == "Pragma") NS = Spelling.getValueAsString("Namespace"); bool Unset; @@ -78,11 +78,15 @@ GetFlattenedSpellings(const Record &Attr) { std::vector<FlattenedSpelling> Ret; for (const auto &Spelling : Spellings) { - if (Spelling->getValueAsString("Variety") == "GCC") { + StringRef Variety = Spelling->getValueAsString("Variety"); + StringRef Name = Spelling->getValueAsString("Name"); + if (Variety == "GCC") { // Gin up two new spelling objects to add into the list. - Ret.emplace_back("GNU", Spelling->getValueAsString("Name"), "", true); - Ret.emplace_back("CXX11", Spelling->getValueAsString("Name"), "gnu", - true); + Ret.emplace_back("GNU", Name, "", true); + Ret.emplace_back("CXX11", Name, "gnu", true); + } else if (Variety == "Clang") { + Ret.emplace_back("GNU", Name, "", false); + Ret.emplace_back("CXX11", Name, "clang", false); } else Ret.push_back(FlattenedSpelling(*Spelling)); } |