|
34 | 34 | #include "llvm/MC/MCSymbol.h" |
35 | 35 | #include "llvm/MC/TargetRegistry.h" |
36 | 36 | #include "llvm/Support/ErrorHandling.h" |
| 37 | +#include "llvm/Support/IOSandbox.h" |
37 | 38 | #include "llvm/Support/MemoryBuffer.h" |
38 | 39 | #include "llvm/Support/SourceMgr.h" |
39 | 40 | #include "llvm/Support/VirtualFileSystem.h" |
@@ -98,13 +99,12 @@ void AsmPrinter::emitInlineAsm(StringRef Str, const MCSubtargetInfo &STI, |
98 | 99 |
|
99 | 100 | unsigned BufNum = addInlineAsmDiagBuffer(Str, LocMDNode); |
100 | 101 | SourceMgr &SrcMgr = *MMI->getContext().getInlineSourceManager(); |
101 | | - // FIXME(sandboxing): This is not executed in tests, but might be common. |
102 | | - // Propagating vfs::FileSystem here is lots of work, |
103 | | - // consider bypassing the sandbox. |
104 | | - if (!MCOptions.IASSearchPaths.empty()) { |
105 | | - SrcMgr.setIncludeDirs(MCOptions.IASSearchPaths); |
106 | | - SrcMgr.setVirtualFileSystem(vfs::getRealFileSystem()); |
107 | | - } |
| 102 | + SrcMgr.setIncludeDirs(MCOptions.IASSearchPaths); |
| 103 | + SrcMgr.setVirtualFileSystem([] { |
| 104 | + // FIXME(sandboxing): Propagating vfs::FileSystem here is lots of work. |
| 105 | + [[maybe_unused]] auto BypassSandbox = sys::sandbox::scopedDisable(); |
| 106 | + return vfs::getRealFileSystem(); |
| 107 | + }()); |
108 | 108 |
|
109 | 109 | std::unique_ptr<MCAsmParser> Parser( |
110 | 110 | createMCAsmParser(SrcMgr, OutContext, *OutStreamer, *MAI, BufNum)); |
|
0 commit comments