[PATCH] D157445: [CodeGen][UBSan] Add support for handling attributed functions in getUBSanFunctionTypeHash.
Yeoul Na via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 10 11:04:56 PDT 2023
rapidsna requested changes to this revision.
rapidsna added a comment.
This revision now requires changes to proceed.
We should add a test to exercise when `Ty` is wrapped by other sugar types. Could you try with `typedef`?
================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:573-575
+ if (isa<AttributedType>(Ty))
+ Ty = Ty.getDesugaredType(getContext());
+
----------------
================
Comment at: clang/lib/CodeGen/CodeGenFunction.cpp:578
// noexcept function through a non-noexcept pointer.
if (!isa<FunctionNoProtoType>(Ty))
Ty = getContext().getFunctionTypeWithExceptionSpec(Ty, EST_None);
----------------
Checking `isa<T>` still doesn't handle cases where `Ty` is wrapped in other sugar types (not just `AttributedType`).
Instead of adding `if (isa<AttributedType>(Ty))` above, I would use
`Ty->isFunctionNoProtoType()` here.
`isFunctionNoProtoType` is a helper function that uses `getAs<FunctionNoProtoType>()`. `getAs<T>` removes any existing sugar until it reaches `T` or a non-sugar type.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D157445/new/
https://reviews.llvm.org/D157445
More information about the cfe-commits
mailing list