<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 13 February 2018 at 08:53, Frank Redeker via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello list,<br>
<br>
I'm using ClangTool.buildASTs() to create the ASTs for a given set of<br>
source files.<br>
<br>
I wonder why #line directives are ignored. (Or have I missed some option<br>
when setting up my ClangTool instance. Or must I fix the line numbers in<br>
my own DiagnosticsConsumer)<br></blockquote><div><br></div><div>How are you setting your DiagnosticOptions? Generally we'd expect these to be set by a call to CompilerInvocation::CreateFromArgs, which sets DiagnosticOptions::ShowPresumedLoc to 'true' by default (giving the output you see from Clang). Since you're using libTooling, ToolInvocation::run() is the place I'd expect this to happen.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When compiling the following source<br>
<br>
#line 123 "foo"<br>
void foo () {<br>
  if (condition) {<br>
  }<br>
}<br>
<br>
clang -c test.c gives the following output:<br>
<br>
foo:123:6: error: use of undeclared identifier 'condition'<br>
        if (condition) {<br>
            ^<br>
1 error generated.<br>
<br>
<br>
But my program gives the following output:<br>
<br>
t:\test.c:3:6: error: use of undeclared identifier 'condition'<br>
        if (condition) {<br>
            ^<br>
IDB32++: Fatal - Analyze terminated with errors<br>
<br>
<br>
Frank<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div></div>