summaryrefslogtreecommitdiff
path: root/compilerplugins
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2013-02-09 18:31:38 +0100
committerLuboš Luňák <l.lunak@suse.cz>2013-02-09 18:48:31 +0100
commit8f1a01ad001d2288c4aa43420bb56bab1094aa20 (patch)
tree8371b3bf71a1c68ab124902a9ed573d022a39179 /compilerplugins
parent1b535267dfa18ad802229851fdbb88b656e8b7df (diff)
fix check whether a file is in a directory
Make sure / is appended, otherwise /foo might match /foobar/file . Change-Id: I36469916b72b407c8f0c9c255099ee671039cf17
Diffstat (limited to 'compilerplugins')
-rw-r--r--compilerplugins/clang/pluginhandler.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx
index eeda78ace7d1..468587e58c6f 100644
--- a/compilerplugins/clang/pluginhandler.cxx
+++ b/compilerplugins/clang/pluginhandler.cxx
@@ -109,7 +109,7 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
The order here is important, as OUTDIR and WORKDIR are often in SRCDIR/BUILDDIR,
and BUILDDIR is sometimes in SRCDIR. */
string modifyFile;
- if( strncmp( e->getName(), OUTDIR, strlen( OUTDIR )) == 0 )
+ if( strncmp( e->getName(), OUTDIR "/", strlen( OUTDIR "/" )) == 0 )
{
/* Try to find a matching file for a file in solver/ (include files
are usually included from there rather than from the source dir) if possible. */
@@ -127,11 +127,11 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context )
if( modifyFile.empty())
report( DiagnosticsEngine::Warning, "modified source in solver/ : %0" ) << e->getName();
}
- else if( strncmp( e->getName(), WORKDIR, strlen( WORKDIR )) == 0 )
+ else if( strncmp( e->getName(), WORKDIR "/", strlen( WORKDIR "/" )) == 0 )
report( DiagnosticsEngine::Warning, "modified source in workdir/ : %0" ) << e->getName();
- else if( strcmp( SRCDIR, BUILDDIR ) != 0 && strncmp( e->getName(), BUILDDIR, strlen( BUILDDIR )) == 0 )
+ else if( strcmp( SRCDIR, BUILDDIR ) != 0 && strncmp( e->getName(), BUILDDIR "/", strlen( BUILDDIR "/" )) == 0 )
report( DiagnosticsEngine::Warning, "modified source in build dir : %0" ) << e->getName();
- else if( strncmp( e->getName(), SRCDIR, strlen( SRCDIR )) == 0 )
+ else if( strncmp( e->getName(), SRCDIR "/", strlen( SRCDIR "/" )) == 0 )
; // ok
else
{