This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Added highlighting for members and methods
ClosedPublic

Authored by jvikstrom on Jul 12 2019, 1:37 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

jvikstrom created this revision.Jul 12 2019, 1:37 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 12 2019, 1:37 AM
jvikstrom edited the summary of this revision. (Show Details)Jul 12 2019, 2:24 AM
sammccall accepted this revision.Jul 12 2019, 2:30 AM

LG from my side

clang-tools-extra/clangd/SemanticHighlighting.h
28 ↗(On Diff #209425)

nit: clang calls these Field which is terser and pretty understandable, I think.

(Formally, I think these are data members and "methods" are member functions, but I like the shorter names better)

This revision is now accepted and ready to land.Jul 12 2019, 2:30 AM
hokein added inline comments.Jul 12 2019, 2:51 AM
clang-tools-extra/clangd/SemanticHighlighting.cpp
44 ↗(On Diff #209425)

nit: this can be simplified like

if (const auto* D = dyn_cast<CXXDestructorDecl>(ME->getMemberDecl())) {
  // When calling the destructor manually like: AAA::~A(); The ~ is a
  // MemberExpr.  
 return true;
}
53 ↗(On Diff #209425)

It took me a while to understand how the comment associate with the code here, maybe add and we use the MemberExpr in the comment?

142 ↗(On Diff #209425)

nit: clang-format.

As it is class-related, could you move it to Line 133 (immediately after the Class case), the same to the FieldDecl.

clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp
140 ↗(On Diff #209425)

could you add a test case for static member?

jvikstrom updated this revision to Diff 209509.Jul 12 2019, 9:21 AM
jvikstrom marked 6 inline comments as done.

Addressed comments.

jvikstrom updated this revision to Diff 209510.Jul 12 2019, 9:22 AM

Removed addToken for Exprs.

Harbormaster completed remote builds in B34877: Diff 209510.
hokein accepted this revision.Jul 12 2019, 2:03 PM
hokein added inline comments.
clang-tools-extra/clangd/SemanticHighlighting.h
28 ↗(On Diff #209510)

nit: put it Field around Class.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 15 2019, 1:12 AM