forked from OSchip/llvm-project
parent
325fa0fd93
commit
a36e78ef5d
|
@ -146,11 +146,10 @@ bool FileRemapper::flushToFile(StringRef outputPath, DiagnosticsEngine &Diag) {
|
|||
} else {
|
||||
|
||||
SmallString<64> tempPath;
|
||||
tempPath = path::filename(origFE->getName());
|
||||
tempPath += "-%%%%%%%%";
|
||||
tempPath += path::extension(origFE->getName());
|
||||
int fd;
|
||||
if (fs::unique_file(tempPath.str(), fd, tempPath) != llvm::errc::success)
|
||||
if (fs::createTemporaryFile(path::filename(origFE->getName()),
|
||||
path::extension(origFE->getName()), fd,
|
||||
tempPath))
|
||||
return report("Could not create file: " + tempPath.str(), Diag);
|
||||
|
||||
llvm::raw_fd_ostream newOut(fd, /*shouldClose=*/true);
|
||||
|
|
|
@ -140,8 +140,8 @@ void CXXRecordDecl::viewInheritance(ASTContext& Context) const {
|
|||
|
||||
int FD;
|
||||
SmallString<128> Filename;
|
||||
error_code EC = sys::fs::unique_file(Self.getAsString() + "-%%%%%%.dot", FD,
|
||||
Filename);
|
||||
error_code EC =
|
||||
sys::fs::createTemporaryFile(Self.getAsString(), "dot", FD, Filename);
|
||||
if (EC) {
|
||||
llvm::errs() << "Error: " << EC.message() << "\n";
|
||||
return;
|
||||
|
|
|
@ -1616,7 +1616,7 @@ std::string Driver::GetTemporaryPath(StringRef Prefix, const char *Suffix)
|
|||
const {
|
||||
SmallString<128> Path;
|
||||
llvm::error_code EC =
|
||||
llvm::sys::fs::unique_file(Prefix + "-%%%%%%." + Suffix, Path);
|
||||
llvm::sys::fs::createTemporaryFile(Prefix, Suffix, Path);
|
||||
if (EC) {
|
||||
Diag(clang::diag::err_unable_to_make_temp) << EC.message();
|
||||
return "";
|
||||
|
|
|
@ -1244,7 +1244,7 @@ static std::string GetPreamblePCHPath() {
|
|||
return TmpFile;
|
||||
|
||||
SmallString<128> Path;
|
||||
llvm::sys::fs::unique_file("preamble-%%%%%%.pch", Path);
|
||||
llvm::sys::fs::createTemporaryFile("preamble", "pch", Path);
|
||||
|
||||
return Path.str();
|
||||
}
|
||||
|
|
|
@ -855,13 +855,9 @@ static void compileModule(CompilerInstance &ImportingInstance,
|
|||
IK));
|
||||
} else {
|
||||
// Create a temporary module map file.
|
||||
TempModuleMapFileName = Module->Name;
|
||||
TempModuleMapFileName += "-%%%%%%%%.map";
|
||||
int FD;
|
||||
if (llvm::sys::fs::unique_file(TempModuleMapFileName.str(), FD,
|
||||
TempModuleMapFileName,
|
||||
/*makeAbsolute=*/true)
|
||||
!= llvm::errc::success) {
|
||||
if (llvm::sys::fs::createTemporaryFile(Module->Name, "map", FD,
|
||||
TempModuleMapFileName)) {
|
||||
ImportingInstance.getDiagnostics().Report(diag::err_module_map_temp_file)
|
||||
<< TempModuleMapFileName;
|
||||
return;
|
||||
|
|
|
@ -76,12 +76,10 @@ class FixItRewriteToTemp : public FixItOptions {
|
|||
public:
|
||||
std::string RewriteFilename(const std::string &Filename, int &fd) {
|
||||
SmallString<128> Path;
|
||||
Path = llvm::sys::path::filename(Filename);
|
||||
Path += "-%%%%%%%%";
|
||||
Path += llvm::sys::path::extension(Filename);
|
||||
SmallString<128> NewPath;
|
||||
llvm::sys::fs::unique_file(Path.str(), fd, NewPath);
|
||||
return NewPath.str();
|
||||
llvm::sys::fs::createTemporaryFile(llvm::sys::path::filename(Filename),
|
||||
llvm::sys::path::extension(Filename), fd,
|
||||
Path);
|
||||
return Path.str();
|
||||
}
|
||||
};
|
||||
} // end anonymous namespace
|
||||
|
|
|
@ -700,7 +700,7 @@ public:
|
|||
static ExplodedNode::Auditor* CreateUbiViz() {
|
||||
SmallString<128> P;
|
||||
int FD;
|
||||
llvm::sys::fs::unique_file("llvm_ubi-%%%%%%", FD, P);
|
||||
llvm::sys::fs::createTemporaryFile("llvm_ubi", "", FD, P);
|
||||
llvm::errs() << "Writing '" << P.str() << "'.\n";
|
||||
|
||||
OwningPtr<llvm::raw_fd_ostream> Stream;
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
SmallString<1024> Path;
|
||||
int FD;
|
||||
llvm::error_code EC =
|
||||
llvm::sys::fs::unique_file(Twine(Name) + "%%%%%%", FD, Path);
|
||||
llvm::sys::fs::createTemporaryFile(Name, "", FD, Path);
|
||||
assert(!EC);
|
||||
(void)EC;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class RewriterTestContext {
|
|||
SmallString<1024> Path;
|
||||
int FD;
|
||||
llvm::error_code EC =
|
||||
llvm::sys::fs::unique_file(Twine(Name) + "%%%%%%", FD, Path);
|
||||
llvm::sys::fs::createTemporaryFile(Name, "", FD, Path);
|
||||
assert(!EC);
|
||||
(void)EC;
|
||||
|
||||
|
|
Loading…
Reference in New Issue