compilerplugins: fix clang plugin allowlists for sccache-dist

While icecream passes preprocessed (via -frewrite-includes) input to the
compiler on stdin, sccache-dist writes it to a file at the same location
as the source file in its sandbox.

So we need a new heuristic to detect that the input has
-frewrite-includes applied; there is not any variable that sccache sets,
users could have SCCACHE_CACHE_SIZE set but only if they use the disk
cache, so check CXX for now.

Also set SCCACHE_EXTRAFILES to include log-areas.dox required by plugin.

Change-Id: I4e00bfb0db7dab28f228fc0e85d753506e2c86b1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112480
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
This commit is contained in:
Michael Stahl
2021-03-14 21:34:03 +01:00
parent ed3a13ac98
commit 473f2dec08
2 changed files with 7 additions and 1 deletions

View File

@@ -251,6 +251,12 @@ StringRef Plugin::getFilenameOfLocation(SourceLocation spellingLocation) const
}
else
{
char const*const pCXX = getenv("CXX");
if (pCXX && strstr(pCXX, "sccache"))
{ // heuristic; sccache passes file with -frewrite-directives by name
s_Mode = STDIN;
return getFilenameOfLocation(spellingLocation);
}
auto const fn(compiler.getSourceManager().getFilename(spellingLocation));
if (!fn.data()) // wtf? happens in sot/source/sdstor/stg.cxx
{