aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-01-23 18:16:07 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-01-23 18:16:07 +0000
commit1b627dc566f9f6fd7b8acfbb47fef4bedab688cf (patch)
treea9cc238e1abfcaa293f113a0410ff383ae1dbee9 /lib/CodeGen
parent23e1ad09bb68f929212e0ff51206258d06e7f6cf (diff)
No need to terminate this buffer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94313 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 1ffad3edca..cd81d99775 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -78,10 +78,9 @@ llvm::StringRef CGDebugInfo::getFunctionName(const FunctionDecl *FD) {
std::string NS = FD->getNameAsString();
// Copy this name on the side and use its reference.
- unsigned Length = NS.length() + 1;
- char *StrPtr = FunctionNames.Allocate<char>(Length);
- strncpy(StrPtr, NS.c_str(), Length);
- return llvm::StringRef(StrPtr);
+ char *StrPtr = FunctionNames.Allocate<char>(NS.length());
+ memcpy(StrPtr, NS.data(), NS.length());
+ return llvm::StringRef(StrPtr, NS.length());
}
/// getOrCreateCompileUnit - Get the compile unit from the cache or create a new