[PATCH] D52890: Also report range for the name token on no_member error.
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 4 08:58:24 PDT 2018
kadircet created this revision.
kadircet added reviewers: sammccall, ilya-biryukov.
Herald added subscribers: cfe-commits, ioeric.
kadircet added a dependent revision: D52889: [clangd] Add new test to cover no_member diag..
[clang] Report range of the missing-memmber on no_member diagnostic.
Currently no_member diagnostic only reports to range for the structs name, which
is not very useful when highlighting. This patch also adds the identifier which
caused diagnostic as a range. For example:
struct Foo {
int x;
}
Foo foo;
foo.y;
only had [[foo]].y as a range and foo.^y as the location of the diagnostic.
After the patch it will have [[foo]].[[^y]] as ranges and location.
You can see the revision that adds a test in clangd as a dependent revision.
Repository:
rC Clang
https://reviews.llvm.org/D52890
Files:
lib/Sema/SemaExprMember.cpp
Index: lib/Sema/SemaExprMember.cpp
===================================================================
--- lib/Sema/SemaExprMember.cpp
+++ lib/Sema/SemaExprMember.cpp
@@ -1018,7 +1018,8 @@
Diag(R.getNameLoc(), diag::err_no_member)
<< MemberName << DC
- << (BaseExpr ? BaseExpr->getSourceRange() : SourceRange());
+ << (BaseExpr ? BaseExpr->getSourceRange() : SourceRange())
+ << MemberNameInfo.getSourceRange();
return ExprError();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52890.168306.patch
Type: text/x-patch
Size: 473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181004/c7a1152e/attachment.bin>
More information about the cfe-commits
mailing list