[PATCH] D56829: Move decl context dumping to TextNodeDumper

Stephen Kelly via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 19 01:15:12 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rC351637: Move decl context dumping to TextNodeDumper (authored by steveire, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56829?vs=182607&id=182669#toc

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: lib/AST/TextNodeDumper.cpp
===================================================================
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -255,6 +255,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
@@ -359,13 +359,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) {
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>


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


More information about the cfe-commits mailing list