bogner wrote:

> I agree that "is declared here" is useless when "here" is... nowhere. But the 
> point to the note is to help the user to see what the actual declaration is 
> to help them repair the issue. Losing the note entirely isn't the worst 
> thing, but I wonder if it would be better for declarations coming from 
> external AST sources to pretty print the declaration instead? e.g., Before:
> 
> ```
> hlsl::vector<1> BadVec; // expected-error{{template argument for template 
> type parameter must be a type}}
> // expected-note@*:* {{template is declared here}}
> // expected-note@*:* {{template parameter is declared here}}
> ```
> 
> After:
> 
> ```
> hlsl::vector<1> BadVec; // expected-error{{template argument for template 
> type parameter must be a type}}
> // expected-note@-1 {{template declaration from hidden source: template 
> <typename Ty> vector}}
> // expected-note@-2 {{template parameter from hidden source: typename Ty}}
> ```
> 
> This would give the user more relevant information than just dropping the 
> notes. (I have no idea if I'm asking for something incredibly difficult but I 
> was thinking we could use the declaration printer to print this information 
> out to the diagnostic in these cases.)

I made an attempt at this, and I think I like it. It does have a bit of novelty 
in terms of how it generates appropriate errors though.

https://github.com/llvm/llvm-project/pull/71264
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to