diff options
| author | Fangrui Song <i@maskray.me> | 2025-04-09 19:57:38 -0700 |
|---|---|---|
| committer | Fangrui Song <i@maskray.me> | 2025-04-09 19:57:38 -0700 |
| commit | 2b8cc651dca0c000ee18ec79bd5de4826156c9d6 (patch) | |
| tree | 2548bfa497d4ef6a1a233212e718a8e02dea1847 /llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp | |
| parent | d1badf5635c5876a8c0b9558fe149ef0e293b865 (diff) | |
:createMCStreamer: delete InstPrinter on error
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp index 37611479088b..32e77dbb1c22 100644 --- a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp +++ b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp @@ -166,9 +166,12 @@ CodeGenTargetMachineImpl::createMCStreamer(raw_pwrite_stream &Out, getTargetTriple(), Options.MCOptions.OutputAsmVariant.value_or(MAI.getAssemblerDialect()), MAI, MII, MRI); - for (StringRef Opt : Options.MCOptions.InstPrinterOptions) - if (!InstPrinter->applyTargetSpecificCLOption(Opt)) + for (StringRef Opt : Options.MCOptions.InstPrinterOptions) { + if (!InstPrinter->applyTargetSpecificCLOption(Opt)) { + delete InstPrinter; return createStringError("invalid InstPrinter option '" + Opt + "'"); + } + } // Create a code emitter if asked to show the encoding. std::unique_ptr<MCCodeEmitter> MCE; |
