[PATCH] D56829: Move decl context dumping to TextNodeDumper
Stephen Kelly via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 18 02:11:49 PST 2019
steveire updated this revision to Diff 182482.
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
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
@@ -355,18 +355,8 @@
}
void ASTDumper::dumpDeclContext(const DeclContext *DC) {
- if (!DC)
- return;
-
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) {
@@ -513,11 +503,7 @@
// Decls within functions are visited by the body.
if (!isa<FunctionDecl>(*D) && !isa<ObjCMethodDecl>(*D)) {
- auto DC = dyn_cast<DeclContext>(D);
- if (DC &&
- (DC->hasExternalLexicalStorage() ||
- (Deserialize ? DC->decls_begin() != DC->decls_end()
- : DC->noload_decls_begin() != DC->noload_decls_end())))
+ if (const auto *DC = dyn_cast<DeclContext>(D))
dumpDeclContext(DC);
}
});
@@ -1243,12 +1229,11 @@
if (D->isVariadic())
OS << " variadic";
- if (D->isThisDeclarationADefinition()) {
+ if (D->isThisDeclarationADefinition())
dumpDeclContext(D);
- } else {
+ else
for (const ParmVarDecl *Parameter : D->parameters())
dumpDecl(Parameter);
- }
if (D->hasBody())
dumpStmt(D->getBody());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56829.182482.patch
Type: text/x-patch
Size: 2191 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190118/7cf92152/attachment.bin>
More information about the cfe-commits
mailing list