diff options
author | Stephen Kelly <steveire@gmail.com> | 2018-10-24 20:33:45 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2018-10-24 20:33:45 +0000 |
commit | 51707b21a0d7fe140fd0cf20f001192cecd301aa (patch) | |
tree | 6233c1e0067d04d3e89d321b4cc392eaba5aa3c3 /clang-tools-extra/clang-query | |
parent | 4c3d7a969aa61fa9333a88f22320e48e8afe228c (diff) | |
download | llvm-51707b21a0d7fe140fd0cf20f001192cecd301aa.zip llvm-51707b21a0d7fe140fd0cf20f001192cecd301aa.tar.gz llvm-51707b21a0d7fe140fd0cf20f001192cecd301aa.tar.bz2 |
[clang-query] Add 'detailed-ast' output as an alias for 'dump'
Summary: Future development can then dump other content than AST.
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D53500
llvm-svn: 345193
Diffstat (limited to 'clang-tools-extra/clang-query')
-rw-r--r-- | clang-tools-extra/clang-query/Query.cpp | 6 | ||||
-rw-r--r-- | clang-tools-extra/clang-query/Query.h | 2 | ||||
-rw-r--r-- | clang-tools-extra/clang-query/QueryParser.cpp | 8 |
3 files changed, 10 insertions, 6 deletions
diff --git a/clang-tools-extra/clang-query/Query.cpp b/clang-tools-extra/clang-query/Query.cpp index 3e83bbc..abf1a32 100644 --- a/clang-tools-extra/clang-query/Query.cpp +++ b/clang-tools-extra/clang-query/Query.cpp @@ -53,8 +53,10 @@ bool HelpQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const { "Pretty-print bound nodes.\n" " diag " "Diagnostic location for bound nodes.\n" + " detailed-ast " + "Detailed AST output for bound nodes.\n" " dump " - "Detailed AST output for bound nodes.\n\n"; + "Detailed AST output for bound nodes (alias of detailed-ast).\n\n"; return true; } @@ -124,7 +126,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const { OS << "\n"; break; } - case OK_Dump: { + case OK_DetailedAST: { OS << "Binding for \"" << BI->first << "\":\n"; BI->second.dump(OS, AST->getSourceManager()); OS << "\n"; diff --git a/clang-tools-extra/clang-query/Query.h b/clang-tools-extra/clang-query/Query.h index 7771139..e8f4ff3 100644 --- a/clang-tools-extra/clang-query/Query.h +++ b/clang-tools-extra/clang-query/Query.h @@ -18,7 +18,7 @@ namespace clang { namespace query { -enum OutputKind { OK_Diag, OK_Print, OK_Dump }; +enum OutputKind { OK_Diag, OK_Print, OK_DetailedAST }; enum QueryKind { QK_Invalid, diff --git a/clang-tools-extra/clang-query/QueryParser.cpp b/clang-tools-extra/clang-query/QueryParser.cpp index e7312d8..eec3202 100644 --- a/clang-tools-extra/clang-query/QueryParser.cpp +++ b/clang-tools-extra/clang-query/QueryParser.cpp @@ -111,11 +111,13 @@ QueryRef QueryParser::parseSetOutputKind() { unsigned OutKind = LexOrCompleteWord<unsigned>(this, ValStr) .Case("diag", OK_Diag) .Case("print", OK_Print) - .Case("dump", OK_Dump) + .Case("detailed-ast", OK_DetailedAST) + .Case("dump", OK_DetailedAST) .Default(~0u); if (OutKind == ~0u) { - return new InvalidQuery("expected 'diag', 'print' or 'dump', got '" + - ValStr + "'"); + return new InvalidQuery( + "expected 'diag', 'print', 'detailed-ast' or 'dump', got '" + ValStr + + "'"); } return new SetQuery<OutputKind>(&QuerySession::OutKind, OutputKind(OutKind)); } |