No need to terminate this buffer.

llvm-svn: 94313
This commit is contained in:
Benjamin Kramer 2010-01-23 18:16:07 +00:00
parent 082da53f9a
commit 8f8f405c71
1 changed files with 3 additions and 4 deletions

View File

@ -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