llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

And save two lines.

---
Full diff: https://github.com/llvm/llvm-project/pull/234914.diff


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Pointer.h (+8-10) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h
index 6c8ac0066f597..7b49875e19729 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();
+      break;
+    case Storage::Block:
+      return BS.Pointee->isWeak();
+    default:
       return false;
     }
-    if (!isBlockPointer())
-      return false;
-
-    assert(isBlockPointer());
-    return BS.Pointee->isWeak();
+    llvm_unreachable("Unhandled storage kind");
   }
   /// Checks if the object is active.
   bool isActive() const {

``````````

</details>


https://github.com/llvm/llvm-project/pull/234914
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to