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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 28 10:49:42 PST 2022


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 &Val : Inits) {
+    auto Char64 = Val.getInt().getExtValue();
+    if (!isASCII(Char64))
----------------



================
Comment at: clang/lib/AST/APValue.cpp:663
+    // The diagnostic message is 'quoted'
+    auto Escaped = escapeCStyle<EscapeChar::SingleAndDouble>(Ch);
+    if (Escaped.empty()) {
----------------



================
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())
----------------
Not quite the same thing, but do we have to worry about printing pascal strings here? (e.g., do we need to do `"\pwhatever"`?


================
Comment at: clang/lib/AST/Expr.cpp:1137
+    uint32_t Char = getCodeUnit(I);
+    auto Escaped = escapeCStyle<EscapeChar::Double>(Char);
+    if (Escaped.empty()) {
----------------



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