[PATCH] D123064: [Clang][C++23] P2071 Named universal character escapes

Corentin Jabot via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 11 10:51:36 PDT 2022


cor3ntin added inline comments.


================
Comment at: clang/lib/Lex/LiteralSupport.cpp:238
+             diag::err_delimited_escape_missing_brace)
+            << std::string(1, 'o');
 
----------------
aaron.ballman wrote:
> Can you use `"o"` instead of constructing a `std::string` for it?
Why do simple when you can do complicated?....


================
Comment at: clang/lib/Lex/LiteralSupport.cpp:501
+  auto Matches = llvm::sys::unicode::nearestMatchesForCodepointName(Name, 5);
+  assert(!Matches.empty() && "No unicode characters found");
+
----------------
aaron.ballman wrote:
> Just double checking that the assertion here is valid and the function can never return an empty set.
you should always get some result yes, at it find all the characters with the smallest edit distance


================
Comment at: llvm/include/llvm/ADT/StringExtras.h:329
 
+std::string to_hexString(uint64_t Value, bool UpperCase = true);
+
----------------
aaron.ballman wrote:
> `utohexstr()` already exists on line 152 -- any reason we can't reuse that?
I guess I missed that. Why do we have 2 functions doing the same thing?
How do you want me to clean that up?
I think we should have a separate nfc patch to clean that afterwards


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123064



More information about the llvm-commits mailing list