[PATCH] D95536: [clang][sema] Note decl location on missing member
Timm Bäder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 17 05:13:19 PST 2021
tbaeder added a comment.
In D95536#2557197 <https://reviews.llvm.org/D95536#2557197>, @aaron.ballman wrote:
> Hmm... I feel like the diagnostic should already be sufficient to locate the originating location of the class or namespace and the note is adding a bit more (almost, but not quite) noise,
I guess this makes sense when you're talking about https://godbolt.org/z/1Yo3Pj, but I don't understand how I would know where `OsType` is defined in https://godbolt.org/ in a larger code base (e.g. when using `OsType` in clang, with it being defined in llvm).
> Anonymous namespaces:
>
> namespace foo {
> namespace {
> void func();
> }
> }
>
> void bar() {
> foo::blarg(); // Should point to 'foo'?
> }
Seems to work:
./enum.cpp:56:8: error: no member named 'blarg' in namespace 'foo'
foo::blarg(); // Should point to 'foo'?
~~~~~^
./enum.cpp:49:11: note: namespace 'foo' declared here
namespace foo {
^~~
You list a few more interesting corner cases however. I'm not sure if I want to pursue this patch further as it is already quite ugly because it's touching all those tests. Or if it would be better to implement a note that lists all enum members (up to a certain threshold?), but just for enums.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D95536/new/
https://reviews.llvm.org/D95536
More information about the cfe-commits
mailing list