[llvm-branch-commits] [CodeGen][CFI] Generalize transparent union in args of args of functions (PR #158194)
Peter Collingbourne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Sep 12 11:28:19 PDT 2025
================
@@ -2360,12 +2363,19 @@ static QualType GeneralizeType(ASTContext &Ctx, QualType Ty,
bool GeneralizePointers) {
Ty = GeneralizeTransparentUnion(Ty);
- if (!GeneralizePointers || !Ty->isPointerType())
+ if (!Ty->isPointerType())
+ return Ty;
+
+ QualType PTy = Ty->getPointeeType();
+ if (PTy->getAs<FunctionProtoType>() || PTy->getAs<FunctionNoProtoType>())
----------------
pcc wrote:
I guess this is not the only way you can end up with a function type. E.g. pointer to pointer to function, reference to pointer to function, etc.
What do you think about doing this in the mangler? E.g. add a call to a hook near the top of `void CXXNameMangler::mangleType(QualType T)` and supply a hook that does the transparent_union generalization from here.
https://github.com/llvm/llvm-project/pull/158194
More information about the llvm-branch-commits
mailing list