Kaydet (Commit) d01768c3 authored tarafından Luboš Luňák's avatar Luboš Luňák

Revert "ignore already seen locations in compiler plugins"

This does not always work well, e.g. when building a return value
in a return statement from a temporary, there is CXXConstructExpr
containing CXXTemporaryObjectExpr, which both share the same location.
This reverts commit 1c0669af2f1f58e6431b5e489ac48a883e242ba7.
üst a0da6725
......@@ -56,21 +56,12 @@ bool Plugin::ignoreLocation( SourceLocation loc )
const char* bufferName = compiler.getSourceManager().getPresumedLoc( expansionLoc ).getFilename();
if( bufferName == NULL )
return true;
if( strncmp( bufferName, OUTDIR, strlen( OUTDIR )) != 0
&& strncmp( bufferName, WORKDIR, strlen( WORKDIR )) != 0
&& strncmp( bufferName, BUILDDIR, strlen( BUILDDIR )) != 0
&& strncmp( bufferName, SRCDIR, strlen( SRCDIR )) != 0 )
return true; // not in LO sources
// Sometimes a VisitXXX function may be called more than once for one source location.
// This can happen e.g. with a default argument for a function, if it involves constructing
// a temporary, then this temporary will be constructed whenever the function is called
// and the default argument is needed. As this would mean processing the same piece of code
// more than once, and thus possibly modifying the source code more than once, just
// ignore an already seen location.
if( alreadySeen.find( loc ) != alreadySeen.end())
if( strncmp( bufferName, OUTDIR, strlen( OUTDIR )) == 0
|| strncmp( bufferName, WORKDIR, strlen( WORKDIR )) == 0
|| strncmp( bufferName, BUILDDIR, strlen( BUILDDIR )) == 0
|| strncmp( bufferName, SRCDIR, strlen( SRCDIR )) == 0 )
return false; // ok
return true;
alreadySeen.insert( loc );
return false;
}
void Plugin::registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter )
......
......@@ -53,7 +53,6 @@ class Plugin
bool ignoreLocation( const Decl* decl );
bool ignoreLocation( const Stmt* stmt );
CompilerInstance& compiler;
set< SourceLocation > alreadySeen;
private:
static void registerPlugin( Plugin* (*create)( CompilerInstance&, Rewriter& ), const char* optionName, bool isRewriter );
template< typename T > static Plugin* createHelper( CompilerInstance& compiler, Rewriter& rewriter );
......
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