aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-11-13 21:55:31 +0000
committerDan Gohman <gohman@apple.com>2009-11-13 21:55:31 +0000
commit24f8e29b4efe70496474c6d43aa6abfa27c21511 (patch)
treeda0eb51f0d939fca43d7d85cbde3b9a0c6728853
parenta2b3cdc21f51d0e24310878b0c759ec48b5e6749 (diff)
downloadexternal_llvm-24f8e29b4efe70496474c6d43aa6abfa27c21511.tar.gz
external_llvm-24f8e29b4efe70496474c6d43aa6abfa27c21511.tar.bz2
external_llvm-24f8e29b4efe70496474c6d43aa6abfa27c21511.zip
Use .data() instead of .c_str() when nul-termination is not needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88703 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/StringRef.h2
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/include/llvm/ADT/StringRef.h b/include/llvm/ADT/StringRef.h
index 6b17eb22de..b6486e7676 100644
--- a/include/llvm/ADT/StringRef.h
+++ b/include/llvm/ADT/StringRef.h
@@ -56,7 +56,7 @@ namespace llvm {
/// Construct a string ref from an std::string.
/*implicit*/ StringRef(const std::string &Str)
- : Data(Str.c_str()), Length(Str.length()) {}
+ : Data(Str.data()), Length(Str.length()) {}
/// @}
/// @name Iterators
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 9bac860013..7c5c23b268 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -729,7 +729,7 @@ static void printStringChar(formatted_raw_ostream &O, unsigned char C) {
/// Special characters are emitted properly.
/// \literal (Eg. '\t') \endliteral
void AsmPrinter::EmitString(const std::string &String) const {
- EmitString(String.c_str(), String.size());
+ EmitString(String.data(), String.size());
}
void AsmPrinter::EmitString(const char *String, unsigned Size) const {