r351637 - Move decl context dumping to TextNodeDumper

Stephen Kelly via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 19 01:05:56 PST 2019


Author: steveire
Date: Sat Jan 19 01:05:55 2019
New Revision: 351637

URL: http://llvm.org/viewvc/llvm-project?rev=351637&view=rev
Log:
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

Modified:
    cfe/trunk/lib/AST/ASTDumper.cpp
    cfe/trunk/lib/AST/TextNodeDumper.cpp
    cfe/trunk/test/AST/ast-dump-undeserialized.cpp

Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Sat Jan 19 01:05:55 2019
@@ -359,13 +359,6 @@ void ASTDumper::dumpDeclContext(const De
 
   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) {

Modified: cfe/trunk/lib/AST/TextNodeDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/TextNodeDumper.cpp?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- cfe/trunk/lib/AST/TextNodeDumper.cpp (original)
+++ cfe/trunk/lib/AST/TextNodeDumper.cpp Sat Jan 19 01:05:55 2019
@@ -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) {

Modified: cfe/trunk/test/AST/ast-dump-undeserialized.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/AST/ast-dump-undeserialized.cpp?rev=351637&r1=351636&r2=351637&view=diff
==============================================================================
--- cfe/trunk/test/AST/ast-dump-undeserialized.cpp (original)
+++ cfe/trunk/test/AST/ast-dump-undeserialized.cpp Sat Jan 19 01:05:55 2019
@@ -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>




More information about the cfe-commits mailing list