[clang] [clang] Implement function pointer type discrimination (PR #96992)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 28 21:52:46 PDT 2024


================
@@ -2220,6 +2220,11 @@ llvm::Constant *ConstantLValueEmitter::emitPointerAuthPointer(const Expr *E) {
 
   // The assertions here are all checked by Sema.
   assert(Result.Val.isLValue());
+  const auto *Base = Result.Val.getLValueBase().get<const ValueDecl *>();
+  if (const auto *Decl = dyn_cast_or_null<FunctionDecl>(Base)) {
----------------
tbaederr wrote:

```suggestion
  if (const auto *Decl = dyn_cast_if_present<FunctionDecl>(Base)) {
```

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


More information about the cfe-commits mailing list