<p dir="ltr"><br>
On Jun 3, 2015 4:23 AM, "Manuel Klimek" <<a href="mailto:klimek@google.com">klimek@google.com</a>> wrote:<br>
><br>
> On Tue, Jun 2, 2015 at 9:25 PM Nate Wilson <<a href="mailto:nwilson20@gmail.com">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>
<p dir="ltr">>><br>
>> Similarly, when the AST is constructed and I'm able to assign a value to foo, is there anyway for me to get the information about where the lookup is correctly found (for a data member in particular)? <br>
>><br>
>> Or, do would I need to do some libAST tooling, get called back when a match is found, and debug from there?<br>
><br>
><br>
> Depends on what you want to do - can you expand on what you are trying to build?<br>
> </p>
<p dir="ltr">Sure, in this case there's a bug/feature request which I'd like work on by looking at data members when they're being assigned to in a BinaryOp, and if the syntax is not this->... = ..., emit a warning.</p>
<p dir="ltr">That's the source of my question. But, something else off the top off my head would be to see the valid use of a dependent type being looked up and used.</p>
<p dir="ltr">Does that help?</p>
<p dir="ltr">>><br>
>> I'd appreciate any help.<br>
>><br>
>> Thank you,<br>
>><br>
>> Nate<br>
>><br>
>><br>
</p>