[cfe-commits] r98112 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
Daniel Dunbar
daniel at zuster.org
Wed Mar 10 15:35:01 PST 2010
On Wed, Mar 10, 2010 at 12:48 PM, Devang Patel <dpatel at apple.com> wrote:
>
> On Mar 10, 2010, at 11:46 AM, Daniel Dunbar wrote:
>
>> Hi Devang,
>>
>> Can you use raw_ostream instead of resize + sprintf please? Tx!
>
> I switched to SmallString as per recommendation. I'd rather do it right way and eliminate need for a temp name. Is there a very good reason to not use SmallString ? Feel free to update if there is one.
Using raw_(svector_)ostream implies using SmallString.
- Daniel
> -
> Devang
>
>>
>> - Daniel
>>
>> On Tue, Mar 9, 2010 at 4:19 PM, Devang Patel <dpatel at apple.com> wrote:
>>> Author: dpatel
>>> Date: Tue Mar 9 18:19:43 2010
>>> New Revision: 98112
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=98112&view=rev
>>> Log:
>>> Use SmallString instead of alloca.
>>>
>>> Modified:
>>> cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=98112&r1=98111&r2=98112&view=diff
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Tue Mar 9 18:19:43 2010
>>> @@ -774,8 +774,9 @@
>>>
>>> // A RD->getName() is not unique. However, the debug info descriptors
>>> // are uniqued so use type name to ensure uniquness.
>>> - char *FwdDeclName = (char *)alloca(65);
>>> - sprintf(FwdDeclName, "fwd.type.%d", FwdDeclCount++);
>>> + llvm::SmallString<256> FwdDeclName;
>>> + FwdDeclName.resize(256);
>>> + sprintf(&FwdDeclName[0], "fwd.type.%d", FwdDeclCount++);
>>> llvm::DIDescriptor FDContext =
>>> getContextDescriptor(dyn_cast<Decl>(RD->getDeclContext()), Unit);
>>> llvm::DICompositeType FwdDecl =
>>>
>>>
>>> _______________________________________________
>>> cfe-commits mailing list
>>> cfe-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>
>
>
More information about the cfe-commits
mailing list