diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-02 09:21:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-02 09:21:34 +0000 |
commit | 735df88a38e80c1ca70daa889aa516b8b9f54b50 (patch) | |
tree | 853efa5e789ca1c2621f32ed40d32ad4511283a8 /include/clang-c | |
parent | 51fa86f738a9768fac4e1cad7bdde53774b5b322 (diff) |
Extend the CIndex code-completion API to perform code completion
involving unsaved files, using the -remap-file= functionality recently
added to clang-cc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90314 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang-c')
-rw-r--r-- | include/clang-c/Index.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h index 85f7a6a31b..8e6eeb5422 100644 --- a/include/clang-c/Index.h +++ b/include/clang-c/Index.h @@ -104,6 +104,34 @@ enum CXCursorKind { CXCursor_LastInvalid = 72 }; +/** + * \brief Provides the contents of a file that has not yet been saved to disk. + * + * Each CXUnsavedFile instance provides the name of a file on the + * system along with the current contents of that file that have not + * yet been saved to disk. + */ +struct CXUnsavedFile { + /** + * \brief The file whose contents have not yet been saved. + * + * This file must already exist in the file system. + */ + const char *Filename; + + /** + * \brief A null-terminated buffer containing the unsaved contents + * of this file. + */ + const char *Contents; + + /** + * \brief The length of the unsaved contents of this buffer, not + * counting the NULL at the end of the buffer. + */ + unsigned long Length; +}; + /* A cursor into the CXTranslationUnit. */ typedef struct { @@ -621,6 +649,13 @@ clang_getNumCompletionChunks(CXCompletionString completion_string); * includes, etc., but should not include any information specific to * code completion. * + * \param num_unsaved_files the number of unsaved file entries in \p + * unsaved_files. + * + * \param unsaved_files the files that have not yet been saved to disk + * but may be required for code completion, including the contents of + * those files. + * * \param complete_filename the name of the source file where code completion * should be performed. In many cases, this name will be the same as the * source filename. However, the completion filename may also be a file @@ -643,6 +678,8 @@ CINDEX_LINKAGE void clang_codeComplete(CXIndex CIdx, const char *source_filename, int num_command_line_args, const char **command_line_args, + unsigned num_unsaved_files, + struct CXUnsavedFile *unsaved_files, const char *complete_filename, unsigned complete_line, unsigned complete_column, |