steveire created this revision.
steveire added a reviewer: aaron.ballman.
Herald added a subscriber: cfe-commits.
Repository:
rC Clang
https://reviews.llvm.org/D55490
Files:
include/clang/AST/TextNodeDumper.h
lib/AST/ASTDumper.cpp
lib/AST/TextNodeDumper.cpp
Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -168,6 +168,29 @@
[=] { OS << ">"; });
}
+void TextNodeDumper::dumpMethodDeclOverrides(const CXXMethodDecl *D) {
+ if (D->size_overridden_methods() != 0) {
+auto dumpOverride = [=](const CXXMethodDecl *D) {
+ SplitQualType T_split = D->getType().split();
+ OS << D << " " << D->getParent()->getName()
+ << "::" << D->getNameAsString() << " '"
+ << QualType::getAsString(T_split, PrintPolicy) << "'";
+};
+
+TreeStructure.addChild([=] {
+ auto Overrides = D->overridden_methods();
+ OS << "Overrides: [ ";
+ dumpOverride(*Overrides.begin());
+ for (const auto *Override :
+ llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
+OS << ", ";
+dumpOverride(Override);
+ }
+ OS << " ]";
+});
+ }
+}
+
void TextNodeDumper::dumpDeclRef(const Decl *D, const char *Label) {
if (!D)
return;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -101,6 +101,9 @@
for (const ParmVarDecl *Parameter : D->parameters())
dumpDecl(Parameter);
}
+void dumpMethodDeclOverrides(const CXXMethodDecl *D) {
+ NodeDumper.dumpMethodDeclOverrides(D);
+}
// C++ Utilities
void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
@@ -916,26 +919,7 @@
dumpCXXCtorInitializer(*I);
if (const CXXMethodDecl *MD = dyn_cast(D)) {
-if (MD->size_overridden_methods() != 0) {
- auto dumpOverride = [=](const CXXMethodDecl *D) {
-SplitQualType T_split = D->getType().split();
-OS << D << " " << D->getParent()->getName()
- << "::" << D->getNameAsString() << " '"
- << QualType::getAsString(T_split, PrintPolicy) << "'";
- };
-
- dumpChild([=] {
-auto Overrides = MD->overridden_methods();
-OS << "Overrides: [ ";
-dumpOverride(*Overrides.begin());
-for (const auto *Override :
- llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
- OS << ", ";
- dumpOverride(Override);
-}
-OS << " ]";
- });
-}
+dumpMethodDeclOverrides(MD);
}
if (D->doesThisDeclarationHaveABody())
Index: include/clang/AST/TextNodeDumper.h
===
--- include/clang/AST/TextNodeDumper.h
+++ include/clang/AST/TextNodeDumper.h
@@ -61,6 +61,7 @@
void dumpAccessSpecifier(AccessSpecifier AS);
void dumpCXXTemporary(const CXXTemporary *Temporary);
void dumpFunctionDeclParameters(const FunctionDecl *D);
+ void dumpMethodDeclOverrides(const CXXMethodDecl *D);
void dumpDeclRef(const Decl *D, const char *Label = nullptr);
Index: lib/AST/TextNodeDumper.cpp
===
--- lib/AST/TextNodeDumper.cpp
+++ lib/AST/TextNodeDumper.cpp
@@ -168,6 +168,29 @@
[=] { OS << ">"; });
}
+void TextNodeDumper::dumpMethodDeclOverrides(const CXXMethodDecl *D) {
+ if (D->size_overridden_methods() != 0) {
+auto dumpOverride = [=](const CXXMethodDecl *D) {
+ SplitQualType T_split = D->getType().split();
+ OS << D << " " << D->getParent()->getName()
+ << "::" << D->getNameAsString() << " '"
+ << QualType::getAsString(T_split, PrintPolicy) << "'";
+};
+
+TreeStructure.addChild([=] {
+ auto Overrides = D->overridden_methods();
+ OS << "Overrides: [ ";
+ dumpOverride(*Overrides.begin());
+ for (const auto *Override :
+ llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
+OS << ", ";
+dumpOverride(Override);
+ }
+ OS << " ]";
+});
+ }
+}
+
void TextNodeDumper::dumpDeclRef(const Decl *D, const char *Label) {
if (!D)
return;
Index: lib/AST/ASTDumper.cpp
===
--- lib/AST/ASTDumper.cpp
+++ lib/AST/ASTDumper.cpp
@@ -101,6 +101,9 @@
for (const ParmVarDecl *Parameter : D->parameters())
dumpDecl(Parameter);
}
+void dumpMethodDeclOverrides(const CXXMethodDecl *D) {
+ NodeDumper.dumpMethodDeclOverrides(D);
+}
// C++ Utilities
void dumpCXXCtorInitializer(const CXXCtorInitializer *Init);
@@ -916,26 +919,7 @@
dumpCXXCtorInitializer(*I);
if (const CXXMethodDecl *MD = dyn_cast(D)) {
-if (MD->size_overridden_methods() != 0) {
- auto dumpOverride = [=](cons