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
This commit is contained in:
Christian Blichmann 2022-04-06 05:17:00 -07:00 committed by Copybara-Service
parent eb20966666
commit 0d833be608

View File

@ -61,11 +61,12 @@ static auto* g_sapi_functions = new llvm::cl::list<std::string>(
llvm::cl::cat(*g_tool_category)); llvm::cl::cat(*g_tool_category));
static auto* g_sapi_in = new llvm::cl::list<std::string>( static auto* g_sapi_in = new llvm::cl::list<std::string>(
"sapi_in", llvm::cl::CommaSeparated, "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)); llvm::cl::cat(*g_tool_category));
static auto* g_sapi_isystem = new llvm::cl::opt<std::string>( static auto* g_sapi_isystem = new llvm::cl::opt<std::string>(
"sapi_isystem", "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)); llvm::cl::cat(*g_tool_category));
static auto* g_sapi_limit_scan_depth = new llvm::cl::opt<bool>( static auto* g_sapi_limit_scan_depth = new llvm::cl::opt<bool>(
"sapi_limit_scan_depth", "sapi_limit_scan_depth",
@ -127,19 +128,10 @@ absl::Status GeneratorMain(int argc, const char** argv) {
NonOwningCompileCommands(opt_parser.getCompilations())); NonOwningCompileCommands(opt_parser.getCompilations()));
clang::tooling::ClangTool tool(*db, sources); clang::tooling::ClangTool tool(*db, sources);
// TODO(cblichmann): Rmove the .isystem files. CMake does not need them, and if (!g_sapi_isystem->empty()) {
// we can get the information in Bazel from the toolchain. absl::FPrintF(
if (!sapi::g_sapi_isystem->empty()) { stderr,
std::string isystem_lines; "Note: Ignoring deprecated command-line option: sapi_isystem\n");
SAPI_RETURN_IF_ERROR(sapi::file::GetContents(
*sapi::g_sapi_isystem, &isystem_lines, sapi::file::Defaults()));
std::vector<std::string> 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 (int result = tool.run( if (int result = tool.run(