summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGExprConstant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/CodeGen/CGExprConstant.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprConstant.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index 6ba45f42db4d..069cc09cd91d 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -2236,8 +2236,12 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase &base) {
return ConstantLValue(C);
};
- if (const auto *FD = dyn_cast<FunctionDecl>(D))
- return PtrAuthSign(CGM.getRawFunctionPointer(FD));
+ if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
+ llvm::Constant *C = CGM.getRawFunctionPointer(FD);
+ if (FD->getType()->isCFIUncheckedCalleeFunctionType())
+ C = llvm::NoCFIValue::get(cast<llvm::GlobalValue>(C));
+ return PtrAuthSign(C);
+ }
if (const auto *VD = dyn_cast<VarDecl>(D)) {
// We can never refer to a variable with local storage.