<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi Richard,<br>
<br>
I've tried to follow it through from both ends but lost my way.<br>
I'll have a second go at it and suggest a patch.<br>
<br>
thank you<br>
<br>
Robert<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF446566"><font color="#000000" face="Tahoma" size="2"><b>From:</b> metafoo@gmail.com [metafoo@gmail.com] on behalf of Richard Smith [richard@metafoo.co.uk]<br>
<b>Sent:</b> 02 May 2014 00:35<br>
<b>To:</b> Robert Lytton<br>
<b>Cc:</b> cfe-dev@cs.uiuc.edu<br>
<b>Subject:</b> Re: [cfe-dev] using the original file name for compiling preprocessed files ("-main-file-name"?)<br>
</font><br>
</div>
<div></div>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">On Thu, May 1, 2014 at 2:22 AM, Robert Lytton <span dir="ltr">
<<a href="mailto:robert@xmos.com" target="_blank">robert@xmos.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hi,<br>
<br>
I would like to call clang twice, once to preprocess and second time to compile.<br>
The second time clang is called, I would like to pass in the original file name for it to use as the ModuleID.<br>
I tried to use:<br>
   clang -E test.c -o tmp.i<br>
   clang -S -x c tmp.i -o test.s    -Xclang -main-file-name -Xclang test.c   -emit-llvm<br>
<br>
However, the ModuleID is 'tmp.i' rather than that passed in by '-main-file-name'.<br>
</div>
</div>
</blockquote>
<div><br>
</div>
<div>This seems like a bug to me; -main-file-name should be used as the name of the input in all respects other than where we find it on disk. Care to put together a patch to fix this? (I doubt you'll be able to get anyone else to care much about what ends
 up in ModuleID, so I think you'll need to do the work yourself here...)</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Same with:<br>
    clang -cc1 -triple x86_64-unknown-linux-gnu -x c tmp.i -o test.s  -main-file-name test.c -emit-llvm<br>
<br>
<br>
I am trying to achieve the same affect as using "-fpreprocessed -dumpbase <file>" with llvm-gcc.<br>
Here it seems the gcc front end fetches the file name from the first line of the preprocessed file.<br>
<br>
Thank you.<span class="HOEnZb"><font color="#888888"><br>
<br>
Robert<br>
<br>
<br>
<br>
<br>
<br>
</font></span></div>
</div>
<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>