@@ -58,8 +58,6 @@ enum DiagnosticSeverity : char {
58
58
// / Defines the different supported kind of a diagnostic.
59
59
// / This enum should be extended with a new ID for each added concrete subclass.
60
60
enum DiagnosticKind {
61
- DK_Generic,
62
- DK_GenericWithLoc,
63
61
DK_InlineAsm,
64
62
DK_ResourceLimit,
65
63
DK_StackSize,
@@ -136,33 +134,6 @@ class DiagnosticInfo {
136
134
137
135
using DiagnosticHandlerFunction = std::function<void (const DiagnosticInfo &)>;
138
136
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
-
166
137
// / Diagnostic information for inline asm reporting.
167
138
// / This is basically a message and an optional location.
168
139
class DiagnosticInfoInlineAsm : public DiagnosticInfo {
@@ -175,12 +146,21 @@ class DiagnosticInfoInlineAsm : public DiagnosticInfo {
175
146
const Instruction *Instr = nullptr ;
176
147
177
148
public:
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
+
178
156
// / \p LocCookie if non-zero gives the line number for this report.
179
157
// / \p MsgStr gives the message.
180
158
// / This class does not copy \p MsgStr, therefore the reference must be valid
181
159
// / for the whole life time of the Diagnostic.
182
160
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) {}
184
164
185
165
// / \p Instr gives the original instruction that triggered the diagnostic.
186
166
// / \p MsgStr gives the message.
@@ -374,31 +354,6 @@ class DiagnosticInfoWithLocationBase : public DiagnosticInfo {
374
354
DiagnosticLocation Loc;
375
355
};
376
356
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
-
402
357
// / Diagnostic information for stack size etc. reporting.
403
358
// / This is basically a function and a size.
404
359
class DiagnosticInfoResourceLimit : public DiagnosticInfoWithLocationBase {
0 commit comments