Refactor and clean up the AST printer, so that it uses a DeclVisitor,
walks through DeclContexts properly, and prints more of the
information available in the AST. The functionality is still available
via -ast-print, -ast-dump, etc., and also via the new member functions
Decl::dump() and Decl::print().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72597 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 8375a68..562b2da 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -4416,6 +4416,8 @@
ExprArg expr) {
StringLiteral *AsmString = cast<StringLiteral>(expr.takeAs<Expr>());
- return DeclPtrTy::make(FileScopeAsmDecl::Create(Context, CurContext,
- Loc, AsmString));
+ FileScopeAsmDecl *New = FileScopeAsmDecl::Create(Context, CurContext,
+ Loc, AsmString);
+ CurContext->addDecl(Context, New);
+ return DeclPtrTy::make(New);
}