yvvan added a comment. In https://reviews.llvm.org/D41537#1097763, @ilya-biryukov wrote:
> I should've suggested splitting the change into two earlier. Next time I will do that from the beginning :) ================ Comment at: tools/libclang/CIndexCodeCompletion.cpp:309 + /// before that result for the corresponding completion item. + std::vector<std::vector<FixItHint>> FixItsVector; }; ---------------- ilya-biryukov wrote: > Storing `vector<vector<>>` here makes looks like a hack. Even though it might > seem more tricky, I suggest storing an opaque pointer to `vector<FixItHint>` > in each `CXCompletionResult`. Managing the lifetime of vectors in the > `AllocatedCXCodeCompleteResults` seems totally fine, but there should be a > way to get to the fixits in a similar way we can get to the completion string. > More concretely, I suggest the following API: > ``` > // === Index.h > typedef void* CXCompletionFixIts; > typedef struct { > // ... > CXCompletionFixIts FixIts; > }; > > // Get the number of fix-its. > unsigned clang_getCompletionNumFixIts(CXCompletionResult *Result); > // ... Similar to getDiagnosticFixIt > CXString clang_getCompletionFixIt((CXCompletionResult *Result, unsigned > fixit_index, CXSourceRange *replacement_range); > > > > // === Impl.cpp > struct AllocatedCXCodeCompleteResults : public CXCodeCompleteResults { > // ..... > // Pool for allocating non-empty fixit vectors in the CXCompletionResult. > std::vector<std::vector<FixItHint>> FixItsVector > }; > > unsigned clang_getCompletionNumFixIts(CXCompletionResult *Result) { > auto* FixIts = static_cast<std::vector<FixItHint>*>(Result->FixIts); > if (!FixIts) > return 0; > return FixIts->size(); > } > ``` unsigned clang_getCompletionNumFixIts(CXCompletionResult *Result); Do you mean appending CXCompletionResult struct with the "CXCompletionFixIts FixIts" member? Doesn't it break binary compatibility (changing the struct size)? https://reviews.llvm.org/D41537 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits