fix detection whether to ignore a source file or not

When compiling using icecream, the whole input is one file fed from stdin,
so getBufferName() is "<stdin>", so get the filename from #line directives.

Change-Id: Ie87937b10b0c7e8ddfa57a405b80fd9bde68dd0a
This commit is contained in:
Luboš Luňák
2013-01-07 12:24:58 +01:00
parent 3527efa7e0
commit d9a5c6bdf0

View File

@@ -55,9 +55,8 @@ bool Plugin::ignoreLocation( SourceLocation loc )
SourceLocation expansionLoc = context.getSourceManager().getExpansionLoc( loc );
if( context.getSourceManager().isInSystemHeader( expansionLoc ))
return true;
bool invalid;
const char* bufferName = context.getSourceManager().getBufferName( expansionLoc, &invalid );
if( invalid )
const char* bufferName = context.getSourceManager().getPresumedLoc( expansionLoc ).getFilename();
if( bufferName == NULL )
return true;
if( strncmp( bufferName, OUTDIR, strlen( OUTDIR )) == 0
|| strncmp( bufferName, WORKDIR, strlen( WORKDIR )) == 0