aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-11-17 18:18:02 +0000
committerTed Kremenek <kremenek@apple.com>2009-11-17 18:18:02 +0000
commit4633d1b26949346b6c0e707f76b899c79948b592 (patch)
treee9a1bc2afebf11e48b826629925e0224dfb0dd79
parent0d435191fc8f78338c2ef26d566cfe4d2c52c706 (diff)
Allow "source_filename" to be an optional argument (the client can provide NULL). This allows the client to put the source_filename in the command_line_args without fear of the file being named twice.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89118 91177308-0d34-0410-b5e6-96231b3b80d8
-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)