aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang-c/Index.h3
-rw-r--r--tools/CIndex/CIndex.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index bd79eb0803..ccdddf6cdb 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -605,7 +605,8 @@ clang_getNumCompletionChunks(CXCompletionString completion_string);
* \param source_filename the name of the source file that should be parsed
* to perform code-completion. This source file must be the same as or
* include the filename described by \p complete_filename, or no code-completion
- * results will be produced.
+ * results will be produced. NOTE: One can also specify NULL for this argument if
+ * the source file is included in command_line_args.
*
* \param num_command_line_args the number of command-line arguments stored in
* \p command_line_args.
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 216638d718..2e0eafebb2 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -1211,7 +1211,8 @@ void clang_codeComplete(CXIndex CIdx,
// Add the source file name (FIXME: later, we'll want to build temporary
// file from the buffer, or just feed the source text via standard input).
- argv.push_back(source_filename);
+ if (source_filename)
+ argv.push_back(source_filename);
// Process the compiler options, stripping off '-o', '-c', '-fsyntax-only'.
for (int i = 0; i < num_command_line_args; ++i)