From 81187ae82a322caba25211d5384df2e723d62533 Mon Sep 17 00:00:00 2001
From: Chris Lattner Although LLVM generally does not do much string manipulation, we do have
-several important APIs which take string. Several important examples are the
+several important APIs which take strings. Two important examples are the
Value class -- which has names for instructions, functions, etc. -- and the
StringMap class which is used extensively in LLVM and Clang. These are generic classes, and they need to be able to accept strings which
may have embedded null characters. Therefore, they cannot simply take
-a const char *, and taking a const std::string& requires
+a const char *, and taking a const std::string& requires
clients to perform a heap allocation which is usually unnecessary. Instead,
-many LLVM APIs use a const StringRef& or a const Twine& for
-passing strings efficiently.
It can be implicitly constructed using a C style null-terminated string, +an std::string, or explicitly with a character pointer and length. For example, the StringRef find function is declared as:
+and clients can call it using any one of:
@@ -489,7 +490,7 @@ for more information.You should rarely use the StringRef class directly, because it contains pointers to external memory it is not generally safe to store an instance of the -class (since the external storage may be freed).
+class (unless you know that the external storage will not be freed).