Hi Jonah and All,
Thanks for your kind help so I can move further along the a possible long way. Now I encountered another issue.
private static int visit(IIndex index, CPPASTFunctionDeclarator cppFunctionDeclarator) {
display("Visiting CPPASTFunctionDeclarator: " + cppFunctionDeclarator.getRawSignature());
processFuncName(index, cppFunctionDeclarator.getName().toString());
return PROCESS_CONTINUE;
}
private static void processFuncName(IIndex index, String funcName) {
// find bindings for name
try {
index.acquireReadLock();
IIndexBinding[] bindings= index.findBindings(funcName.toCharArray(),IndexFilter.ALL_DECLARED, new NullProgressMonitor());
// find references for each binding
JOptionPane.showMessageDialog(CurrentGui.getInstance().getGui().getMainFrame(), "IIndexBinding size=" + bindings.length, "INFO", JOptionPane.INFORMATION_MESSAGE);
for (IIndexBinding b : bindings) {
if (b instanceof IFunction) {
outputReferences(index, b);
} else {
display("non IFunction");
}
}
} catch (CoreException e) {
log.error(e.getMessage());
} catch (InterruptedException e) {
log.error(e.getMessage());
} finally {
index.releaseReadLock();
}
}
When my program ran here:
The next prompt is “non IFunction”.
Index was created like this:
IIndex index= CCorePlugin.getIndexManager().getIndex(cproject, IIndexManager.UPDATE_ALL |
IIndexManager.UPDATE_EXTERNAL_FILES_FOR_PROJECT);
Thanks.
Sent from
Mail for Windows 10
Hello,
I believe you want visit(IASTDeclaration) for ICPPASTLinkageSpecification.
IIRC IASTPreprocessorIncludeStatement and the pre-processor in general is not visitable, use IASTTranslationUnit.getAllPreprocessorStatements() and/or getIncludeDirectives
ASTVisitor does not provide visit(ICPPASTLinkageSpecification )
and many other CPP specific types callback interface; neither of IASTPreprocessorIncludeStatement. What's the best practice of read these lines?
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/cdt-dev