[Libreoffice-commits] core.git: compilerplugins/clang
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Aug 10 13:14:30 UTC 2018
compilerplugins/clang/automem.cxx | 4
compilerplugins/clang/blockblock.cxx | 8 -
compilerplugins/clang/casttovoid.cxx | 4
compilerplugins/clang/changetoolsgen.cxx | 35 ++--
compilerplugins/clang/checkunusedparams.cxx | 6
compilerplugins/clang/commaoperator.cxx | 4
compilerplugins/clang/compat.hxx | 65 ++++++++
compilerplugins/clang/constantparam.cxx | 4
compilerplugins/clang/constparams.cxx | 16 +-
compilerplugins/clang/countusersofdefaultparams.cxx | 4
compilerplugins/clang/cstylecast.cxx | 6
compilerplugins/clang/datamembershadow.cxx | 6
compilerplugins/clang/dbgunhandledexception.cxx | 8 -
compilerplugins/clang/derefnullptr.cxx | 2
compilerplugins/clang/dodgyswitch.cxx | 4
compilerplugins/clang/emptyif.cxx | 5
compilerplugins/clang/expandablemethods.cxx | 2
compilerplugins/clang/expressionalwayszero.cxx | 8 -
compilerplugins/clang/faileddyncast.cxx | 2
compilerplugins/clang/finalclasses.cxx | 2
compilerplugins/clang/finalprotected.cxx | 4
compilerplugins/clang/flatten.cxx | 8 -
compilerplugins/clang/fragiledestructor.cxx | 12 -
compilerplugins/clang/implicitboolconversion.cxx | 14 -
compilerplugins/clang/inlinesimplememberfunctions.cxx | 10 -
compilerplugins/clang/literaltoboolconversion.cxx | 20 +-
compilerplugins/clang/mergeclasses.cxx | 2
compilerplugins/clang/nullptr.cxx | 12 -
compilerplugins/clang/oncevar.cxx | 2
compilerplugins/clang/plugin.hxx | 3
compilerplugins/clang/privatebase.cxx | 2
compilerplugins/clang/rangedforcopy.cxx | 2
compilerplugins/clang/redundantcast.cxx | 18 +-
compilerplugins/clang/redundantinline.cxx | 10 -
compilerplugins/clang/redundantpointerops.cxx | 10 -
compilerplugins/clang/refcounting.cxx | 6
compilerplugins/clang/rendercontext.cxx | 2
compilerplugins/clang/returnconstant.cxx | 11 -
compilerplugins/clang/salbool.cxx | 32 ++--
compilerplugins/clang/salcall.cxx | 4
compilerplugins/clang/sallogareas.cxx | 10 -
compilerplugins/clang/salunicodeliteral.cxx | 2
compilerplugins/clang/sfxpoolitem.cxx | 2
compilerplugins/clang/shouldreturnbool.cxx | 4
compilerplugins/clang/simplifybool.cxx | 142 +++++++++---------
compilerplugins/clang/simplifydynamiccast.cxx | 6
compilerplugins/clang/singlevalfields.cxx | 2
compilerplugins/clang/staticaccess.cxx | 2
compilerplugins/clang/staticanonymous.cxx | 2
compilerplugins/clang/staticmethods.cxx | 4
compilerplugins/clang/stringconcat.cxx | 10 -
compilerplugins/clang/stringconstant.cxx | 14 -
compilerplugins/clang/stringloop.cxx | 8 -
compilerplugins/clang/unnecessarycatchthrow.cxx | 2
compilerplugins/clang/unnecessaryoverride.cxx | 2
compilerplugins/clang/unnecessaryparen.cxx | 56 +++----
compilerplugins/clang/unoany.cxx | 2
compilerplugins/clang/unusedenumconstants.cxx | 2
compilerplugins/clang/unusedfields.cxx | 16 +-
compilerplugins/clang/unusedfieldsremove.cxx | 2
compilerplugins/clang/unusedindex.cxx | 3
compilerplugins/clang/unusedmethodsremove.cxx | 2
compilerplugins/clang/useuniqueptr.cxx | 18 +-
compilerplugins/clang/vclwidgets.cxx | 26 +--
64 files changed, 395 insertions(+), 323 deletions(-)
New commits:
commit 3cc5149a84c7b8cfaf0deb2e2f6c88c72343ee28
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Aug 10 12:35:21 2018 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Aug 10 15:14:03 2018 +0200
Avoid -Werror=deprecated-declarations with recent Clang trunk
...which first added alternative names to and then deprecated getLocBegin/End
Change-Id: Iaefb8ce259057abfa6cd20f0b63c0ef2949a96b2
Reviewed-on: https://gerrit.libreoffice.org/58820
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/compilerplugins/clang/automem.cxx b/compilerplugins/clang/automem.cxx
index 4675c02325be..5c3d740bb9d0 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(expr->getLocStart()));
+ StringRef aFileName = getFileNameOfSpellingLoc(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)));
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/salhelper/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/osl/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/salhelper/")
@@ -79,7 +79,7 @@ bool AutoMem::VisitCXXDeleteExpr(const CXXDeleteExpr* expr)
report(
DiagnosticsEngine::Warning,
"calling delete on object field, rather use std::unique_ptr or std::scoped_ptr",
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/blockblock.cxx b/compilerplugins/clang/blockblock.cxx
index bdb7d1361410..b0cba961aba0 100644
--- a/compilerplugins/clang/blockblock.cxx
+++ b/compilerplugins/clang/blockblock.cxx
@@ -47,9 +47,9 @@ bool BlockBlock::VisitCompoundStmt(CompoundStmt const * compound)
auto inner = *compound->body_begin();
if (!isa<CompoundStmt>(inner))
return true;
- if (compiler.getSourceManager().isMacroBodyExpansion(compound->getLocStart()))
+ if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(compound)))
return true;
- if (compiler.getSourceManager().isMacroBodyExpansion(inner->getLocStart()))
+ if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(inner)))
return true;
if (containsPreprocessingConditionalInclusion(compound->getSourceRange())) {
return true;
@@ -57,12 +57,12 @@ bool BlockBlock::VisitCompoundStmt(CompoundStmt const * compound)
report(
DiagnosticsEngine::Warning,
"block directly inside block",
- compound->getLocStart())
+ compat::getBeginLoc(compound))
<< compound->getSourceRange();
report(
DiagnosticsEngine::Note,
"inner block here",
- inner->getLocStart())
+ compat::getBeginLoc(inner))
<< inner->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/casttovoid.cxx b/compilerplugins/clang/casttovoid.cxx
index e8b080dab2a5..35c35da42a9a 100644
--- a/compilerplugins/clang/casttovoid.cxx
+++ b/compilerplugins/clang/casttovoid.cxx
@@ -440,7 +440,7 @@ private:
return nullptr;
}
if (compiler.getSourceManager().isMacroBodyExpansion(
- expr->getLocStart()))
+ compat::getBeginLoc(expr)))
{
return nullptr;
}
@@ -487,7 +487,7 @@ private:
if (usage.firstConsumption != nullptr) {
return;
}
- auto const loc = dre->getLocStart();
+ auto const loc = compat::getBeginLoc(dre);
if (compiler.getSourceManager().isMacroArgExpansion(loc)
&& (compat::getImmediateMacroNameForDiagnostics(
loc, compiler.getSourceManager(), compiler.getLangOpts())
diff --git a/compilerplugins/clang/changetoolsgen.cxx b/compilerplugins/clang/changetoolsgen.cxx
index 0b072c5dcbde..190c4abf2c84 100644
--- a/compilerplugins/clang/changetoolsgen.cxx
+++ b/compilerplugins/clang/changetoolsgen.cxx
@@ -111,7 +111,7 @@ bool ChangeToolsGen::VisitCXXMemberCallExpr(CXXMemberCallExpr const* call)
if (auto unaryOp = dyn_cast<UnaryOperator>(parent))
{
if (!ChangeUnaryOperator(unaryOp, call, methodName))
- report(DiagnosticsEngine::Warning, "Could not fix, unary", call->getLocStart());
+ report(DiagnosticsEngine::Warning, "Could not fix, unary", compat::getBeginLoc(call));
return true;
}
auto binaryOp = dyn_cast<BinaryOperator>(parent);
@@ -130,7 +130,7 @@ bool ChangeToolsGen::VisitCXXMemberCallExpr(CXXMemberCallExpr const* call)
if (parent2 && isa<Expr>(parent2))
{
report(DiagnosticsEngine::Warning, "Could not fix, embedded assign",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
// Check for
@@ -139,25 +139,25 @@ bool ChangeToolsGen::VisitCXXMemberCallExpr(CXXMemberCallExpr const* call)
if (rhs->getOpcode() == BO_Assign)
{
report(DiagnosticsEngine::Warning, "Could not fix, double assign",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
if (!ChangeAssignment(parent, methodName, setPrefix))
- report(DiagnosticsEngine::Warning, "Could not fix, assign", call->getLocStart());
+ report(DiagnosticsEngine::Warning, "Could not fix, assign", compat::getBeginLoc(call));
return true;
}
if (opcode == BO_AddAssign || opcode == BO_SubAssign)
{
if (!ChangeBinaryOperatorPlusMinus(binaryOp, call, methodName))
report(DiagnosticsEngine::Warning, "Could not fix, assign-and-change",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
else if (opcode == BO_RemAssign || opcode == BO_MulAssign || opcode == BO_DivAssign)
{
if (!ChangeBinaryOperatorOther(binaryOp, call, methodName, setPrefix))
report(DiagnosticsEngine::Warning, "Could not fix, assign-and-change",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
else
@@ -173,8 +173,8 @@ bool ChangeToolsGen::ChangeAssignment(Stmt const* parent, std::string const& met
// and replace with
// aRect.SetLeft( ... );
SourceManager& SM = compiler.getSourceManager();
- SourceLocation startLoc = SM.getExpansionLoc(parent->getLocStart());
- SourceLocation endLoc = SM.getExpansionLoc(parent->getLocEnd());
+ SourceLocation startLoc = SM.getExpansionLoc(compat::getBeginLoc(parent));
+ SourceLocation endLoc = SM.getExpansionLoc(compat::getEndLoc(parent));
const char* p1 = SM.getCharacterData(startLoc);
const char* p2 = SM.getCharacterData(endLoc);
unsigned n = Lexer::MeasureTokenLength(endLoc, SM, compiler.getLangOpts());
@@ -201,8 +201,8 @@ bool ChangeToolsGen::ChangeBinaryOperatorPlusMinus(BinaryOperator const* binaryO
// and replace with
// aRect.MoveLeft( ... );
SourceManager& SM = compiler.getSourceManager();
- SourceLocation startLoc = SM.getExpansionLoc(binaryOp->getLocStart());
- SourceLocation endLoc = SM.getExpansionLoc(binaryOp->getLocEnd());
+ SourceLocation startLoc = SM.getExpansionLoc(compat::getBeginLoc(binaryOp));
+ SourceLocation endLoc = SM.getExpansionLoc(compat::getEndLoc(binaryOp));
const char* p1 = SM.getCharacterData(startLoc);
const char* p2 = SM.getCharacterData(endLoc);
if (p2 < p1) // clang is misbehaving, appears to be macro constant related
@@ -228,7 +228,7 @@ bool ChangeToolsGen::ChangeBinaryOperatorPlusMinus(BinaryOperator const* binaryO
if (newText == callText)
{
report(DiagnosticsEngine::Warning, "binaryop-plusminus regex match failed",
- call->getLocStart());
+ compat::getBeginLoc(call));
return false;
}
@@ -245,8 +245,8 @@ bool ChangeToolsGen::ChangeBinaryOperatorOther(BinaryOperator const* binaryOp,
// and replace with
// aRect.SetLeft( aRect.GetLeft() + ... );
SourceManager& SM = compiler.getSourceManager();
- SourceLocation startLoc = SM.getExpansionLoc(binaryOp->getLocStart());
- SourceLocation endLoc = SM.getExpansionLoc(binaryOp->getLocEnd());
+ SourceLocation startLoc = SM.getExpansionLoc(compat::getBeginLoc(binaryOp));
+ SourceLocation endLoc = SM.getExpansionLoc(compat::getEndLoc(binaryOp));
const char* p1 = SM.getCharacterData(startLoc);
const char* p2 = SM.getCharacterData(endLoc);
if (p2 < p1) // clang is misbehaving, appears to be macro constant related
@@ -284,7 +284,7 @@ bool ChangeToolsGen::ChangeBinaryOperatorOther(BinaryOperator const* binaryOp,
if (newText == callText)
{
report(DiagnosticsEngine::Warning, "binaryop-other regex match failed %0",
- call->getLocStart())
+ compat::getBeginLoc(call))
<< reString;
return false;
}
@@ -308,8 +308,8 @@ bool ChangeToolsGen::ChangeUnaryOperator(UnaryOperator const* unaryOp,
// aRect.MoveLeft( 1 );
SourceManager& SM = compiler.getSourceManager();
- SourceLocation startLoc = SM.getExpansionLoc(unaryOp->getLocStart());
- SourceLocation endLoc = SM.getExpansionLoc(unaryOp->getLocEnd());
+ SourceLocation startLoc = SM.getExpansionLoc(compat::getBeginLoc(unaryOp));
+ SourceLocation endLoc = SM.getExpansionLoc(compat::getEndLoc(unaryOp));
const char* p1 = SM.getCharacterData(startLoc);
const char* p2 = SM.getCharacterData(endLoc);
if (p2 < p1) // clang is misbehaving, appears to be macro constant related
@@ -352,7 +352,8 @@ bool ChangeToolsGen::ChangeUnaryOperator(UnaryOperator const* unaryOp,
}
if (newText == callText)
{
- report(DiagnosticsEngine::Warning, "unaryop regex match failed %0", call->getLocStart())
+ report(DiagnosticsEngine::Warning, "unaryop regex match failed %0",
+ compat::getBeginLoc(call))
<< reString;
return false;
}
diff --git a/compilerplugins/clang/checkunusedparams.cxx b/compilerplugins/clang/checkunusedparams.cxx
index 84f05dca4dab..f0f95f6141db 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(canon->getLocStart()));
+ StringRef fn = getFileNameOfSpellingLoc(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"))
@@ -471,7 +471,7 @@ bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
continue;
}
report( DiagnosticsEngine::Warning,
- "unused param %0 in %1", param->getLocStart())
+ "unused param %0 in %1", compat::getBeginLoc(param))
<< param->getSourceRange()
<< param->getName()
<< fqn;
@@ -480,7 +480,7 @@ bool CheckUnusedParams::VisitFunctionDecl(FunctionDecl const * decl) {
unsigned idx = param->getFunctionScopeIndex();
const ParmVarDecl* pOther = canon->getParamDecl(idx);
report( DiagnosticsEngine::Note, "declaration is here",
- pOther->getLocStart())
+ compat::getBeginLoc(pOther))
<< pOther->getSourceRange();
}
}
diff --git a/compilerplugins/clang/commaoperator.cxx b/compilerplugins/clang/commaoperator.cxx
index 0693fc83a07b..431cb10a68a9 100644
--- a/compilerplugins/clang/commaoperator.cxx
+++ b/compilerplugins/clang/commaoperator.cxx
@@ -97,11 +97,11 @@ bool CommaOperator::VisitBinComma(const BinaryOperator* binaryOp)
// winsock2.h (TODO: improve heuristic of determining that the whole
// binaryOp is part of a single macro body expansion):
if (compiler.getSourceManager().isMacroBodyExpansion(
- binaryOp->getLocStart())
+ compat::getBeginLoc(binaryOp))
&& compiler.getSourceManager().isMacroBodyExpansion(
binaryOp->getOperatorLoc())
&& compiler.getSourceManager().isMacroBodyExpansion(
- binaryOp->getLocEnd())
+ compat::getEndLoc(binaryOp))
&& ignoreLocation(
compiler.getSourceManager().getSpellingLoc(
binaryOp->getOperatorLoc())))
diff --git a/compilerplugins/clang/compat.hxx b/compilerplugins/clang/compat.hxx
index e77846ab1166..a83ed8688278 100644
--- a/compilerplugins/clang/compat.hxx
+++ b/compilerplugins/clang/compat.hxx
@@ -14,6 +14,7 @@
#include <utility>
#include "clang/AST/Decl.h"
+#include "clang/AST/DeclCXX.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/Basic/SourceManager.h"
@@ -50,6 +51,70 @@ inline clang::FunctionDecl::param_const_range parameters(
}
#endif
+inline clang::SourceLocation getBeginLoc(clang::Decl const * decl) {
+#if CLANG_VERSION >= 80000
+ return decl->getBeginLoc();
+#else
+ return decl->getLocStart();
+#endif
+}
+
+inline clang::SourceLocation getEndLoc(clang::Decl const * decl) {
+#if CLANG_VERSION >= 80000
+ return decl->getEndLoc();
+#else
+ return decl->getLocEnd();
+#endif
+}
+
+inline clang::SourceLocation getBeginLoc(clang::DeclarationNameInfo const & info) {
+#if CLANG_VERSION >= 80000
+ return info.getBeginLoc();
+#else
+ return info.getLocStart();
+#endif
+}
+
+inline clang::SourceLocation getEndLoc(clang::DeclarationNameInfo const & info) {
+#if CLANG_VERSION >= 80000
+ return info.getEndLoc();
+#else
+ return info.getLocEnd();
+#endif
+}
+
+inline clang::SourceLocation getBeginLoc(clang::Stmt const * stmt) {
+#if CLANG_VERSION >= 80000
+ return stmt->getBeginLoc();
+#else
+ return stmt->getLocStart();
+#endif
+}
+
+inline clang::SourceLocation getEndLoc(clang::Stmt const * stmt) {
+#if CLANG_VERSION >= 80000
+ return stmt->getEndLoc();
+#else
+ return stmt->getLocEnd();
+#endif
+}
+
+inline clang::SourceLocation getBeginLoc(clang::CXXBaseSpecifier const * spec) {
+#if CLANG_VERSION >= 80000
+ return spec->getBeginLoc();
+#else
+ return spec->getLocStart();
+#endif
+}
+
+inline clang::SourceLocation getEndLoc(clang::CXXBaseSpecifier const * spec) {
+#if CLANG_VERSION >= 80000
+ return spec->getEndLoc();
+#else
+ return spec->getLocEnd();
+#endif
+}
+
inline std::pair<clang::SourceLocation, clang::SourceLocation> getImmediateExpansionRange(
clang::SourceManager const & SM, clang::SourceLocation Loc)
{
diff --git a/compilerplugins/clang/constantparam.cxx b/compilerplugins/clang/constantparam.cxx
index efff4ac896d5..208fc19ca0f7 100644
--- a/compilerplugins/clang/constantparam.cxx
+++ b/compilerplugins/clang/constantparam.cxx
@@ -199,8 +199,8 @@ std::string ConstantParam::getCallValue(const Expr* arg)
// Get the expression contents.
// This helps us find params which are always initialised with something like "OUString()".
SourceManager& SM = compiler.getSourceManager();
- SourceLocation startLoc = arg->getLocStart();
- SourceLocation endLoc = arg->getLocEnd();
+ SourceLocation startLoc = compat::getBeginLoc(arg);
+ SourceLocation endLoc = compat::getEndLoc(arg);
const char *p1 = SM.getCharacterData( startLoc );
const char *p2 = SM.getCharacterData( endLoc );
if (!p1 || !p2 || (p2 - p1) < 0 || (p2 - p1) > 40) {
diff --git a/compilerplugins/clang/constparams.cxx b/compilerplugins/clang/constparams.cxx
index 08e6aa2f1dc1..ee8ede3c1e2c 100644
--- a/compilerplugins/clang/constparams.cxx
+++ b/compilerplugins/clang/constparams.cxx
@@ -79,7 +79,7 @@ public:
report(
DiagnosticsEngine::Warning,
"this parameter can be const",
- pParmVarDecl->getLocStart())
+ compat::getBeginLoc(pParmVarDecl))
<< pParmVarDecl->getSourceRange();
if (canonicalDecl->getLocation() != functionDecl->getLocation()) {
unsigned idx = pParmVarDecl->getFunctionScopeIndex();
@@ -87,7 +87,7 @@ public:
report(
DiagnosticsEngine::Note,
"canonical parameter declaration here",
- pOther->getLocStart())
+ compat::getBeginLoc(pOther))
<< pOther->getSourceRange();
}
//functionDecl->dump();
@@ -172,13 +172,13 @@ bool ConstParams::CheckTraverseFunctionDecl(FunctionDecl * functionDecl)
// ignore the macros from include/tools/link.hxx
auto canonicalDecl = functionDecl->getCanonicalDecl();
- if (compiler.getSourceManager().isMacroBodyExpansion(canonicalDecl->getLocStart())
- || compiler.getSourceManager().isMacroArgExpansion(canonicalDecl->getLocStart())) {
+ if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(canonicalDecl))
+ || compiler.getSourceManager().isMacroArgExpansion(compat::getBeginLoc(canonicalDecl))) {
StringRef name { Lexer::getImmediateMacroName(
- canonicalDecl->getLocStart(), compiler.getSourceManager(), compiler.getLangOpts()) };
+ compat::getBeginLoc(canonicalDecl), compiler.getSourceManager(), compiler.getLangOpts()) };
if (name.startswith("DECL_LINK") || name.startswith("DECL_STATIC_LINK"))
return false;
- auto loc2 = compat::getImmediateExpansionRange(compiler.getSourceManager(), canonicalDecl->getLocStart()).first;
+ auto loc2 = compat::getImmediateExpansionRange(compiler.getSourceManager(), compat::getBeginLoc(canonicalDecl)).first;
if (compiler.getSourceManager().isMacroBodyExpansion(loc2))
{
StringRef name2 { Lexer::getImmediateMacroName(
@@ -300,7 +300,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
report(
DiagnosticsEngine::Warning,
"no parent?",
- stmt->getLocStart())
+ compat::getBeginLoc(stmt))
<< stmt->getSourceRange();
return false;
}
@@ -549,7 +549,7 @@ bool ConstParams::checkIfCanBeConst(const Stmt* stmt, const ParmVarDecl* parmVar
report(
DiagnosticsEngine::Warning,
"oh dear, what can the matter be?",
- parent->getLocStart())
+ compat::getBeginLoc(parent))
<< parent->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/countusersofdefaultparams.cxx b/compilerplugins/clang/countusersofdefaultparams.cxx
index f3d68a143aed..12057dec9264 100644
--- a/compilerplugins/clang/countusersofdefaultparams.cxx
+++ b/compilerplugins/clang/countusersofdefaultparams.cxx
@@ -170,7 +170,7 @@ bool CountUsersOfDefaultParams::VisitCallExpr(const CallExpr * callExpr) {
if ( n < (int)callExpr->getNumArgs() && callExpr->getArg(n)->isDefaultArgument()) {
MyCallInfo callInfo;
niceName(functionDecl, callInfo);
- callInfo.sourceLocationOfCall = locationToString(callExpr->getLocStart());
+ callInfo.sourceLocationOfCall = locationToString(compat::getBeginLoc(callExpr));
callSet.insert(callInfo);
}
return true;
@@ -199,7 +199,7 @@ bool CountUsersOfDefaultParams::VisitCXXConstructExpr(const CXXConstructExpr * c
if ( n < (int)constructExpr->getNumArgs() && constructExpr->getArg(n)->isDefaultArgument()) {
MyCallInfo callInfo;
niceName(constructorDecl, callInfo);
- callInfo.sourceLocationOfCall = locationToString(constructExpr->getLocStart());
+ callInfo.sourceLocationOfCall = locationToString(compat::getBeginLoc(constructExpr));
callSet.insert(callInfo);
}
return true;
diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 4bf3aaf6460f..07f59d8858e5 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -234,7 +234,7 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
if( expr->getCastKind() == CK_ToVoid ) {
return true;
}
- if (isSharedCAndCppCode(expr->getLocStart())) {
+ if (isSharedCAndCppCode(compat::getBeginLoc(expr))) {
return true;
}
char const * perf = nullptr;
@@ -407,8 +407,8 @@ bool CStyleCast::rewriteArithmeticCast(CStyleCastExpr const * expr, char const *
firstBegin = compiler.getSourceManager().getSpellingLoc(firstBegin);
secondBegin = compiler.getSourceManager().getSpellingLoc(secondBegin);
}
- auto third = sub->getLocStart();
- auto fourth = sub->getLocEnd();
+ auto third = compat::getBeginLoc(sub);
+ auto fourth = compat::getEndLoc(sub);
bool macro = false;
// Ensure that
//
diff --git a/compilerplugins/clang/datamembershadow.cxx b/compilerplugins/clang/datamembershadow.cxx
index 35c96c6f240f..2bb643d22a86 100644
--- a/compilerplugins/clang/datamembershadow.cxx
+++ b/compilerplugins/clang/datamembershadow.cxx
@@ -45,7 +45,7 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
return true;
}
StringRef aFileName = getFileNameOfSpellingLoc(
- compiler.getSourceManager().getSpellingLoc(fieldDecl->getLocStart()));
+ compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(fieldDecl)));
// FIXME complex stuff to fix later
@@ -97,13 +97,13 @@ bool DataMemberShadow::VisitFieldDecl(FieldDecl const * fieldDecl)
sPath += baseCXXRecordDecl->getNameAsString();
report(DiagnosticsEngine::Warning,
"data member %0 is shadowing member in superclass, through inheritance path %1",
- fieldDecl->getLocStart())
+ compat::getBeginLoc(fieldDecl))
<< fieldDecl->getName()
<< sPath
<< fieldDecl->getSourceRange();
report(DiagnosticsEngine::Note,
"superclass member here",
- baseFieldDecl->getLocStart())
+ compat::getBeginLoc(baseFieldDecl))
<< baseFieldDecl->getSourceRange();
}
return false;
diff --git a/compilerplugins/clang/dbgunhandledexception.cxx b/compilerplugins/clang/dbgunhandledexception.cxx
index 54b00f57f758..633e655cd109 100644
--- a/compilerplugins/clang/dbgunhandledexception.cxx
+++ b/compilerplugins/clang/dbgunhandledexception.cxx
@@ -69,7 +69,7 @@ bool DbgUnhandledException::VisitCallExpr(const CallExpr* call)
if (!currCatchStmt)
{
report(DiagnosticsEngine::Warning, "DBG_UNHANDLED_EXCEPTION outside catch block",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
auto catchBlock = dyn_cast<CompoundStmt>(currCatchStmt->getHandlerBlock());
@@ -77,14 +77,14 @@ bool DbgUnhandledException::VisitCallExpr(const CallExpr* call)
{
report(DiagnosticsEngine::Warning,
"something wrong with DBG_UNHANDLED_EXCEPTION, no CompoundStmt?",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
if (catchBlock->size() < 1)
{
report(DiagnosticsEngine::Warning,
"something wrong with DBG_UNHANDLED_EXCEPTION, CompoundStmt size == 0?",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
@@ -95,7 +95,7 @@ bool DbgUnhandledException::VisitCallExpr(const CallExpr* call)
{
report(DiagnosticsEngine::Warning,
"DBG_UNHANDLED_EXCEPTION must be first statement in catch block",
- call->getLocStart());
+ compat::getBeginLoc(call));
}
return true;
}
diff --git a/compilerplugins/clang/derefnullptr.cxx b/compilerplugins/clang/derefnullptr.cxx
index 350bed2156dc..db7b3b9eb5ed 100644
--- a/compilerplugins/clang/derefnullptr.cxx
+++ b/compilerplugins/clang/derefnullptr.cxx
@@ -32,7 +32,7 @@ bool DerefNullPtr::VisitUnaryDeref(UnaryOperator const * op) {
{
report(
DiagnosticsEngine::Warning, "null pointer dereference",
- op->getLocStart())
+ compat::getBeginLoc(op))
<< op->getSourceRange();
}
return true;
diff --git a/compilerplugins/clang/dodgyswitch.cxx b/compilerplugins/clang/dodgyswitch.cxx
index 98ac1c161ef5..066d4fcebebb 100644
--- a/compilerplugins/clang/dodgyswitch.cxx
+++ b/compilerplugins/clang/dodgyswitch.cxx
@@ -41,7 +41,7 @@ bool DodgySwitch::VisitDefaultStmt(DefaultStmt const * defaultStmt)
if (!IsParentSwitch(defaultStmt))
report(
DiagnosticsEngine::Warning, "default statement not directly under switch",
- defaultStmt->getLocStart())
+ compat::getBeginLoc(defaultStmt))
<< defaultStmt->getSourceRange();
return true;
}
@@ -55,7 +55,7 @@ bool DodgySwitch::VisitCaseStmt(CaseStmt const * caseStmt)
//parentStmt(parentStmt(caseStmt))->dump();
report(
DiagnosticsEngine::Warning, "case statement not directly under switch",
- caseStmt->getLocStart())
+ compat::getBeginLoc(caseStmt))
<< caseStmt->getSourceRange();
}
return true;
diff --git a/compilerplugins/clang/emptyif.cxx b/compilerplugins/clang/emptyif.cxx
index 6eac86b6bcc7..82bd22338c06 100644
--- a/compilerplugins/clang/emptyif.cxx
+++ b/compilerplugins/clang/emptyif.cxx
@@ -69,14 +69,15 @@ bool EmptyIf::VisitIfStmt(IfStmt const* ifStmt)
if (ifStmt->getElse() && empty(ifStmt->getElse()) && !ContainsComment(ifStmt->getElse()))
{
- report(DiagnosticsEngine::Warning, "empty else body", ifStmt->getElse()->getLocStart())
+ report(DiagnosticsEngine::Warning, "empty else body",
+ compat::getBeginLoc(ifStmt->getElse()))
<< ifStmt->getElse()->getSourceRange();
return true;
}
if (!ifStmt->getElse() && empty(ifStmt->getThen()) && !ContainsComment(ifStmt->getThen()))
{
- report(DiagnosticsEngine::Warning, "empty if body", ifStmt->getLocStart())
+ report(DiagnosticsEngine::Warning, "empty if body", compat::getBeginLoc(ifStmt))
<< ifStmt->getSourceRange();
}
diff --git a/compilerplugins/clang/expandablemethods.cxx b/compilerplugins/clang/expandablemethods.cxx
index 20d5a6998e39..4da75cfd0f02 100644
--- a/compilerplugins/clang/expandablemethods.cxx
+++ b/compilerplugins/clang/expandablemethods.cxx
@@ -268,7 +268,7 @@ void ExpandableMethods::functionTouchedFromExpr( const FunctionDecl* calleeFunct
return;
}
- calledFromSet.emplace(toString(expr->getLocStart()), niceName(canonicalFunctionDecl));
+ calledFromSet.emplace(toString(compat::getBeginLoc(expr)), niceName(canonicalFunctionDecl));
if (const UnaryOperator* unaryOp = dyn_cast_or_null<UnaryOperator>(getParentStmt(expr))) {
if (unaryOp->getOpcode() == UO_AddrOf) {
diff --git a/compilerplugins/clang/expressionalwayszero.cxx b/compilerplugins/clang/expressionalwayszero.cxx
index 0f0eb7a541e6..ab343c1ae902 100644
--- a/compilerplugins/clang/expressionalwayszero.cxx
+++ b/compilerplugins/clang/expressionalwayszero.cxx
@@ -73,7 +73,7 @@ bool ExpressionAlwaysZero::VisitBinaryOperator( BinaryOperator const * binaryOpe
{
if (ignoreLocation(binaryOperator))
return true;
- if (binaryOperator->getLocStart().isMacroID())
+ if (compat::getBeginLoc(binaryOperator).isMacroID())
return true;
auto op = binaryOperator->getOpcode();
@@ -92,7 +92,7 @@ bool ExpressionAlwaysZero::VisitBinaryOperator( BinaryOperator const * binaryOpe
return true;
report(
DiagnosticsEngine::Warning, "expression always evaluates to zero, lhs=%0 rhs=%1",
- binaryOperator->getLocStart())
+ compat::getBeginLoc(binaryOperator))
<< (lhsValue ? lhsValue->toString(10) : "unknown")
<< (rhsValue ? rhsValue->toString(10) : "unknown")
<< binaryOperator->getSourceRange();
@@ -103,7 +103,7 @@ bool ExpressionAlwaysZero::VisitCXXOperatorCallExpr( CXXOperatorCallExpr const *
{
if (ignoreLocation(cxxOperatorCallExpr))
return true;
- if (cxxOperatorCallExpr->getLocStart().isMacroID())
+ if (compat::getBeginLoc(cxxOperatorCallExpr).isMacroID())
return true;
auto op = cxxOperatorCallExpr->getOperator();
@@ -124,7 +124,7 @@ bool ExpressionAlwaysZero::VisitCXXOperatorCallExpr( CXXOperatorCallExpr const *
return true;
report(
DiagnosticsEngine::Warning, "expression always evaluates to zero, lhs=%0 rhs=%1",
- cxxOperatorCallExpr->getLocStart())
+ compat::getBeginLoc(cxxOperatorCallExpr))
<< (lhsValue ? lhsValue->toString(10) : "unknown")
<< (rhsValue ? rhsValue->toString(10) : "unknown")
<< cxxOperatorCallExpr->getSourceRange();
diff --git a/compilerplugins/clang/faileddyncast.cxx b/compilerplugins/clang/faileddyncast.cxx
index f99077137f9f..eee5be57d584 100644
--- a/compilerplugins/clang/faileddyncast.cxx
+++ b/compilerplugins/clang/faileddyncast.cxx
@@ -116,7 +116,7 @@ bool FailedDynCast::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const * expr) {
if (isAlwaysNull(expr)) {
report(
DiagnosticsEngine::Warning,
- "dynamic_cast from %0 to %1 always fails", expr->getLocStart())
+ "dynamic_cast from %0 to %1 always fails", compat::getBeginLoc(expr))
<< expr->getSubExpr()->getType() << expr->getType()
<< expr->getSourceRange();
}
diff --git a/compilerplugins/clang/finalclasses.cxx b/compilerplugins/clang/finalclasses.cxx
index 6e8596a78421..f31f28d8f895 100644
--- a/compilerplugins/clang/finalclasses.cxx
+++ b/compilerplugins/clang/finalclasses.cxx
@@ -127,7 +127,7 @@ bool FinalClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
if (ignoreClass(s))
return true;
- SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(decl->getLocStart());
+ SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl));
std::string filename = compiler.getSourceManager().getFilename(spellingLocation);
auto sourceLocation = filename.substr(strlen(SRCDIR)) + ":"
+ std::to_string(compiler.getSourceManager().getSpellingLineNumber(spellingLocation));
diff --git a/compilerplugins/clang/finalprotected.cxx b/compilerplugins/clang/finalprotected.cxx
index 71b3cfca03f1..8032d0d5d743 100644
--- a/compilerplugins/clang/finalprotected.cxx
+++ b/compilerplugins/clang/finalprotected.cxx
@@ -50,7 +50,7 @@ bool FinalProtected::VisitCXXMethodDecl(CXXMethodDecl const * cxxMethodDecl)
cxxMethodDecl = cxxMethodDecl->getCanonicalDecl();
report(DiagnosticsEngine::Warning,
"final class should not have protected members - convert them to private",
- cxxMethodDecl->getLocStart())
+ compat::getBeginLoc(cxxMethodDecl))
<< cxxMethodDecl->getSourceRange();
return true;
}
@@ -69,7 +69,7 @@ bool FinalProtected::VisitFieldDecl(FieldDecl const * fieldDecl)
fieldDecl = fieldDecl->getCanonicalDecl();
report(DiagnosticsEngine::Warning,
"final class should not have protected members - convert them to private",
- fieldDecl->getLocStart())
+ compat::getBeginLoc(fieldDecl))
<< fieldDecl->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/flatten.cxx b/compilerplugins/clang/flatten.cxx
index dd116d7a4ea5..40376d2e1678 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -204,7 +204,7 @@ bool Flatten::VisitIfStmt(IfStmt const * ifStmt)
report(
DiagnosticsEngine::Warning,
"large if statement at end of function, rather invert the condition and exit early, and flatten the function",
- ifStmt->getLocStart())
+ compat::getBeginLoc(ifStmt))
<< ifStmt->getSourceRange();
}
return true;
@@ -238,12 +238,12 @@ bool Flatten::VisitIfStmt(IfStmt const * ifStmt)
report(
DiagnosticsEngine::Warning,
"unconditional throw in else branch, rather invert the condition, throw early, and flatten the normal case",
- elseThrowExpr->getLocStart())
+ compat::getBeginLoc(elseThrowExpr))
<< elseThrowExpr->getSourceRange();
report(
DiagnosticsEngine::Note,
"if condition here",
- ifStmt->getLocStart())
+ compat::getBeginLoc(ifStmt))
<< ifStmt->getSourceRange();
}
}
@@ -260,7 +260,7 @@ bool Flatten::VisitIfStmt(IfStmt const * ifStmt)
report(
DiagnosticsEngine::Warning,
"unconditional throw in then branch, just flatten the else",
- thenThrowExpr->getLocStart())
+ compat::getBeginLoc(thenThrowExpr))
<< thenThrowExpr->getSourceRange();
}
}
diff --git a/compilerplugins/clang/fragiledestructor.cxx b/compilerplugins/clang/fragiledestructor.cxx
index d1bff95ddf72..2c4b3235eb38 100644
--- a/compilerplugins/clang/fragiledestructor.cxx
+++ b/compilerplugins/clang/fragiledestructor.cxx
@@ -48,7 +48,7 @@ bool FragileDestructor::TraverseCXXDestructorDecl(CXXDestructorDecl* pCXXDestruc
}
// ignore this for now, too tricky for me to work out
StringRef aFileName = getFileNameOfSpellingLoc(
- compiler.getSourceManager().getSpellingLoc(pCXXDestructorDecl->getLocStart()));
+ compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(pCXXDestructorDecl)));
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/comphelper/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/cppuhelper/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/cppuhelper/")
@@ -80,15 +80,15 @@ bool FragileDestructor::VisitCXXMemberCallExpr(const CXXMemberCallExpr* callExpr
return true;
}
// if we see an explicit call to its own method, that's OK
- auto s1 = compiler.getSourceManager().getCharacterData(callExpr->getLocStart());
- auto s2 = compiler.getSourceManager().getCharacterData(callExpr->getLocEnd());
+ auto s1 = compiler.getSourceManager().getCharacterData(compat::getBeginLoc(callExpr));
+ auto s2 = compiler.getSourceManager().getCharacterData(compat::getEndLoc(callExpr));
std::string tok(s1, s2-s1);
if (tok.find("::") != std::string::npos) {
return true;
}
// e.g. osl/thread.hxx and cppuhelper/compbase.hxx
StringRef aFileName = getFileNameOfSpellingLoc(
- compiler.getSourceManager().getSpellingLoc(methodDecl->getLocStart()));
+ compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(methodDecl)));
if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/osl/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/comphelper/")
|| loplugin::hasPathnamePrefix(aFileName, SRCDIR "/include/cppuhelper/"))
@@ -96,12 +96,12 @@ bool FragileDestructor::VisitCXXMemberCallExpr(const CXXMemberCallExpr* callExpr
report(
DiagnosticsEngine::Warning,
"calling virtual method from destructor, either make the virtual method SAL_FINAL, or make this class SAL_FINAL",
- callExpr->getLocStart())
+ compat::getBeginLoc(callExpr))
<< callExpr->getSourceRange();
report(
DiagnosticsEngine::Note,
"callee method here",
- methodDecl->getLocStart())
+ compat::getBeginLoc(methodDecl))
<< methodDecl->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/implicitboolconversion.cxx b/compilerplugins/clang/implicitboolconversion.cxx
index d7e80f56ab36..dd1eb4c1718b 100644
--- a/compilerplugins/clang/implicitboolconversion.cxx
+++ b/compilerplugins/clang/implicitboolconversion.cxx
@@ -686,7 +686,7 @@ bool ImplicitBoolConversion::TraverseBinAndAssign(CompoundAssignOperator * expr)
{
report(
DiagnosticsEngine::Warning, "mix of %0 and %1 in operator &=",
- expr->getRHS()->getLocStart())
+ compat::getBeginLoc(expr->getRHS()))
<< expr->getLHS()->getType()
<< expr->getRHS()->IgnoreParenImpCasts()->getType()
<< expr->getSourceRange();
@@ -712,7 +712,7 @@ bool ImplicitBoolConversion::TraverseBinOrAssign(CompoundAssignOperator * expr)
{
report(
DiagnosticsEngine::Warning, "mix of %0 and %1 in operator |=",
- expr->getRHS()->getLocStart())
+ compat::getBeginLoc(expr->getRHS()))
<< expr->getLHS()->getType()
<< expr->getRHS()->IgnoreParenImpCasts()->getType()
<< expr->getSourceRange();
@@ -738,7 +738,7 @@ bool ImplicitBoolConversion::TraverseBinXorAssign(CompoundAssignOperator * expr)
{
report(
DiagnosticsEngine::Warning, "mix of %0 and %1 in operator ^=",
- expr->getRHS()->getLocStart())
+ compat::getBeginLoc(expr->getRHS()))
<< expr->getLHS()->getType()
<< expr->getRHS()->IgnoreParenImpCasts()->getType()
<< expr->getSourceRange();
@@ -870,7 +870,7 @@ bool ImplicitBoolConversion::VisitImplicitCastExpr(
DiagnosticsEngine::Warning,
("explicit conversion (%0) from %1 to %2 implicitly cast back"
" to %3"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< sub->getCastKindName() << subsub->getType() << sub->getType()
<< expr->getType() << expr->getSourceRange();
return true;
@@ -888,7 +888,7 @@ bool ImplicitBoolConversion::VisitImplicitCastExpr(
report(
DiagnosticsEngine::Warning,
"implicit conversion (%0) of call argument from %1 to %2",
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getCastKindName() << expr->getSubExpr()->getType()
<< expr->getType() << expr->getSourceRange();
return true;
@@ -912,7 +912,7 @@ bool ImplicitBoolConversion::VisitMaterializeTemporaryExpr(
DiagnosticsEngine::Warning,
("explicit conversion (%0) from %1 to %2 implicitly converted"
" back to %3"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< sub->getCastKindName() << subsub->getType() << sub->getType()
<< expr->getType() << expr->getSourceRange();
return true;
@@ -1017,7 +1017,7 @@ void ImplicitBoolConversion::reportWarning(ImplicitCastExpr const * expr) {
if (compiler.getLangOpts().CPlusPlus) {
report(
DiagnosticsEngine::Warning,
- "implicit conversion (%0) from %1 to %2", expr->getLocStart())
+ "implicit conversion (%0) from %1 to %2", compat::getBeginLoc(expr))
<< expr->getCastKindName() << expr->getSubExprAsWritten()->getType()
<< expr->getType() << expr->getSourceRange();
}
diff --git a/compilerplugins/clang/inlinesimplememberfunctions.cxx b/compilerplugins/clang/inlinesimplememberfunctions.cxx
index 9a1d1f6f3abb..64734dc9de9a 100644
--- a/compilerplugins/clang/inlinesimplememberfunctions.cxx
+++ b/compilerplugins/clang/inlinesimplememberfunctions.cxx
@@ -243,8 +243,8 @@ bool InlineSimpleMemberFunctions::rewrite(const CXXMethodDecl * functionDecl) {
const char *p1, *p2;
// get the function body contents
- p1 = compiler.getSourceManager().getCharacterData( functionDecl->getBody()->getLocStart() );
- p2 = compiler.getSourceManager().getCharacterData( functionDecl->getBody()->getLocEnd() );
+ p1 = compiler.getSourceManager().getCharacterData( compat::getBeginLoc(functionDecl->getBody()) );
+ p2 = compiler.getSourceManager().getCharacterData( compat::getEndLoc(functionDecl->getBody()) );
std::string s1( p1, p2 - p1 + 1);
/* we can't safely move around stuff containing comments, we mess up the resulting code */
@@ -274,18 +274,18 @@ bool InlineSimpleMemberFunctions::rewrite(const CXXMethodDecl * functionDecl) {
// remove the function's out of line body and declaration
RewriteOptions opts;
opts.RemoveLineIfEmpty = true;
- if (!removeText(SourceRange(functionDecl->getLocStart(), functionDecl->getBody()->getLocEnd()), opts)) {
+ if (!removeText(SourceRange(compat::getBeginLoc(functionDecl), compat::getEndLoc(functionDecl->getBody())), opts)) {
return false;
}
// scan forward until we find the semicolon
const FunctionDecl * canonicalDecl = functionDecl->getCanonicalDecl();
- p1 = compiler.getSourceManager().getCharacterData( canonicalDecl->getLocEnd() );
+ p1 = compiler.getSourceManager().getCharacterData( compat::getEndLoc(canonicalDecl) );
p2 = ++p1;
while (*p2 != 0 && *p2 != ';') p2++;
// insert the function body into the inline function definition (i.e. the one inside the class definition)
- return replaceText(canonicalDecl->getLocEnd().getLocWithOffset(p2 - p1 + 1), 1, s1);
+ return replaceText(compat::getEndLoc(canonicalDecl).getLocWithOffset(p2 - p1 + 1), 1, s1);
}
loplugin::Plugin::Registration< InlineSimpleMemberFunctions > X("inlinesimplememberfunctions");
diff --git a/compilerplugins/clang/literaltoboolconversion.cxx b/compilerplugins/clang/literaltoboolconversion.cxx
index 19c18a4ca765..270ebc3455ca 100644
--- a/compilerplugins/clang/literaltoboolconversion.cxx
+++ b/compilerplugins/clang/literaltoboolconversion.cxx
@@ -118,7 +118,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
&& subExpr->isIntegerConstantExpr(res, compiler.getASTContext())
&& res.getLimitedValue() <= 1)
{
- SourceLocation loc { subExpr->getLocStart() };
+ SourceLocation loc { compat::getBeginLoc(subExpr) };
while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
}
@@ -134,7 +134,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
}
}
if (isa<clang::StringLiteral>(subExpr)) {
- SourceLocation loc { subExpr->getLocStart() };
+ SourceLocation loc { compat::getBeginLoc(subExpr) };
if (compiler.getSourceManager().isMacroArgExpansion(loc)
&& (Lexer::getImmediateMacroName(
loc, compiler.getSourceManager(), compiler.getLangOpts())
@@ -150,25 +150,25 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
bool bRewritten = false;
if (rewriter != nullptr) {
SourceLocation loc { compiler.getSourceManager().getExpansionLoc(
- expr2->getLocStart()) };
- if (compiler.getSourceManager().getExpansionLoc(expr2->getLocEnd())
+ compat::getBeginLoc(expr2)) };
+ if (compiler.getSourceManager().getExpansionLoc(compat::getEndLoc(expr2))
== loc)
{
char const * s = compiler.getSourceManager().getCharacterData(
loc);
unsigned n = Lexer::MeasureTokenLength(
- expr2->getLocEnd(), compiler.getSourceManager(),
+ compat::getEndLoc(expr2), compiler.getSourceManager(),
compiler.getLangOpts());
std::string tok { s, n };
if (tok == "sal_False" || tok == "0") {
bRewritten = replaceText(
compiler.getSourceManager().getExpansionLoc(
- expr2->getLocStart()),
+ compat::getBeginLoc(expr2)),
n, "false");
} else if (tok == "sal_True" || tok == "1") {
bRewritten = replaceText(
compiler.getSourceManager().getExpansionLoc(
- expr2->getLocStart()),
+ compat::getBeginLoc(expr2)),
n, "true");
}
}
@@ -177,7 +177,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
report(
DiagnosticsEngine::Warning,
"implicit conversion (%0) of literal of type %1 to %2",
- expr2->getLocStart())
+ compat::getBeginLoc(expr2))
<< castExpr->getCastKindName() << subExpr->getType()
<< castExpr->getType() << expr2->getSourceRange();
}
@@ -194,7 +194,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
DiagnosticsEngine::Warning,
("implicit conversion (%0) of null pointer constant of type %1 to"
" %2"),
- expr2->getLocStart())
+ compat::getBeginLoc(expr2))
<< castExpr->getCastKindName() << subExpr->getType()
<< castExpr->getType() << expr2->getSourceRange();
} else if (!subExpr->isValueDependent()
@@ -204,7 +204,7 @@ void LiteralToBoolConversion::handleImplicitCastSubExpr(
DiagnosticsEngine::Warning,
("implicit conversion (%0) of integer constant expression of type"
" %1 with value %2 to %3"),
- expr2->getLocStart())
+ compat::getBeginLoc(expr2))
<< castExpr->getCastKindName() << subExpr->getType()
<< res.toString(10) << castExpr->getType()
<< expr2->getSourceRange();
diff --git a/compilerplugins/clang/mergeclasses.cxx b/compilerplugins/clang/mergeclasses.cxx
index 6035e7c275dc..ce08d627b931 100644
--- a/compilerplugins/clang/mergeclasses.cxx
+++ b/compilerplugins/clang/mergeclasses.cxx
@@ -148,7 +148,7 @@ bool MergeClasses::VisitCXXRecordDecl(const CXXRecordDecl* decl)
}
if (decl->isThisDeclarationADefinition())
{
- SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(decl->getLocStart());
+ SourceLocation spellingLocation = compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl));
std::string filename = compiler.getSourceManager().getFilename(spellingLocation);
filename = filename.substr(strlen(SRCDIR));
std::string s = decl->getQualifiedNameAsString();
diff --git a/compilerplugins/clang/nullptr.cxx b/compilerplugins/clang/nullptr.cxx
index ccd5837b226f..c463caec7c5d 100644
--- a/compilerplugins/clang/nullptr.cxx
+++ b/compilerplugins/clang/nullptr.cxx
@@ -121,7 +121,7 @@ bool Nullptr::VisitImplicitCastExpr(CastExpr const * expr) {
case Expr::NPCK_ZeroLiteral:
report(
DiagnosticsEngine::Warning,
- "suspicious ValueDependentIsNull %0", expr->getLocStart())
+ "suspicious ValueDependentIsNull %0", compat::getBeginLoc(expr))
<< kindName(k) << expr->getSourceRange();
break;
default:
@@ -304,7 +304,7 @@ void Nullptr::handleNull(
SourceLocation loc;
for (;;) {
e = e->IgnoreImpCasts();
- loc = e->getLocStart();
+ loc = compat::getBeginLoc(e);
while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
}
@@ -369,7 +369,7 @@ void Nullptr::rewriteOrWarn(
Expr::NullPointerConstantKind nullPointerKind, char const * replacement)
{
if (rewriter != nullptr) {
- SourceLocation locStart(expr->getLocStart());
+ SourceLocation locStart(compat::getBeginLoc(expr));
while (compiler.getSourceManager().isMacroArgExpansion(locStart)) {
locStart = compiler.getSourceManager()
.getImmediateMacroCallerLoc(locStart);
@@ -384,7 +384,7 @@ void Nullptr::rewriteOrWarn(
locStart = compat::getImmediateExpansionRange(compiler.getSourceManager(), locStart)
.first;
}
- SourceLocation locEnd(expr->getLocEnd());
+ SourceLocation locEnd(compat::getEndLoc(expr));
while (compiler.getSourceManager().isMacroArgExpansion(locEnd)) {
locEnd = compiler.getSourceManager()
.getImmediateMacroCallerLoc(locEnd);
@@ -403,13 +403,13 @@ void Nullptr::rewriteOrWarn(
}
}
if (castKind == nullptr) {
- report(DiagnosticsEngine::Warning, "%0 -> %1", expr->getLocStart())
+ report(DiagnosticsEngine::Warning, "%0 -> %1", compat::getBeginLoc(expr))
<< kindName(nullPointerKind) << replacement
<< expr->getSourceRange();
} else {
report(
DiagnosticsEngine::Warning, "%0 ValueDependentIsNotNull %1 -> %2",
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< castKind << kindName(nullPointerKind) << replacement
<< expr->getSourceRange();
}
diff --git a/compilerplugins/clang/oncevar.cxx b/compilerplugins/clang/oncevar.cxx
index afb1b0fa85e9..be03b4d96589 100644
--- a/compilerplugins/clang/oncevar.cxx
+++ b/compilerplugins/clang/oncevar.cxx
@@ -322,7 +322,7 @@ bool OnceVar::VisitVarDecl( const VarDecl* varDecl )
return true;
}
// Ignore macros like FD_ZERO
- if (compiler.getSourceManager().isMacroBodyExpansion(varDecl->getLocStart())) {
+ if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(varDecl))) {
return true;
}
if (varDecl->hasGlobalStorage()) {
diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index 4c4d9a70fcb3..0820f311c1a1 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -25,6 +25,7 @@
#include <clang/Rewrite/Core/Rewriter.h>
+#include "compat.hxx"
#include "pluginhandler.hxx"
using namespace clang;
@@ -195,7 +196,7 @@ bool Plugin::ignoreLocation( const Stmt* stmt ) const
{
// Invalid location can happen at least for ImplicitCastExpr of
// ImplicitParam 'self' in Objective C method declarations:
- return stmt->getLocStart().isValid() && ignoreLocation( stmt->getLocStart());
+ return compat::getBeginLoc(stmt).isValid() && ignoreLocation( compat::getBeginLoc(stmt));
}
template< typename T >
diff --git a/compilerplugins/clang/privatebase.cxx b/compilerplugins/clang/privatebase.cxx
index 60acfc347ed9..3b1862a7bc6c 100644
--- a/compilerplugins/clang/privatebase.cxx
+++ b/compilerplugins/clang/privatebase.cxx
@@ -41,7 +41,7 @@ bool PrivateBase::VisitCXXRecordDecl(CXXRecordDecl const * decl) {
DiagnosticsEngine::Warning,
"base class is private by default; explicitly give an access"
" specifier",
- i->getLocStart())
+ compat::getBeginLoc(i))
<< i->getSourceRange();
}
}
diff --git a/compilerplugins/clang/rangedforcopy.cxx b/compilerplugins/clang/rangedforcopy.cxx
index 4baed6b6e5db..4a05de1c6558 100644
--- a/compilerplugins/clang/rangedforcopy.cxx
+++ b/compilerplugins/clang/rangedforcopy.cxx
@@ -51,7 +51,7 @@ bool RangedForCopy::VisitCXXForRangeStmt( const CXXForRangeStmt* stmt )
report(
DiagnosticsEngine::Warning,
"Loop variable passed by value, pass by reference instead, e.g. 'const %0&'",
- varDecl->getLocStart())
+ compat::getBeginLoc(varDecl))
<< name << varDecl->getSourceRange();
}
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index b6db47495a6d..ad7818f4a981 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -207,7 +207,7 @@ bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
dyn_cast<CXXStaticCastExpr>(e)->getSubExpr()
->IgnoreParenImpCasts()->getType())
&& !compiler.getSourceManager().isMacroBodyExpansion(
- e->getLocStart()))
+ compat::getBeginLoc(e)))
{
report(
DiagnosticsEngine::Warning,
@@ -287,7 +287,7 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
if (ignoreLocation(expr)) {
return true;
}
- if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(expr->getLocStart()))) {
+ if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr)))) {
return true;
}
auto t1 = compat::getSubExprAsWritten(expr)->getType();
@@ -308,7 +308,7 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
// Ignore FD_ISSET expanding to "...(SOCKET)(fd)..." in some Microsoft
// winsock2.h (TODO: improve heuristic of determining that the whole
// expr is part of a single macro body expansion):
- auto l1 = expr->getLocStart();
+ auto l1 = compat::getBeginLoc(expr);
while (compiler.getSourceManager().isMacroArgExpansion(l1)) {
l1 = compiler.getSourceManager().getImmediateMacroCallerLoc(l1);
}
@@ -316,7 +316,7 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
while (compiler.getSourceManager().isMacroArgExpansion(l2)) {
l2 = compiler.getSourceManager().getImmediateMacroCallerLoc(l2);
}
- auto l3 = expr->getLocEnd();
+ auto l3 = compat::getEndLoc(expr);
while (compiler.getSourceManager().isMacroArgExpansion(l3)) {
l3 = compiler.getSourceManager().getImmediateMacroCallerLoc(l3);
}
@@ -445,7 +445,7 @@ bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) {
// h=b5889d25e9bf944a89fdd7bcabf3b6c6f6bb6f7c> "assert: Support types
// without operator== (int) [BZ #21972]":
if (t1->isBooleanType() && t2->isBooleanType()) {
- auto loc = expr->getLocStart();
+ auto loc = compat::getBeginLoc(expr);
if (compiler.getSourceManager().isMacroBodyExpansion(loc)
&& (Lexer::getImmediateMacroName(
loc, compiler.getSourceManager(), compiler.getLangOpts())
@@ -477,13 +477,13 @@ bool RedundantCast::VisitCXXReinterpretCastExpr(
return true;
}
if (rewriter != nullptr) {
- auto loc = expr->getLocStart();
+ auto loc = compat::getBeginLoc(expr);
while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(
loc);
}
if (compiler.getSourceManager().isMacroBodyExpansion(loc)) {
- auto loc2 = expr->getLocEnd();
+ auto loc2 = compat::getEndLoc(expr);
while (compiler.getSourceManager().isMacroArgExpansion(loc2)) {
loc2 = compiler.getSourceManager()
.getImmediateMacroCallerLoc(loc2);
@@ -665,8 +665,8 @@ bool RedundantCast::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr const * exp
//
// in sal/osl/unx/socket.cxx:
//TODO: Better check that sub is exactly an expansion of FD_ISSET:
- if (sub->getLocEnd().isMacroID()) {
- for (auto loc = sub->getLocStart();
+ if (compat::getEndLoc(sub).isMacroID()) {
+ for (auto loc = compat::getBeginLoc(sub);
loc.isMacroID()
&& (compiler.getSourceManager()
.isAtStartOfImmediateMacroExpansion(loc));
diff --git a/compilerplugins/clang/redundantinline.cxx b/compilerplugins/clang/redundantinline.cxx
index 67347febb443..70cdbd6fdce6 100644
--- a/compilerplugins/clang/redundantinline.cxx
+++ b/compilerplugins/clang/redundantinline.cxx
@@ -35,18 +35,18 @@ public:
{
return true;
}
- auto l1 = unwindToQObject(decl->getLocStart());
- if (l1.isValid() && l1 == unwindToQObject(decl->getLocEnd())) {
+ auto l1 = unwindToQObject(compat::getBeginLoc(decl));
+ if (l1.isValid() && l1 == unwindToQObject(compat::getEndLoc(decl))) {
return true;
}
SourceLocation inlineLoc;
unsigned n;
auto end = Lexer::getLocForEndOfToken(
- compiler.getSourceManager().getExpansionLoc(decl->getLocEnd()), 0,
+ compiler.getSourceManager().getExpansionLoc(compat::getEndLoc(decl)), 0,
compiler.getSourceManager(), compiler.getLangOpts());
assert(end.isValid());
for (auto loc = compiler.getSourceManager().getExpansionLoc(
- decl->getLocStart());
+ compat::getBeginLoc(decl));
loc != end; loc = loc.getLocWithOffset(std::max<unsigned>(n, 1)))
{
n = Lexer::MeasureTokenLength(
@@ -102,7 +102,7 @@ public:
report(
DiagnosticsEngine::Warning,
"function definition redundantly declared 'inline'",
- inlineLoc.isValid() ? inlineLoc : decl->getLocStart())
+ inlineLoc.isValid() ? inlineLoc : compat::getBeginLoc(decl))
<< decl->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/redundantpointerops.cxx b/compilerplugins/clang/redundantpointerops.cxx
index 0340b7c12c19..1c28052f046a 100644
--- a/compilerplugins/clang/redundantpointerops.cxx
+++ b/compilerplugins/clang/redundantpointerops.cxx
@@ -63,7 +63,7 @@ bool RedundantPointerOps::VisitMemberExpr(MemberExpr const * memberExpr)
{
if (ignoreLocation(memberExpr))
return true;
- if (memberExpr->getLocStart().isMacroID())
+ if (compat::getBeginLoc(memberExpr).isMacroID())
return true;
auto base = memberExpr->getBase()->IgnoreParenImpCasts();
//parentStmt(parentStmt(memberExpr))->dump();
@@ -74,7 +74,7 @@ bool RedundantPointerOps::VisitMemberExpr(MemberExpr const * memberExpr)
if (unaryOp->getOpcode() == UO_AddrOf)
report(
DiagnosticsEngine::Warning, "'&' followed by '->', rather use '.'",
- memberExpr->getLocStart())
+ compat::getBeginLoc(memberExpr))
<< memberExpr->getSourceRange();
}
@@ -83,7 +83,7 @@ bool RedundantPointerOps::VisitMemberExpr(MemberExpr const * memberExpr)
if (operatorCallExpr->getOperator() == OO_Amp)
report(
DiagnosticsEngine::Warning, "'&' followed by '->', rather use '.'",
- memberExpr->getLocStart())
+ compat::getBeginLoc(memberExpr))
<< memberExpr->getSourceRange();
}
@@ -107,7 +107,7 @@ bool RedundantPointerOps::VisitUnaryOperator(UnaryOperator const * unaryOperator
{
if (ignoreLocation(unaryOperator))
return true;
- if (unaryOperator->getLocStart().isMacroID())
+ if (compat::getBeginLoc(unaryOperator).isMacroID())
return true;
if (unaryOperator->getOpcode() != UO_Deref)
return true;
@@ -117,7 +117,7 @@ bool RedundantPointerOps::VisitUnaryOperator(UnaryOperator const * unaryOperator
report(
DiagnosticsEngine::Warning, "'&' followed by '*', rather use '.'",
- unaryOperator->getLocStart())
+ compat::getBeginLoc(unaryOperator))
<< unaryOperator->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index f4e7e8e5929b..426127c76862 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -357,7 +357,7 @@ bool RefCounting::visitTemporaryObjectExpr(Expr const * expr) {
DiagnosticsEngine::Warning,
("Temporary object of SvRefBase subclass %0 being directly stack"
" managed, should be managed via tools::SvRef"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< t.getUnqualifiedType() << expr->getSourceRange();
} else if (containsSalhelperReferenceObjectSubclass(t.getTypePtr())) {
report(
@@ -365,7 +365,7 @@ bool RefCounting::visitTemporaryObjectExpr(Expr const * expr) {
("Temporary object of salhelper::SimpleReferenceObject subclass %0"
" being directly stack managed, should be managed via"
" rtl::Reference"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< t.getUnqualifiedType() << expr->getSourceRange();
} else if (containsXInterfaceSubclass(t)) {
report(
@@ -373,7 +373,7 @@ bool RefCounting::visitTemporaryObjectExpr(Expr const * expr) {
("Temporary object of css::uno::XInterface subclass %0 being"
" directly stack managed, should be managed via"
" css::uno::Reference"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< t.getUnqualifiedType() << expr->getSourceRange();
}
return true;
diff --git a/compilerplugins/clang/rendercontext.cxx b/compilerplugins/clang/rendercontext.cxx
index c0f3acf4f3cc..ada566561377 100644
--- a/compilerplugins/clang/rendercontext.cxx
+++ b/compilerplugins/clang/rendercontext.cxx
@@ -121,7 +121,7 @@ bool RenderContext::VisitCXXMemberCallExpr(const CXXMemberCallExpr* pCXXMemberCa
report(
DiagnosticsEngine::Warning,
"Should be calling OutputDevice method through RenderContext.",
- pCXXMemberCallExpr->getLocStart())
+ compat::getBeginLoc(pCXXMemberCallExpr))
<< pCXXMemberCallExpr->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/returnconstant.cxx b/compilerplugins/clang/returnconstant.cxx
index 0c6e747bc348..eff3495191fd 100644
--- a/compilerplugins/clang/returnconstant.cxx
+++ b/compilerplugins/clang/returnconstant.cxx
@@ -552,10 +552,11 @@ bool ReturnConstant::TraverseCXXMethodDecl(CXXMethodDecl* functionDecl)
// ignore LINK macro stuff
std::string aImmediateMacro = "";
- if (compiler.getSourceManager().isMacroBodyExpansion(functionDecl->getLocStart()))
+ if (compiler.getSourceManager().isMacroBodyExpansion(compat::getBeginLoc(functionDecl)))
{
- StringRef name{ Lexer::getImmediateMacroName(
- functionDecl->getLocStart(), compiler.getSourceManager(), compiler.getLangOpts()) };
+ StringRef name{ Lexer::getImmediateMacroName(compat::getBeginLoc(functionDecl),
+ compiler.getSourceManager(),
+ compiler.getLangOpts()) };
aImmediateMacro = name;
if (name.startswith("IMPL_LINK_"))
{
@@ -571,11 +572,11 @@ bool ReturnConstant::TraverseCXXMethodDecl(CXXMethodDecl* functionDecl)
{
report(DiagnosticsEngine::Warning,
"Method only returns a single constant value %0, does it make sense?",
- functionDecl->getLocStart())
+ compat::getBeginLoc(functionDecl))
<< *rContext.values.begin() << functionDecl->getSourceRange();
if (functionDecl != functionDecl->getCanonicalDecl())
report(DiagnosticsEngine::Note, "decl here",
- functionDecl->getCanonicalDecl()->getLocStart())
+ compat::getBeginLoc(functionDecl->getCanonicalDecl()))
<< functionDecl->getCanonicalDecl()->getSourceRange();
}
m_functionStack.pop_back();
diff --git a/compilerplugins/clang/salbool.cxx b/compilerplugins/clang/salbool.cxx
index 02cc2f609661..f0024e96da27 100644
--- a/compilerplugins/clang/salbool.cxx
+++ b/compilerplugins/clang/salbool.cxx
@@ -200,7 +200,7 @@ void SalBool::run() {
if (compiler.getLangOpts().CPlusPlus) {
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
for (auto decl: varDecls_) {
- SourceLocation loc { decl->getLocStart() };
+ SourceLocation loc { compat::getBeginLoc(decl) };
TypeSourceInfo * tsi = decl->getTypeSourceInfo();
if (tsi != nullptr) {
SourceLocation l {
@@ -321,7 +321,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
return true;
}
if (isSalBool(expr->getType())) {
- SourceLocation loc { expr->getLocStart() };
+ SourceLocation loc { compat::getBeginLoc(expr) };
while (compiler.getSourceManager().isMacroArgExpansion(loc)) {
loc = compiler.getSourceManager().getImmediateMacroCallerLoc(loc);
}
@@ -334,7 +334,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
if (!isSharedCAndCppCode(callLoc)) {
SourceLocation argLoc;
if (compat::isMacroArgExpansion(
- compiler, expr->getLocStart(), &argLoc)
+ compiler, compat::getBeginLoc(expr), &argLoc)
//TODO: check it's the complete (first) arg to the macro
&& (Lexer::getImmediateMacroName(
argLoc, compiler.getSourceManager(),
@@ -373,7 +373,7 @@ bool SalBool::VisitCStyleCastExpr(CStyleCastExpr * expr) {
report(
DiagnosticsEngine::Warning,
"CStyleCastExpr, suspicious cast from %0 to %1",
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSubExpr()->IgnoreParenImpCasts()->getType()
<< expr->getType() << expr->getSourceRange();
}
@@ -386,12 +386,12 @@ bool SalBool::VisitCXXStaticCastExpr(CXXStaticCastExpr * expr) {
}
if (isSalBool(expr->getType())
&& !isInSpecialMainFile(
- compiler.getSourceManager().getSpellingLoc(expr->getLocStart())))
+ compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(expr))))
{
report(
DiagnosticsEngine::Warning,
"CXXStaticCastExpr, suspicious cast from %0 to %1",
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSubExpr()->IgnoreParenImpCasts()->getType()
<< expr->getType() << expr->getSourceRange();
}
@@ -406,7 +406,7 @@ bool SalBool::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr * expr) {
report(
DiagnosticsEngine::Warning,
"CXXFunctionalCastExpr, suspicious cast from %0 to %1",
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSubExpr()->IgnoreParenImpCasts()->getType()
<< expr->getType() << expr->getSourceRange();
}
@@ -420,7 +420,7 @@ bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) {
if (!isSalBool(expr->getType())) {
return true;
}
- auto l = expr->getLocStart();
+ auto l = compat::getBeginLoc(expr);
while (compiler.getSourceManager().isMacroArgExpansion(l)) {
l = compiler.getSourceManager().getImmediateMacroCallerLoc(l);
}
@@ -455,7 +455,7 @@ bool SalBool::VisitImplicitCastExpr(ImplicitCastExpr * expr) {
}
report(
DiagnosticsEngine::Warning, "conversion from %0 to sal_Bool",
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< t << expr->getSourceRange();
return true;
}
@@ -528,7 +528,7 @@ bool SalBool::VisitParmVarDecl(ParmVarDecl const * decl) {
{
OverrideKind k = getOverrideKind(f);
if (k != OverrideKind::YES) {
- SourceLocation loc { decl->getLocStart() };
+ SourceLocation loc { compat::getBeginLoc(decl) };
TypeSourceInfo * tsi = decl->getTypeSourceInfo();
if (tsi != nullptr) {
SourceLocation l {
@@ -611,7 +611,7 @@ bool SalBool::VisitVarDecl(VarDecl const * decl) {
if (!decl->isExternC()
&& (isSalBool(decl->getType()) || isSalBoolArray(decl->getType()))
&& !isInSpecialMainFile(
- compiler.getSourceManager().getSpellingLoc(decl->getLocStart())))
+ compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl))))
{
varDecls_.insert(decl);
}
@@ -628,7 +628,7 @@ bool SalBool::VisitFieldDecl(FieldDecl const * decl) {
}
if ((isSalBool(decl->getType()) || isSalBoolArray(decl->getType()))
&& !isInSpecialMainFile(
- compiler.getSourceManager().getSpellingLoc(decl->getLocStart())))
+ compiler.getSourceManager().getSpellingLoc(compat::getBeginLoc(decl))))
{
TagDecl const * td = dyn_cast<TagDecl>(decl->getDeclContext());
assert(td != nullptr);
@@ -637,7 +637,7 @@ bool SalBool::VisitFieldDecl(FieldDecl const * decl) {
compiler.getSourceManager().getSpellingLoc(
decl->getLocation()))))
{
- SourceLocation loc { decl->getLocStart() };
+ SourceLocation loc { compat::getBeginLoc(decl) };
TypeSourceInfo * tsi = decl->getTypeSourceInfo();
if (tsi != nullptr) {
SourceLocation l {
@@ -698,7 +698,7 @@ bool SalBool::VisitFunctionDecl(FunctionDecl const * decl) {
|| (isInUnoIncludeFile(f)
&& (!f->isInlined() || f->hasAttr<DeprecatedAttr>()))))
{
- SourceLocation loc { decl->getLocStart() };
+ SourceLocation loc { compat::getBeginLoc(decl) };
SourceLocation l { compiler.getSourceManager().getExpansionLoc(
loc) };
SourceLocation end { compiler.getSourceManager().getExpansionLoc(
@@ -749,11 +749,11 @@ bool SalBool::VisitValueDecl(ValueDecl const * decl) {
if (ignoreLocation(decl)) {
return true;
}
- if (isSalBool(decl->getType()) && !rewrite(decl->getLocStart())) {
+ if (isSalBool(decl->getType()) && !rewrite(compat::getBeginLoc(decl))) {
report(
DiagnosticsEngine::Warning,
"ValueDecl, use \"bool\" instead of \"sal_Bool\"",
- decl->getLocStart())
+ compat::getBeginLoc(decl))
<< decl->getSourceRange();
}
return true;
diff --git a/compilerplugins/clang/salcall.cxx b/compilerplugins/clang/salcall.cxx
index a84cbd9825d5..2a6160162527 100644
--- a/compilerplugins/clang/salcall.cxx
+++ b/compilerplugins/clang/salcall.cxx
@@ -382,7 +382,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
// qualified names this will point after the qualifiers, but needlessly including those in
// the search should be harmless---modulo issues with using "SAL_CALL" as the name of a
// function-like macro parameter as discussed below):
- endLoc = functionDecl->getNameInfo().getLocStart();
+ endLoc = compat::getBeginLoc(functionDecl->getNameInfo());
while (SM.isMacroArgExpansion(endLoc, &endLoc))
{
}
@@ -463,7 +463,7 @@ bool SalCall::isSalCallFunction(FunctionDecl const* functionDecl, SourceLocation
// Stop searching for "SAL_CALL" at the start of the function declaration's name (for
// qualified names this will point after the qualifiers, but needlessly including those in
// the search should be harmless):
- endLoc = functionDecl->getNameInfo().getLocStart();
+ endLoc = compat::getBeginLoc(functionDecl->getNameInfo());
while (endLoc.isMacroID() && SM.isAtStartOfImmediateMacroExpansion(endLoc, &endLoc))
{
}
diff --git a/compilerplugins/clang/sallogareas.cxx b/compilerplugins/clang/sallogareas.cxx
index e18f100043e5..9100b8973f00 100644
--- a/compilerplugins/clang/sallogareas.cxx
+++ b/compilerplugins/clang/sallogareas.cxx
@@ -80,7 +80,7 @@ bool SalLogAreas::VisitCallExpr( const CallExpr* call )
// from the same macro should be the same).
if( kind == LogCallKind::Sal )
{
- SourceLocation expansionLocation = compiler.getSourceManager().getExpansionLoc( call->getLocStart());
+ SourceLocation expansionLocation = compiler.getSourceManager().getExpansionLoc( compat::getBeginLoc(call));
if( expansionLocation == lastSalDetailLogStreamMacro )
return true;
lastSalDetailLogStreamMacro = expansionLocation;
@@ -91,7 +91,7 @@ bool SalLogAreas::VisitCallExpr( const CallExpr* call )
checkArea( area->getBytes(), area->getExprLoc());
else
report( DiagnosticsEngine::Warning, "unsupported string literal kind (plugin needs fixing?)",
- area->getLocStart());
+ compat::getBeginLoc(area));
return true;
}
if( loplugin::DeclCheck(inFunction).Function("log").Namespace("detail").Namespace("sal").GlobalNamespace()
@@ -101,7 +101,7 @@ bool SalLogAreas::VisitCallExpr( const CallExpr* call )
Expr::NPC_ValueDependentIsNotNull ) != Expr::NPCK_NotNull )
{ // If the area argument is a null pointer, that is allowed only for SAL_DEBUG.
const SourceManager& source = compiler.getSourceManager();
- for( SourceLocation loc = call->getLocStart();
+ for( SourceLocation loc = compat::getBeginLoc(call);
loc.isMacroID();
loc = compat::getImmediateExpansionRange(source, loc ).first )
{
@@ -110,11 +110,11 @@ bool SalLogAreas::VisitCallExpr( const CallExpr* call )
return true; // ok
}
report( DiagnosticsEngine::Warning, "missing log area",
- call->getArg( 1 )->IgnoreParenImpCasts()->getLocStart());
+ compat::getBeginLoc(call->getArg( 1 )->IgnoreParenImpCasts()));
return true;
}
report( DiagnosticsEngine::Warning, "cannot analyse log area argument (plugin needs fixing?)",
- call->getLocStart());
+ compat::getBeginLoc(call));
return true;
}
diff --git a/compilerplugins/clang/salunicodeliteral.cxx b/compilerplugins/clang/salunicodeliteral.cxx
index 529d20c970eb..cf06b6ccaad7 100644
--- a/compilerplugins/clang/salunicodeliteral.cxx
+++ b/compilerplugins/clang/salunicodeliteral.cxx
@@ -71,7 +71,7 @@ private:
t = tt->desugar();
}
auto const e1 = expr->getSubExprAsWritten();
- auto const loc = e1->getLocStart();
+ auto const loc = compat::getBeginLoc(e1);
if (loc.isMacroID()
&& compiler.getSourceManager().isAtStartOfImmediateMacroExpansion(
loc))
diff --git a/compilerplugins/clang/sfxpoolitem.cxx b/compilerplugins/clang/sfxpoolitem.cxx
index d269070e03fe..f41a006f30b0 100644
--- a/compilerplugins/clang/sfxpoolitem.cxx
+++ b/compilerplugins/clang/sfxpoolitem.cxx
@@ -122,7 +122,7 @@ bool SfxPoolItem::VisitCXXRecordDecl(const CXXRecordDecl* decl)
report(
DiagnosticsEngine::Warning,
"SfxPoolItem subclass %0 declares new fields, but does not override operator==",
- decl->getLocStart())
+ compat::getBeginLoc(decl))
<< decl->getQualifiedNameAsString() << decl->getSourceRange();
return true;
}
diff --git a/compilerplugins/clang/shouldreturnbool.cxx b/compilerplugins/clang/shouldreturnbool.cxx
index ea9e696674de..937dba126da0 100644
--- a/compilerplugins/clang/shouldreturnbool.cxx
+++ b/compilerplugins/clang/shouldreturnbool.cxx
@@ -111,12 +111,12 @@ public:
continue;
report(DiagnosticsEngine::Warning,
"only returning one or zero is an indication you want to return bool",
- functionDecl->getLocStart())
+ compat::getBeginLoc(functionDecl))
<< functionDecl->getSourceRange();
if (canonicalDecl->getLocation() != functionDecl->getLocation())
{
report(DiagnosticsEngine::Note, "canonical function declaration here",
- canonicalDecl->getLocStart())
+ compat::getBeginLoc(canonicalDecl))
<< canonicalDecl->getSourceRange();
}
}
diff --git a/compilerplugins/clang/simplifybool.cxx b/compilerplugins/clang/simplifybool.cxx
index 9167014f8c84..23f75a9a6705 100644
--- a/compilerplugins/clang/simplifybool.cxx
+++ b/compilerplugins/clang/simplifybool.cxx
@@ -116,7 +116,7 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
// Ignore macros, otherwise
// OSL_ENSURE(!b, ...);
// triggers.
- if (e->getLocStart().isMacroID())
+ if (compat::getBeginLoc(e).isMacroID())
return true;
// double logical not of an int is an idiom to convert to bool
auto const sub = ignoreAllImplicit(e);
@@ -126,7 +126,7 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
DiagnosticsEngine::Warning,
("double logical negation expression of the form '!!A' (with A of type"
" %0) can %select{logically|literally}1 be simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< sub->getType()
<< sub->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -136,7 +136,7 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
// Ignore macros, otherwise
// OSL_ENSURE(!b, ...);
// triggers.
- if (binaryOp->getLocStart().isMacroID())
+ if (compat::getBeginLoc(binaryOp).isMacroID())
return true;
auto t = binaryOp->getLHS()->IgnoreImpCasts()->getType()->getUnqualifiedDesugaredType();
// RecordType would require more smarts - we'd need to verify that an inverted operator actually existed
@@ -151,7 +151,7 @@ bool SimplifyBool::VisitUnaryLNot(UnaryOperator const * expr) {
report(
DiagnosticsEngine::Warning,
("logical negation of comparison operator, can be simplified by inverting operator"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
}
return true;
@@ -178,7 +178,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than expression of the form 'A < false' (with A of type"
" %0) can logically be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -191,7 +191,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
("less-than expression of the form 'A < true' (with A"
" of type %0) can %select{logically|literally}1 be"
" simplified as '!A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< (expr->getLHS()->IgnoreImpCasts()->getType()
->isBooleanType())
@@ -202,7 +202,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
("less-than expression of the form '!A < true' (with A"
" of type %0) can %select{logically|literally}1 be"
" simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -218,7 +218,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than expression of the form 'false < A' (with A of type"
" %0) can %select{logically|literally}1 be simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -228,7 +228,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than expression of the form 'false < false' can"
" literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -236,7 +236,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than expression of the form 'false < true' can"
" literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -248,7 +248,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than expression of the form 'true < A' (with A of type"
" %0) can logically be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -257,7 +257,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than expression of the form 'true < false' can"
" literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -265,7 +265,7 @@ bool SimplifyBool::VisitBinLT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than expression of the form 'true < true' can"
" literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -296,7 +296,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
("greater-than expression of the form 'A > false' (with A of"
" type %0) can %select{logically|literally}1 be simplified as"
" 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -306,7 +306,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than expression of the form 'A > true' (with A of"
" type %0) can logically be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -319,7 +319,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than expression of the form 'false > A' (with A of"
" type %0) can logically be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -328,7 +328,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than expression of the form 'false > false' can"
" literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -336,7 +336,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than expression of the form 'false > true' can"
" literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -352,7 +352,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
("greater-than expression of the form 'true > A' (with"
" A of type %0) can %select{logically|literally}1 be"
" simplified as '!A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< (expr->getRHS()->IgnoreImpCasts()->getType()
->isBooleanType())
@@ -363,7 +363,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
("greater-than expression of the form 'true > !A' (with"
" A of type %0) can %select{logically|literally}1 be"
" simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -375,7 +375,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than expression of the form 'true > false' can"
" literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -383,7 +383,7 @@ bool SimplifyBool::VisitBinGT(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than expression of the form 'true > true' can"
" literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -418,7 +418,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
" false' (with A of type %0) can"
" %select{logically|literally}1 be simplified as"
" '!A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< (expr->getLHS()->IgnoreImpCasts()->getType()
->isBooleanType())
@@ -429,7 +429,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
("less-than-or-equal-to expression of the form '!A <="
" false' (with A of type %0) can"
" %select{logically|literally}1 be simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -441,7 +441,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than-or-equal-to expression of the form 'A <= true'"
" (with A of type %0) can logically be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -454,7 +454,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than-or-equal-to expression of the form 'false <= A'"
" (with A of type %0) can logically be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -463,7 +463,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than-or-equal-to expression of the form 'false <= false'"
" can literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -471,7 +471,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than-or-equal-to expression of the form 'false <= true'"
" can literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -484,7 +484,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
("less-than-or-equal-to expression of the form 'true <= A'"
" (with A of type %0) can %select{logically|literally}1 be"
" simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< expr->getRHS()->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -494,7 +494,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than-or-equal-to expression of the form 'true <= false'"
" can literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -502,7 +502,7 @@ bool SimplifyBool::VisitBinLE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("less-than-or-equal-to expression of the form 'true <= true'"
" can literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -532,7 +532,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than-or-equal-to expression of the form 'A >= false'"
" (with A of type %0) can logically be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -542,7 +542,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
("greater-than-or-equal-to expression of the form 'A >= true'"
" (with A of type %0) can %select{logically|literally}1 be"
" simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -561,7 +561,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
" 'false >= A' (with A of type %0) can"
" %select{logically|literally}1 be simplified as"
" '!A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< (expr->getRHS()->IgnoreImpCasts()->getType()
->isBooleanType())
@@ -572,7 +572,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
("greater-than-or-equal-to expression of the form"
" 'false >= !A' (with A of type %0) can"
" %select{logically|literally}1 be simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -584,7 +584,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than-or-equal-to expression of the form 'false >="
" false' can literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -592,7 +592,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than-or-equal-to expression of the form 'false >="
" true' can literally be simplified as 'false'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -604,7 +604,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than-or-equal-to expression of the form 'true >= A'"
" (with A of type %0) can logically be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< expr->getSourceRange();
break;
@@ -613,7 +613,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than-or-equal-to expression of the form 'true >="
" false' can literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
case Value::True:
@@ -621,7 +621,7 @@ bool SimplifyBool::VisitBinGE(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("greater-than-or-equal-to expression of the form 'true >="
" true' can literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getSourceRange();
break;
}
@@ -655,7 +655,7 @@ bool SimplifyBool::VisitBinEQ(BinaryOperator const * expr) {
("equal-to expression of the form 'A == false' (with A"
" of type %0) can %select{logically|literally}1 be"
" simplified as '!A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< (expr->getLHS()->IgnoreImpCasts()->getType()
->isBooleanType())
@@ -666,7 +666,7 @@ bool SimplifyBool::VisitBinEQ(BinaryOperator const * expr) {
("equal-to expression of the form '!A == false' (with A"
" of type %0) can %select{logically|literally}1 be"
" simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -678,7 +678,7 @@ bool SimplifyBool::VisitBinEQ(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("equal-to expression of the form 'A == true' (with A of type"
" %0) can %select{logically|literally}1 be simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getLHS()->IgnoreImpCasts()->getType()
<< expr->getLHS()->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -696,7 +696,7 @@ bool SimplifyBool::VisitBinEQ(BinaryOperator const * expr) {
("equal-to expression of the form 'false == A' (with A"
" of type %0) can %select{logically|literally}1 be"
" simplified as '!A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< expr->getRHS()->IgnoreImpCasts()->getType()
<< (expr->getRHS()->IgnoreImpCasts()->getType()
->isBooleanType())
@@ -707,7 +707,7 @@ bool SimplifyBool::VisitBinEQ(BinaryOperator const * expr) {
("equal-to expression of the form 'false == !A' (with A"
" of type %0) can %select{logically|literally}1 be"
" simplified as 'A'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
<< e->IgnoreImpCasts()->getType()
<< e->IgnoreImpCasts()->getType()->isBooleanType()
<< expr->getSourceRange();
@@ -719,7 +719,7 @@ bool SimplifyBool::VisitBinEQ(BinaryOperator const * expr) {
DiagnosticsEngine::Warning,
("equal-to expression of the form 'false == false' can"
" literally be simplified as 'true'"),
- expr->getLocStart())
+ compat::getBeginLoc(expr))
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list