diff options
author | Stephen Kelly <steveire@gmail.com> | 2018-10-24 20:33:55 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2018-10-24 20:33:55 +0000 |
commit | 70d771714ec6210df887139b2c1467c5acd79da1 (patch) | |
tree | 3b5fc2577ac3766bf691239ea725087cc4cb0eff /clang-tools-extra/clang-query/Query.cpp | |
parent | 51707b21a0d7fe140fd0cf20f001192cecd301aa (diff) | |
download | bcm5719-llvm-70d771714ec6210df887139b2c1467c5acd79da1.tar.gz bcm5719-llvm-70d771714ec6210df887139b2c1467c5acd79da1.zip |
[clang-query] Refactor Output settings to booleans
Summary: This will make it possible to add non-exclusive mode output.
Reviewers: aaron.ballman
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D53501
llvm-svn: 345194
Diffstat (limited to 'clang-tools-extra/clang-query/Query.cpp')
-rw-r--r-- | clang-tools-extra/clang-query/Query.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/clang-tools-extra/clang-query/Query.cpp b/clang-tools-extra/clang-query/Query.cpp index abf1a32470d..48e20047701 100644 --- a/clang-tools-extra/clang-query/Query.cpp +++ b/clang-tools-extra/clang-query/Query.cpp @@ -107,8 +107,7 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const { for (auto BI = MI->getMap().begin(), BE = MI->getMap().end(); BI != BE; ++BI) { - switch (QS.OutKind) { - case OK_Diag: { + if (QS.DiagOutput) { clang::SourceRange R = BI->second.getSourceRange(); if (R.isValid()) { TextDiagnostic TD(OS, AST->getASTContext().getLangOpts(), @@ -118,20 +117,16 @@ bool MatchQuery::run(llvm::raw_ostream &OS, QuerySession &QS) const { DiagnosticsEngine::Note, "\"" + BI->first + "\" binds here", CharSourceRange::getTokenRange(R), None); } - break; } - case OK_Print: { + if (QS.PrintOutput) { OS << "Binding for \"" << BI->first << "\":\n"; BI->second.print(OS, AST->getASTContext().getPrintingPolicy()); OS << "\n"; - break; } - case OK_DetailedAST: { + if (QS.DetailedASTOutput) { OS << "Binding for \"" << BI->first << "\":\n"; BI->second.dump(OS, AST->getSourceManager()); OS << "\n"; - break; - } } } |