DeclrationAndMacrosFinder will find some declarations (not macro!) that are
referened inside the macro somehow, isSearchedLocation() is not sufficient, we
don't know whether the searched source location is macro or not.
Details
Diff Detail
- Repository
- rCTE Clang Tools Extra
- Build Status
Buildable 15859 Build 15859: arc lint + arc unit
Event Timeline
clangd/XRefs.cpp | ||
---|---|---|
201 | I wonder whether we should fix the DeclrationAndMacrosFinder to not return declarations coming from macro instantiations instead. Do you think it would be possible and it would make sense for DeclrationAndMacrosFinder to only return a macro in this case and not return Decls coming from macro expansions? |
clangd/XRefs.cpp | ||
---|---|---|
201 | I thought about it initially, but the information provided handleDeclOccurrence is limited...the occurrence location (FID and Offset) is expansion location (which is not always we want). That being said, when GoToDefinition on a macro, all declarations inside the macro body will be picked up. In document hover implementation, we also use the same mechanism to avoid this problem :( |
clangd/XRefs.cpp | ||
---|---|---|
201 | As discussed offline, we should probably move this logic to DeclrationAndMacrosFinder so that all its clients (hover, documentHighlights, findDefinitions) are consistent. |
Address review comment.
clangd/XRefs.cpp | ||
---|---|---|
201 | As discussed, made the workaround in Finder to keep the change minimal, no changes are required in client side. |
clangd/XRefs.cpp | ||
---|---|---|
137 | NIT: the fixme was a bit hard to follow for me. Maybe make it more clear where the problem should be handled, e.g. FIXME: we should avoid adding decls from inside macros in handlDeclOccurence. |
NIT: the fixme was a bit hard to follow for me. Maybe make it more clear where the problem should be handled, e.g.