aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-10-15 20:50:09 +0000
committerSteve Naroff <snaroff@apple.com>2009-10-15 20:50:09 +0000
commit37b5ac2909a7693fc6e6842c5a8825bdeaa636dd (patch)
tree2bc7a2a9d919eea4e5141f60ab5f2af62d378369
parent5b7d8e254f6c2855b37b5521c0aee0a560dab237 (diff)
Minor improvement to format...no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84203 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/CIndex/CIndex.cpp27
1 files changed, 13 insertions, 14 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 9ab3f790ec..970ba3878a 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -292,16 +292,15 @@ CXTranslationUnit clang_createTranslationUnitFromSourceFile(
const char *source_filename,
int num_command_line_args, const char **command_line_args)
{
- // Generate a temporary name for the AST file.
- char astTmpFile[L_tmpnam];
-
// Build up the arguments for involking clang.
- const char * argv[ARG_MAX];
int argc = 0;
+ const char * argv[ARG_MAX];
argv[argc++] = clangPath;
argv[argc++] = "-emit-ast";
argv[argc++] = source_filename;
argv[argc++] = "-o";
+ // Generate a temporary name for the AST file.
+ char astTmpFile[L_tmpnam];
argv[argc++] = tmpnam(astTmpFile);
for (int i = num_command_line_args; i < num_command_line_args; i++)
argv[argc++] = command_line_args[i];
@@ -316,16 +315,16 @@ CXTranslationUnit clang_createTranslationUnitFromSourceFile(
// If execv returns, it failed.
assert(0 && "execv() failed");
- } else { // This is run by the parent.
- int child_status;
- pid_t tpid;
- do { // Wait for the child to terminate.
- tpid = wait(&child_status);
- } while (tpid != child_pid);
-
- // Finally, we create the translation unit from the ast file.
- return clang_createTranslationUnit(CIdx, astTmpFile);
- }
+ }
+ // This is run by the parent.
+ int child_status;
+ pid_t tpid;
+ do { // Wait for the child to terminate.
+ tpid = wait(&child_status);
+ } while (tpid != child_pid);
+
+ // Finally, we create the translation unit from the ast file.
+ return clang_createTranslationUnit(CIdx, astTmpFile);
}
void clang_disposeTranslationUnit(