[clang] [clang][bytecode] Only reject function tyeps in Pointer::toRValue() (PR #180722)

via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 10 03:19:18 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

No test because I'm not sure how to reproduce this, but this patch fixes `CodeGen/ptrauth-qualifier-function.c`.

For function pointer types and function reference types, we use `Pointer`s these days, so we _can_ return them.

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


1 Files Affected:

- (modified) clang/lib/AST/ByteCode/Pointer.cpp (+1-2) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Pointer.cpp b/clang/lib/AST/ByteCode/Pointer.cpp
index 8b496c5663ae6..e237013f4199c 100644
--- a/clang/lib/AST/ByteCode/Pointer.cpp
+++ b/clang/lib/AST/ByteCode/Pointer.cpp
@@ -938,8 +938,7 @@ std::optional<APValue> Pointer::toRValue(const Context &Ctx,
   };
 
   // Can't return functions as rvalues.
-  if (ResultType->isFunctionType() || ResultType->isFunctionPointerType() ||
-      ResultType->isFunctionReferenceType())
+  if (ResultType->isFunctionType())
     return std::nullopt;
 
   // Invalid to read from.

``````````

</details>


https://github.com/llvm/llvm-project/pull/180722


More information about the cfe-commits mailing list