[PATCH] fix for CGDebugInfo.cpp filename append

Yaron Keren yaron.keren at gmail.com
Thu Oct 17 12:23:43 PDT 2013


Yes, using .str() will work, but it involves creating yet another
temporary, a StringRef returned from .str() and then converted to
std::string. An optimizer may help here.
The most efficient code would be

      MainFileName.assign(MainFileDirSS.data(), MainFileDirSS.size());

What I was hoping for is to avoid using the SmallString conversions.

Are the path functions using SmallStrings for efficiency or is there
another reason?

Yaron


2013/10/17 David Blaikie <dblaikie at gmail.com>

> I think instead of writing:
>
> MainFileName = std::string(MainFileDirSS.data(), MainFileDirSS.size());
>
> you can just write:
>
> MainFileName = MainFileDirSS.str();
>
> Hopefully.



On Thu, Oct 17, 2013 at 8:09 AM, Yaron Keren <yaron.keren at gmail.com> wrote:

> Hi,
>
> Filename appending in CGDebugInfo.cpp was implemented as simple string
> concatenation, resulting in duplicate file debug information on Windows due
> to wrong path separator.
>
> The patch uses  llvm::sys::path::append to properly append the filename on
> all OS.
>
> Is there a way to use path::append without the SmallString temporary?
>
> Yaron
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131017/1c0c55db/attachment.html>


More information about the cfe-commits mailing list