compilerplugins/clang/constantparam.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 55c8095703e6e4521ba58181c561ec62a70d727b
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Mon Apr 22 10:11:32 2024 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Apr 22 13:26:57 2024 +0200

    loplugin:constantparam filter out workdir/ stuff earlier
    
    Change-Id: I5b90bd855a74b03d534ce64689361b7417293a6e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166422
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/compilerplugins/clang/constantparam.cxx 
b/compilerplugins/clang/constantparam.cxx
index db82bc4df9ce..fd8f8f4e7992 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -116,10 +116,14 @@ void ConstantParam::addToCallSet(const FunctionDecl* 
functionDecl, int paramInde
     // ignore stuff that forms part of the stable URE interface
     if (isInUnoIncludeFile(functionDecl))
         return;
+
     SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( 
functionDecl->getLocation() );
-    StringRef filename = getFilenameOfLocation(expansionLoc);
+    std::string filename = getFilenameOfLocation(expansionLoc).str();
+    loplugin::normalizeDotDotInFilePath(filename);
     if (!loplugin::hasPathnamePrefix(filename, SRCDIR "/"))
         return;
+    if (loplugin::hasPathnamePrefix(filename, WORKDIR "/"))
+        return;
     filename = filename.substr(strlen(SRCDIR)+1);
 
     MyCallSiteInfo aInfo;
@@ -149,8 +153,7 @@ void ConstantParam::addToCallSet(const FunctionDecl* 
functionDecl, int paramInde
         aInfo.paramType = 
functionDecl->getParamDecl(paramIndex)->getType().getCanonicalType().getAsString();
 
     aInfo.callValue = callValue;
-    aInfo.sourceLocation = filename.str() + ":" + 
std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
-    loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation);
+    aInfo.sourceLocation = filename + ":" + 
std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
 
     callSet.insert(aInfo);
 }

Reply via email to