From 7e90985df09855dc309ed888a5b16a0ae684f8e3 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Thu, 28 Jul 2011 00:45:10 +0000 Subject: Cut down the number of open/close system calls for output files. For PCH files, have only one open/close for temporary + rename to be safe from race conditions. For all other output files open/close the output file directly. Depends on llvm r136310. rdar://9082880 & http://llvm.org/PR9374. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136315 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/FrontendActions.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Frontend/FrontendActions.cpp') diff --git a/lib/Frontend/FrontendActions.cpp b/lib/Frontend/FrontendActions.cpp index 44cd2dfe9b..4eb9cda398 100644 --- a/lib/Frontend/FrontendActions.cpp +++ b/lib/Frontend/FrontendActions.cpp @@ -102,8 +102,10 @@ bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI, // We use createOutputFile here because this is exposed via libclang, and we // must disable the RemoveFileOnSignal behavior. + // We use a temporary to avoid race conditions. OS = CI.createOutputFile(CI.getFrontendOpts().OutputFile, /*Binary=*/true, - /*RemoveFileOnSignal=*/false, InFile); + /*RemoveFileOnSignal=*/false, InFile, + /*Extension=*/"", /*useTemporary=*/true); if (!OS) return true; -- cgit v1.2.3-70-g09d2