Author: Nathan James Date: 2020-08-28T01:06:46+01:00 New Revision: 3776999b494d05abc87a52bf8d5317fd3d68a8ab
URL: https://github.com/llvm/llvm-project/commit/3776999b494d05abc87a52bf8d5317fd3d68a8ab DIFF: https://github.com/llvm/llvm-project/commit/3776999b494d05abc87a52bf8d5317fd3d68a8ab.diff LOG: [clang-query][NFC] Silence a few lint warnings Added: Modified: clang-tools-extra/clang-query/tool/ClangQuery.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clang-query/tool/ClangQuery.cpp b/clang-tools-extra/clang-query/tool/ClangQuery.cpp index 0c471def2e14..31c7f12251c9 100644 --- a/clang-tools-extra/clang-query/tool/ClangQuery.cpp +++ b/clang-tools-extra/clang-query/tool/ClangQuery.cpp @@ -110,31 +110,33 @@ int main(int argc, const char **argv) { ClangTool Tool(OptionsParser->getCompilations(), OptionsParser->getSourcePathList()); std::vector<std::unique_ptr<ASTUnit>> ASTs; - int Status = Tool.buildASTs(ASTs); int ASTStatus = 0; - if (Status == 1) { - // Building ASTs failed. + switch (Tool.buildASTs(ASTs)) { + case 0: + break; + case 1: // Building ASTs failed. return 1; - } else if (Status == 2) { + case 2: ASTStatus |= 1; llvm::errs() << "Failed to build AST for some of the files, " << "results may be incomplete." << "\n"; - } else { - assert(Status == 0 && "Unexpected status returned"); + break; + default: + llvm_unreachable("Unexpected status returned"); } QuerySession QS(ASTs); if (!Commands.empty()) { - for (auto I = Commands.begin(), E = Commands.end(); I != E; ++I) { - QueryRef Q = QueryParser::parse(*I, QS); + for (auto &Command : Commands) { + QueryRef Q = QueryParser::parse(Command, QS); if (!Q->run(llvm::outs(), QS)) return 1; } } else if (!CommandFiles.empty()) { - for (auto I = CommandFiles.begin(), E = CommandFiles.end(); I != E; ++I) { - if (runCommandsInFile(argv[0], *I, QS)) + for (auto &CommandFile : CommandFiles) { + if (runCommandsInFile(argv[0], CommandFile, QS)) return 1; } } else { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits