aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Interp.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-13 10:55:24 +0200
committerGitHub <noreply@github.com>2025-05-13 10:55:24 +0200
commit98763433e66dd91bf5f10b1daf03d9373f07912a (patch)
tree36966237c6b2073578353242ec07b81b4c5445f6 /clang/lib/AST/ByteCode/Interp.cpp
parent6d35ec233525f278cbe06ff3cd49ea276825817f (diff)
downloadllvm-98763433e66dd91bf5f10b1daf03d9373f07912a.zip
llvm-98763433e66dd91bf5f10b1daf03d9373f07912a.tar.gz
llvm-98763433e66dd91bf5f10b1daf03d9373f07912a.tar.bz2
[clang][bytecode] Optimize enum value range checks (#139672)
Only do the work if we really have to.
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Interp.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 43f8d15..91930c0 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1251,12 +1251,11 @@ bool Free(InterpState &S, CodePtr OpPC, bool DeleteIsArrayForm,
void diagnoseEnumValue(InterpState &S, CodePtr OpPC, const EnumDecl *ED,
const APSInt &Value) {
- llvm::APInt Min;
- llvm::APInt Max;
-
if (S.EvaluatingDecl && !S.EvaluatingDecl->isConstexpr())
return;
+ llvm::APInt Min;
+ llvm::APInt Max;
ED->getValueRange(Max, Min);
--Max;