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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to