aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-01-08 14:45:19 +0100
committerGitHub <noreply@github.com>2025-01-08 14:45:19 +0100
commit81fc3add1e627c23b7270fe2739cdacc09063e54 (patch)
treeede826f9137b2cd824b70eb756a4b1041acf26cc /clang/lib/Sema/SemaDeclObjC.cpp
parent72a28a3bf0b539bcdfd8f41905675ce6a890c0ac (diff)
downloadllvm-81fc3add1e627c23b7270fe2739cdacc09063e54.zip
llvm-81fc3add1e627c23b7270fe2739cdacc09063e54.tar.gz
llvm-81fc3add1e627c23b7270fe2739cdacc09063e54.tar.bz2
[clang] Avoid re-evaluating field bitwidth (#117732)
Save the bitwidth value as a `ConstantExpr` with the value set. Remove the `ASTContext` parameter from `getBitWidthValue()`, so the latter simply returns the value from the `ConstantExpr` instead of constant-evaluating the bitwidth expression every time it is called.
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 6e6174b..f97f17e 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -2210,8 +2210,7 @@ void SemaObjC::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
<< ImplIvar->getType() << ClsIvar->getType();
Diag(ClsIvar->getLocation(), diag::note_previous_definition);
} else if (ImplIvar->isBitField() && ClsIvar->isBitField() &&
- ImplIvar->getBitWidthValue(Context) !=
- ClsIvar->getBitWidthValue(Context)) {
+ ImplIvar->getBitWidthValue() != ClsIvar->getBitWidthValue()) {
Diag(ImplIvar->getBitWidth()->getBeginLoc(),
diag::err_conflicting_ivar_bitwidth)
<< ImplIvar->getIdentifier();