[PATCH] D26332: Add a user-defined literal for StringRef

Paweł Żukowski via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 6 04:46:24 PST 2016


idlecode added inline comments.


================
Comment at: include/llvm/ADT/StringRef.h:778
+
+  namespace operators {
+  /// User defined literal
----------------
Does this operator need it's own namespace?


================
Comment at: lib/CodeGen/AsmPrinter/AsmPrinter.cpp:1221
     MCSymbol *AddrSymbol =
-        OutContext.getOrCreateSymbol(StringRef("__morestack_addr"));
+        OutContext.getOrCreateSymbol("__morestack_addr"_sr);
     OutStreamer->EmitLabel(AddrSymbol);
----------------
`getOrCreateSymbol` takes Twine as argument so `StringRef` conversion is not needed.
There is few other such use-cases but it would be quite tedious to fix them all manually - maybe clang-tidy could take care of it in the future.


https://reviews.llvm.org/D26332





More information about the llvm-commits mailing list