Fix failure of loplugin:useuniqueptr with older compilers
...where CompilerTest_compilerplugins_clang failed in compilerplugins/clang/test/useuniqueptr.cxx due to Foo24's HTMLAttrs::const_iterator it = m_aSetAttrTab.begin(); and either the old compiler lacked Clang's recent <https://reviews.llvm.org/D50666> "Fix Stmt::ignoreImplicit" (and the above initialization expression happens to include a CXXBindTemporaryExpr, at least with libstdc++), or an even older compiler was used in pre-C++17 mode, so the above initialization expression happens to include an elidable CXXConstructExpr copy constructor call. Change-Id: I757a9ad76829e399b4fe2da1c82863909b8c9657 Reviewed-on: https://gerrit.libreoffice.org/61531 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -495,12 +495,16 @@ void UseUniquePtr::CheckLoopDelete(const FunctionDecl* functionDecl, const CXXDe
|
||||
auto init = iterVarDecl->getInit();
|
||||
if (init)
|
||||
{
|
||||
init = init->IgnoreImplicit();
|
||||
init = compat::IgnoreImplicit(init);
|
||||
if (!compat::CPlusPlus17(compiler.getLangOpts()))
|
||||
if (auto x = dyn_cast<CXXConstructExpr>(init))
|
||||
if (x->isElidable())
|
||||
init = compat::IgnoreImplicit(x->getArg(0));
|
||||
if (auto x = dyn_cast<CXXConstructExpr>(init))
|
||||
if (x->getNumArgs() == 1
|
||||
|| (x->getNumArgs() >= 2 && isa<CXXDefaultArgExpr>(x->getArg(1))))
|
||||
{
|
||||
init = x->getArg(0)->IgnoreImplicit();
|
||||
init = compat::IgnoreImplicit(x->getArg(0));
|
||||
}
|
||||
if (auto x = dyn_cast<CXXMemberCallExpr>(init))
|
||||
init = x->getImplicitObjectArgument();
|
||||
|
Reference in New Issue
Block a user