[llvm] r178941 - Dwarf: use utostr on CUID to append to SmallString.

David Blaikie dblaikie at gmail.com
Tue Apr 23 05:31:29 PDT 2013


On Apr 6, 2013 12:05 PM, "Manman Ren" <mren at apple.com> wrote:
>
> Author: mren
> Date: Fri Apr  5 20:02:38 2013
> New Revision: 178941
>
> URL: http://llvm.org/viewvc/llvm-project?rev=178941&view=rev
> Log:
> Dwarf: use utostr on CUID to append to SmallString.
>
> We used to do "SmallString += CUID", which is incorrect, since CUID will
> be truncated to a char.
>
> rdar://problem/13573833
>
> Modified:
>     llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=178941&r1=178940&r2=178941&view=diff
>
==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Fri Apr  5 20:02:38
2013
> @@ -643,7 +643,7 @@ unsigned DwarfDebug::getOrCreateSourceID
>
>    // We look up the CUID/file/dir by concatenating them with a zero byte.
>    SmallString<128> NamePair;
> -  NamePair += CUID;
> +  NamePair += utostr(CUID);

I haven't looked at the source to verify what type 'cuid'is, but if we want
to avoid allowing += (and any similar ops) to implicitly narrow to char we
could add some sfinae magic or deleted overloads.

>    NamePair += '\0';
>    NamePair += DirName;
>    NamePair += '\0'; // Zero bytes are not allowed in paths.
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130423/fd01b99a/attachment.html>


More information about the llvm-commits mailing list