@@ -58,8 +58,6 @@ enum DiagnosticSeverity : char {
5858// / Defines the different supported kind of a diagnostic.
5959// / This enum should be extended with a new ID for each added concrete subclass.
6060enum DiagnosticKind {
61- DK_Generic,
62- DK_GenericWithLoc,
6361 DK_InlineAsm,
6462 DK_ResourceLimit,
6563 DK_StackSize,
@@ -136,33 +134,6 @@ class DiagnosticInfo {
136134
137135using DiagnosticHandlerFunction = std::function<void (const DiagnosticInfo &)>;
138136
139- class DiagnosticInfoGeneric : public DiagnosticInfo {
140- const Twine &MsgStr;
141- const Instruction *Inst = nullptr ;
142-
143- public:
144- // / \p MsgStr is the message to be reported to the frontend.
145- // / This class does not copy \p MsgStr, therefore the reference must be valid
146- // / for the whole life time of the Diagnostic.
147- DiagnosticInfoGeneric (const Twine &MsgStr,
148- DiagnosticSeverity Severity = DS_Error)
149- : DiagnosticInfo(DK_Generic, Severity), MsgStr(MsgStr) {}
150-
151- DiagnosticInfoGeneric (const Instruction *I, const Twine &ErrMsg,
152- DiagnosticSeverity Severity = DS_Warning)
153- : DiagnosticInfo(DK_Generic, Severity), MsgStr(ErrMsg), Inst(I) {}
154-
155- const Twine &getMsgStr () const { return MsgStr; }
156- const Instruction *getInstruction () const { return Inst; }
157-
158- // / \see DiagnosticInfo::print.
159- void print (DiagnosticPrinter &DP) const override ;
160-
161- static bool classof (const DiagnosticInfo *DI) {
162- return DI->getKind () == DK_Generic;
163- }
164- };
165-
166137// / Diagnostic information for inline asm reporting.
167138// / This is basically a message and an optional location.
168139class DiagnosticInfoInlineAsm : public DiagnosticInfo {
@@ -175,12 +146,21 @@ class DiagnosticInfoInlineAsm : public DiagnosticInfo {
175146 const Instruction *Instr = nullptr ;
176147
177148public:
149+ // / \p MsgStr is the message to be reported to the frontend.
150+ // / This class does not copy \p MsgStr, therefore the reference must be valid
151+ // / for the whole life time of the Diagnostic.
152+ DiagnosticInfoInlineAsm (const Twine &MsgStr,
153+ DiagnosticSeverity Severity = DS_Error)
154+ : DiagnosticInfo(DK_InlineAsm, Severity), MsgStr(MsgStr) {}
155+
178156 // / \p LocCookie if non-zero gives the line number for this report.
179157 // / \p MsgStr gives the message.
180158 // / This class does not copy \p MsgStr, therefore the reference must be valid
181159 // / for the whole life time of the Diagnostic.
182160 DiagnosticInfoInlineAsm (uint64_t LocCookie, const Twine &MsgStr,
183- DiagnosticSeverity Severity = DS_Error);
161+ DiagnosticSeverity Severity = DS_Error)
162+ : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(LocCookie),
163+ MsgStr (MsgStr) {}
184164
185165 // / \p Instr gives the original instruction that triggered the diagnostic.
186166 // / \p MsgStr gives the message.
@@ -374,31 +354,6 @@ class DiagnosticInfoWithLocationBase : public DiagnosticInfo {
374354 DiagnosticLocation Loc;
375355};
376356
377- class DiagnosticInfoGenericWithLoc : public DiagnosticInfoWithLocationBase {
378- private:
379- // / Message to be reported.
380- const Twine &MsgStr;
381-
382- public:
383- // / \p MsgStr is the message to be reported to the frontend.
384- // / This class does not copy \p MsgStr, therefore the reference must be valid
385- // / for the whole life time of the Diagnostic.
386- DiagnosticInfoGenericWithLoc (const Twine &MsgStr, const Function &Fn,
387- const DiagnosticLocation &Loc,
388- DiagnosticSeverity Severity = DS_Error)
389- : DiagnosticInfoWithLocationBase(DK_GenericWithLoc, Severity, Fn, Loc),
390- MsgStr (MsgStr) {}
391-
392- const Twine &getMsgStr () const { return MsgStr; }
393-
394- // / \see DiagnosticInfo::print.
395- void print (DiagnosticPrinter &DP) const override ;
396-
397- static bool classof (const DiagnosticInfo *DI) {
398- return DI->getKind () == DK_GenericWithLoc;
399- }
400- };
401-
402357// / Diagnostic information for stack size etc. reporting.
403358// / This is basically a function and a size.
404359class DiagnosticInfoResourceLimit : public DiagnosticInfoWithLocationBase {
0 commit comments