Done in VisitDeclaratorDecl as the AutoTypeLoc is not deduced.
Scoped to only work for variables.
auto function return values need to be handled in a special way (separate patch for that).
auto's that are in lambdas ar enot highlighted as we don't highlight their underlying type (it's a RecordDecl, but the name is not an identifier so it returns in addToken).
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
153 ↗ | (On Diff #214319) | The heuristic using here is fragile, (it doesn't handle decltype (auto) correctly). I'm not quite sure we really want to highlight the inner auto, it may introduce inconsistent behavior (see we have $Primitive[[decltype]]($Variable[[Form]]) in the unittest). I think we could just leave it with the default behavior here... |
154 ↗ | (On Diff #214319) | nit: remove the debug log |
161 ↗ | (On Diff #214319) | assert TP cannot be null, or even move the null-ptr check into this method? |
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
143 ↗ | (On Diff #214373) | nit: it seems clearer to me, if we write the code like: if (!Deduced.isNull()) { addType(D->getTypeSpecStartLoc(), Deduced.getTypePtr()); } |