]> granicus.if.org Git - clang/commitdiff
Move decl context dumping to TextNodeDumper
authorStephen Kelly <steveire@gmail.com>
Sat, 19 Jan 2019 09:05:55 +0000 (09:05 +0000)
committerStephen Kelly <steveire@gmail.com>
Sat, 19 Jan 2019 09:05:55 +0000 (09:05 +0000)
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
lib/AST/TextNodeDumper.cpp
test/AST/ast-dump-undeserialized.cpp

index a477ee326949b7e3e613f3f19e28dd42c21e80a5..fc33ff331bbca17afe1b2b89ae64f253201f9f0e 100644 (file)
@@ -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 << "<undeserialized declarations>";
-    });
-  }
 }
 
 void ASTDumper::dumpLookups(const DeclContext *DC, bool DumpDecls) {
index ca2d6b2d05773a503a98d3a716b6439171ace643..06beb77f7a92e58dca7ababf1da68dbcd33cd1da 100644 (file)
@@ -255,6 +255,17 @@ void TextNodeDumper::Visit(const Decl *D) {
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
     if (FD->isConstexpr())
       OS << " constexpr";
+
+  if (!isa<FunctionDecl>(*D)) {
+    const auto *MD = dyn_cast<ObjCMethodDecl>(D);
+    if (!MD || !MD->isThisDeclarationADefinition()) {
+      const auto *DC = dyn_cast<DeclContext>(D);
+      if (DC && DC->hasExternalLexicalStorage()) {
+        ColorScope Color(OS, ShowColors, UndeserializedColor);
+        OS << " <undeserialized declarations>";
+      }
+    }
+  }
 }
 
 void TextNodeDumper::Visit(const CXXCtorInitializer *Init) {
index 12fccf4a05db0b0058c85723541b052499d46dee..05f4a28e83c40f5243ac008ad0ac6ee8a878b2b4 100644 (file)
@@ -1,4 +1,3 @@
 // RUN: %clang_cc1 %s -chain-include %s -ast-dump | FileCheck -strict-whitespace %s
 
-// CHECK: TranslationUnitDecl 0x{{.+}} <<invalid sloc>> <invalid sloc>
-// CHECK: `-<undeserialized declarations>
+// CHECK: TranslationUnitDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> <undeserialized declarations>