mirror of
https://github.com/LibreOffice/core.git
synced 2025-08-15 20:47:46 +00:00
Adapt to LLVM 21 trunk MemberPointerType change
<github.com/llvm/llvm-project/commit/14f7bd63b95d0f61a6f47119ac66398ca230559a> "Reland: [clang] preserve class type sugar when taking pointer to member (#132401)" Change-Id: Ie409324fcf3b98cd733cc46e06ee9e99dc140968 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183250 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
@ -13,6 +13,7 @@
|
||||
#include <clang/AST/DeclTemplate.h>
|
||||
|
||||
#include "check.hxx"
|
||||
#include "compat.hxx"
|
||||
|
||||
namespace loplugin {
|
||||
|
||||
@ -137,7 +138,7 @@ TypeCheck TypeCheck::MemberPointerOf() const {
|
||||
if (!type_.isNull()) {
|
||||
auto const t = type_->getAs<clang::MemberPointerType>();
|
||||
if (t != nullptr) {
|
||||
return TypeCheck(t->getClass());
|
||||
return TypeCheck(compat::getClass(t));
|
||||
}
|
||||
}
|
||||
return TypeCheck();
|
||||
|
@ -278,6 +278,14 @@ inline unsigned getBitWidthValue(clang::FieldDecl const * decl, clang::ASTContex
|
||||
#endif
|
||||
}
|
||||
|
||||
inline clang::Type const * getClass(clang::MemberPointerType const * type) {
|
||||
#if CLANG_VERSION >= 210000
|
||||
return type->getQualifier()->getAsType();
|
||||
#else
|
||||
return type->getClass();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline clang::TemplateTypeParmDecl const * getReplacedParameter(
|
||||
clang::SubstTemplateTypeParmType const * type)
|
||||
{
|
||||
|
@ -42,8 +42,8 @@ bool areSimilar(QualType type1, QualType type2) {
|
||||
}
|
||||
auto t1a = t1->getAs<MemberPointerType>();
|
||||
auto t2a = t2->getAs<MemberPointerType>();
|
||||
if (t1a->getClass()->getCanonicalTypeInternal()
|
||||
!= t2a->getClass()->getCanonicalTypeInternal())
|
||||
if (compat::getClass(t1a)->getCanonicalTypeInternal()
|
||||
!= compat::getClass(t2a)->getCanonicalTypeInternal())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ bool mentions(QualType type1, QualType type2)
|
||||
}
|
||||
if (auto const t2 = t1->getAs<MemberPointerType>())
|
||||
{
|
||||
if (t2->getClass()->getUnqualifiedDesugaredType() == type2.getTypePtr())
|
||||
if (compat::getClass(t2)->getUnqualifiedDesugaredType() == type2.getTypePtr())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "config_clang.h"
|
||||
|
||||
#include "check.hxx"
|
||||
#include "compat.hxx"
|
||||
#include "plugin.hxx"
|
||||
|
||||
/**
|
||||
@ -290,7 +291,7 @@ static bool areTypesEqual(QualType lhs, QualType rhs)
|
||||
auto rhsMember = dyn_cast<MemberPointerType>(rhsType);
|
||||
if (!rhsMember)
|
||||
return false;
|
||||
if (lhsMember->getClass() != rhsMember->getClass())
|
||||
if (compat::getClass(lhsMember) != compat::getClass(rhsMember))
|
||||
return true;
|
||||
return areTypesEqual(lhsMember->getPointeeType(), rhsMember->getPointeeType());
|
||||
}
|
||||
|
Reference in New Issue
Block a user