diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-22 10:11:32 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-04-22 13:26:57 +0200 |
commit | 55c8095703e6e4521ba58181c561ec62a70d727b (patch) | |
tree | 6533176018e091d8cc097b4f5c937fa70da5a873 /compilerplugins/clang | |
parent | a50045cd9b2a6587f71c1c104c59b1309eeffbb7 (diff) |
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.grandin@collabora.co.uk>
Diffstat (limited to 'compilerplugins/clang')
-rw-r--r-- | compilerplugins/clang/constantparam.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
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); } |