diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-03-14 21:34:03 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2021-03-25 09:48:23 +0100 |
commit | 473f2dec087288309cb169bf84c12124e1d7d7d1 (patch) | |
tree | 0b15d3921149d5c6689de251f363fa0338e4c7ef | |
parent | ed3a13ac9837b52e899bd82ccae1244988e99f47 (diff) |
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>
-rw-r--r-- | compilerplugins/clang/plugin.cxx | 6 | ||||
-rw-r--r-- | solenv/gbuild/platform/com_GCC_defs.mk | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index 753c548cf252..c68eceb67c32 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -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 { diff --git a/solenv/gbuild/platform/com_GCC_defs.mk b/solenv/gbuild/platform/com_GCC_defs.mk index 876d57ab6fa2..e07bd2824ff5 100644 --- a/solenv/gbuild/platform/com_GCC_defs.mk +++ b/solenv/gbuild/platform/com_GCC_defs.mk @@ -254,7 +254,7 @@ gb_COMPILER_PLUGINS += -Xclang -plugin-arg-loplugin -Xclang --debug endif # set CCACHE_CPP2=1 to prevent clang generating spurious warnings gb_COMPILER_SETUP += CCACHE_CPP2=1 -gb_COMPILER_PLUGINS_SETUP := ICECC_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox CCACHE_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox +gb_COMPILER_PLUGINS_SETUP := ICECC_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox CCACHE_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox SCCACHE_EXTRAFILES=$(SRCDIR)/include/sal/log-areas.dox gb_COMPILER_PLUGINS_WARNINGS_AS_ERRORS := \ -Xclang -plugin-arg-loplugin -Xclang --warnings-as-errors else |