]> granicus.if.org Git - clang/commitdiff
Unify Unix and Windows code paths when executing 'clang'.
authorTed Kremenek <kremenek@apple.com>
Mon, 26 Oct 2009 22:14:08 +0000 (22:14 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 26 Oct 2009 22:14:08 +0000 (22:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85163 91177308-0d34-0410-b5e6-96231b3b80d8

tools/CIndex/CIndex.cpp

index 09ee1351ba2e4f9993ea61363dc0ac0593c0f6c4..f044f89c4ae10ff6924ae66a86a4cf831d69c60a 100644 (file)
@@ -434,8 +434,9 @@ CXTranslationUnit clang_createTranslationUnitFromSourceFile(
   // Add the null terminator.
   argv.push_back(NULL);
 
-#ifndef LLVM_ON_WIN32
-  llvm::sys::Path DevNull("/dev/null");
+  // Invoke 'clang'.
+  llvm::sys::Path DevNull; // leave empty, causes redirection to /dev/null
+                           // on Unix or NUL (Windows).
   std::string ErrMsg;
   const llvm::sys::Path *Redirects[] = { &DevNull, &DevNull, &DevNull, NULL };
   llvm::sys::Program::ExecuteAndWait(ClangPath, &argv[0], /* env */ NULL,
@@ -452,11 +453,6 @@ CXTranslationUnit clang_createTranslationUnitFromSourceFile(
     }
     llvm::errs() << '\n';
   }
-#else
-  // FIXME: I don't know what is the equivalent '/dev/null' redirect for
-  // Windows for this API.
-  llvm::sys::Program::ExecuteAndWait(ClangPath, &argv[0]);
-#endif
 
   // Finally, we create the translation unit from the ast file.
   ASTUnit *ATU = static_cast<ASTUnit *>(