Commit Graph

2 Commits

Author SHA1 Message Date
Nenad Mikša 835b99e4c8 Disambiguate type names when printing NTTP types
When printing NTTP template types, ensure that type name of the NTTP is
printed.

Fixes #57562

Differential Revision: https://reviews.llvm.org/D134453
2022-10-28 08:18:38 -04:00
Zhihao Yuan 44eee659f1
[AST] Print NTTP args as string-literals when possible
C++20 non-type template parameter prints `MyType<{{116, 104, 105, 115}}>` when the code is as simple as `MyType<"this">`. This patch prints `MyType<{"this"}>`, with one layer of braces preserved for the intermediate structural type to trigger CTAD.

`StringLiteral` handles this case, but `StringLiteral` inside `APValue` code looks like a circular dependency. The proposed patch implements a cheap strategy to emit string literals in diagnostic messages only when they are readable and fall back to integer sequences.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D115031
2022-03-01 19:34:27 -06:00