llvm.org GIT mirror llvm / 85f5302
Bitcode: Remove the remnants of the BitcodeDiagnosticInfo class. The BitcodeReader no longer produces BitcodeDiagnosticInfo diagnostics. The only remaining reference was in the gold plugin; the code there has been dead since we stopped producing InvalidBitcodeSignature error codes in r225562. While at it remove the InvalidBitcodeSignature error code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@286326 91177308-0d34-0410-b5e6-96231b3b80d8 Peter Collingbourne 4 years ago
4 changed file(s) with 1 addition(s) and 25 deletion(s). Raw diff Collapse all Expand all
183183 }
184184
185185 const std::error_category &BitcodeErrorCategory();
186 enum class BitcodeError { InvalidBitcodeSignature = 1, CorruptedBitcode };
186 enum class BitcodeError { CorruptedBitcode = 1 };
187187 inline std::error_code make_error_code(BitcodeError E) {
188188 return std::error_code(static_cast(E), BitcodeErrorCategory());
189189 }
190
191 class BitcodeDiagnosticInfo : public DiagnosticInfo {
192 const Twine &Msg;
193 std::error_code EC;
194
195 public:
196 BitcodeDiagnosticInfo(std::error_code EC, DiagnosticSeverity Severity,
197 const Twine &Msg);
198 void print(DiagnosticPrinter &DP) const override;
199 std::error_code getError() const { return EC; }
200
201 static bool classof(const DiagnosticInfo *DI) {
202 return DI->getKind() == DK_Bitcode;
203 }
204 };
205190
206191 } // End llvm namespace
207192
4848 /// \brief Defines the different supported kind of a diagnostic.
4949 /// This enum should be extended with a new ID for each added concrete subclass.
5050 enum DiagnosticKind {
51 DK_Bitcode,
5251 DK_InlineAsm,
5352 DK_ResourceLimit,
5453 DK_StackSize,
66206620 std::string message(int IE) const override {
66216621 BitcodeError E = static_cast(IE);
66226622 switch (E) {
6623 case BitcodeError::InvalidBitcodeSignature:
6624 return "Invalid bitcode signature";
66256623 case BitcodeError::CorruptedBitcode:
66266624 return "Corrupted bitcode";
66276625 }
367367 }
368368
369369 static void diagnosticHandler(const DiagnosticInfo &DI) {
370 if (const auto *BDI = dyn_cast(&DI)) {
371 std::error_code EC = BDI->getError();
372 if (EC == BitcodeError::InvalidBitcodeSignature)
373 return;
374 }
375
376370 std::string ErrStorage;
377371 {
378372 raw_string_ostream OS(ErrStorage);