Community
Participate
Working Groups
Consider the following code: void waldo(); struct S { void foo() { waldo(); } }; Find References on 'waldo' finds one result, which is presented as follows: S::foo, line 5: waldo(); Notice how the presentation includes the name of the containing class and function. Now, replace the function with a macro: #define waldo() struct S { void foo() { waldo(); } }; If you search again, the presentation of the result is now: line 5: waldo(); Notice how the containing class and function is no longer there. I think it should be; it's useful information.
The containing class and function is derived from IIndexName.getEnclosingDefinition(). PDOMName (used for bindings like functions) implements this, but PDOMMacroReferenceName (used for macros) does not. The solution is to implement getEnclosingDefinition() for PDOMMacroReferenceName. This requires storing an extra field in the PDOMMacroReferenceName record, but we are not increasing the effective size of the record.
New Gerrit change created: https://git.eclipse.org/r/86671
Gerrit change https://git.eclipse.org/r/86671 was merged to [master]. Commit: http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=cf46cbf117bc0e3b7bd334d785de0b56e079ab00
Fixed for 9.3.
I mentioned this in the 9.3 N&N: https://wiki.eclipse.org/CDT/User/NewIn93#Enclosing_definition_of_macro_reference
Any option to disable this fix? We are updating an old product to CDT 9.6 and we are seeing a lot of time spent in org.eclipse.cdt.internal.core.pdom.indexer.IndexerASTVisitor.Definition.search(int, int).
The closest thing would be Preferences -> C/C++ -> Indexer -> "Skip type and macro references". I'm not sure why type and macro references are lumped together into a single option in the UI; at the level of the CDT API, there are separate options for type references and macro references. I would accept a patch that exposes the two options separately in the UI.
(In reply to Nathan Ridge from comment #7) > The closest thing would be Preferences -> C/C++ -> Indexer -> "Skip type and > macro references". > > I'm not sure why type and macro references are lumped together into a single > option in the UI; at the level of the CDT API, there are separate options > for type references and macro references. I would accept a patch that > exposes the two options separately in the UI. Thanks! I was able to disable the macro search with this in the product customization ini: +org.eclipse.cdt.core/indexer/skipTypeReferences=true +org.eclipse.cdt.core/indexer/skipMacroReferences=true We'll leave it at that, if our user base complains we can look into adding a separate checkbox and disable for macros only.