<p dir="ltr">All of the -cc1 and -Xclang interface is internal.</p>
<div class="gmail_quote">On 4 Apr 2014 09:09, "Lubos Lunak" <<a href="mailto:l.lunak@centrum.cz">l.lunak@centrum.cz</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Friday 04 of April 2014, David Blaikie wrote:<br>
> The comment in CGDebugInfo.cpp says that -main-file-name will contain<br>
> only the file name, with no path information. Are there cases where<br>
> that is not true when -main-file-name is passed from the Clang driver,<br>
> rather than by the user in your example below?<br>
><br>
> If the driver provides this guarantee and the user violates it when<br>
> passing an undocumented flag manually, I don't see a need to support<br>
> it - but if there is such a need, it'd be good to<br>
> understand/documemnt/discuss it.<br>
<br>
I think the driver always only passes the filename, but I do pass it<br>
explicitly, since I feed the source from stdin and the source or even its<br>
directory don't exist (distributed compiling, the same way with the patch<br>
for -dwarf-split-file).<br>
<br>
And actually case 2) without using the option explicitly results in<br>
DW_AT_name becoming "/-" (I don't know why the driver doesn't simply pass the<br>
name as it is, which wouldn't need the code that attempts to rebuild it<br>
later).<br>
<br>
As for "undocumented", the documentation status of the option is about the<br>
same like with many others - it's just in the .td file including its<br>
description. The description says quite clearly what the option does, it<br>
doesn't say it's internal, it works fine (except for these small problems), I<br>
even checked the sources to be sure, and I don't see why Clang should forbid<br>
usage of the option if I know what I'm doing (and would have to resort to<br>
ugly hacks otherwise).<br>
<br>
> On Fri, Apr 4, 2014 at 5:02 AM, Lubos Lunak <<a href="mailto:l.lunak@centrum.cz">l.lunak@centrum.cz</a>> wrote:<br>
> > The handling of -main-file-name in CGDebugInfo::CreateCompileUnit() can<br>
> > result in incorrect DW_AT_name in somewhat special cases:<br>
> ><br>
> > 1)<br>
> > $ touch /tmp/a.cpp<br>
> > $<br>
> > clang++ -Wall -c /tmp/a.cpp -g -o /tmp/a.o -Xclang -main-file-name<br>
> > -Xclang /new/path/a.cpp $ readelf -wi /tmp/a.o | grep DW_AT_name<br>
> > <12> DW_AT_name : (indirect string, offset:<br>
> > 0x15): /tmp/new/path/a.cpp<br>
> ><br>
> > 2)<br>
> > $ touch /tmp/a.cpp<br>
> > $ cd /<br>
> > $ cat /tmp/a.cpp | clang++ -Wall -x<br>
> > c++ -c - -g -o /tmp/a.o -Xclang -main-file-name -Xclang a.cpp<br>
> > $ readelf -wi /tmp/a.o | grep DW_AT_name<br>
> > <12> DW_AT_name : (indirect string, offset: 0x15): /a.cpp<br>
> ><br>
> > The attached patch fixes those. Ok to commit?<br>
--<br>
Lubos Lunak<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div>