[Libreoffice-commits] core.git: compilerplugins/clang solenv/gbuild

Michael Stahl (via logerrit) logerrit at kemper.freedesktop.org
Thu Mar 25 08:49:01 UTC 2021


 compilerplugins/clang/plugin.cxx       |    6 ++++++
 solenv/gbuild/platform/com_GCC_defs.mk |    2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 473f2dec087288309cb169bf84c12124e1d7d7d1
Author:     Michael Stahl <michael.stahl at allotropia.de>
AuthorDate: Sun Mar 14 21:34:03 2021 +0100
Commit:     Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Thu Mar 25 09:48:23 2021 +0100

    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 at allotropia.de>

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


More information about the Libreoffice-commits mailing list