From 71b8d073c1e13858eee9f23e3de9d18201f85a9d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 19 Jan 2019 09:05:55 +0000 Subject: [PATCH] Move decl context dumping to TextNodeDumper Summary: Only an obscure case is moved. Reviewers: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D56829 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351637 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/AST/ASTDumper.cpp | 7 ------- lib/AST/TextNodeDumper.cpp | 11 +++++++++++ test/AST/ast-dump-undeserialized.cpp | 3 +-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/AST/ASTDumper.cpp b/lib/AST/ASTDumper.cpp index a477ee3269..fc33ff331b 100644 --- a/lib/AST/ASTDumper.cpp +++ b/lib/AST/ASTDumper.cpp @@ -359,13 +359,6 @@ void ASTDumper::dumpDeclContext(const DeclContext *DC) { for (auto *D : (Deserialize ? DC->decls() : DC->noload_decls())) dumpDecl(D); - - if (DC->hasExternalLexicalStorage()) { - dumpChild([=] { - ColorScope Color(OS, ShowColors, UndeserializedColor); - OS << ""; - }); - } } void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) { diff --git a/lib/AST/TextNodeDumper.cpp b/lib/AST/TextNodeDumper.cpp index ca2d6b2d05..06beb77f7a 100644 --- a/lib/AST/TextNodeDumper.cpp +++ b/lib/AST/TextNodeDumper.cpp @@ -255,6 +255,17 @@ void TextNodeDumper::Visit(const Decl *D) { if (const FunctionDecl *FD = dyn_cast(D)) if (FD->isConstexpr()) OS << " constexpr"; + + if (!isa(*D)) { + const auto *MD = dyn_cast(D); + if (!MD || !MD->isThisDeclarationADefinition()) { + const auto *DC = dyn_cast(D); + if (DC && DC->hasExternalLexicalStorage()) { + ColorScope Color(OS, ShowColors, UndeserializedColor); + OS << " "; + } + } + } } void TextNodeDumper::Visit(const CXXCtorInitializer *Init) { diff --git a/test/AST/ast-dump-undeserialized.cpp b/test/AST/ast-dump-undeserialized.cpp index 12fccf4a05..05f4a28e83 100644 --- a/test/AST/ast-dump-undeserialized.cpp +++ b/test/AST/ast-dump-undeserialized.cpp @@ -1,4 +1,3 @@ // RUN: %clang_cc1 %s -chain-include %s -ast-dump | FileCheck -strict-whitespace %s -// CHECK: TranslationUnitDecl 0x{{.+}} <> -// CHECK: `- +// CHECK: TranslationUnitDecl 0x{{.+}} <> -- 2.50.1