@@ -62,13 +62,13 @@ static void extractDeclarations(const SwiftExtractorConfiguration& config,
62
62
// TODO: find a more robust approach to avoid collisions?
63
63
llvm::StringRef filename = primaryFile ? primaryFile->getFilename () : module .getModuleFilename ();
64
64
std::string tempTrapName = filename.str () + ' .' + std::to_string (getpid ()) + " .trap" ;
65
- llvm::SmallString<PATH_MAX> tempTrapPath (config.trapDir );
65
+ llvm::SmallString<PATH_MAX> tempTrapPath (config.tempTrapDir );
66
66
llvm::sys::path::append (tempTrapPath, tempTrapName);
67
67
68
- llvm::StringRef trapParent = llvm::sys::path::parent_path (tempTrapPath);
69
- if (std::error_code ec = llvm::sys::fs::create_directories (trapParent )) {
70
- std::cerr << " Cannot create trap directory '" << trapParent .str () << " ': " << ec. message ()
71
- << " \n " ;
68
+ llvm::StringRef tempTrapParent = llvm::sys::path::parent_path (tempTrapPath);
69
+ if (std::error_code ec = llvm::sys::fs::create_directories (tempTrapParent )) {
70
+ std::cerr << " Cannot create temp trap directory '" << tempTrapParent .str ()
71
+ << " ': " << ec. message () << " \n " ;
72
72
return ;
73
73
}
74
74
@@ -117,6 +117,13 @@ static void extractDeclarations(const SwiftExtractorConfiguration& config,
117
117
llvm::SmallString<PATH_MAX> trapPath (config.trapDir );
118
118
llvm::sys::path::append (trapPath, trapName);
119
119
120
+ llvm::StringRef trapParent = llvm::sys::path::parent_path (trapPath);
121
+ if (std::error_code ec = llvm::sys::fs::create_directories (trapParent)) {
122
+ std::cerr << " Cannot create trap directory '" << trapParent.str () << " ': " << ec.message ()
123
+ << " \n " ;
124
+ return ;
125
+ }
126
+
120
127
// TODO: The last process wins. Should we do better than that?
121
128
if (std::error_code ec = llvm::sys::fs::rename (tempTrapPath, trapPath)) {
122
129
std::cerr << " Cannot rename temp trap file '" << tempTrapPath.str ().str () << " ' -> '"
0 commit comments