[libTooling] Recognize sccache as a compiler wrapper in compilation database commands

sccache is a compiler caching tool similar to ccache.

Differential Revision: https://reviews.llvm.org/D88790
This commit is contained in:
Nathan Ridge 2020-10-04 01:07:20 -04:00
parent b69919b537
commit 2756e2ee0b
2 changed files with 3 additions and 1 deletions

View File

@ -272,7 +272,8 @@ static bool unwrapCommand(std::vector<std::string> &Args) {
return false;
StringRef Wrapper =
stripExecutableExtension(llvm::sys::path::filename(Args.front()));
if (Wrapper == "distcc" || Wrapper == "gomacc" || Wrapper == "ccache") {
if (Wrapper == "distcc" || Wrapper == "gomacc" || Wrapper == "ccache" ||
Wrapper == "sccache") {
// Most of these wrappers support being invoked 3 ways:
// `distcc g++ file.c` This is the mode we're trying to match.
// We need to drop `distcc`.

View File

@ -383,6 +383,7 @@ TEST(findCompileArgsInJsonDatabase, ParsesCompilerWrappers) {
std::vector<std::pair<std::string, std::string>> Cases = {
{"distcc gcc foo.c", "gcc foo.c"},
{"gomacc clang++ foo.c", "clang++ foo.c"},
{"sccache clang++ foo.c", "clang++ foo.c"},
{"ccache gcc foo.c", "gcc foo.c"},
{"ccache.exe gcc foo.c", "gcc foo.c"},
{"ccache g++.exe foo.c", "g++.exe foo.c"},