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

Zhihao Yuan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 28 11:44:02 PST 2022


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 need `"escaping?"`


================
Comment at: clang/lib/AST/APValue.cpp:676-683
+  if (Ty->isWideCharType())
+    Out << 'L';
+  else if (Ty->isChar8Type())
+    Out << "u8";
+  else if (Ty->isChar16Type())
+    Out << 'u';
+  else if (Ty->isChar32Type())
----------------
aaron.ballman wrote:
> Not quite the same thing, but do we have to worry about printing pascal strings here? (e.g., do we need to do `"\pwhatever"`?
This is in `APValue` where we lost the context of StringLiteral; nothing tells me that this array was created from a Pascal string literal. Unless you want to do some heuristics, like printing `"\pthis"` when seens an `unsigned char[6]` where the first element = 4 (last element = 0 is checked at the beginning).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115031/new/

https://reviews.llvm.org/D115031



More information about the cfe-commits mailing list