Author: Timm Baeder Date: 2026-09-12T17:30:24+02:00 New Revision: 0adddbb3a5f7f57614e8c59c87d37cec5421e514
URL: https://github.com/llvm/llvm-project/commit/0adddbb3a5f7f57614e8c59c87d37cec5421e514 DIFF: https://github.com/llvm/llvm-project/commit/0adddbb3a5f7f57614e8c59c87d37cec5421e514.diff LOG: [clang][bytecode][NFC] Move Remove unused CheckExtern prototype (#223146) And add an overload taking only a Block. Added: Modified: clang/lib/AST/ByteCode/Interp.cpp clang/lib/AST/ByteCode/Interp.h Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index 160cc745c89b6..b0b8cfd7198ac 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -461,7 +461,7 @@ bool CheckActive(InterpState &S, CodePtr OpPC, const Pointer &Ptr, return false; } -bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { +static bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { if (!Ptr.isExtern()) return true; @@ -480,6 +480,12 @@ bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { return false; } +static bool CheckExtern(InterpState &S, CodePtr OpPC, const Block *B) { + if (!B->isExtern()) + return true; + return CheckExtern(S, OpPC, Pointer(const_cast<Block *>(B))); +} + bool CheckArray(InterpState &S, CodePtr OpPC, const Pointer &Ptr) { if (!Ptr.isUnknownSizeArray()) return true; @@ -874,7 +880,7 @@ static bool CheckWeak(InterpState &S, CodePtr OpPC, const Block *B) { bool CheckGlobalLoad(InterpState &S, CodePtr OpPC, const Block *B) { const auto &Desc = B->getBlockDesc<GlobalInlineDescriptor>(); if (!B->isAccessible()) { - if (!CheckExtern(S, OpPC, Pointer(const_cast<Block *>(B)))) + if (!CheckExtern(S, OpPC, B)) return false; if (!CheckDummy(S, OpPC, B, AK_Read)) return false; diff --git a/clang/lib/AST/ByteCode/Interp.h b/clang/lib/AST/ByteCode/Interp.h index a20a3f91dd267..7c71635561708 100644 --- a/clang/lib/AST/ByteCode/Interp.h +++ b/clang/lib/AST/ByteCode/Interp.h @@ -55,9 +55,6 @@ namespace interp { using APSInt = llvm::APSInt; using FixedPointSemantics = llvm::FixedPointSemantics; -/// Checks if the variable has externally defined storage. -bool CheckExtern(InterpState &S, CodePtr OpPC, const Pointer &Ptr); - /// Checks if a pointer is null. bool CheckNull(InterpState &S, CodePtr OpPC, const Pointer &Ptr, CheckSubobjectKind CSK); _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
