[clang] [clang][bytecode] Remove needless global check (PR #148163)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 11 02:11:55 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Timm Baeder (tbaederr)
<details>
<summary>Changes</summary>
Remove the call to D->hasGlobalStorage(), since we never reach this point for local variables.
---
Full diff: https://github.com/llvm/llvm-project/pull/148163.diff
1 Files Affected:
- (modified) clang/lib/AST/ByteCode/Interp.cpp (+1-7)
``````````diff
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index be77657acabcc..49063cf755cc0 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -445,13 +445,7 @@ bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
assert(Desc);
const auto *D = Desc->asVarDecl();
- if (!D || !D->hasGlobalStorage())
- return true;
-
- if (D == S.EvaluatingDecl)
- return true;
-
- if (D->isConstexpr())
+ if (!D || D == S.EvaluatingDecl || D->isConstexpr())
return true;
// If we're evaluating the initializer for a constexpr variable in C23, we may
``````````
</details>
https://github.com/llvm/llvm-project/pull/148163
More information about the cfe-commits
mailing list