PiJoules wrote:

I updated to this with a new AST node but would like some guidance in 
implementation details. One of the shortcomings of making this a (sugared) node 
is when passing this type around through templates, the node doesn't persist 
since only canonical types are substituted through templates. This could lead 
to something like:

```
void func() __attribute__((cfi_unchecked_callee)) {}
template <typename T>
struct S {
  S(T *ptr) {}
};
S s(&func);
```

Giving a warning since clang deduces `T *ptr` as the canonical `void (*)()`. 
Other attributes like `noreturn` work around this by being part of the function 
prototype via `ExtInfo` or `FunctionTypeExtraBitfields` as @efriedma-quic 
suggested, but using the bitfields alone wouldn't allow warning on casts since 
those attrributes get freely added/dropped without warning. I think perhaps the 
best way to approach this would be instead treating this as an extra bitfield 
rather than having a node and for every implicit conversion which would add or 
drop attributes, specifically check if this attribute is dropped. I'd like some 
opinions on this before moving forward though just to make sure I don't do 
unnecessary work. I imagine we wouldn't want a mix of both a node and extra 
bitfield since we'd have two representations of the same thing. Another idea is 
perhaps making this not a sugared type, but I don't know if there would be 
ramifications to that.

https://github.com/llvm/llvm-project/pull/135836
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to