[PATCH] Make Attr::Clone() also clone the Inherited, IsPackExpansion and Implicit flags
Hans Wennborg
hans at chromium.org
Fri May 30 16:01:11 PDT 2014
Hi aaron.ballman, rnk,
I was bitten by this when working with the dll attributes: when a dll
attribute was cloned from a class template declaration to its
specialization, the Inherited flag didn't get cloned.
http://reviews.llvm.org/D3972
Files:
utils/TableGen/ClangAttrEmitter.cpp
Index: utils/TableGen/ClangAttrEmitter.cpp
===================================================================
--- utils/TableGen/ClangAttrEmitter.cpp
+++ utils/TableGen/ClangAttrEmitter.cpp
@@ -1553,12 +1553,16 @@
OS << R.getName() << "Attr *" << R.getName()
<< "Attr::clone(ASTContext &C) const {\n";
- OS << " return new (C) " << R.getName() << "Attr(getLocation(), C";
+ OS << " auto *A = new (C) " << R.getName() << "Attr(getLocation(), C";
for (auto const &ai : Args) {
OS << ", ";
ai->writeCloneArgs(OS);
}
- OS << ", getSpellingListIndex());\n}\n\n";
+ OS << ", getSpellingListIndex());\n";
+ OS << " A->Inherited = Inherited;\n";
+ OS << " A->IsPackExpansion = IsPackExpansion;\n";
+ OS << " A->Implicit = Implicit;\n";
+ OS << " return A;\n}\n\n";
writePrettyPrintFunction(R, Args, OS);
writeGetSpellingFunction(R, OS);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3972.9968.patch
Type: text/x-patch
Size: 911 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140530/0cbe7dcf/attachment.bin>
More information about the cfe-commits
mailing list