Open chandlerc opened 3 years ago
I think we need the temporary 12 year old hack fixed because otherwise we have no location information for the attribute. We can get "close enough" by using one of the nearby locations to solve the immediate crashing problem, but better to solve this properly by not stripping the attribute from the type source information.
Right. The proper fix there is to remove TransformType(QualType) so that we only ever transform a TSI, which of course requires all the call sites to move to TransformType(TSI), which requires them to preserve a TSI down.
The issue is that we lose the attribute due to a "temporary" measure in template instantiation that was added in 2009.
https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/TreeTransform.h#L4623 is the problematic line. Calling getTrivialTypeSourceInfo() gets a TypeSourceInfo object that does not track the Attr * for the attributed type. So when we go to diagnose on https://github.com/llvm/llvm-project/blob/main/clang/lib/Sema/TreeTransform.h#L6785 the modifiedType is a null pointer.
https://github.com/llvm/llvm-project/commit/550e0c2f0fd655d6946a2e2b6dbbbf2c473a513c is what introduced the temporary hack.
I think we need the temporary 12 year old hack fixed because otherwise we have no location information for the attribute. We can get "close enough" by using one of the nearby locations to solve the immediate crashing problem, but better to solve this properly by not stripping the attribute from the type source information.
Extended Description
https://compiler-explorer.com/z/EKfcebd97
From compiler explorer: