summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
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
commit8f8f405c715e4955e6b3086ba751a4cc06a3930d (patch)
treebaafb153ab7cc778a9e7db6977ec370710a03965 /clang/lib/CodeGen/CGDebugInfo.cpp
parent082da53f9aca3620af301f5d2232f240ef834919 (diff)
downloadbcm5719-llvm-8f8f405c715e4955e6b3086ba751a4cc06a3930d.tar.gz
bcm5719-llvm-8f8f405c715e4955e6b3086ba751a4cc06a3930d.zip
No need to terminate this buffer.
llvm-svn: 94313
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 1ffad3edcac..cd81d99775c 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud