summaryrefslogtreecommitdiffstats
path: root/clang/tools/CIndex/CIndex.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-03-13 21:22:49 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-03-13 21:22:49 +0000
commitf156b9d55dd4cc4aebeb418449c2a09df10dbb99 (patch)
tree88917a8a99106a4bc6888b7fcfa77e7cc5a8d0a0 /clang/tools/CIndex/CIndex.cpp
parent29bdac4928c417f25670e462ca55ffbd68a4f11b (diff)
downloadbcm5719-llvm-f156b9d55dd4cc4aebeb418449c2a09df10dbb99.tar.gz
bcm5719-llvm-f156b9d55dd4cc4aebeb418449c2a09df10dbb99.zip
Revert 98439. There is a bad race condition in sys::Path::makeUnique on win32.
llvm-svn: 98452
Diffstat (limited to 'clang/tools/CIndex/CIndex.cpp')
-rw-r--r--clang/tools/CIndex/CIndex.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/tools/CIndex/CIndex.cpp b/clang/tools/CIndex/CIndex.cpp
index 594654fe6c6..b52a32ed9b5 100644
--- a/clang/tools/CIndex/CIndex.cpp
+++ b/clang/tools/CIndex/CIndex.cpp
@@ -29,6 +29,9 @@
#include "llvm/System/Program.h"
#include "llvm/System/Signals.h"
+// Needed to define L_TMPNAM on some systems.
+#include <cstdio>
+
using namespace clang;
using namespace clang::cxcursor;
using namespace clang::cxstring;
@@ -1052,8 +1055,8 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
// Generate a temporary name for the AST file.
argv.push_back("-o");
- llvm::sys::Path astTmpFile(CIndexer::getTemporaryPath());
- argv.push_back(astTmpFile.c_str());
+ char astTmpFile[L_tmpnam];
+ argv.push_back(tmpnam(astTmpFile));
// Remap any unsaved files to temporary files.
std::vector<llvm::sys::Path> TemporaryFiles;
@@ -1084,7 +1087,9 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
}
// Generate a temporary name for the diagnostics file.
- llvm::sys::Path DiagnosticsFile(CIndexer::getTemporaryPath());
+ char tmpFileResults[L_tmpnam];
+ char *tmpResultsFileName = tmpnam(tmpFileResults);
+ llvm::sys::Path DiagnosticsFile(tmpResultsFileName);
TemporaryFiles.push_back(DiagnosticsFile);
argv.push_back("-fdiagnostics-binary");
@@ -1113,7 +1118,7 @@ clang_createTranslationUnitFromSourceFile(CXIndex CIdx,
Diags->Report(diag::err_fe_invoking) << AllArgs << ErrMsg;
}
- ASTUnit *ATU = ASTUnit::LoadFromPCHFile(astTmpFile.str(), *Diags,
+ ASTUnit *ATU = ASTUnit::LoadFromPCHFile(astTmpFile, *Diags,
CXXIdx->getOnlyLocalDecls(),
RemappedFiles.data(),
RemappedFiles.size(),
OpenPOWER on IntegriCloud