Kaydet (Commit) 119d8137 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Revert "Allow compiler plugins for online"

This reverts commit b39e627b.  The assumed (see
comment at <https://gerrit.libreoffice.org/#/c/46769/4/compilerplugins/clang/
plugin.cxx@633>) performance bottleneck of isSamePathname -> getAbsolutePath
does show up in Flamegraph inspections of LO builds.  But changing (non-member
function) isSamePathname to only call getAbsolutePath if (PluginHandlder member
function) isLOOLMode is true would need some code reorg, and Online development
doesn't seem to make too much actual use of the plugin, so conclusion on IRC was
to revert.

Change-Id: I0f04fdcc87087dac516630ed5e48361f5ea332ca
Reviewed-on: https://gerrit.libreoffice.org/51774Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst aea9d9b0
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#include <clang/Basic/FileManager.h> #include <clang/Basic/FileManager.h>
#include <clang/Lex/Lexer.h> #include <clang/Lex/Lexer.h>
#include <llvm/Support/Path.h>
#include "pluginhandler.hxx" #include "pluginhandler.hxx"
/* /*
...@@ -653,20 +651,10 @@ bool hasPathnamePrefix(StringRef pathname, StringRef prefix) ...@@ -653,20 +651,10 @@ bool hasPathnamePrefix(StringRef pathname, StringRef prefix)
[](StringRef p, StringRef a) { return p.startswith(a); }); [](StringRef p, StringRef a) { return p.startswith(a); });
} }
std::string getAbsolutePath(StringRef path)
{
llvm::SmallString<1024> absPath(path);
llvm::sys::fs::make_absolute(absPath);
llvm::sys::path::remove_dots(absPath, true);
return absPath.str().str();
}
bool isSamePathname(StringRef pathname, StringRef other) bool isSamePathname(StringRef pathname, StringRef other)
{ {
std::string absPathname = getAbsolutePath(pathname);
std::string absOther = getAbsolutePath(other);
return checkPathname( return checkPathname(
absPathname, absOther, [](StringRef p, StringRef a) { return p == a; }); pathname, other, [](StringRef p, StringRef a) { return p == a; });
} }
} // namespace } // namespace
......
...@@ -80,7 +80,6 @@ protected: ...@@ -80,7 +80,6 @@ protected:
bool isInUnoIncludeFile(const FunctionDecl*) const; bool isInUnoIncludeFile(const FunctionDecl*) const;
bool isDebugMode() const { return handler.isDebugMode(); } bool isDebugMode() const { return handler.isDebugMode(); }
bool isLOOLMode() const { return handler.isLOOLMode(); }
static bool isUnitTestMode(); static bool isUnitTestMode();
...@@ -230,9 +229,6 @@ void normalizeDotDotInFilePath(std::string&); ...@@ -230,9 +229,6 @@ void normalizeDotDotInFilePath(std::string&);
// prefix may also contain backslashes: // prefix may also contain backslashes:
bool hasPathnamePrefix(StringRef pathname, StringRef prefix); bool hasPathnamePrefix(StringRef pathname, StringRef prefix);
// get the absolute path for a given path
std::string getAbsolutePath(StringRef path);
// Same as pathname == other, except on Windows, where pathname and other may // Same as pathname == other, except on Windows, where pathname and other may
// also contain backslashes: // also contain backslashes:
bool isSamePathname(StringRef pathname, StringRef other); bool isSamePathname(StringRef pathname, StringRef other);
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <clang/Frontend/CompilerInstance.h> #include <clang/Frontend/CompilerInstance.h>
#include <clang/Frontend/FrontendPluginRegistry.h> #include <clang/Frontend/FrontendPluginRegistry.h>
#include <clang/Lex/PPCallbacks.h> #include <clang/Lex/PPCallbacks.h>
#include <stdio.h> #include <stdio.h>
#if defined _WIN32 #if defined _WIN32
...@@ -117,8 +116,6 @@ void PluginHandler::handleOption( const std::string& option ) ...@@ -117,8 +116,6 @@ void PluginHandler::handleOption( const std::string& option )
unitTestMode = true; unitTestMode = true;
else if (option == "debug") else if (option == "debug")
debugMode = true; debugMode = true;
else if ( option.substr(0, 15) == "lool-base-path=" )
loolBasePath = option.substr(15);
else else
report( DiagnosticsEngine::Fatal, "unknown option %0" ) << option; report( DiagnosticsEngine::Fatal, "unknown option %0" ) << option;
} }
...@@ -196,7 +193,7 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc) ...@@ -196,7 +193,7 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc)
if( compiler.getSourceManager().isInSystemHeader( expansionLoc )) if( compiler.getSourceManager().isInSystemHeader( expansionLoc ))
return true; return true;
const char* bufferName = compiler.getSourceManager().getPresumedLoc( expansionLoc ).getFilename(); const char* bufferName = compiler.getSourceManager().getPresumedLoc( expansionLoc ).getFilename();
if (bufferName == nullptr if (bufferName == NULL
|| hasPathnamePrefix(bufferName, SRCDIR "/external/") || hasPathnamePrefix(bufferName, SRCDIR "/external/")
|| isSamePathname(bufferName, SRCDIR "/sdext/source/pdfimport/wrapper/keyword_list") ) || isSamePathname(bufferName, SRCDIR "/sdext/source/pdfimport/wrapper/keyword_list") )
// workdir/CustomTarget/sdext/pdfimport/hash.cxx is generated from // workdir/CustomTarget/sdext/pdfimport/hash.cxx is generated from
...@@ -225,11 +222,6 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc) ...@@ -225,11 +222,6 @@ bool PluginHandler::checkIgnoreLocation(SourceLocation loc)
if (hasPathnamePrefix(s, WORKDIR)) if (hasPathnamePrefix(s, WORKDIR))
return true; return true;
} }
if ( isLOOLMode() ) {
std::string absPath = getAbsolutePath(bufferName);
if ( StringRef(absPath).startswith(loolBasePath) )
return false;
}
if( hasPathnamePrefix(bufferName, BUILDDIR) if( hasPathnamePrefix(bufferName, BUILDDIR)
|| hasPathnamePrefix(bufferName, SRCDIR) ) || hasPathnamePrefix(bufferName, SRCDIR) )
return false; // ok return false; // ok
...@@ -305,12 +297,6 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) ...@@ -305,12 +297,6 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
pathWarning = "modified source in build dir : %0"; pathWarning = "modified source in build dir : %0";
else if( name.startswith(SRCDIR "/") ) else if( name.startswith(SRCDIR "/") )
; // ok ; // ok
else if ( isLOOLMode() )
{
std::string absPath = getAbsolutePath(name);
if ( !StringRef(absPath).startswith(loolBasePath) )
bSkip = true;
}
else else
{ {
pathWarning = "modified source in unknown location, not modifying : %0"; pathWarning = "modified source in unknown location, not modifying : %0";
......
...@@ -55,7 +55,6 @@ public: ...@@ -55,7 +55,6 @@ public:
CompilerInstance& compiler, SourceLocation loc = SourceLocation()); CompilerInstance& compiler, SourceLocation loc = SourceLocation());
bool ignoreLocation(SourceLocation loc); bool ignoreLocation(SourceLocation loc);
bool isDebugMode() const { return debugMode; } bool isDebugMode() const { return debugMode; }
bool isLOOLMode() const { return !loolBasePath.empty(); }
static bool isUnitTestMode(); static bool isUnitTestMode();
// If we overlap with a previous area we modified, we cannot perform this change // If we overlap with a previous area we modified, we cannot perform this change
// without corrupting the source // without corrupting the source
...@@ -72,7 +71,6 @@ private: ...@@ -72,7 +71,6 @@ private:
Rewriter rewriter; Rewriter rewriter;
std::string scope; std::string scope;
std::string warningsOnly; std::string warningsOnly;
std::string loolBasePath;
bool warningsAsErrors; bool warningsAsErrors;
bool debugMode = false; bool debugMode = false;
std::vector<std::pair<char const*, char const*>> mvModifiedRanges; std::vector<std::pair<char const*, char const*>> mvModifiedRanges;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment