From 0d833be6085f1eed640760cba48f466698ebb65d Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Wed, 6 Apr 2022 05:17:00 -0700 Subject: [PATCH] clang_generator: Remove `.isystem` parameter file support The corresponding command-line option `sapi_isystem` will be ignored for compatibility. PiperOrigin-RevId: 439806387 Change-Id: I8ad6d7feed2fba5fca9940281f03cfc757ada5be --- .../tools/clang_generator/generator_tool.cc | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/sandboxed_api/tools/clang_generator/generator_tool.cc b/sandboxed_api/tools/clang_generator/generator_tool.cc index f476482..0078119 100644 --- a/sandboxed_api/tools/clang_generator/generator_tool.cc +++ b/sandboxed_api/tools/clang_generator/generator_tool.cc @@ -61,11 +61,12 @@ static auto* g_sapi_functions = new llvm::cl::list( llvm::cl::cat(*g_tool_category)); static auto* g_sapi_in = new llvm::cl::list( "sapi_in", llvm::cl::CommaSeparated, - llvm::cl::desc("List of input files to analyze."), + llvm::cl::desc("List of input files to analyze (deprecated)"), llvm::cl::cat(*g_tool_category)); static auto* g_sapi_isystem = new llvm::cl::opt( "sapi_isystem", - llvm::cl::desc("Parameter file with extra system include paths"), + llvm::cl::desc("Parameter file with extra system include paths (ignored " + "for compatibility)"), llvm::cl::cat(*g_tool_category)); static auto* g_sapi_limit_scan_depth = new llvm::cl::opt( "sapi_limit_scan_depth", @@ -127,19 +128,10 @@ absl::Status GeneratorMain(int argc, const char** argv) { NonOwningCompileCommands(opt_parser.getCompilations())); clang::tooling::ClangTool tool(*db, sources); - // TODO(cblichmann): Rmove the .isystem files. CMake does not need them, and - // we can get the information in Bazel from the toolchain. - if (!sapi::g_sapi_isystem->empty()) { - std::string isystem_lines; - SAPI_RETURN_IF_ERROR(sapi::file::GetContents( - *sapi::g_sapi_isystem, &isystem_lines, sapi::file::Defaults())); - std::vector isystem = - absl::StrSplit(isystem_lines, '\n', absl::SkipWhitespace()); - for (std::string& line : isystem) { - line.insert(0, "-isystem"); - } - tool.appendArgumentsAdjuster(clang::tooling::getInsertArgumentAdjuster( - isystem, clang::tooling::ArgumentInsertPosition::BEGIN)); + if (!g_sapi_isystem->empty()) { + absl::FPrintF( + stderr, + "Note: Ignoring deprecated command-line option: sapi_isystem\n"); } if (int result = tool.run(