[cfe-commits] r89118 - in /cfe/trunk: include/clang-c/Index.h tools/CIndex/CIndex.cpp

Ted Kremenek kremenek at apple.com
Tue Nov 17 10:18:03 PST 2009


Author: kremenek
Date: Tue Nov 17 12:18:02 2009
New Revision: 89118

URL: http://llvm.org/viewvc/llvm-project?rev=89118&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang-c/Index.h
    cfe/trunk/tools/CIndex/CIndex.cpp

Modified: cfe/trunk/include/clang-c/Index.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang-c/Index.h?rev=89118&r1=89117&r2=89118&view=diff

==============================================================================
--- cfe/trunk/include/clang-c/Index.h (original)
+++ cfe/trunk/include/clang-c/Index.h Tue Nov 17 12:18:02 2009
@@ -605,7 +605,8 @@
  * \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.

Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=89118&r1=89117&r2=89118&view=diff

==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Tue Nov 17 12:18:02 2009
@@ -1211,7 +1211,8 @@
   
   // 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)





More information about the cfe-commits mailing list