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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to