|
@@ -118,6 +118,8 @@ namespace {
|
|
|
|
|
|
bool ShowColors;
|
|
bool ShowColors;
|
|
|
|
|
|
|
|
+ bool DumpImplicitTopLevelDecls = true; // HLSL Change
|
|
|
|
+
|
|
/// Dump a child of the current node.
|
|
/// Dump a child of the current node.
|
|
template<typename Fn> void dumpChild(Fn doDumpChild) {
|
|
template<typename Fn> void dumpChild(Fn doDumpChild) {
|
|
// If we're at the top level, there's nothing interesting to do; just
|
|
// If we're at the top level, there's nothing interesting to do; just
|
|
@@ -210,6 +212,10 @@ namespace {
|
|
LastLocFilename(""), LastLocLine(~0U),
|
|
LastLocFilename(""), LastLocLine(~0U),
|
|
ShowColors(ShowColors) { }
|
|
ShowColors(ShowColors) { }
|
|
|
|
|
|
|
|
+ // HLSL Change Start - filter implicit decls.
|
|
|
|
+ void setDumpImplicitTopLevelDecls(bool B) { DumpImplicitTopLevelDecls = B; }
|
|
|
|
+ // HLSL Change End - filter implicit decls.
|
|
|
|
+
|
|
void dumpDecl(const Decl *D);
|
|
void dumpDecl(const Decl *D);
|
|
void dumpStmt(const Stmt *S);
|
|
void dumpStmt(const Stmt *S);
|
|
void dumpFullComment(const FullComment *C);
|
|
void dumpFullComment(const FullComment *C);
|
|
@@ -734,8 +740,12 @@ void ASTDumper::dumpDeclContext(const DeclContext *DC) {
|
|
if (!DC)
|
|
if (!DC)
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ // HLSL Change Starts: Don't dump implicit decls unless requested.
|
|
|
|
+ bool ShouldDumpImplicit = DumpImplicitTopLevelDecls || !DC->isTranslationUnit();
|
|
for (auto *D : DC->noload_decls())
|
|
for (auto *D : DC->noload_decls())
|
|
- dumpDecl(D);
|
|
|
|
|
|
+ if (ShouldDumpImplicit || !D->isImplicit())
|
|
|
|
+ dumpDecl(D);
|
|
|
|
+ // HLSL Change Ends
|
|
|
|
|
|
if (DC->hasExternalLexicalStorage()) {
|
|
if (DC->hasExternalLexicalStorage()) {
|
|
dumpChild([=]{
|
|
dumpChild([=]{
|
|
@@ -1071,15 +1081,6 @@ void ASTDumper::dumpHLSLUnusualAnnotations(const ArrayRef<hlsl::UnusualAnnotatio
|
|
// HLSL Change Ends
|
|
// HLSL Change Ends
|
|
|
|
|
|
void ASTDumper::dumpDecl(const Decl *D) {
|
|
void ASTDumper::dumpDecl(const Decl *D) {
|
|
- // HLSL Change Starts: Don't display decls with invalid SourceLocations.
|
|
|
|
- if (D && D->getDeclContext() &&
|
|
|
|
- D->getDeclContext()->getDeclKind() == Decl::Kind::TranslationUnit &&
|
|
|
|
- D->getSourceRange().isInvalid())
|
|
|
|
- {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- // HLSL Change Ends
|
|
|
|
-
|
|
|
|
dumpChild([=] {
|
|
dumpChild([=] {
|
|
if (!D) {
|
|
if (!D) {
|
|
ColorScope Color(*this, NullColor);
|
|
ColorScope Color(*this, NullColor);
|
|
@@ -2447,6 +2448,8 @@ LLVM_DUMP_METHOD void Decl::dump() const { dump(llvm::errs()); }
|
|
LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS) const {
|
|
LLVM_DUMP_METHOD void Decl::dump(raw_ostream &OS) const {
|
|
ASTDumper P(OS, &getASTContext().getCommentCommandTraits(),
|
|
ASTDumper P(OS, &getASTContext().getCommentCommandTraits(),
|
|
&getASTContext().getSourceManager());
|
|
&getASTContext().getSourceManager());
|
|
|
|
+ // HLSL Change - Support suppressing dumping implicit decls.
|
|
|
|
+ P.setDumpImplicitTopLevelDecls(getASTContext().getLangOpts().DumpImplicitTopLevelDecls);
|
|
P.dumpDecl(this);
|
|
P.dumpDecl(this);
|
|
}
|
|
}
|
|
|
|
|