summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-10-07 15:29:30 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-10-08 20:46:36 +0200
commitbef96f7a7b4d1dc7bcb01c949e0ae296c969dcee (patch)
tree77462295af716f5afb2645fadcc4034855ee4ee6
parentFix typo (diff)
downloadcore-bef96f7a7b4d1dc7bcb01c949e0ae296c969dcee.tar.gz
core-bef96f7a7b4d1dc7bcb01c949e0ae296c969dcee.zip
better name for a function in compilerplugins
The function is not just about a spelling location. Change-Id: I96e9e9ef7e27a9763397b4b86473c1c30d0e3eeb Reviewed-on: https://gerrit.libreoffice.org/80381 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--compilerplugins/clang/automem.cxx2
-rw-r--r--compilerplugins/clang/checkunusedparams.cxx2
-rw-r--r--compilerplugins/clang/constantparam.cxx2
-rw-r--r--compilerplugins/clang/constfields.cxx2
-rw-r--r--compilerplugins/clang/constmethod.cxx2
-rw-r--r--compilerplugins/clang/convertlong.cxx2
-rw-r--r--compilerplugins/clang/countusersofdefaultparams.cxx2
-rw-r--r--compilerplugins/clang/datamembershadow.cxx2
-rw-r--r--compilerplugins/clang/dyncastvisibility.cxx2
-rw-r--r--compilerplugins/clang/expandablemethods.cxx2
-rw-r--r--compilerplugins/clang/externandnotdefined.cxx2
-rw-r--r--compilerplugins/clang/finalclasses.cxx2
-rw-r--r--compilerplugins/clang/inlinefields.cxx2
-rw-r--r--compilerplugins/clang/logexceptionnicely.cxx2
-rw-r--r--compilerplugins/clang/memoryvar.cxx2
-rw-r--r--compilerplugins/clang/mergeclasses.cxx2
-rw-r--r--compilerplugins/clang/methodcycles.cxx2
-rw-r--r--compilerplugins/clang/noexceptmove.cxx2
-rw-r--r--compilerplugins/clang/nullptr.cxx2
-rw-r--r--compilerplugins/clang/plugin.cxx8
-rw-r--r--compilerplugins/clang/plugin.hxx7
-rw-r--r--compilerplugins/clang/refcounting.cxx2
-rw-r--r--compilerplugins/clang/referencecasting.cxx6
-rw-r--r--compilerplugins/clang/reservedid.cxx6
-rw-r--r--compilerplugins/clang/salbool.cxx4
-rw-r--r--compilerplugins/clang/shouldreturnbool.cxx2
-rw-r--r--compilerplugins/clang/singlevalfields.cxx2
-rw-r--r--compilerplugins/clang/staticmethods.cxx2
-rw-r--r--compilerplugins/clang/store/badvectorinit.cxx2
-rw-r--r--compilerplugins/clang/store/constantfunction.cxx2
-rw-r--r--compilerplugins/clang/store/defaultparams.cxx2
-rw-r--r--compilerplugins/clang/store/deletedspecial.cxx2
-rw-r--r--compilerplugins/clang/store/fpcomparison.cxx2
-rw-r--r--compilerplugins/clang/store/returnbyref.cxx2
-rw-r--r--compilerplugins/clang/store/revisibility.cxx2
-rw-r--r--compilerplugins/clang/store/stylepolice.cxx2
-rw-r--r--compilerplugins/clang/stringconcatauto.cxx2
-rw-r--r--compilerplugins/clang/stringconcatliterals.cxx4
-rw-r--r--compilerplugins/clang/stringconstant.cxx8
-rw-r--r--compilerplugins/clang/typedefparam.cxx2
-rw-r--r--compilerplugins/clang/unnecessaryoverride.cxx4
-rw-r--r--compilerplugins/clang/unnecessaryvirtual.cxx2
-rw-r--r--compilerplugins/clang/unoany.cxx2
-rw-r--r--compilerplugins/clang/unusedenumconstants.cxx2
-rw-r--r--compilerplugins/clang/unusedfields.cxx2
-rw-r--r--compilerplugins/clang/unusedmethods.cxx2
-rw-r--r--compilerplugins/clang/useuniqueptr.cxx2
-rw-r--r--compilerplugins/clang/vclwidgets.cxx12
-rw-r--r--compilerplugins/clang/virtualdead.cxx2
-rw-r--r--compilerplugins/clang/virtualdown.cxx2
-rw-r--r--compilerplugins/clang/weakbase.cxx2
-rw-r--r--compilerplugins/clang/writeonlyvars.cxx2
52 files changed, 74 insertions, 71 deletions
diff --git a/compilerplugins/clang/automem.cxx b/compilerplugins/clang/automem.cxx
index 30f3223b89f9..099c05458e13 100644
--- a/compilerplugins/clang/automem.cxx
+++ b/compilerplugins/clang/automem.cxx
@@ -51,7 +51,7 @@ bool AutoMem::VisitCXXDeleteExpr(const CXXDeleteExpr* expr)
{
if (ignoreLocation( expr ))
return true;
- StringRef aFileName = getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
+ StringRef aFileName = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/salhelper/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/osl/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/salhelper/")
diff --git a/compilerplugins/clang/checkunusedparams.cxx b/compilerplugins/clang/checkunusedparams.cxx
index 2d4bc0dd60fe..f5540db33e43 100644
--- a/compilerplugins/clang/checkunusedparams.cxx
+++ b/compilerplugins/clang/checkunusedparams.cxx
@@ -199,7 +199,7 @@ bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
return true;
if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(canon->getLocation())))
return true;
- StringRef fn = getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(canon)));
+ StringRef fn = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(canon)));
// Some backwards compat magic.
// TODO Can probably be removed, but need to do some checking
if (loplugin::isSamePathname(fn, SRCDIR "/include/sax/fshelper.hxx"))
diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx
index 33e25909c681..f73a7d2ef6c3 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -121,7 +121,7 @@ void ConstantParam::addToCallSet(const FunctionDecl* functionDecl, int paramInde
if (isInUnoIncludeFile(functionDecl))
return;
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( functionDecl->getLocation() );
- StringRef filename = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef filename = getFilenameOfLocation(expansionLoc);
if (!loplugin::hasPathnamePrefix(filename, SRCDIR "/"))
return;
filename = filename.substr(strlen(SRCDIR)+1);
diff --git a/compilerplugins/clang/constfields.cxx b/compilerplugins/clang/constfields.cxx
index 85546bed6c69..62cd56a54ad7 100644
--- a/compilerplugins/clang/constfields.cxx
+++ b/compilerplugins/clang/constfields.cxx
@@ -233,7 +233,7 @@ MyFieldInfo ConstFields::niceName(const FieldDecl* fieldDecl)
SourceLocation expansionLoc
= compiler.getSourceManager().getExpansionLoc(fieldDecl->getLocation());
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
aInfo.sourceLocation
= std::string(name.substr(strlen(SRCDIR) + 1)) + ":"
+ std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
diff --git a/compilerplugins/clang/constmethod.cxx b/compilerplugins/clang/constmethod.cxx
index fe19b38c15ac..217dd17bd6d7 100644
--- a/compilerplugins/clang/constmethod.cxx
+++ b/compilerplugins/clang/constmethod.cxx
@@ -46,7 +46,7 @@ public:
if (getFunctionsWithAddressTaken().find((FunctionDecl const *)canonicalDecl)
!= getFunctionsWithAddressTaken().end())
continue;
- StringRef aFileName = getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(canonicalDecl)));
+ StringRef aFileName = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(canonicalDecl)));
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/LibreOfficeKit/LibreOfficeKit.hxx"))
continue;
report(
diff --git a/compilerplugins/clang/convertlong.cxx b/compilerplugins/clang/convertlong.cxx
index 07ec9e38a7e9..5d2ac82f5849 100644
--- a/compilerplugins/clang/convertlong.cxx
+++ b/compilerplugins/clang/convertlong.cxx
@@ -72,7 +72,7 @@ bool ConvertLong::VisitVarDecl(VarDecl const* varDecl)
{
if (ignoreLocation(varDecl))
return true;
- StringRef fileName{ getFileNameOfSpellingLoc(varDecl->getLocation()) };
+ StringRef fileName{ getFilenameOfLocation(varDecl->getLocation()) };
if (loplugin::isSamePathname(fileName, SRCDIR "/include/tools/bigint.hxx"))
return true;
if (loplugin::isSamePathname(fileName, SRCDIR "/include/tools/solar.h"))
diff --git a/compilerplugins/clang/countusersofdefaultparams.cxx b/compilerplugins/clang/countusersofdefaultparams.cxx
index 79fa99742afc..0f689058197a 100644
--- a/compilerplugins/clang/countusersofdefaultparams.cxx
+++ b/compilerplugins/clang/countusersofdefaultparams.cxx
@@ -214,7 +214,7 @@ bool CountUsersOfDefaultParams::VisitCXXConstructExpr(const CXXConstructExpr * c
std::string CountUsersOfDefaultParams::locationToString(const SourceLocation& sourceLoc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( sourceLoc );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
return std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
}
diff --git a/compilerplugins/clang/datamembershadow.cxx b/compilerplugins/clang/datamembershadow.cxx
index d325650becea..7a5bf4bc3e87 100644
--- a/compilerplugins/clang/datamembershadow.cxx
+++ b/compilerplugins/clang/datamembershadow.cxx
@@ -46,7 +46,7 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
if (ignoreLocation(fieldDecl)) {
return true;
}
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(fieldDecl)));
// FIXME complex stuff to fix later
diff --git a/compilerplugins/clang/dyncastvisibility.cxx b/compilerplugins/clang/dyncastvisibility.cxx
index 3aa66e0dc21b..0899fb8d18d0 100644
--- a/compilerplugins/clang/dyncastvisibility.cxx
+++ b/compilerplugins/clang/dyncastvisibility.cxx
@@ -117,7 +117,7 @@ public:
// at least some interesting cases (though it would still not be aggressive enough to
// have found ff570b4b58dbf274d3094d21d974f18b613e9b4b "DocumentSettingsSerializer must
// be SAL_DLLPUBLIC_RTTI for dynamic_cast"):
- auto const file = getFileNameOfSpellingLoc(
+ auto const file = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(rdd->getLocation()));
if (loplugin::hasPathnamePrefix(file, SRCDIR "/include/")) {
std::size_t const n1 = std::strlen(SRCDIR "/include/");
diff --git a/compilerplugins/clang/expandablemethods.cxx b/compilerplugins/clang/expandablemethods.cxx
index 2732d4e598fd..d40dadd90247 100644
--- a/compilerplugins/clang/expandablemethods.cxx
+++ b/compilerplugins/clang/expandablemethods.cxx
@@ -162,7 +162,7 @@ MyFuncInfo ExpandableMethods::niceName(const FunctionDecl* functionDecl)
std::string ExpandableMethods::toString(SourceLocation loc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
std::string sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
loplugin::normalizeDotDotInFilePath(sourceLocation);
return sourceLocation;
diff --git a/compilerplugins/clang/externandnotdefined.cxx b/compilerplugins/clang/externandnotdefined.cxx
index 72b250d3d82e..5d65579a6af1 100644
--- a/compilerplugins/clang/externandnotdefined.cxx
+++ b/compilerplugins/clang/externandnotdefined.cxx
@@ -59,7 +59,7 @@ bool ExternAndNotDefined::VisitFunctionDecl(const FunctionDecl * functionDecl) {
{
return true;
}
- StringRef fileName { getFileNameOfSpellingLoc(functionDecl->getLocation()) };
+ StringRef fileName { getFilenameOfLocation(functionDecl->getLocation()) };
// the filters use some kind of dynamic loading stunt
if (loplugin::hasPathnamePrefix(fileName, SRCDIR "/filter/qa/")) {
return true;
diff --git a/compilerplugins/clang/finalclasses.cxx b/compilerplugins/clang/finalclasses.cxx
index b90c9c4c72ec..24bc814602fe 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -128,7 +128,7 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
return true;
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl));
- std::string filename = getFileNameOfSpellingLoc(spellingLocation);
+ std::string filename = getFilenameOfLocation(spellingLocation);
auto sourceLocation = filename.substr(strlen(SRCDIR)) + ":"
+ std::to_string(compiler.getSourceManager().getSpellingLineNumber(spellingLocation));
definitionMap.insert( std::pair<std::string,std::string>(s, sourceLocation) );
diff --git a/compilerplugins/clang/inlinefields.cxx b/compilerplugins/clang/inlinefields.cxx
index 7ae4fb1345b7..a29a9662e6d5 100644
--- a/compilerplugins/clang/inlinefields.cxx
+++ b/compilerplugins/clang/inlinefields.cxx
@@ -119,7 +119,7 @@ MyFieldInfo InlineFields::niceName(const FieldDecl* fieldDecl)
aInfo.fieldName = fieldDecl->getNameAsString();
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( fieldDecl->getLocation() );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
aInfo.sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation);
diff --git a/compilerplugins/clang/logexceptionnicely.cxx b/compilerplugins/clang/logexceptionnicely.cxx
index 8c272b6d7556..86f6406a7c3b 100644
--- a/compilerplugins/clang/logexceptionnicely.cxx
+++ b/compilerplugins/clang/logexceptionnicely.cxx
@@ -101,7 +101,7 @@ public:
if (ignoreLocation(operatorCallExpr))
return true;
- StringRef fn = getFileNameOfSpellingLoc(
+ StringRef fn = getFilenameOfLocation(
compiler.getSourceManager().getExpansionLoc(compat::getBeginLoc(operatorCallExpr)));
// these are below tools in the module hierarchy, so we can't use the pretty printing
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/include/comphelper/"))
diff --git a/compilerplugins/clang/memoryvar.cxx b/compilerplugins/clang/memoryvar.cxx
index 9cd723cf2bf8..2354739f458f 100644
--- a/compilerplugins/clang/memoryvar.cxx
+++ b/compilerplugins/clang/memoryvar.cxx
@@ -50,7 +50,7 @@ private:
StringRef MemoryVar::getFilename(SourceLocation loc)
{
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc);
- StringRef name { getFileNameOfSpellingLoc(spellingLocation) };
+ StringRef name { getFilenameOfLocation(spellingLocation) };
return name;
}
diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx
index a37abd568d02..b3a167ff143e 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -149,7 +149,7 @@ bool MergeClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
if (decl->isThisDeclarationADefinition())
{
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl));
- std::string filename = getFileNameOfSpellingLoc(spellingLocation);
+ std::string filename = getFilenameOfLocation(spellingLocation);
filename = filename.substr(strlen(SRCDIR));
std::string s = decl->getQualifiedNameAsString();
if (ignoreClass(s))
diff --git a/compilerplugins/clang/methodcycles.cxx b/compilerplugins/clang/methodcycles.cxx
index e6e1a83c36cb..42e15c91024a 100644
--- a/compilerplugins/clang/methodcycles.cxx
+++ b/compilerplugins/clang/methodcycles.cxx
@@ -176,7 +176,7 @@ MyFuncInfo MethodCycles::niceName(const FunctionDecl* functionDecl)
std::string MethodCycles::toString(SourceLocation loc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc(loc);
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
std::string sourceLocation
= std::string(name.substr(strlen(SRCDIR) + 1)) + ":"
+ std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
diff --git a/compilerplugins/clang/noexceptmove.cxx b/compilerplugins/clang/noexceptmove.cxx
index f0fd6cd899c5..b2679024e97b 100644
--- a/compilerplugins/clang/noexceptmove.cxx
+++ b/compilerplugins/clang/noexceptmove.cxx
@@ -119,7 +119,7 @@ bool NoExceptMove::TraverseCXXMethodDecl(CXXMethodDecl* methodDecl)
&& methodDecl->isThisDeclarationADefinition() && methodDecl->getBody() != nullptr;
if (isMove)
{
- StringRef fn = getFileNameOfSpellingLoc(
+ StringRef fn = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(methodDecl)));
// SfxObjectShellLock::operator= calls SotObject::OwnerLock which in turn calls stuff which cannot be noexcept
if (loplugin::isSamePathname(fn, SRCDIR "/include/sfx2/objsh.hxx"))
diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx
index 89535daa9849..b4a40b408a6c 100644
--- a/compilerplugins/clang/nullptr.cxx
+++ b/compilerplugins/clang/nullptr.cxx
@@ -239,7 +239,7 @@ bool Nullptr::TraverseInitListExpr(InitListExpr * expr, DataRecursionQueue * que
bool Nullptr::isInLokIncludeFile(SourceLocation spellingLocation) const {
return loplugin::hasPathnamePrefix(
- getFileNameOfSpellingLoc(spellingLocation),
+ getFilenameOfLocation(spellingLocation),
SRCDIR "/include/LibreOfficeKit/");
}
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 5d34dfc49d34..6839fec0a836 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -216,7 +216,7 @@ const FunctionDecl* Plugin::getParentFunctionDecl( const Stmt* stmt )
return nullptr;
}
-StringRef Plugin::getFileNameOfSpellingLoc(SourceLocation spellingLocation) const
+StringRef Plugin::getFilenameOfLocation(SourceLocation spellingLocation) const
{
// prevent crashes when running the global-analysis plugins
if (!spellingLocation.isValid())
@@ -244,13 +244,13 @@ StringRef Plugin::getFileNameOfSpellingLoc(SourceLocation spellingLocation) cons
assert(fn.startswith("/") || fn == "<stdin>");
#endif
s_Mode = fn == "<stdin>" ? STDIN : GOOD;
- return getFileNameOfSpellingLoc(spellingLocation);
+ return getFilenameOfLocation(spellingLocation);
}
}
bool Plugin::isInUnoIncludeFile(SourceLocation spellingLocation) const
{
- StringRef name{ getFileNameOfSpellingLoc(spellingLocation) };
+ StringRef name{ getFilenameOfLocation(spellingLocation) };
return compiler.getSourceManager().isInMainFile(spellingLocation)
? (isSamePathname(name, SRCDIR "/cppu/source/cppu/compat.cxx")
|| isSamePathname(name, SRCDIR "/cppuhelper/source/compat.cxx")
@@ -621,7 +621,7 @@ bool RewritePlugin::wouldRewriteWorkdir(SourceLocation loc)
return false;
}
return
- getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(loc))
+ getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(loc))
.startswith(WORKDIR "/");
}
diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index 0712a22afc2a..ebadc645ef7a 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -81,8 +81,11 @@ protected:
Stmt* getParentStmt( Stmt* stmt );
const FunctionDecl* getParentFunctionDecl( const Stmt* stmt );
- /// to check file names against whitelists, so that it works with preprocessed input too
- StringRef getFileNameOfSpellingLoc(SourceLocation spellingLocation) const;
+ /**
+ Get filename of the given location. Use this instead of SourceManager::getFilename(), as that one
+ does not handle source with expanded #inline directives (used by Icecream for remote compilation).
+ */
+ StringRef getFilenameOfLocation(SourceLocation spellingLocation) const;
/**
Checks if the location is inside a UNO file, more specifically, if it forms part of the URE stable interface,
which is not allowed to be changed.
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index 7a49f0573bf4..c002a1499977 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -479,7 +479,7 @@ bool RefCounting::VisitVarDecl(const VarDecl * varDecl) {
<< varDecl->getSourceRange();
}
if (containsSalhelperReferenceObjectSubclass(varDecl->getType().getTypePtr())) {
- StringRef name { getFileNameOfSpellingLoc(
+ StringRef name { getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())) };
// this is playing games that it believes is safe
if (loplugin::isSamePathname(name, SRCDIR "/stoc/source/security/permissions.cxx"))
diff --git a/compilerplugins/clang/referencecasting.cxx b/compilerplugins/clang/referencecasting.cxx
index 6b1e3a47e920..45b65d3e7f26 100644
--- a/compilerplugins/clang/referencecasting.cxx
+++ b/compilerplugins/clang/referencecasting.cxx
@@ -67,7 +67,7 @@ static bool isDerivedFrom(const CXXRecordDecl* subtypeRecord, const CXXRecordDec
bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
{
// don't bother processing anything in the Reference.h file. Makes my life easier when debugging this.
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(cce)));
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.h"))
return true;
@@ -178,7 +178,7 @@ bool ReferenceCasting::VisitCXXConstructExpr(const CXXConstructExpr* cce)
bool ReferenceCasting::VisitCXXMemberCallExpr(const CXXMemberCallExpr* mce)
{
// don't bother processing anything in the Reference.h file. Makes my life easier when debugging this.
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(mce)));
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Reference.h"))
return true;
@@ -308,7 +308,7 @@ bool ReferenceCasting::CheckForUnnecessaryGet(const Expr* expr)
if (!loplugin::DeclCheck(methodDecl->getParent()).Class("Reference").Namespace("uno"))
return false;
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
if (loplugin::isSamePathname(aFileName, SRCDIR "/cppu/qa/test_reference.cxx"))
return false;
diff --git a/compilerplugins/clang/reservedid.cxx b/compilerplugins/clang/reservedid.cxx
index acdc18217514..b43b1c882046 100644
--- a/compilerplugins/clang/reservedid.cxx
+++ b/compilerplugins/clang/reservedid.cxx
@@ -111,7 +111,7 @@ void ReservedId::postRun() {
if (d->getKind() == MacroDirective::MD_Define) {
auto loc = d->getLocation();
if (loc.isValid() && !ignoreLocation(loc)) {
- auto file = getFileNameOfSpellingLoc(loc);
+ auto file = getFilenameOfLocation(loc);
if (!loplugin::isSamePathname(
file,
SRCDIR
@@ -143,7 +143,7 @@ bool ReservedId::VisitNamedDecl(NamedDecl const * decl) {
if (ignoreLocation(spelLoc)) {
return true;
}
- auto filename = getFileNameOfSpellingLoc(spelLoc);
+ auto filename = getFilenameOfLocation(spelLoc);
if (loplugin::hasPathnamePrefix(filename, SRCDIR "/bridges/source/cpp_uno/")
&& filename.endswith("share.hxx"))
{
@@ -274,7 +274,7 @@ ReservedId::Kind ReservedId::determineKind(llvm::StringRef const & id) {
bool ReservedId::isInLokIncludeFile(SourceLocation spellingLocation) const {
return loplugin::hasPathnamePrefix(
- getFileNameOfSpellingLoc(spellingLocation),
+ getFilenameOfLocation(spellingLocation),
SRCDIR "/include/LibreOfficeKit/");
}
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index ad71435470f0..3aba59124e2b 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -767,7 +767,7 @@ bool SalBool::TraverseStaticAssertDecl(StaticAssertDecl * decl) {
// inside static_assert in cppu/source/uno/check.cxx:
return
loplugin::isSamePathname(
- getFileNameOfSpellingLoc(decl->getLocation()),
+ getFilenameOfLocation(decl->getLocation()),
SRCDIR "/cppu/source/uno/check.cxx")
|| RecursiveASTVisitor::TraverseStaticAssertDecl(decl);
}
@@ -803,7 +803,7 @@ bool SalBool::isInSpecialMainFile(SourceLocation spellingLocation) const {
if (!compiler.getSourceManager().isInMainFile(spellingLocation)) {
return false;
}
- auto f = getFileNameOfSpellingLoc(spellingLocation);
+ auto f = getFilenameOfLocation(spellingLocation);
return loplugin::isSamePathname(f, SRCDIR "/cppu/qa/test_any.cxx")
|| loplugin::isSamePathname(f, SRCDIR "/cppu/source/uno/check.cxx");
// TODO: the offset checks
diff --git a/compilerplugins/clang/shouldreturnbool.cxx b/compilerplugins/clang/shouldreturnbool.cxx
index e46d05d0b28f..a15e9d9b872b 100644
--- a/compilerplugins/clang/shouldreturnbool.cxx
+++ b/compilerplugins/clang/shouldreturnbool.cxx
@@ -199,7 +199,7 @@ bool ShouldReturnBool::IsInteresting(FunctionDecl const* functionDecl)
return false;
// not sure what basegfx is doing here
- StringRef fileName{ getFileNameOfSpellingLoc(functionDecl->getLocation()) };
+ StringRef fileName{ getFilenameOfLocation(functionDecl->getLocation()) };
if (loplugin::isSamePathname(fileName, SRCDIR "/include/basegfx/range/basicrange.hxx"))
return false;
// false +
diff --git a/compilerplugins/clang/singlevalfields.cxx b/compilerplugins/clang/singlevalfields.cxx
index 52631dabaa10..2949ce10ef3c 100644
--- a/compilerplugins/clang/singlevalfields.cxx
+++ b/compilerplugins/clang/singlevalfields.cxx
@@ -154,7 +154,7 @@ void SingleValFields::niceName(const DeclaratorDecl* fieldOrVarDecl, MyFieldInfo
aInfo.fieldType = fieldOrVarDecl->getType().getAsString();
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( fieldOrVarDecl->getLocation() );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
aInfo.sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation);
}
diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx
index bc37189eb64b..25e4d2c77473 100644
--- a/compilerplugins/clang/staticmethods.cxx
+++ b/compilerplugins/clang/staticmethods.cxx
@@ -60,7 +60,7 @@ bool isDerivedFromTestFixture(const CXXRecordDecl *decl) {
StringRef StaticMethods::getFilename(SourceLocation loc)
{
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc);
- return getFileNameOfSpellingLoc(spellingLocation);
+ return getFilenameOfLocation(spellingLocation);
}
bool startsWith(const std::string& rStr, const char* pSubStr) {
diff --git a/compilerplugins/clang/store/badvectorinit.cxx b/compilerplugins/clang/store/badvectorinit.cxx
index 67c50fb59189..4ab086d9ecc8 100644
--- a/compilerplugins/clang/store/badvectorinit.cxx
+++ b/compilerplugins/clang/store/badvectorinit.cxx
@@ -113,7 +113,7 @@ bool BadVectorInit::TraverseFunctionDecl(FunctionDecl* decl)
StringRef BadVectorInit::getFilename(SourceLocation loc)
{
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc);
- StringRef name { getFileNameOfSpellingLoc(spellingLocation) };
+ StringRef name { getFilenameOfLocation(spellingLocation) };
return name;
}
diff --git a/compilerplugins/clang/store/constantfunction.cxx b/compilerplugins/clang/store/constantfunction.cxx
index 3d0b911e863c..a29556723748 100644
--- a/compilerplugins/clang/store/constantfunction.cxx
+++ b/compilerplugins/clang/store/constantfunction.cxx
@@ -45,7 +45,7 @@ public:
StringRef ConstantFunction::getFilename(const FunctionDecl* functionDecl)
{
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(functionDecl->getCanonicalDecl()->getNameInfo().getLoc());
- StringRef name { getFileNameOfSpellingLoc(spellingLocation) };
+ StringRef name { getFilenameOfLocation(spellingLocation) };
return name;
}
diff --git a/compilerplugins/clang/store/defaultparams.cxx b/compilerplugins/clang/store/defaultparams.cxx
index 331fd8ae843d..cb533cb19085 100644
--- a/compilerplugins/clang/store/defaultparams.cxx
+++ b/compilerplugins/clang/store/defaultparams.cxx
@@ -91,7 +91,7 @@ bool DefaultParams::VisitCallExpr(CallExpr * callExpr) {
if (!found)
break;
// Ignore CPPUNIT, it's macros contain some stuff that triggers us
- StringRef aFileName = getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(parmVarDecl->getLocStart()));
+ StringRef aFileName = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(parmVarDecl->getLocStart()));
if (aFileName.find("include/cppunit") != std::string::npos)
break;
report(
diff --git a/compilerplugins/clang/store/deletedspecial.cxx b/compilerplugins/clang/store/deletedspecial.cxx
index b287283cdd36..7ee75bb319d0 100644
--- a/compilerplugins/clang/store/deletedspecial.cxx
+++ b/compilerplugins/clang/store/deletedspecial.cxx
@@ -141,7 +141,7 @@ bool DeletedSpecial::whitelist(
std::string const & path)
{
return getClass(decl)->getQualifiedNameAsString() == name
- && (getFileNameOfSpellingLoc(
+ && (getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(decl->getLocation()))
== SRCDIR "/" + path);
}
diff --git a/compilerplugins/clang/store/fpcomparison.cxx b/compilerplugins/clang/store/fpcomparison.cxx
index d56b02644445..faaec0110fa5 100644
--- a/compilerplugins/clang/store/fpcomparison.cxx
+++ b/compilerplugins/clang/store/fpcomparison.cxx
@@ -70,7 +70,7 @@ bool FpComparison::ignore(FunctionDecl* function)
return true;
}
// we assume that these modules know what they are doing with FP stuff
- StringRef aFileName = getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(function->getLocStart()));
+ StringRef aFileName = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(function->getLocStart()));
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sc/")) {
return true;
}
diff --git a/compilerplugins/clang/store/returnbyref.cxx b/compilerplugins/clang/store/returnbyref.cxx
index fd99a2d0ec06..d4049481a4ca 100644
--- a/compilerplugins/clang/store/returnbyref.cxx
+++ b/compilerplugins/clang/store/returnbyref.cxx
@@ -128,7 +128,7 @@ nextStmt->dump();
std::string ReturnByRef::getFilename(SourceLocation loc)
{
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc);
- return getFileNameOfSpellingLoc(spellingLocation);
+ return getFilenameOfLocation(spellingLocation);
}
loplugin::Plugin::Registration< ReturnByRef > X("returnbyref");
diff --git a/compilerplugins/clang/store/revisibility.cxx b/compilerplugins/clang/store/revisibility.cxx
index 3ca541c1fadc..727d7094a093 100644
--- a/compilerplugins/clang/store/revisibility.cxx
+++ b/compilerplugins/clang/store/revisibility.cxx
@@ -63,7 +63,7 @@ bool ReVisibility::VisitFunctionDecl(FunctionDecl const * decl) {
}
}
if (decl->isThisDeclarationADefinition() && first != nullptr
- && !(getFileNameOfSpellingLoc(
+ && !(getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(
decl->getLocation()))
.startswith(SRCDIR "/libreofficekit/")))
diff --git a/compilerplugins/clang/store/stylepolice.cxx b/compilerplugins/clang/store/stylepolice.cxx
index f8536108a37d..e70b74b2e43c 100644
--- a/compilerplugins/clang/store/stylepolice.cxx
+++ b/compilerplugins/clang/store/stylepolice.cxx
@@ -38,7 +38,7 @@ private:
StringRef StylePolice::getFilename(SourceLocation loc)
{
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(loc);
- StringRef name { getFileNameOfSpellingLoc(spellingLocation) };
+ StringRef name { getFilenameOfLocation(spellingLocation) };
return name;
}
diff --git a/compilerplugins/clang/stringconcatauto.cxx b/compilerplugins/clang/stringconcatauto.cxx
index 6d20f2fd0e14..9565225bf45e 100644
--- a/compilerplugins/clang/stringconcatauto.cxx
+++ b/compilerplugins/clang/stringconcatauto.cxx
@@ -70,7 +70,7 @@ bool StringConcatAuto::checkDecl( const DeclaratorDecl* decl, QualType type, con
return true;
if( isa< ParmVarDecl >( decl )) // parameters should be fine, temporaries should exist during the call
return true;
- std::string fileName = getFileNameOfSpellingLoc(
+ std::string fileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl)));
loplugin::normalizeDotDotInFilePath(fileName);
if (loplugin::isSamePathname(fileName, SRCDIR "/include/rtl/string.hxx")
diff --git a/compilerplugins/clang/stringconcatliterals.cxx b/compilerplugins/clang/stringconcatliterals.cxx
index 2d2699a09acf..0f26f4f553bc 100644
--- a/compilerplugins/clang/stringconcatliterals.cxx
+++ b/compilerplugins/clang/stringconcatliterals.cxx
@@ -105,7 +105,7 @@ bool StringConcatLiterals::VisitCallExpr(CallExpr const * expr) {
// We add an extra " " in the TOOLS_WARN_EXCEPTION macro, which triggers this plugin
if (loplugin::isSamePathname(
- getFileNameOfSpellingLoc(
+ getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(
compiler.getSourceManager().getImmediateMacroCallerLoc(
compiler.getSourceManager().getImmediateMacroCallerLoc(
@@ -114,7 +114,7 @@ bool StringConcatLiterals::VisitCallExpr(CallExpr const * expr) {
return true;
StringRef name {
- getFileNameOfSpellingLoc(
+ getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr))) };
if (loplugin::isSamePathname(
name, SRCDIR "/sal/qa/rtl/oustringbuffer/test_oustringbuffer_assign.cxx")
diff --git a/compilerplugins/clang/stringconstant.cxx b/compilerplugins/clang/stringconstant.cxx
index ed2fd52b75b0..ed332e5644e0 100644
--- a/compilerplugins/clang/stringconstant.cxx
+++ b/compilerplugins/clang/stringconstant.cxx
@@ -417,7 +417,7 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
// u.equalsIgnoreAsciiCaseAscii("foo") ->
// u.equalsIngoreAsciiCase("foo"):
- auto file = getFileNameOfSpellingLoc(
+ auto file = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
if (loplugin::isSamePathname(
file, SRCDIR "/sal/qa/rtl/strings/test_oustring_compare.cxx"))
@@ -435,7 +435,7 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
{
// u.equalsIgnoreAsciiCaseAsciiL("foo", 3) ->
// u.equalsIngoreAsciiCase("foo"):
- auto file = getFileNameOfSpellingLoc(
+ auto file = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
if (loplugin::isSamePathname(
file, SRCDIR "/sal/qa/rtl/strings/test_oustring_compare.cxx"))
@@ -802,7 +802,7 @@ bool StringConstant::VisitCallExpr(CallExpr const * expr) {
case 2:
{
// b.append("foo", 3) -> b.append("foo"):
- auto file = getFileNameOfSpellingLoc(
+ auto file = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(
compat::getBeginLoc(expr)));
if (loplugin::isSamePathname(
@@ -1169,7 +1169,7 @@ bool StringConstant::VisitCXXConstructExpr(CXXConstructExpr const * expr) {
if (dc.Operator(OO_Plus).Namespace("rtl")
.GlobalNamespace())
{
- auto file = getFileNameOfSpellingLoc(
+ auto file = getFilenameOfLocation(
compiler.getSourceManager()
.getSpellingLoc(
compat::getBeginLoc(expr)));
diff --git a/compilerplugins/clang/typedefparam.cxx b/compilerplugins/clang/typedefparam.cxx
index 2c7031ff7af0..7ea4df79d2af 100644
--- a/compilerplugins/clang/typedefparam.cxx
+++ b/compilerplugins/clang/typedefparam.cxx
@@ -104,7 +104,7 @@ bool TypedefParam::VisitCXXMethodDecl(CXXMethodDecl const* methodDecl)
if (methodDecl->getCanonicalDecl() != methodDecl)
return true;
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(methodDecl)));
// seems to be using typedefs as a form of documentation for method params
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sw/source/filter/ww8/ww8scan.hxx"))
diff --git a/compilerplugins/clang/unnecessaryoverride.cxx b/compilerplugins/clang/unnecessaryoverride.cxx
index 4d4cee322751..e36e5c67a4e8 100644
--- a/compilerplugins/clang/unnecessaryoverride.cxx
+++ b/compilerplugins/clang/unnecessaryoverride.cxx
@@ -120,7 +120,7 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
return true;
}
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(methodDecl)));
if (isa<CXXDestructorDecl>(methodDecl)
@@ -367,7 +367,7 @@ bool UnnecessaryOverride::VisitCXXMethodDecl(const CXXMethodDecl* methodDecl)
pOther = methodDecl->getCanonicalDecl();
if (pOther) {
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(pOther)));
// SFX_DECL_CHILDWINDOW_WITHID macro
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/sfx2/childwin.hxx"))
diff --git a/compilerplugins/clang/unnecessaryvirtual.cxx b/compilerplugins/clang/unnecessaryvirtual.cxx
index 7f6751017bc0..7556217f29ce 100644
--- a/compilerplugins/clang/unnecessaryvirtual.cxx
+++ b/compilerplugins/clang/unnecessaryvirtual.cxx
@@ -187,7 +187,7 @@ void UnnecessaryVirtual::MarkRootOverridesNonEmpty( const CXXMethodDecl* methodD
std::string UnnecessaryVirtual::toString(SourceLocation loc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
std::string sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
loplugin::normalizeDotDotInFilePath(sourceLocation);
return sourceLocation;
diff --git a/compilerplugins/clang/unoany.cxx b/compilerplugins/clang/unoany.cxx
index 38e216fed437..e0360c6cd2de 100644
--- a/compilerplugins/clang/unoany.cxx
+++ b/compilerplugins/clang/unoany.cxx
@@ -38,7 +38,7 @@ bool UnoAny::VisitCXXOperatorCallExpr(CXXOperatorCallExpr const * expr)
if (ignoreLocation(expr)) {
return true;
}
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/com/sun/star/uno/Any.hxx")) {
return true;
diff --git a/compilerplugins/clang/unusedenumconstants.cxx b/compilerplugins/clang/unusedenumconstants.cxx
index f64028e11ce3..4ae1f52f2713 100644
--- a/compilerplugins/clang/unusedenumconstants.cxx
+++ b/compilerplugins/clang/unusedenumconstants.cxx
@@ -118,7 +118,7 @@ MyFieldInfo UnusedEnumConstants::niceName(const EnumConstantDecl* enumConstantDe
}
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( enumConstantDecl->getLocation() );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
aInfo.loc = expansionLoc;
aInfo.sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation);
diff --git a/compilerplugins/clang/unusedfields.cxx b/compilerplugins/clang/unusedfields.cxx
index b552630a51d1..4aafd9cec746 100644
--- a/compilerplugins/clang/unusedfields.cxx
+++ b/compilerplugins/clang/unusedfields.cxx
@@ -247,7 +247,7 @@ MyFieldInfo UnusedFields::niceName(const FieldDecl* fieldDecl)
aInfo.fieldType = fieldDecl->getType().getAsString();
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( fieldDecl->getLocation() );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
aInfo.sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
loplugin::normalizeDotDotInFilePath(aInfo.sourceLocation);
diff --git a/compilerplugins/clang/unusedmethods.cxx b/compilerplugins/clang/unusedmethods.cxx
index 9977593d5b1e..9c7ce9a41606 100644
--- a/compilerplugins/clang/unusedmethods.cxx
+++ b/compilerplugins/clang/unusedmethods.cxx
@@ -187,7 +187,7 @@ MyFuncInfo UnusedMethods::niceName(const FunctionDecl* functionDecl)
std::string UnusedMethods::toString(SourceLocation loc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc( loc );
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
std::string sourceLocation = std::string(name.substr(strlen(SRCDIR)+1)) + ":" + std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
loplugin::normalizeDotDotInFilePath(sourceLocation);
return sourceLocation;
diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index 9caab06341a0..ad8f43132eaa 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -1092,7 +1092,7 @@ bool UseUniquePtr::TraverseConstructorInitializer(CXXCtorInitializer * ctorInit)
if (!isa<DeclRefExpr>(init))
return true;
- StringRef fn = getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(ctorInit->getSourceLocation()));
+ StringRef fn = getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(ctorInit->getSourceLocation()));
// don't feel like fiddling with the yacc parser
if (loplugin::hasPathnamePrefix(fn, SRCDIR "/idlc/"))
return true;
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 45dbe450ec87..46933a5087c5 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -241,7 +241,7 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
if (!bOk) {
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
compat::getBeginLoc(pCXXDestructorDecl));
- StringRef filename = getFileNameOfSpellingLoc(spellingLocation);
+ StringRef filename = getFilenameOfLocation(spellingLocation);
if ( !(loplugin::isSamePathname(filename, SRCDIR "/vcl/source/window/window.cxx"))
&& !(loplugin::isSamePathname(filename, SRCDIR "/vcl/source/gdi/virdev.cxx"))
&& !(loplugin::isSamePathname(filename, SRCDIR "/vcl/qa/cppunit/lifecycle.cxx"))
@@ -281,7 +281,7 @@ void VCLWidgets::checkAssignmentForVclPtrToRawConversion(const SourceLocation& s
if (!rhs) {
return;
}
- StringRef filename = getFileNameOfSpellingLoc(spellingLocation);
+ StringRef filename = getFilenameOfLocation(spellingLocation);
if (loplugin::isSamePathname(filename, SRCDIR "/include/rtl/ref.hxx")) {
return;
}
@@ -363,7 +363,7 @@ bool VCLWidgets::VisitVarDecl(const VarDecl * pVarDecl) {
if (pVarDecl->getInit()) {
checkAssignmentForVclPtrToRawConversion(spellingLocation, pVarDecl->getType().getTypePtr(), pVarDecl->getInit());
}
- StringRef aFileName = getFileNameOfSpellingLoc(spellingLocation);
+ StringRef aFileName = getFilenameOfLocation(spellingLocation);
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/vcl/vclptr.hxx"))
return true;
if (loplugin::isSamePathname(aFileName, SRCDIR "/vcl/source/window/layout.cxx"))
@@ -415,7 +415,7 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
if (ignoreLocation(fieldDecl)) {
return true;
}
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(fieldDecl)));
if (loplugin::isSamePathname(aFileName, SRCDIR "/include/vcl/vclptr.hxx"))
return true;
@@ -673,7 +673,7 @@ bool VCLWidgets::VisitCXXDeleteExpr(const CXXDeleteExpr *pCXXDeleteExpr)
if (pPointee && isDerivedFromVclReferenceBase(pPointee)) {
SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(
compat::getBeginLoc(pCXXDeleteExpr));
- StringRef filename = getFileNameOfSpellingLoc(spellingLocation);
+ StringRef filename = getFilenameOfLocation(spellingLocation);
if ( !(loplugin::isSamePathname(filename, SRCDIR "/include/vcl/vclreferencebase.hxx")))
{
report(
@@ -849,7 +849,7 @@ bool VCLWidgets::VisitCXXConstructExpr( const CXXConstructExpr* constructExpr )
const CXXConstructorDecl* pConstructorDecl = constructExpr->getConstructor();
const CXXRecordDecl* recordDecl = pConstructorDecl->getParent();
if (isDerivedFromVclReferenceBase(recordDecl)) {
- StringRef aFileName = getFileNameOfSpellingLoc(
+ StringRef aFileName = getFilenameOfLocation(
compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(constructExpr)));
if (!loplugin::isSamePathname(aFileName, SRCDIR "/include/vcl/vclptr.hxx")) {
report(
diff --git a/compilerplugins/clang/virtualdead.cxx b/compilerplugins/clang/virtualdead.cxx
index bfcb3d7c94cb..c2d804067d7b 100644
--- a/compilerplugins/clang/virtualdead.cxx
+++ b/compilerplugins/clang/virtualdead.cxx
@@ -253,7 +253,7 @@ std::string VirtualDead::getCallValue(const Expr* arg)
std::string VirtualDead::toString(SourceLocation loc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc(loc);
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
std::string sourceLocation
= std::string(name.substr(strlen(SRCDIR) + 1)) + ":"
+ std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
diff --git a/compilerplugins/clang/virtualdown.cxx b/compilerplugins/clang/virtualdown.cxx
index 48df7934bc04..ff5fc373a1dd 100644
--- a/compilerplugins/clang/virtualdown.cxx
+++ b/compilerplugins/clang/virtualdown.cxx
@@ -204,7 +204,7 @@ std::string VirtualDown::niceName(const CXXMethodDecl* cxxMethodDecl)
std::string VirtualDown::toString(SourceLocation loc)
{
SourceLocation expansionLoc = compiler.getSourceManager().getExpansionLoc(loc);
- StringRef name = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef name = getFilenameOfLocation(expansionLoc);
std::string sourceLocation
= std::string(name.substr(strlen(SRCDIR) + 1)) + ":"
+ std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));
diff --git a/compilerplugins/clang/weakbase.cxx b/compilerplugins/clang/weakbase.cxx
index a0040dd37c30..ffc0b931956c 100644
--- a/compilerplugins/clang/weakbase.cxx
+++ b/compilerplugins/clang/weakbase.cxx
@@ -49,7 +49,7 @@ bool WeakBase::VisitCXXRecordDecl(CXXRecordDecl const* recordDecl)
{
return true;
}
- // StringRef aFileName = getFileNameOfSpellingLoc(
+ // StringRef aFileName = getFilenameOfLocation(
// compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(fieldDecl)));
// if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/chart2/source/"))
diff --git a/compilerplugins/clang/writeonlyvars.cxx b/compilerplugins/clang/writeonlyvars.cxx
index fcaf3d3c7e26..984f83b2fd80 100644
--- a/compilerplugins/clang/writeonlyvars.cxx
+++ b/compilerplugins/clang/writeonlyvars.cxx
@@ -510,7 +510,7 @@ MyVarInfo WriteOnlyVars::niceName(const VarDecl* varDecl)
SourceLocation expansionLoc
= compiler.getSourceManager().getExpansionLoc(varDecl->getLocation());
- StringRef filename = getFileNameOfSpellingLoc(expansionLoc);
+ StringRef filename = getFilenameOfLocation(expansionLoc);
aInfo.sourceLocation
= std::string(filename.substr(strlen(SRCDIR) + 1)) + ":"
+ std::to_string(compiler.getSourceManager().getSpellingLineNumber(expansionLoc));