diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index 3f7e002915895..1e2d53196e923 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -894,6 +894,10 @@ static std::error_code createTemporaryFile(const Twine &Model, int &ResultFD, llvm::SmallVectorImpl &ResultPath, FSEntity Type, sys::fs::OpenFlags Flags = sys::fs::OF_None) { + // Any *temporary* file is assumed to be a compiler-internal output, not + // a formal one. + auto BypassSandbox = sys::sandbox::scopedDisable(); + SmallString<128> Storage; StringRef P = Model.toNullTerminatedStringRef(Storage); assert(P.find_first_of(separators(Style::native)) == StringRef::npos &&