[PATCH] D25639: Add ctor for string literal to StringRef, and make explicit the conversion from const char *

Noel Grandin via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 14 23:00:25 PDT 2016


grandinj added a comment.

You might like to take a look at the ConstCharArrayDetector stuff in the LibreOffice codebase here:

  https://cgit.freedesktop.org/libreoffice/core/tree/include/rtl/ustring.hxx

where Stephan Bergman has implemented optimisations to avoid calling strlen() at runtime when dealing with static const char arrays.

As far as I know, clang will compute strlen() at compile time if it knows the string being passed is a static constant


https://reviews.llvm.org/D25639





More information about the llvm-commits mailing list