[clang] [clang-tools-extra] [clang] Improve nested name specifier AST representation (PR #147835)

Michael Jones via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 25 14:30:24 PDT 2025


michaelrj-google wrote:

> > Related, I think the change to [`void TypePrinter::printUsingBefore(const UsingType *T, raw_ostream &OS)`](https://github.com/llvm/llvm-project/blame/d439c9ea4a19bf783120d8efee5e671316666550/clang/lib/AST/TypePrinter.cpp#L1227) might be causing similar issues. The `getKeywordName` is causing `enum` to get printed when the type is listed for template instantiation, which is causing errors.
> 
> Can you give me an example of that? We shouldn't be printing a keyword unless the type was written / created with a keyword.

The exact code is internal so I'm not sure exactly how much I can share, that being said, the relevant piece is this:

```
   ::sapi::v::IntBase<A::StorageType> v_type__(type__);
```
This line shows up in a regenerated function, and after the change it's being generated as
```
   ::sapi::v::IntBase<enum A::StorageType> v_type__(type__);
```
which clang errors on.

https://github.com/llvm/llvm-project/pull/147835


More information about the cfe-commits mailing list