[clang] d5b42db - [clang][bytecode][NFC] Only do CheckConstant checks for global pointers (#113786)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 26 20:56:56 PDT 2024


Author: Timm Baeder
Date: 2024-10-27T04:56:53+01:00
New Revision: d5b42db00f0b21855501b01e8cd80326e1ce763d

URL: https://github.com/llvm/llvm-project/commit/d5b42db00f0b21855501b01e8cd80326e1ce763d
DIFF: https://github.com/llvm/llvm-project/commit/d5b42db00f0b21855501b01e8cd80326e1ce763d.diff

LOG: [clang][bytecode][NFC] Only do CheckConstant checks for global pointers (#113786)

We can check isStatic() early here and save ourselves some work.

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Interp.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index b7a6c224c80f8e..6d40fb03696d48 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -400,7 +400,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