summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/useuniqueptr.cxx
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-02-15 15:03:24 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-02-17 21:45:06 +0100
commitd1a2b80b9dc146c7fe63d2657e5506f49d6e5c0d (patch)
tree7ceeb7e977c660d5b69bc93e8327674b7ea1ae5d /compilerplugins/clang/useuniqueptr.cxx
parenteed401bc7429f29f1b21cf8e3b08969e011d5692 (diff)
Bump compiler plugins Clang baseline to 12.0.1
...as discussed in the mail thread starting at <https://lists.freedesktop.org/archives/libreoffice/2020-November/086234.html> "Bump --enable-compiler-plugins Clang baseline?" (and now picked up again at <https://lists.freedesktop.org/archives/libreoffice/2022-February/088459.html> "Re: Bump --enable-compiler-plugins Clang baseline?"), and clean up compilerplugins/clang/ accordingly Change-Id: I5e81c6fdcc363aeefd6227606225b526fdf7ac16 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129989 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'compilerplugins/clang/useuniqueptr.cxx')
-rw-r--r--compilerplugins/clang/useuniqueptr.cxx29
1 files changed, 15 insertions, 14 deletions
diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index c26e3db11365..ae95cbdfe99e 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -13,6 +13,7 @@
#include <iostream>
#include <fstream>
#include <set>
+#include "config_clang.h"
#include "plugin.hxx"
#include "check.hxx"
@@ -589,12 +590,12 @@ void UseUniquePtr::CheckDeleteLocalVar(const FunctionDecl* functionDecl, const C
report(
DiagnosticsEngine::Warning,
"call to delete on a var, should be using std::unique_ptr",
- compat::getBeginLoc(deleteExpr))
+ deleteExpr->getBeginLoc())
<< deleteExpr->getSourceRange();
report(
DiagnosticsEngine::Note,
"var is here",
- compat::getBeginLoc(varDecl))
+ varDecl->getBeginLoc())
<< varDecl->getSourceRange();
}
@@ -662,16 +663,16 @@ void UseUniquePtr::CheckLoopDelete(const FunctionDecl* functionDecl, const CXXDe
auto init = iterVarDecl->getInit();
if (init)
{
- init = compat::IgnoreImplicit(init);
- if (!compat::CPlusPlus17(compiler.getLangOpts()))
+ init = init->IgnoreImplicit();
+ if (!compiler.getLangOpts().CPlusPlus17)
if (auto x = dyn_cast<CXXConstructExpr>(init))
if (x->isElidable())
- init = compat::IgnoreImplicit(x->getArg(0));
+ init = x->getArg(0)->IgnoreImplicit();
if (auto x = dyn_cast<CXXConstructExpr>(init))
if (x->getNumArgs() == 1
|| (x->getNumArgs() >= 2 && isa<CXXDefaultArgExpr>(x->getArg(1))))
{
- init = compat::IgnoreImplicit(x->getArg(0));
+ init = x->getArg(0)->IgnoreImplicit();
}
if (auto x = dyn_cast<CXXMemberCallExpr>(init))
init = x->getImplicitObjectArgument()->IgnoreParenImpCasts();
@@ -820,12 +821,12 @@ void UseUniquePtr::CheckLoopDelete(const FunctionDecl* functionDecl, const CXXDe
report(
DiagnosticsEngine::Warning,
"loopdelete: rather manage this var with std::some_container<std::unique_ptr<T>>",
- compat::getBeginLoc(deleteExpr))
+ deleteExpr->getBeginLoc())
<< deleteExpr->getSourceRange();
report(
DiagnosticsEngine::Note,
"var is here",
- compat::getBeginLoc(varDecl))
+ varDecl->getBeginLoc())
<< varDecl->getSourceRange();
}
}
@@ -908,12 +909,12 @@ void UseUniquePtr::CheckCXXForRangeStmt(const FunctionDecl* functionDecl, const
report(
DiagnosticsEngine::Warning,
"rather manage this var with std::some_container<std::unique_ptr<T>>",
- compat::getBeginLoc(deleteExpr))
+ deleteExpr->getBeginLoc())
<< deleteExpr->getSourceRange();
report(
DiagnosticsEngine::Note,
"var is here",
- compat::getBeginLoc(varDecl))
+ varDecl->getBeginLoc())
<< varDecl->getSourceRange();
}
}
@@ -992,12 +993,12 @@ void UseUniquePtr::CheckMemberDeleteExpr(const FunctionDecl* functionDecl, const
report(
DiagnosticsEngine::Warning,
message,
- compat::getBeginLoc(deleteExpr))
+ deleteExpr->getBeginLoc())
<< deleteExpr->getSourceRange();
report(
DiagnosticsEngine::Note,
"member is here",
- compat::getBeginLoc(fieldDecl))
+ fieldDecl->getBeginLoc())
<< fieldDecl->getSourceRange();
}
@@ -1117,7 +1118,7 @@ bool UseUniquePtr::VisitCXXDeleteExpr(const CXXDeleteExpr* deleteExpr)
return true;
if (ignoreLocation(mpCurrentFunctionDecl))
return true;
- if (isInUnoIncludeFile(compat::getBeginLoc(mpCurrentFunctionDecl->getCanonicalDecl())))
+ if (isInUnoIncludeFile(mpCurrentFunctionDecl->getCanonicalDecl()->getBeginLoc()))
return true;
auto declRefExpr = dyn_cast<DeclRefExpr>(deleteExpr->getArgument()->IgnoreParenImpCasts()->IgnoreImplicit());
if (!declRefExpr)
@@ -1298,7 +1299,7 @@ void UseUniquePtr::CheckDeleteParmVar(const CXXDeleteExpr* deleteExpr, const Par
report(
DiagnosticsEngine::Warning,
"calling delete on a pointer param, should be either allowlisted or simplified",
- compat::getBeginLoc(deleteExpr))
+ deleteExpr->getBeginLoc())
<< deleteExpr->getSourceRange();
}