<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 3, 2015 at 10:00 PM, Manuel Klimek <span dir="ltr"><<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><div dir="ltr">On Wed, Jun 3, 2015 at 1:47 PM Nathan Wilson <<a href="mailto:nwilson20@gmail.com" target="_blank">nwilson20@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr"><br>
On Jun 3, 2015 4:23 AM, "Manuel Klimek" <<a href="mailto:klimek@google.com" target="_blank">klimek@google.com</a>> wrote:<br>
><br>
> On Tue, Jun 2, 2015 at 9:25 PM Nate Wilson <<a href="mailto:nwilson20@gmail.com" target="_blank">nwilson20@gmail.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> Is there any way to get information about where a diagnostic came from in clang, e.g. the source from which the Diagnostic was constructed? For example, when I try to assign to a member which doesn't exist in my class/struct, I get:<br>
>><br>
>> error: no member named 'foo' in 'Bar'<br>
>><br>
>> Is there anyway for clang to tell me where this Diagnostic came from?<br>
><br>
><br>
> Do you mean where in the Clang source it was generated? </p>
<p dir="ltr">Yes I do, but i imagine it's not possible. Correct? Sorry for the ambiguity. I'm asking about this because I'd like to see how clang determined what I'm doing is wrong by looking at a backtrace (or something). Not just in this case, but for something a little more complicated in general as well which won't get put into the AST.</p></blockquote><div><br></div></span><div>Generally, you search for the diagnostic in the clang source code. Diagnostics are in so-called tablegen files. Those will define the diagnostic text and a constant that's used in the code. Once you have that constant, you look for that constant in the clang source code, which then shows you under which circumstances that diagnostic is emitted.</div><span class=""><div> </div></span></div></div></blockquote><div><br></div><div>Or you put a breakpoint inside DiagnosticBuilder::Emit and run clang with a file that produces the error under a debugger.</div></div></div></div>