diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-16 02:43:29 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-08-16 02:43:29 +0000 |
commit | 0dae729a69c4fccc38c97d5dd44f7b20bb20de1c (patch) | |
tree | 59d219e04c685b1ce878d38b8830bf3a7828926f /utils/TableGen | |
parent | d01258641a0695ed9112d18b0f79632579c1bbca (diff) |
Don't constant-fold when pretty-printing alignment attribute. This fixes a
potential crasher -- Context is sometimes a null reference (!!) here.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162007 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r-- | utils/TableGen/ClangAttrEmitter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/TableGen/ClangAttrEmitter.cpp b/utils/TableGen/ClangAttrEmitter.cpp index 1b1a478ceb..ef1ad3e1d2 100644 --- a/utils/TableGen/ClangAttrEmitter.cpp +++ b/utils/TableGen/ClangAttrEmitter.cpp @@ -349,7 +349,9 @@ namespace { << "Type(), Record);\n"; } void writeValue(raw_ostream &OS) const { - OS << "\" << get" << getUpperName() << "(Ctx) << \""; + OS << "\";\n" + << " " << getLowerName() << "Expr->printPretty(OS, 0, Policy);\n" + << " OS << \""; } }; @@ -728,7 +730,8 @@ void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) { OS << " }\n\n"; OS << " virtual " << R.getName() << "Attr *clone (ASTContext &C) const;\n"; - OS << " virtual void printPretty(llvm::raw_ostream &OS, ASTContext &Ctx) const;\n"; + OS << " virtual void printPretty(llvm::raw_ostream &OS," + << " const PrintingPolicy &Policy) const;\n"; for (ai = Args.begin(); ai != ae; ++ai) { (*ai)->writeAccessors(OS); @@ -786,7 +789,7 @@ void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) { OS << ");\n}\n\n"; OS << "void " << R.getName() << "Attr::printPretty(" - << "llvm::raw_ostream &OS, ASTContext &Ctx) const {\n"; + << "llvm::raw_ostream &OS, const PrintingPolicy &Policy) const {\n"; if (Spellings.begin() != Spellings.end()) { std::string Spelling = (*Spellings.begin())->getValueAsString("Name"); OS << " OS << \" __attribute__((" << Spelling; |