diff options
author | Pranav Kant <pranavk@collabora.co.uk> | 2017-12-16 14:50:30 +0530 |
---|---|---|
committer | pranavk <pranavk@collabora.co.uk> | 2017-12-21 15:37:36 +0100 |
commit | b39e627be45f847554f11fdac040b6f4da4054ba (patch) | |
tree | 6b0625931538f5d44644eb01530ed81a77475ecb /compilerplugins/clang/pluginhandler.cxx | |
parent | ed29dc6b3b4d7baa1a85621cceb940707454d87d (diff) |
Allow compiler plugins for online
Change-Id: I8e45936ef5675d531be71496e8894b90eaf2f6e2
Reviewed-on: https://gerrit.libreoffice.org/46769
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang/pluginhandler.cxx')
-rw-r--r-- | compilerplugins/clang/pluginhandler.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index 433bd0a9efad..150bc4d1ef4d 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -18,6 +18,7 @@ #include <clang/Frontend/CompilerInstance.h> #include <clang/Frontend/FrontendPluginRegistry.h> #include <clang/Lex/PPCallbacks.h> + #include <stdio.h> #if defined _WIN32 @@ -116,6 +117,8 @@ void PluginHandler::handleOption( const std::string& option ) unitTestMode = true; else if (option == "debug") debugMode = true; + else if ( option.substr(0, 15) == "lool-base-path=" ) + loolBasePath = option.substr(15); else report( DiagnosticsEngine::Fatal, "unknown option %0" ) << option; } @@ -193,7 +196,7 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc) if( compiler.getSourceManager().isInSystemHeader( expansionLoc )) return true; const char* bufferName = compiler.getSourceManager().getPresumedLoc( expansionLoc ).getFilename(); - if (bufferName == NULL + if (bufferName == nullptr || hasPathnamePrefix(bufferName, SRCDIR "/external/") || isSamePathname(bufferName, SRCDIR "/sdext/source/pdfimport/wrapper/keyword_list") ) // workdir/CustomTarget/sdext/pdfimport/hash.cxx is generated from @@ -222,6 +225,11 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc) if (hasPathnamePrefix(s, WORKDIR)) return true; } + if ( isLOOLMode() ) { + std::string absPath = getAbsolutePath(bufferName); + if ( StringRef(absPath).startswith(loolBasePath) ) + return false; + } if( hasPathnamePrefix(bufferName, BUILDDIR) || hasPathnamePrefix(bufferName, SRCDIR) ) return false; // ok @@ -277,6 +285,12 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) pathWarning = "modified source in build dir : %0"; else if( name.startswith(SRCDIR "/") ) ; // ok + else if ( isLOOLMode() ) + { + std::string absPath = getAbsolutePath(name); + if ( !StringRef(absPath).startswith(loolBasePath) ) + bSkip = true; + } else { pathWarning = "modified source in unknown location, not modifying : %0"; |