[PATCH] D56829: Move decl context dumping to TextNodeDumper

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 18 14:23:16 PST 2019


steveire updated this revision to Diff 182607.
steveire marked an inline comment as done.
steveire added a comment.

Update


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56829/new/

https://reviews.llvm.org/D56829

Files:
  lib/AST/ASTDumper.cpp
  lib/AST/TextNodeDumper.cpp
  test/AST/ast-dump-undeserialized.cpp


Index: test/AST/ast-dump-undeserialized.cpp
===================================================================
--- test/AST/ast-dump-undeserialized.cpp
+++ 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{{.+}} <<invalid sloc>> <invalid sloc>
-// CHECK: `-<undeserialized declarations>
+// CHECK: TranslationUnitDecl 0x{{.+}} <<invalid sloc>> <invalid sloc> <undeserialized declarations>
Index: lib/AST/TextNodeDumper.cpp
===================================================================
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -256,6 +256,17 @@
   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: lib/AST/ASTDumper.cpp
===================================================================
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -360,13 +360,6 @@
 
   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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56829.182607.patch
Type: text/x-patch
Size: 1777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190118/a10857cb/attachment.bin>


More information about the cfe-commits mailing list