]> granicus.if.org Git - clang/commitdiff
Allow "source_filename" to be an optional argument (the client can provide NULL)...
authorTed Kremenek <kremenek@apple.com>
Tue, 17 Nov 2009 18:18:02 +0000 (18:18 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 17 Nov 2009 18:18:02 +0000 (18:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89118 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang-c/Index.h
tools/CIndex/CIndex.cpp

index bd79eb0803162d81a5d822926d3f75ed9c08e29e..ccdddf6cdbfa6a22ff1cbc67ce7ed79a51b8cc45 100644 (file)
@@ -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.
index 216638d71869bc7438111e129d663fa33efe7db2..2e0eafebb25ef3a37b1f67351288fa58359ff462 100644 (file)
@@ -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)