Adapt compilerplugins to recent LLVM 20 trunk change
<github.com/llvm/llvm-project/commit/cfe26358e3051755961fb1f3b46328dc2c326895> "Reapply '[clang] Avoid re-evaluating field bitwidth'" Change-Id: Ic31d5cd8251d0f83e7589e2f00e3c34789c75bad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180150 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
This commit is contained in:
@@ -269,6 +269,15 @@ inline bool isUnnamedBitField(clang::FieldDecl const * decl) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline unsigned getBitWidthValue(clang::FieldDecl const * decl, clang::ASTContext const & context) {
|
||||||
|
#if CLANG_VERSION >= 200000
|
||||||
|
(void) context;
|
||||||
|
return decl->getBitWidthValue();
|
||||||
|
#else
|
||||||
|
return decl->getBitWidthValue(context);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline clang::TemplateTypeParmDecl const * getReplacedParameter(
|
inline clang::TemplateTypeParmDecl const * getReplacedParameter(
|
||||||
clang::SubstTemplateTypeParmType const * type)
|
clang::SubstTemplateTypeParmType const * type)
|
||||||
{
|
{
|
||||||
|
@@ -558,7 +558,7 @@ bool ImplicitBoolConversion::TraverseBinaryOperator(BinaryOperator * expr) {
|
|||||||
if (me != nullptr) {
|
if (me != nullptr) {
|
||||||
FieldDecl const * fd = dyn_cast<FieldDecl>(me->getMemberDecl());
|
FieldDecl const * fd = dyn_cast<FieldDecl>(me->getMemberDecl());
|
||||||
if (fd != nullptr && fd->isBitField()
|
if (fd != nullptr && fd->isBitField()
|
||||||
&& fd->getBitWidthValue(compiler.getASTContext()) == 1)
|
&& compat::getBitWidthValue(fd, compiler.getASTContext()) == 1)
|
||||||
{
|
{
|
||||||
auto const check = loplugin::TypeCheck(fd->getType());
|
auto const check = loplugin::TypeCheck(fd->getType());
|
||||||
bExt = check.Typedef("guint").GlobalNamespace()
|
bExt = check.Typedef("guint").GlobalNamespace()
|
||||||
|
@@ -143,7 +143,7 @@ void LoopVarTooSmall::checkSubExpr(Expr const * expr, bool positive) {
|
|||||||
if (fd->isBitField()) {
|
if (fd->isBitField()) {
|
||||||
qt1BitWidth = std::max(
|
qt1BitWidth = std::max(
|
||||||
qt1BitWidth,
|
qt1BitWidth,
|
||||||
fd->getBitWidthValue(compiler.getASTContext()));
|
compat::getBitWidthValue(fd, compiler.getASTContext()));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -184,7 +184,7 @@ void LoopVarTooSmall::checkSubExpr(Expr const * expr, bool positive) {
|
|||||||
if (fd->isBitField()) {
|
if (fd->isBitField()) {
|
||||||
qt2BitWidth = std::max(
|
qt2BitWidth = std::max(
|
||||||
qt2BitWidth,
|
qt2BitWidth,
|
||||||
fd->getBitWidthValue(compiler.getASTContext()));
|
compat::getBitWidthValue(fd, compiler.getASTContext()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user