diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-08-10 12:35:21 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-08-10 15:14:03 +0200 |
commit | 3cc5149a84c7b8cfaf0deb2e2f6c88c72343ee28 (patch) | |
tree | 07bfda734ee36d2ca1dc83e2ac4a1c6ef3222691 /compilerplugins/clang/changetoolsgen.cxx | |
parent | tdf#42949 Fix IWYU warnings in include/salhelper/* (diff) | |
download | core-3cc5149a84c7b8cfaf0deb2e2f6c88c72343ee28.tar.gz core-3cc5149a84c7b8cfaf0deb2e2f6c88c72343ee28.zip |
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@redhat.com>
Diffstat (limited to 'compilerplugins/clang/changetoolsgen.cxx')
-rw-r--r-- | compilerplugins/clang/changetoolsgen.cxx | 35 |
1 files changed, 18 insertions, 17 deletions
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; } |