[clang] [clang][bytecode][NFC] Only do CheckConstant checks for global pointers (PR #113786)
Timm Baeder via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 26 20:12:15 PDT 2024
https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/113786
We can check isStatic() early here and save ourselves some work.
>From e759b44c22bcdd374550929c0c673d414f30e4ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Sun, 27 Oct 2024 04:08:52 +0100
Subject: [PATCH] [clang][bytecode][NFC] Only do CheckConstant checks for
global pointers
We can check isStatic() early here and save ourselves some work.
---
clang/lib/AST/ByteCode/Interp.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index fdc4b38b8aa6dc..9763cabab3cd7d 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -394,7 +394,7 @@ bool CheckConstant(InterpState &S, CodePtr OpPC, const Descriptor *Desc) {
}
static bool CheckConstant(InterpState &S, CodePtr OpPC, const Pointer &Ptr) {
- if (!Ptr.isBlockPointer())
+ if (!Ptr.isStatic() || !Ptr.isBlockPointer())
return true;
return CheckConstant(S, OpPC, Ptr.getDeclDesc());
}
More information about the cfe-commits
mailing list