[LLVMbugs] [Bug 8940] New: libclang API to access CXCodeCompleteResults and CXCompletionResult structures

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Jan 9 00:49:15 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=8940

           Summary: libclang API to access CXCodeCompleteResults and
                    CXCompletionResult structures
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: lightside at safebox.ru
                CC: llvmbugs at cs.uiuc.edu


There are no API to access CXCodeCompleteResults structure to get
CXCompletionResult and unsigned NumResults.
The same situation with CXCompletionResult structure (e.g. CXCursorKind
CursorKind, CXCompletionString CompletionString). They used inside
clang_sortCodeCompletionResults, clang_getCompletionChunkKind,
clang_getCompletionChunkText, clang_getCompletionChunkCompletionString,
clang_getNumCompletionChunks, etc. functions.

Currently, it possible to get them directly only, e.g.:
//...

CXIndex idx = clang_createIndex(NULL, NULL);
CXTranslationUnit tu = clang_createTranslationUnit(idx, ast_filename);
CXCodeCompleteResults *rs = clang_codeCompleteAt(tu, complete_filename,
complete_line, complete_column, unsaved_files, num_unsaved_files, options);
clang_sortCodeCompletionResults(rs->Results, rs->NumResults);

for (unsigned i = 0, n = rs->NumResults; i < n; ++i) {
    CXCompletionResult r = rs->Results[i];
    CXCursorKind kind = r.CursorKind;
    CXCompletionString cs = r.CompletionString;

    for (unsigned j = 0, m = clang_getNumCompletionChunks(cs); j < m; ++j) {
        CXString text = clang_getCompletionChunkText(cs, j);
        printf("%d: %s\n", i, text);
        clang_disposeString(text);
    }
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list