[cfe-commits] r94753 - in /cfe/trunk/lib/CodeGen: CGDebugInfo.cpp CGDebugInfo.h

Chris Lattner clattner at apple.com
Thu Jan 28 14:18:51 PST 2010


On Jan 28, 2010, at 10:21 AM, Devang Patel wrote:
> Author: dpatel
> Date: Thu Jan 28 12:21:00 2010
> New Revision: 94753
>
> URL: http://llvm.org/viewvc/llvm-project?rev=94753&view=rev
> Log:
> s/FunctionNames/DebugInfoNames/g

Hi devang,

> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Thu Jan 28 12:21:00 2010
> @@ -78,7 +78,7 @@
>   std::string NS = FD->getNameAsString();
>
>   // Copy this name on the side and use its reference.
> -  char *StrPtr = FunctionNames.Allocate<char>(NS.length());
> +  char *StrPtr = DebugInfoNames.Allocate<char>(NS.length());
>   memcpy(StrPtr, NS.data(), NS.length());
>   return llvm::StringRef(StrPtr, NS.length());

This seems like a really inefficient way to do this.  getNameAsString  
is not efficient because it returns an std::string, and each call to  
this function allocates and leaks (into the bumppointer allocator) the  
string.  Why not just use a StringSet to unique the strings and  
provide a stable version of the name?

-Chris




More information about the cfe-commits mailing list