summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ASTDumper.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-05-21 05:24:00 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-05-21 05:24:00 +0000
commitb39b9d57350edbb7116715042fe7543dacba5fb4 (patch)
tree12657bb188a94d132ea38728e24c2a2816d9a831 /clang/lib/AST/ASTDumper.cpp
parentdb142d4e1e64de6288803741683f97660c4a8981 (diff)
downloadbcm5719-llvm-b39b9d57350edbb7116715042fe7543dacba5fb4.tar.gz
bcm5719-llvm-b39b9d57350edbb7116715042fe7543dacba5fb4.zip
In -ast-dump, only dump comments when dumping the actual Decl to which they
attach, rather than merging all comments on the declaration chain. This gives a more faithful dump, and has the side benefit of unbreaking uses of dump() from within AST deserialization (where the redeclaration chain may not be sane). llvm-svn: 182350
Diffstat (limited to 'clang/lib/AST/ASTDumper.cpp')
-rw-r--r--clang/lib/AST/ASTDumper.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/AST/ASTDumper.cpp b/clang/lib/AST/ASTDumper.cpp
index 4a0173300d8..8cf41f5db66 100644
--- a/clang/lib/AST/ASTDumper.cpp
+++ b/clang/lib/AST/ASTDumper.cpp
@@ -665,15 +665,16 @@ void ASTDumper::dumpDecl(const Decl *D) {
dumpSourceRange(D->getSourceRange());
bool HasAttrs = D->attr_begin() != D->attr_end();
- bool HasComment = D->getASTContext().getCommentForDecl(D, 0);
+ const FullComment *Comment =
+ D->getASTContext().getLocalCommentForDeclUncached(D);
// Decls within functions are visited by the body
bool HasDeclContext = !isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D) &&
hasNodes(dyn_cast<DeclContext>(D));
- setMoreChildren(HasAttrs || HasComment || HasDeclContext);
+ setMoreChildren(HasAttrs || Comment || HasDeclContext);
ConstDeclVisitor<ASTDumper>::Visit(D);
- setMoreChildren(HasComment || HasDeclContext);
+ setMoreChildren(Comment || HasDeclContext);
for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end();
I != E; ++I) {
if (I + 1 == E)
@@ -683,7 +684,7 @@ void ASTDumper::dumpDecl(const Decl *D) {
setMoreChildren(HasDeclContext);
lastChild();
- dumpFullComment(D->getASTContext().getCommentForDecl(D, 0));
+ dumpFullComment(Comment);
setMoreChildren(false);
if (HasDeclContext)
OpenPOWER on IntegriCloud