[PATCH] D65928: [clangd] Added an early return from VisitMemberExpr in SemanticHighlighting if the MemberLoc is invalid.

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 8 04:18:00 PDT 2019


jvikstrom updated this revision to Diff 214110.
jvikstrom marked an inline comment as done.
jvikstrom added a comment.

Changed to do an isa<CXXConversion> check instead of checking if MemberLoc is invalid.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65928/new/

https://reviews.llvm.org/D65928

Files:
  clang-tools-extra/clangd/SemanticHighlighting.cpp


Index: clang-tools-extra/clangd/SemanticHighlighting.cpp
===================================================================
--- clang-tools-extra/clangd/SemanticHighlighting.cpp
+++ clang-tools-extra/clangd/SemanticHighlighting.cpp
@@ -52,6 +52,11 @@
       // When calling the destructor manually like: AAA::~A(); The ~ is a
       // MemberExpr. Other methods should still be highlighted though.
       return true;
+    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
+      // to add a token with an invalid range.
+      return true;
     addToken(ME->getMemberLoc(), MD);
     return true;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65928.214110.patch
Type: text/x-patch
Size: 745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190808/a205c288/attachment.bin>


More information about the cfe-commits mailing list