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

llvm-svn: 209950
This commit is contained in:
Hans Wennborg 2014-05-31 01:30:30 +00:00
parent cb82dfb11c
commit 613807b4d0
1 changed files with 6 additions and 2 deletions

View File

@ -1553,12 +1553,16 @@ void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
OS << R.getName() << "Attr *" << R.getName() OS << R.getName() << "Attr *" << R.getName()
<< "Attr::clone(ASTContext &C) const {\n"; << "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) { for (auto const &ai : Args) {
OS << ", "; OS << ", ";
ai->writeCloneArgs(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); writePrettyPrintFunction(R, Args, OS);
writeGetSpellingFunction(R, OS); writeGetSpellingFunction(R, OS);