r209950 - Make Attr::Clone() also clone the Inherited, IsPackExpansion and Implicit flags

Hans Wennborg hans at hanshq.net
Fri May 30 18:30:30 PDT 2014


Author: hans
Date: Fri May 30 20:30:30 2014
New Revision: 209950

URL: http://llvm.org/viewvc/llvm-project?rev=209950&view=rev
Log:
Make Attr::Clone() also clone the Inherited, IsPackExpansion and Implicit flags

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.

Differential Revision: http://reviews.llvm.org/D3972

Modified:
    cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp

Modified: cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp?rev=209950&r1=209949&r2=209950&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangAttrEmitter.cpp Fri May 30 20:30:30 2014
@@ -1553,12 +1553,16 @@ void EmitClangAttrImpl(RecordKeeper &Rec
 
     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);





More information about the cfe-commits mailing list