[PATCH] D64257: [clangd] Added highlighting for non-builtin types

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 8 08:09:02 PDT 2019


hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:73
+    if (auto RD = dyn_cast<CXXRecordDecl>(D)) {
+      if (auto DC = RD->getDestructor()) {
+        auto Range = DC->getSourceRange();
----------------
jvikstrom wrote:
> hokein wrote:
> > Here is the case:
> > 
> > ```
> > class Foo {
> >    ~Foo
> >  // ^~~ we get a TypeLoc whose TagDecl is a cxxRecordDecl.
> > }
> > ```
> > not sure this is expected in clang AST, but it is unreasonable in highlighting context -- ideally, we want to highlight `~Foo` as a destructor (we may encounter a tricky case, like `~ /*comment*/ Foo()`, but I assume this is rarce, should be fine), @sammccall, @ilya-biryukov, thoughts?
> Do we want to highlight the entire "~Foo" or only the ~"Foo" for destructors?
> 
based on our discussion, we'd just highlight ~"Foo" as a class type for now.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64257





More information about the cfe-commits mailing list