summaryrefslogtreecommitdiffstats
path: root/clang/utils
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2018-01-04 23:42:29 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2018-01-04 23:42:29 +0000
commit33bddbd64ba4cd6970c6287419d902c2bad0aa21 (patch)
tree1889abfedfb6908b66e0bb2e4c3018045dcd0c3a /clang/utils
parent45925d77d657d27620907a5911bfc3935def2403 (diff)
downloadbcm5719-llvm-33bddbd64ba4cd6970c6287419d902c2bad0aa21.tar.gz
bcm5719-llvm-33bddbd64ba4cd6970c6287419d902c2bad0aa21.zip
Make attribute instantiation instantiate all attributes, not just the first of
each kind. Attribute instantiation would previously default to instantiating each kind of attribute only once. This was overridden by a flag whose intended purpose was to permit attributes from a prior declaration to be inherited onto a new declaration even if that new declaration had its own copy of the attribute. This is the wrong behavior: when instantiating attributes from a template, we should always instantiate all the attributes that were written on that template. This patch renames the flag in the Attr class (and TableGen sources) to more clearly identify what it's actually for, and removes the usage of the flag from template instantiation. I also removed the flag from AlignedAttr, which was only added to work around the incorrect suppression of duplicate attribute instantiation. llvm-svn: 321834
Diffstat (limited to 'clang/utils')
-rw-r--r--clang/utils/TableGen/ClangAttrEmitter.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/utils/TableGen/ClangAttrEmitter.cpp b/clang/utils/TableGen/ClangAttrEmitter.cpp
index 2a8b891e64b..c7e3d31001b 100644
--- a/clang/utils/TableGen/ClangAttrEmitter.cpp
+++ b/clang/utils/TableGen/ClangAttrEmitter.cpp
@@ -2065,10 +2065,13 @@ void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
ArrayRef<std::pair<Record *, SMRange>> Supers = R.getSuperClasses();
assert(!Supers.empty() && "Forgot to specify a superclass for the attr");
std::string SuperName;
+ bool Inheritable = false;
for (const auto &Super : llvm::reverse(Supers)) {
const Record *R = Super.first;
if (R->getName() != "TargetSpecificAttr" && SuperName.empty())
SuperName = R->getName();
+ if (R->getName() == "InheritableAttr")
+ Inheritable = true;
}
OS << "class " << R.getName() << "Attr : public " << SuperName << " {\n";
@@ -2162,8 +2165,13 @@ void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
OS << " )\n";
OS << " : " << SuperName << "(attr::" << R.getName() << ", R, SI, "
- << ( R.getValueAsBit("LateParsed") ? "true" : "false" ) << ", "
- << ( R.getValueAsBit("DuplicatesAllowedWhileMerging") ? "true" : "false" ) << ")\n";
+ << ( R.getValueAsBit("LateParsed") ? "true" : "false" );
+ if (Inheritable) {
+ OS << ", "
+ << (R.getValueAsBit("InheritEvenIfAlreadyPresent") ? "true"
+ : "false");
+ }
+ OS << ")\n";
for (auto const &ai : Args) {
OS << " , ";
OpenPOWER on IntegriCloud