[PATCH] D65928: [clangd] Added an early return from VisitMemberExpr in SemanticHighlighting if the MemberLoc is invalid.
Haojian Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 8 05:06:50 PDT 2019
hokein accepted this revision.
hokein added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:56
+ if (isa<CXXConversionDecl>(MD))
+ // If the member is a conversion operator the loc will be invalid. This
+ // causes the addToken function to emit a lot of error logs about trying
----------------
jvikstrom wrote:
> hokein wrote:
> > Maybe just `The MemberLoc is invalid for C++ conversion operato , we don't attempt to add a token for an invalid location`?
> >
> >
> > Does the location is always invalid? or just for builtin types? e.g.
> > ```
> > class Foo {};
> > struct Bar {
> > explicit operator Foo*() const; // 1
> > explicit operator int() const; // 2
> > };
> > ```
> Builtin types has nothing to do with it. It's invalid for every conversion operator. Will actually add a test just to make sure that everything else is still highlighted correctly.
ah, I thought it is the operator declaration, but here we mean expression.
================
Comment at: clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp:268
+ $Class[[Bar]] $Variable[[B]];
+ $Class[[Foo]] $Variable[[F]] = $Variable[[B]];
+ $Class[[Foo]] *$Variable[[FP]] = ($Class[[Foo]]*)$Variable[[B]];
----------------
nit: could you add a comment describing the purpose of this test?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D65928/new/
https://reviews.llvm.org/D65928
More information about the cfe-commits
mailing list