diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -570,6 +570,9 @@ llvm::ConstantInt * CodeGenFunction::getUBSanFunctionTypeHash(QualType Ty) const { + if (isa(Ty)) + Ty = Ty.getDesugaredType(getContext()); + // Remove any (C++17) exception specifications, to allow calling e.g. a // noexcept function through a non-noexcept pointer. if (!isa(Ty)) diff --git a/clang/test/CodeGen/ubsan-function-attributed.c b/clang/test/CodeGen/ubsan-function-attributed.c new file mode 100644 --- /dev/null +++ b/clang/test/CodeGen/ubsan-function-attributed.c @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 -emit-llvm -triple x86_64 -std=c17 -fsanitize=function %s -o /dev/null + +long __attribute__((ms_abi)) f() {}