[cfe-commits] r54659 - in /cfe/trunk/lib/CodeGen: CGExprConstant.cpp CGObjC.cpp CGObjCGNU.cpp CGObjCMac.cpp CGObjCRuntime.h

Daniel Dunbar daniel at zuster.org
Mon Aug 11 22:37:39 PDT 2008


The purpose was to simplify the API since both consumers were making std::strings
after the call anyhow. This needs to be updated anyway as the strings should probably
be interned in the same way that CodeGenModule is interning c-strings. 

I'll change the interface to take the ObjCStringLiteral directly and do the more efficient
thing.

Note that on the string copying level of efficiency CodeGenModule currently does more
copying than it should. We should merge getStringForStringLiteral with 
GetAddrOfConstantString (once the terminating '\0' semantics are worked out) and then
it is easy to make efficient.

 - Daniel



----- Original Message ----
From: Chris Lattner <clattner at apple.com>
To: Daniel Dunbar <daniel at zuster.org>
Cc: cfe-commits at cs.uiuc.edu
Sent: Monday, August 11, 2008 10:09:31 PM
Subject: Re: [cfe-commits] r54659 - in /cfe/trunk/lib/CodeGen: CGExprConstant.cpp CGObjC.cpp CGObjCGNU.cpp CGObjCMac.cpp CGObjCRuntime.h

On Aug 11, 2008, at 5:12 PM, Daniel Dunbar wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=54659&view=rev
> Log:
> Add ObjC constant string support for NeXT.
>
> Changed CGObjCRuntime::GenerateConstantString interface to take
>       std::string instead of char* and size.

Hey Daniel,

What is the advantage of this approach?  The std::string does a copy  
of the data now which isn't strictly needed.

-Chris



More information about the cfe-commits mailing list