Author: Timm Baeder Date: 2026-10-24T06:27:54+02:00 New Revision: 3f550f8b4a08ff3cfa94027f5abfa5fcd5d2a0d0
URL: https://github.com/llvm/llvm-project/commit/3f550f8b4a08ff3cfa94027f5abfa5fcd5d2a0d0 DIFF: https://github.com/llvm/llvm-project/commit/3f550f8b4a08ff3cfa94027f5abfa5fcd5d2a0d0.diff LOG: [clang][bytecode][NFC] Use switch in `Pointer::isWeak()` (#234914) And save two lines. Added: Modified: clang/lib/AST/ByteCode/Pointer.h Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h index 6c8ac0066f597..0fc540cdd8858 100644 --- a/clang/lib/AST/ByteCode/Pointer.h +++ b/clang/lib/AST/ByteCode/Pointer.h @@ -919,23 +919,21 @@ class Pointer { } bool isWeak() const { - if (isFunctionPointer()) { + switch (StorageKind) { + case Storage::Fn: if (!Fn.Func || !Fn.Func->getDecl()) return false; - return Fn.Func->getDecl()->isWeak(); - } - - if (isOpaquePointer()) { + case Storage::Opaque: if (const VarDecl *BaseDecl = Opaque.getBaseVarDecl()) return BaseDecl->isWeak(); return false; - } - if (!isBlockPointer()) + case Storage::Block: + return BS.Pointee->isWeak(); + default: return false; - - assert(isBlockPointer()); - return BS.Pointee->isWeak(); + } + llvm_unreachable("Unhandled storage kind"); } /// Checks if the object is active. bool isActive() const { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
