[llvm-commits] [llvm] r88703 - in /llvm/trunk: include/llvm/ADT/StringRef.h lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Dan Gohman
gohman at apple.com
Fri Nov 13 13:55:31 PST 2009
Author: djg
Date: Fri Nov 13 15:55:31 2009
New Revision: 88703
URL: http://llvm.org/viewvc/llvm-project?rev=88703&view=rev
Log:
Use .data() instead of .c_str() when nul-termination is not needed.
Modified:
llvm/trunk/include/llvm/ADT/StringRef.h
llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
Modified: llvm/trunk/include/llvm/ADT/StringRef.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/StringRef.h?rev=88703&r1=88702&r2=88703&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/StringRef.h (original)
+++ llvm/trunk/include/llvm/ADT/StringRef.h Fri Nov 13 15:55:31 2009
@@ -56,7 +56,7 @@
/// 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
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=88703&r1=88702&r2=88703&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Nov 13 15:55:31 2009
@@ -729,7 +729,7 @@
/// 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 {
More information about the llvm-commits
mailing list