[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-03-01 Thread Zhihao Yuan via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG44eee659f1c5: [AST] Print NTTP args as string-literals when possible (authored by lichray). Repository: rG LLVM Github Monorepo CHANGES SINCE

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-03-01 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 412289. lichray added a comment. Herald added a project: All. - Add a trigraph test case Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files:

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-03-01 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. Aside from a testing nit, this LGTM! Comment at: clang/include/clang/Basic/CharInfo.h:199-200 +return "\\t"; + case '\v': +return "\\v"; + }

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-02-28 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray marked 4 inline comments as done. lichray added inline comments. Comment at: clang/include/clang/Basic/CharInfo.h:199-200 +return "\\t"; + case '\v': +return "\\v"; + } aaron.ballman wrote: > lichray wrote: > > aaron.ballman wrote: > > > We're

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-02-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/CharInfo.h:199-200 +return "\\t"; + case '\v': +return "\\v"; + } lichray wrote: > aaron.ballman wrote: > > We're also missing `\?` right? > `?` does not seem to need

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-02-28 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray marked 3 inline comments as done. lichray added inline comments. Comment at: clang/include/clang/Basic/CharInfo.h:199-200 +return "\\t"; + case '\v': +return "\\v"; + } aaron.ballman wrote: > We're also missing `\?` right? `?` does not seem to

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-02-28 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 411856. lichray added a comment. - Revert some auto's Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/include/clang/AST/DeclTemplate.h

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-02-28 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/CharInfo.h:199-200 +return "\\t"; + case '\v': +return "\\v"; + } We're also missing `\?` right? Comment at: clang/lib/AST/APValue.cpp:658 + for (auto :

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-02-11 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 408137. lichray added a comment. Rerun pre-merge checks Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/include/clang/AST/DeclTemplate.h

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-02-10 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 407464. lichray added a comment. Rebased Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/include/clang/AST/DeclTemplate.h

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-27 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 403760. lichray added a comment. Rebased Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/include/clang/AST/DeclTemplate.h

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-25 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment. Ping. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-22 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray marked an inline comment as done. lichray added a comment. Restricted the ellipsis only to diagnosis. Type comparison now shows full initializers, which could be made smarter next time. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-21 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 402180. lichray added a comment. - Flip the default and set EntireContentsOfLargeArray off only in diagnosis Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files:

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-12 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/include/clang/AST/PrettyPrinter.h:288 + /// template parameters, no matter how many elements there are. + unsigned EntireContentsOfLargeArray : 1; + lichray wrote: > rsmith wrote: > > It looks like nothing is

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-12 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 399433. lichray added a comment. Rebase Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/include/clang/AST/DeclTemplate.h

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2022-01-12 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 399415. lichray added a comment. - clang-format Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/include/clang/AST/DeclTemplate.h

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-28 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 396408. lichray added a comment. - Put tests in TypePrinterTest.cpp Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/include/clang/AST/DeclTemplate.h

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-24 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray marked 2 inline comments as done. lichray added inline comments. Comment at: clang/include/clang/AST/PrettyPrinter.h:288 + /// template parameters, no matter how many elements there are. + unsigned EntireContentsOfLargeArray : 1; + rsmith wrote: > It

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-24 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 396187. lichray marked an inline comment as done. lichray added a comment. Herald added a subscriber: mgorny. - Fix categorizing int64_t chars of negative values - More ArrayRef - Fix and test the EntireContentsOfLargeArray bit Repository: rG LLVM Github

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-15 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/include/clang/AST/PrettyPrinter.h:288 + /// template parameters, no matter how many elements there are. + unsigned EntireContentsOfLargeArray : 1; + It looks like nothing is setting this to `true` yet, so that

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-15 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment. @rsmith Ping. I'm all on you :) You are almost the only one designed these files. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 ___

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-07 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added a comment. Ping. Ready to review again. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 ___ cfe-commits mailing list cfe-commits@lists.llvm.org

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-04 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 391833. lichray marked an inline comment as done. lichray added a comment. - Switch to `llvm::SmallString` - Refactor code that prints C-style builtin escape sequences - Stop printing strings with embedded NULs in NTTP types - Add an

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-04 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray marked 5 inline comments as done. lichray added inline comments. Comment at: clang/lib/AST/APValue.cpp:637-639 + // Nothing we can do about a sequence that is not null-terminated + if (!Data[--Size].getInt().isZero()) +return false; lichray wrote:

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added inline comments. Comment at: clang/lib/AST/APValue.cpp:637-639 + // Nothing we can do about a sequence that is not null-terminated + if (!Data[--Size].getInt().isZero()) +return false; lichray wrote: > rsmith wrote: > > lichray wrote: > > >

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added inline comments. Comment at: clang/lib/AST/APValue.cpp:637-639 + // Nothing we can do about a sequence that is not null-terminated + if (!Data[--Size].getInt().isZero()) +return false; rsmith wrote: > lichray wrote: > > rsmith wrote: > > > We

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/lib/AST/APValue.cpp:637-639 + // Nothing we can do about a sequence that is not null-terminated + if (!Data[--Size].getInt().isZero()) +return false; lichray wrote: > rsmith wrote: > > We should drop all

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray added inline comments. Comment at: clang/lib/AST/APValue.cpp:628-629 +static bool TryPrintAsStringLiteral(raw_ostream , const ArrayType *ATy, +const APValue *Data, size_t Size) { + if (Size == 0) rsmith wrote: > Is

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 391744. lichray added a comment. Ensure the ellipses output is never shorter than the normal ones (will look at review comments later) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added inline comments. Comment at: clang/lib/AST/APValue.cpp:628-629 +static bool TryPrintAsStringLiteral(raw_ostream , const ArrayType *ATy, +const APValue *Data, size_t Size) { + if (Size == 0) Is there anything

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 391718. lichray added a comment. Add EOL to source file Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/lib/AST/APValue.cpp

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 391717. lichray added a comment. - Add tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/lib/AST/APValue.cpp

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 391602. lichray added a comment. Restore deleted comment Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/lib/AST/APValue.cpp Index:

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray updated this revision to Diff 391600. lichray added a comment. Fix failed assertion Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D115031/new/ https://reviews.llvm.org/D115031 Files: clang/lib/AST/APValue.cpp Index:

[PATCH] D115031: [AST] Print NTTP args as string-literals when possible

2021-12-03 Thread Zhihao Yuan via Phabricator via cfe-commits
lichray created this revision. lichray requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. C++20 NTTP (non-type template parameter) prints `MyType<{{116, 104, 105, 115}}>` when the code is as simple as `MyType<"this">`. Of course, due to the