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
Diff Detail
- Repository
- rG LLVM Github Monorepo
- Build Status
Buildable 36521 Build 36520: arc lint + arc unit
Event Timeline
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
137–145 | assert TP cannot be null, or even move the null-ptr check into this method? | |
150 | 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... | |
151 | nit: remove the debug log |
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
143 | nit: it seems clearer to me, if we write the code like: if (!Deduced.isNull()) { addType(D->getTypeSpecStartLoc(), Deduced.getTypePtr()); } |
nit: it seems clearer to me, if we write the code like: