Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
892–894 | Do we need similar code for ObjCProtocolDecl? Also should ObjCImplDecl be considered definitions here? |
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
892–894 | Possibly. I know next to nothing about Objective C, so I'll just do as I'm told here. On a related note, the code above regarding ObjCMethodDecl does not seem to do anything, i.e. none of the constructs that to my eye appear to be Objective-C methods get the "def" modifier. |
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
892–894 | Gotcha, yeah I think it makes sense to do the same for ObjCImplDecl, ObjCProtocolDecl, and ObjCCategoryDecl. re: methods, ah yeah, that's because canHighlightName will return false since we need to special case handling for ObjC methods since their names can be split across non contiguous tokens (selectors). Instead, would need to update VisitObjCMethodDecl and highlightObjCSelector. |
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
882 | Instead of doing it like this, I wonder if would make more sense to call getDefinition from https://cs.github.com/llvm/llvm-project/blob/ae071a59bc6cc09e0e0043e0ef1d9725853f1681/clang-tools-extra/clangd/XRefs.cpp#L76 and if it matches Decl, add the Definition modifier? |
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
882 | Won't that incur an additional look-up or some other type of work? I'm not deeply familiar with the implementation, but a cursory glance seems to suggests that isThisDeclarationADefinition() is just an accessor, while getDefinition() "does things". |
This is fantastic, I'm really not sure how I missed it, sorry :-(
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
878–879 | nit: move this comment to above the inner if? | |
882 | Yeah, getDefinition may need to walk over all the redecl chain to find the actual def, which we don't care about. | |
882 | can you pull these checks out into a function bool isUniqueDefinition or so? ("unique" because I think we're intentionally returning false for things like NamespaceDecls which are definitions but may be multiply-defined) | |
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp | ||
59 | I wonder if we want to special case when we're printing _def to not print _decl and instead assert that it is present? It's a bit irregular but as you've seen this gets everywhere in the tests, and the noise level seems concerning. |
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
79 | I'm not 100% sure about this one, by the way. I've just never heard anyone talk about a "parameter definition". |
Thanks! Sorry for letting this drop.
clang-tools-extra/clangd/SemanticHighlighting.cpp | ||
---|---|---|
79 | ParmVarDecls should be marked as definition. They definitely are in the formal C++ sense, and they're so similar to local variables that I think we have to be consistent.
Yeah, I suspect this is mostly because:
But I think it's important we treat these consistently with e.g. local variables since they're so similar. | |
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp | ||
62 | can you add a brief comment here: "// _decl_def is common and redundant, just print _def instead." |
Just realized ParmVarDecls (and template args) are maybe more complicated than I thought: I suppose they're only really definitions if the function/template has a body (i.e. is itself a definition).
Anyway don't worry about that, let's get this landed and maybe refine later.
clang-tools-extra/clangd/unittests/SemanticHighlightingTests.cpp | ||
---|---|---|
845–846 | nit: T should be a def here too. |
Could you please land it for me? I don't have the privileges. (How does one attain those, by the way?)
Looks like there are some test failures associated with this commit: https://lab.llvm.org/buildbot/#/builders/123/builds/13698
The change list is a bit confusing, as it's only showing LLVM commits. But the change list includes the commit before and the commit after this one.
The tests in this patch are also failing in our internal CI. @ckandeler, could you take a look?
Looks like an error introduced when rebasing the patch: a recently added test case (for https://github.com/clangd/clangd/issues/1222) needs to be updated to reflect the _decl to _def change that this patch makes to all semantic highlighting tests. I'll land a fix.
Looks like this breaks check-clangd everywhere, eg http://45.33.8.238/linux/89237/step_9.txt
Still failing with that: http://45.33.8.238/linux/89240/step_9.txt
Time to revert to green? Things have been broken for a few hours now. Maybe time to regroup and analyze async?
Fixed in https://reviews.llvm.org/rGd5a99bf5e134, and confirmed via a local build and test run that the tests are passing. Apologies for the breakage.
I'm not 100% sure about this one, by the way. I've just never heard anyone talk about a "parameter definition".