llvm-project/clang/unittests/AST
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
..
ASTContextParentMapTest.cpp [AST] Include the TranslationUnitDecl when traversing with TraversalScope 2021-06-11 14:29:45 +02:00
ASTImporterFixtures.cpp Rename APIs in unittests/AST/Language.h in preparation to share them 2020-05-29 14:25:20 +02:00
ASTImporterFixtures.h [NFC][Clang][test] Inclusive language: Remove and rephrase uses of sanity test/check in clang/test 2021-11-24 14:03:49 -05:00
ASTImporterGenericRedeclTest.cpp Bump googletest to 1.10.0 2021-05-14 19:16:31 +02:00
ASTImporterODRStrategiesTest.cpp Bump googletest to 1.10.0 2021-05-14 19:16:31 +02:00
ASTImporterObjCTest.cpp Bump googletest to 1.10.0 2021-05-14 19:16:31 +02:00
ASTImporterTest.cpp [clang][AST][ASTImporter] Set record to complete during import of its members. 2022-02-14 08:27:44 +01:00
ASTImporterVisibilityTest.cpp Bump googletest to 1.10.0 2021-05-14 19:16:31 +02:00
ASTPrint.h [clang] Refactor AST printing tests to share more infrastructure 2021-07-14 19:44:18 -04:00
ASTTraverserTest.cpp [NFC][testing] Return underlying strings directly instead of OS.str() 2021-12-09 16:05:46 -08:00
ASTTypeTraitsTest.cpp Update `DynTypedNode` to support the conversion of `TypeLoc`s. 2021-10-04 19:25:24 +00:00
ASTVectorTest.cpp Reland "[clang-repl] Implement partial translation units and error recovery." 2021-07-12 15:21:22 +00:00
AttrTest.cpp [AST][clangd] Expose documentation of Attrs on hover. 2021-08-12 21:16:37 +02:00
CMakeLists.txt [clang][unittests] Fix shared lib builds 2021-10-25 15:09:45 +02:00
CommentLexer.cpp Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17" 2022-01-26 16:55:53 +01:00
CommentParser.cpp Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17" 2022-01-26 16:55:53 +01:00
CommentTextTest.cpp [clang] NFC: test for undefined behaviour in RawComment::getFormattedText() 2021-06-07 03:05:00 -07:00
DataCollectionTest.cpp
DeclMatcher.h
DeclPrinterTest.cpp Revert "Rename llvm::array_lengthof into llvm::size to match std::size from C++17" 2022-01-26 16:55:53 +01:00
DeclTest.cpp [NFC] Add unittest for Decl::isInExportDeclContext 2022-02-23 16:29:42 +08:00
EvaluateAsRValueTest.cpp [NFC] Remove duplicate include 2022-01-27 13:56:13 +08:00
ExternalASTSourceTest.cpp
MatchVerifier.h [OpenCL] Add builtin declarations by default. 2021-02-22 12:24:16 +00:00
NamedDeclPrinterTest.cpp [clang] Refactor AST printing tests to share more infrastructure 2021-07-14 19:44:18 -04:00
RecursiveASTVisitorTest.cpp [clang] Add `ObjCProtocolLoc` to represent protocol references 2022-02-18 15:24:00 -05:00
SizelessTypesTest.cpp [llvm][SveEmitter] Emit the bfloat version of `svld1ro`. 2020-06-18 16:36:31 +00:00
SourceLocationTest.cpp [AST] Fix the incorrect auto-keyword loc for constrained auto type loc. 2022-01-19 14:18:38 +01:00
StmtPrinterTest.cpp [CodeCompletion][clangd] Clean __uglified parameter names in completion & hover 2022-01-26 15:51:17 +01:00
StructuralEquivalenceTest.cpp [clang][AST] Check context of record in structural equivalence. 2021-11-26 08:54:34 +01:00
TypePrinterTest.cpp [AST] Print NTTP args as string-literals when possible 2022-03-01 19:34:27 -06:00