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>
This commit is contained in:
@@ -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));
|
||||
|
Reference in New Issue
Block a user