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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110319 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/libclang/CIndexCodeCompletion.cpp b/tools/libclang/CIndexCodeCompletion.cpp
index 2aa644b..4ab6b9b 100644
--- a/tools/libclang/CIndexCodeCompletion.cpp
+++ b/tools/libclang/CIndexCodeCompletion.cpp
@@ -569,7 +569,8 @@
                                             unsigned complete_line,
                                             unsigned complete_column,
                                             struct CXUnsavedFile *unsaved_files,
-                                            unsigned num_unsaved_files) {
+                                            unsigned num_unsaved_files,
+                                            unsigned options) {
 #ifdef UDP_CODE_COMPLETION_LOGGER
 #ifdef UDP_CODE_COMPLETION_LOGGER_PORT
   const llvm::TimeRecord &StartTime =  llvm::TimeRecord::getCurrentTime();
@@ -611,7 +612,10 @@
 
   // Perform completion.
   AST->CodeComplete(complete_filename, complete_line, complete_column,
-                    RemappedFiles.data(), RemappedFiles.size(), Capture,
+                    RemappedFiles.data(), RemappedFiles.size(), 
+                    (options & CXCodeComplete_IncludeMacros),
+                    (options & CXCodeComplete_IncludeCodePatterns),
+                    Capture,
                     *Results->Diag, Results->LangOpts, Results->SourceMgr,
                     Results->FileMgr, Results->Diagnostics);
 
@@ -692,6 +696,10 @@
   return Results;
 }
 
+unsigned clang_defaultCodeCompleteOptions(void) {
+  return CXCodeComplete_IncludeMacros;
+}
+
 void clang_disposeCodeCompleteResults(CXCodeCompleteResults *ResultsIn) {
   if (!ResultsIn)
     return;