[cfe-commits] r95853 - in /cfe/trunk: include/clang/AST/Attr.h lib/AST/AttrImpl.cpp lib/AST/Decl.cpp lib/CodeGen/CodeGenModule.cpp lib/Frontend/PCHReaderDecl.cpp lib/Sema/SemaDecl.cpp lib/Sema/SemaDeclAttr.cpp

Chris Lattner clattner at apple.com
Wed Feb 10 23:41:45 PST 2010


On Feb 10, 2010, at 9:54 PM, Ted Kremenek wrote:

> Not all of these attributes use strings based on StringExprs, but for those that do that's a good idea.

Are you sure?  I see code like this:

> -  d->addAttr(::new (S.Context) AliasAttr(Str->getString()));
> +  d->addAttr(::new (S.Context) AliasAttr(S.Context, Str->getString()));

Can't it just use Str instead of Str->getString()?

-Chris

> 
> On Feb 10, 2010, at 9:38 PM, Chris Lattner wrote:
> 
>> 
>> On Feb 10, 2010, at 9:28 PM, Ted Kremenek wrote:
>> 
>>> Author: kremenek
>>> Date: Wed Feb 10 23:28:37 2010
>>> New Revision: 95853
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=95853&view=rev
>>> Log:
>>> Remove use of 'std::string' from Attr objects, using instead a byte
>>> array allocated using the allocator in ASTContext.  This addresses
>>> these strings getting leaked when using a BumpPtrAllocator (in
>>> ASTContext).
>>> 
>>> Fixes: <rdar://problem/7636765>
>> 
>> Would it work to just make these have StringExpr*'s?  The memory is already allocated by the parsing/sema code, do we really need to copy it?





More information about the cfe-commits mailing list