[PATCH] D64257: [clangd] Added highlighting for class and enum types

Johan Vikström via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 9 06:55:58 PDT 2019


jvikstrom added inline comments.


================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:38
   bool VisitNamedDecl(NamedDecl *ND) {
-    // FIXME: (De)Constructors/operator need to be highlighted some other way.
+    // Constructors have a TypePtr TagDecl that is a Function, therefore we need
+    // to get constructors as a NamedDecl instead.
----------------
hokein wrote:
> I don't understand this comment -- when visiting the constructor AST, we get a TagTypeLoc, and its underlying Decl is a `CXXConstructorDecl`
So the Constructor TypeLoc does not have a TagTypeDecl and is not a TagTypeLoc. When we get the TypePtr of the constructor it's a "FunctionProtoType" and there is no way to distinguish it from other functions. Therefore we need to get the constructor decls as NamedDecls..

The comment was written badly though. This version should be better now I hope.


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