summaryrefslogtreecommitdiff
path: root/compilerplugins/clang
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-10-30 15:15:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-10-30 16:31:13 +0000
commit048d47d54d72babe49920ea5e8ff934fe0032125 (patch)
tree6066d6f91f3360d983623984447ed848709f5b45 /compilerplugins/clang
parent2b5ce52cddc16be5b3bb511b278bcfef3f706237 (diff)
compilerplugins: check that we're not building ccache preprocessed
... input, which breaks because a) isInUnoIncludeFile() will not recognize the paths (which is actually fixable if it used getPresumedLoc() to get the path), and b) the isMacroBodyExpansion() check in salbool.cxx (which doesn't look fixable). So instead of printing lots of spurious warnings just abort. Change-Id: I77fd77b4986d2b099453309ecdf31be9cf93ceec Reviewed-on: https://gerrit.libreoffice.org/19693 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r--compilerplugins/clang/pluginhandler.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx
index 65069766ba42..74260c599cc5 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -168,6 +168,15 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
{
if( context.getDiagnostics().hasErrorOccurred())
return;
+ char const*const mainFileName = context.getSourceManager().getFileEntryForID(context.getSourceManager().getMainFileID())->getName();
+ size_t const len = strlen(mainFileName);
+ if (len > 3 && strncmp(mainFileName + len - 3, ".ii", 3) == 0)
+ {
+ report(DiagnosticsEngine::Fatal,
+ "input file has suffix .ii: \"%0\"\nhighly suspicious, probably ccache generated, this will break warning suppressions; export CCACHE_CPP2=1 to prevent this") << mainFileName;
+ return;
+ }
+
for( int i = 0;
i < pluginCount;
++i )