From 8f1a01ad001d2288c4aa43420bb56bab1094aa20 Mon Sep 17 00:00:00 2001 From: Luboš Luňák Date: Sat, 9 Feb 2013 18:31:38 +0100 Subject: fix check whether a file is in a directory Make sure / is appended, otherwise /foo might match /foobar/file . Change-Id: I36469916b72b407c8f0c9c255099ee671039cf17 --- compilerplugins/clang/pluginhandler.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'compilerplugins') 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 { -- cgit