clang_indexer
clang_indexer copied to clipboard
Determine requirements for future direction
There's been a discussion at Issue 134 at Rip-Rip's clang_complete about what an editor-agnositc C++ indexer will look like. We need to flesh out those ideas and write it up in a wiki page so we can all agree on what we're building.
Number 5 from https://github.com/exclipy/clang_indexer/wiki/Requirements-and-Design:
char** find_references(char* usr),
IMO, char** shouldn't be used directly but rather hidden in a custom type and accessed via function calls.
I suggest something like:
ClickDatabase* click_createDatabase(const char *pathToDbFile, const char** pathsToIndex, unsigned int lengthOfPathsToIndex);
void click_disposeDatabase(ClickDatabase* db);
ClickReferences* click_findReferences(ClickDatabase* db, const char* usr);
void click_disposeReferences(ClickReferences* data);
unsigned int click_getReferenceCount(ClickReferences* data);
ClickReference click_getReferences(ClickReferences* data, unsigned int index);
unsigned int click_getReferenceLine(ClickReference ref);
unsigned int click_getReferenceColumn(ClickReference ref);
const char* click_getReferenceFilename(ClickReference ref);
This interface looks more like libclang and lets us later extend for example the "ClickReference" type in case we figure out some other information that should be included there. One example that just popped up in my head is click_getReferenceVariableName() which would return the name of the variable at that line/column/file that is referencing the cursor searched for.