From: Mehdi Amini Date: Sat, 17 Sep 2016 05:33:58 +0000 (+0000) Subject: MIR Parser: issue an error when the Context discard value names. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f16c76bd093c64fa876d43b450597560735acbe;p=llvm MIR Parser: issue an error when the Context discard value names. This is in line with the LLParser behavior git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@281811 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/MIRParser/MIRParser.cpp b/lib/CodeGen/MIRParser/MIRParser.cpp index 104d7d18812..35614d3b77b 100644 --- a/lib/CodeGen/MIRParser/MIRParser.cpp +++ b/lib/CodeGen/MIRParser/MIRParser.cpp @@ -828,6 +828,14 @@ std::unique_ptr llvm::createMIRParserFromFile(StringRef Filename, std::unique_ptr llvm::createMIRParser(std::unique_ptr Contents, LLVMContext &Context) { + if (Context.shouldDiscardValueNames()) { + Context.diagnose(DiagnosticInfoMIRParser( + DS_Error, + SMDiagnostic( + Filename, SourceMgr::DK_Error, + "Can't read MIR with a Context that discards named Values"))); + return nullptr; + } auto Filename = Contents->getBufferIdentifier(); return llvm::make_unique( llvm::make_unique(std::move(Contents), Filename, Context));