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