summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-08-05 09:09:23 +0000
committerDouglas Gregor <dgregor@apple.com>2010-08-05 09:09:23 +0000
commitb68bc59a2d51dce59a221b52a6490cac8bb65c56 (patch)
tree7708292d1996bce7b67f5329d2b3086c68e8b0d6 /clang/include
parent42d7d19710d09f00f030eff543ff8841b5b56c64 (diff)
downloadbcm5719-llvm-b68bc59a2d51dce59a221b52a6490cac8bb65c56.tar.gz
bcm5719-llvm-b68bc59a2d51dce59a221b52a6490cac8bb65c56.zip
Give clang_codeCompleteAt() an "options" parameter, and add a new
flags enumeration + default-generating function that allows code-completion to be customized via the libclang API. Plus, turn on spell-checking when performing code completion. llvm-svn: 110319
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang-c/Index.h36
-rw-r--r--clang/include/clang/Frontend/ASTUnit.h16
2 files changed, 47 insertions, 5 deletions
diff --git a/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index 9e8623a3d87..bbc8fbaf962 100644
--- a/clang/include/clang-c/Index.h
+++ b/clang/include/clang-c/Index.h
@@ -2079,6 +2079,33 @@ CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx,
unsigned complete_column);
/**
+ * \brief Flags that can be passed to \c clang_codeCompleteAt() to
+ * modify its behavior.
+ *
+ * The enumerators in this enumeration can be bitwise-OR'd together to
+ * provide multiple options to \c clang_codeCompleteAt().
+ */
+enum CXCodeComplete_Flags {
+ /**
+ * \brief Whether to include macros within the set of code
+ * completions returned.
+ */
+ CXCodeComplete_IncludeMacros = 0x01,
+
+ /**
+ * \brief Whether to include code patterns for language constructs
+ * within the set of code completions, e.g., for loops.
+ */
+ CXCodeComplete_IncludeCodePatterns = 0x02
+};
+
+/**
+ * \brief Returns a default set of code-completion options that can be
+ * passed to\c clang_codeCompleteAt().
+ */
+CINDEX_LINKAGE unsigned clang_defaultCodeCompleteOptions(void);
+
+/**
* \brief Perform code completion at a given location in a translation unit.
*
* This function performs code completion at a particular file, line, and
@@ -2135,6 +2162,12 @@ CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx,
* \param num_unsaved_files The number of unsaved file entries in \p
* unsaved_files.
*
+ * \param options Extra options that control the behavior of code
+ * completion, expressed as a bitwise OR of the enumerators of the
+ * CXCodeComplete_Flags enumeration. The
+ * \c clang_defaultCodeCompleteOptions() function returns a default set
+ * of code-completion options.
+ *
* \returns If successful, a new \c CXCodeCompleteResults structure
* containing code-completion results, which should eventually be
* freed with \c clang_disposeCodeCompleteResults(). If code
@@ -2146,7 +2179,8 @@ CXCodeCompleteResults *clang_codeCompleteAt(CXTranslationUnit TU,
unsigned complete_line,
unsigned complete_column,
struct CXUnsavedFile *unsaved_files,
- unsigned num_unsaved_files);
+ unsigned num_unsaved_files,
+ unsigned options);
/**
* \brief Free the given set of code-completion results.
diff --git a/clang/include/clang/Frontend/ASTUnit.h b/clang/include/clang/Frontend/ASTUnit.h
index 0068f90c90f..e8d4ccef029 100644
--- a/clang/include/clang/Frontend/ASTUnit.h
+++ b/clang/include/clang/Frontend/ASTUnit.h
@@ -389,16 +389,24 @@ public:
/// \brief Perform code completion at the given file, line, and
/// column within this translation unit.
///
- /// \brief File The file in which code completion will occur.
- /// \brief Line The line at which code completion will occur.
- /// \brief Column The column at which code completion will occur.
- /// \brief Consumer The consumer that will receive code-completion results.
+ /// \param File The file in which code completion will occur.
+ ///
+ /// \param Line The line at which code completion will occur.
+ ///
+ /// \param Column The column at which code completion will occur.
+ ///
+ /// \param IncludeMacros Whether to include macros in the code-completion
+ /// results.
+ ///
+ /// \param IncludeCodePatterns Whether to include code patterns (such as a
+ /// for loop) in the code-completion results.
///
/// FIXME: The Diag, LangOpts, SourceMgr, FileMgr, and
/// StoredDiagnostics parameters are all disgusting hacks. They will
/// go away.
void CodeComplete(llvm::StringRef File, unsigned Line, unsigned Column,
RemappedFile *RemappedFiles, unsigned NumRemappedFiles,
+ bool IncludeMacros, bool IncludeCodePatterns,
CodeCompleteConsumer &Consumer,
Diagnostic &Diag, LangOptions &LangOpts,
SourceManager &SourceMgr, FileManager &FileMgr,
OpenPOWER on IntegriCloud