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
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 216638d..2e0eafe 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -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)