[PATCH] D67341: [clangd] Simplify semantic highlighting visitor
Ilya Biryukov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 10 02:44:08 PDT 2019
ilya-biryukov added inline comments.
================
Comment at: clang-tools-extra/clangd/SemanticHighlighting.cpp:169
private:
- void addTokenForTypedef(SourceLocation Loc, const TypedefNameDecl *TD) {
- auto *TSI = TD->getTypeSourceInfo();
- if (!TSI)
- return;
- // Try to highlight as underlying type.
- if (addType(Loc, TSI->getType().getTypePtrOrNull()))
- return;
- // Fallback to the typedef highlighting kind.
- addToken(Loc, HighlightingKind::Typedef);
- }
-
- bool addType(SourceLocation Loc, const Type *TP) {
+ llvm::Optional<HighlightingKind> kindForType(const Type *TP) {
if (!TP)
----------------
hokein wrote:
> how about moving out this method (and `kindForDecl`) of the class, they seem to not depend on any fields of the class?
Makes sense. Done.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67341/new/
https://reviews.llvm.org/D67341
More information about the cfe-commits
mailing list