1 //===- llvm/Support/DiagnosticInfo.h - Diagnostic Declaration ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the different classes involved in low level diagnostics.
12 // Diagnostics reporting is still done as part of the LLVMContext.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_IR_DIAGNOSTICINFO_H
16 #define LLVM_IR_DIAGNOSTICINFO_H
18 #include "llvm/ADT/StringRef.h"
19 #include "llvm/ADT/Twine.h"
20 #include "llvm/IR/DebugLoc.h"
21 #include "llvm/Support/CBindingWrapping.h"
22 #include "llvm-c/Types.h"
28 // Forward declarations.
29 class DiagnosticPrinter;
36 /// \brief Defines the different supported severity of a diagnostic.
37 enum DiagnosticSeverity : char {
41 // A note attaches additional information to one of the previous diagnostic
46 /// \brief Defines the different supported kind of a diagnostic.
47 /// This enum should be extended with a new ID for each added concrete subclass.
53 DK_DebugMetadataVersion,
54 DK_DebugMetadataInvalid,
56 DK_OptimizationRemark,
57 DK_OptimizationRemarkMissed,
58 DK_OptimizationRemarkAnalysis,
59 DK_OptimizationRemarkAnalysisFPCommute,
60 DK_OptimizationRemarkAnalysisAliasing,
61 DK_OptimizationFailure,
62 DK_FirstRemark = DK_OptimizationRemark,
63 DK_LastRemark = DK_OptimizationFailure,
70 /// \brief Get the next available kind ID for a plugin diagnostic.
71 /// Each time this function is called, it returns a different number.
72 /// Therefore, a plugin that wants to "identify" its own classes
73 /// with a dynamic identifier, just have to use this method to get a new ID
74 /// and assign it to each of its classes.
75 /// The returned ID will be greater than or equal to DK_FirstPluginKind.
76 /// Thus, the plugin identifiers will not conflict with the
77 /// DiagnosticKind values.
78 int getNextAvailablePluginDiagnosticKind();
80 /// \brief This is the base abstract class for diagnostic reporting in
82 /// The print method must be overloaded by the subclasses to print a
83 /// user-friendly message in the client of the backend (let us call it a
85 class DiagnosticInfo {
87 /// Kind defines the kind of report this is about.
88 const /* DiagnosticKind */ int Kind;
89 /// Severity gives the severity of the diagnostic.
90 const DiagnosticSeverity Severity;
93 DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity)
94 : Kind(Kind), Severity(Severity) {}
96 virtual ~DiagnosticInfo() {}
98 /* DiagnosticKind */ int getKind() const { return Kind; }
99 DiagnosticSeverity getSeverity() const { return Severity; }
101 /// Print using the given \p DP a user-friendly message.
102 /// This is the default message that will be printed to the user.
103 /// It is used when the frontend does not directly take advantage
104 /// of the information contained in fields of the subclasses.
105 /// The printed message must not end with '.' nor start with a severity
107 virtual void print(DiagnosticPrinter &DP) const = 0;
109 static const char *AlwaysPrint;
112 typedef std::function<void(const DiagnosticInfo &)> DiagnosticHandlerFunction;
114 /// Diagnostic information for inline asm reporting.
115 /// This is basically a message and an optional location.
116 class DiagnosticInfoInlineAsm : public DiagnosticInfo {
118 /// Optional line information. 0 if not set.
120 /// Message to be reported.
122 /// Optional origin of the problem.
123 const Instruction *Instr;
126 /// \p MsgStr is the message to be reported to the frontend.
127 /// This class does not copy \p MsgStr, therefore the reference must be valid
128 /// for the whole life time of the Diagnostic.
129 DiagnosticInfoInlineAsm(const Twine &MsgStr,
130 DiagnosticSeverity Severity = DS_Error)
131 : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(0), MsgStr(MsgStr),
134 /// \p LocCookie if non-zero gives the line number for this report.
135 /// \p MsgStr gives the message.
136 /// This class does not copy \p MsgStr, therefore the reference must be valid
137 /// for the whole life time of the Diagnostic.
138 DiagnosticInfoInlineAsm(unsigned LocCookie, const Twine &MsgStr,
139 DiagnosticSeverity Severity = DS_Error)
140 : DiagnosticInfo(DK_InlineAsm, Severity), LocCookie(LocCookie),
141 MsgStr(MsgStr), Instr(nullptr) {}
143 /// \p Instr gives the original instruction that triggered the diagnostic.
144 /// \p MsgStr gives the message.
145 /// This class does not copy \p MsgStr, therefore the reference must be valid
146 /// for the whole life time of the Diagnostic.
148 DiagnosticInfoInlineAsm(const Instruction &I, const Twine &MsgStr,
149 DiagnosticSeverity Severity = DS_Error);
151 unsigned getLocCookie() const { return LocCookie; }
152 const Twine &getMsgStr() const { return MsgStr; }
153 const Instruction *getInstruction() const { return Instr; }
155 /// \see DiagnosticInfo::print.
156 void print(DiagnosticPrinter &DP) const override;
158 static bool classof(const DiagnosticInfo *DI) {
159 return DI->getKind() == DK_InlineAsm;
163 /// Diagnostic information for stack size reporting.
164 /// This is basically a function and a size.
165 class DiagnosticInfoStackSize : public DiagnosticInfo {
167 /// The function that is concerned by this stack size diagnostic.
169 /// The computed stack size.
173 /// \p The function that is concerned by this stack size diagnostic.
174 /// \p The computed stack size.
175 DiagnosticInfoStackSize(const Function &Fn, unsigned StackSize,
176 DiagnosticSeverity Severity = DS_Warning)
177 : DiagnosticInfo(DK_StackSize, Severity), Fn(Fn), StackSize(StackSize) {}
179 const Function &getFunction() const { return Fn; }
180 unsigned getStackSize() const { return StackSize; }
182 /// \see DiagnosticInfo::print.
183 void print(DiagnosticPrinter &DP) const override;
185 static bool classof(const DiagnosticInfo *DI) {
186 return DI->getKind() == DK_StackSize;
190 /// Diagnostic information for debug metadata version reporting.
191 /// This is basically a module and a version.
192 class DiagnosticInfoDebugMetadataVersion : public DiagnosticInfo {
194 /// The module that is concerned by this debug metadata version diagnostic.
196 /// The actual metadata version.
197 unsigned MetadataVersion;
200 /// \p The module that is concerned by this debug metadata version diagnostic.
201 /// \p The actual metadata version.
202 DiagnosticInfoDebugMetadataVersion(const Module &M, unsigned MetadataVersion,
203 DiagnosticSeverity Severity = DS_Warning)
204 : DiagnosticInfo(DK_DebugMetadataVersion, Severity), M(M),
205 MetadataVersion(MetadataVersion) {}
207 const Module &getModule() const { return M; }
208 unsigned getMetadataVersion() const { return MetadataVersion; }
210 /// \see DiagnosticInfo::print.
211 void print(DiagnosticPrinter &DP) const override;
213 static bool classof(const DiagnosticInfo *DI) {
214 return DI->getKind() == DK_DebugMetadataVersion;
218 /// Diagnostic information for stripping invalid debug metadata.
219 class DiagnosticInfoIgnoringInvalidDebugMetadata : public DiagnosticInfo {
221 /// The module that is concerned by this debug metadata version diagnostic.
225 /// \p The module that is concerned by this debug metadata version diagnostic.
226 DiagnosticInfoIgnoringInvalidDebugMetadata(
227 const Module &M, DiagnosticSeverity Severity = DS_Warning)
228 : DiagnosticInfo(DK_DebugMetadataVersion, Severity), M(M) {}
230 const Module &getModule() const { return M; }
232 /// \see DiagnosticInfo::print.
233 void print(DiagnosticPrinter &DP) const override;
235 static bool classof(const DiagnosticInfo *DI) {
236 return DI->getKind() == DK_DebugMetadataInvalid;
241 /// Diagnostic information for the sample profiler.
242 class DiagnosticInfoSampleProfile : public DiagnosticInfo {
244 DiagnosticInfoSampleProfile(StringRef FileName, unsigned LineNum,
246 DiagnosticSeverity Severity = DS_Error)
247 : DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
248 LineNum(LineNum), Msg(Msg) {}
249 DiagnosticInfoSampleProfile(StringRef FileName, const Twine &Msg,
250 DiagnosticSeverity Severity = DS_Error)
251 : DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
252 LineNum(0), Msg(Msg) {}
253 DiagnosticInfoSampleProfile(const Twine &Msg,
254 DiagnosticSeverity Severity = DS_Error)
255 : DiagnosticInfo(DK_SampleProfile, Severity), LineNum(0), Msg(Msg) {}
257 /// \see DiagnosticInfo::print.
258 void print(DiagnosticPrinter &DP) const override;
260 static bool classof(const DiagnosticInfo *DI) {
261 return DI->getKind() == DK_SampleProfile;
264 StringRef getFileName() const { return FileName; }
265 unsigned getLineNum() const { return LineNum; }
266 const Twine &getMsg() const { return Msg; }
269 /// Name of the input file associated with this diagnostic.
272 /// Line number where the diagnostic occurred. If 0, no line number will
273 /// be emitted in the message.
276 /// Message to report.
280 /// Diagnostic information for the PGO profiler.
281 class DiagnosticInfoPGOProfile : public DiagnosticInfo {
283 DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg,
284 DiagnosticSeverity Severity = DS_Error)
285 : DiagnosticInfo(DK_PGOProfile, Severity), FileName(FileName), Msg(Msg) {}
287 /// \see DiagnosticInfo::print.
288 void print(DiagnosticPrinter &DP) const override;
290 static bool classof(const DiagnosticInfo *DI) {
291 return DI->getKind() == DK_PGOProfile;
294 const char *getFileName() const { return FileName; }
295 const Twine &getMsg() const { return Msg; }
298 /// Name of the input file associated with this diagnostic.
299 const char *FileName;
301 /// Message to report.
305 /// Common features for diagnostics with an associated DebugLoc
306 class DiagnosticInfoWithDebugLocBase : public DiagnosticInfo {
308 /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
309 /// the location information to use in the diagnostic.
310 DiagnosticInfoWithDebugLocBase(enum DiagnosticKind Kind,
311 enum DiagnosticSeverity Severity,
313 const DebugLoc &DLoc)
314 : DiagnosticInfo(Kind, Severity), Fn(Fn), DLoc(DLoc) {}
316 /// Return true if location information is available for this diagnostic.
317 bool isLocationAvailable() const;
319 /// Return a string with the location information for this diagnostic
320 /// in the format "file:line:col". If location information is not available,
321 /// it returns "<unknown>:0:0".
322 const std::string getLocationStr() const;
324 /// Return location information for this diagnostic in three parts:
325 /// the source file name, line number and column.
326 void getLocation(StringRef *Filename, unsigned *Line, unsigned *Column) const;
328 const Function &getFunction() const { return Fn; }
329 const DebugLoc &getDebugLoc() const { return DLoc; }
332 /// Function where this diagnostic is triggered.
335 /// Debug location where this diagnostic is triggered.
339 /// Common features for diagnostics dealing with optimization remarks.
340 class DiagnosticInfoOptimizationBase : public DiagnosticInfoWithDebugLocBase {
342 /// \p PassName is the name of the pass emitting this diagnostic.
343 /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
344 /// the location information to use in the diagnostic. If line table
345 /// information is available, the diagnostic will include the source code
346 /// location. \p Msg is the message to show. Note that this class does not
347 /// copy this message, so this reference must be valid for the whole life time
348 /// of the diagnostic.
349 DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind,
350 enum DiagnosticSeverity Severity,
351 const char *PassName, const Function &Fn,
352 const DebugLoc &DLoc, const Twine &Msg)
353 : DiagnosticInfoWithDebugLocBase(Kind, Severity, Fn, DLoc),
354 PassName(PassName), Msg(Msg) {}
356 /// \see DiagnosticInfo::print.
357 void print(DiagnosticPrinter &DP) const override;
359 /// Return true if this optimization remark is enabled by one of
360 /// of the LLVM command line flags (-pass-remarks, -pass-remarks-missed,
361 /// or -pass-remarks-analysis). Note that this only handles the LLVM
362 /// flags. We cannot access Clang flags from here (they are handled
363 /// in BackendConsumer::OptimizationRemarkHandler).
364 virtual bool isEnabled() const = 0;
366 const char *getPassName() const { return PassName; }
367 const Twine &getMsg() const { return Msg; }
369 static bool classof(const DiagnosticInfo *DI) {
370 return DI->getKind() >= DK_FirstRemark &&
371 DI->getKind() <= DK_LastRemark;
375 /// Name of the pass that triggers this report. If this matches the
376 /// regular expression given in -Rpass=regexp, then the remark will
378 const char *PassName;
380 /// Message to report.
384 /// Diagnostic information for applied optimization remarks.
385 class DiagnosticInfoOptimizationRemark : public DiagnosticInfoOptimizationBase {
387 /// \p PassName is the name of the pass emitting this diagnostic. If
388 /// this name matches the regular expression given in -Rpass=, then the
389 /// diagnostic will be emitted. \p Fn is the function where the diagnostic
390 /// is being emitted. \p DLoc is the location information to use in the
391 /// diagnostic. If line table information is available, the diagnostic
392 /// will include the source code location. \p Msg is the message to show.
393 /// Note that this class does not copy this message, so this reference
394 /// must be valid for the whole life time of the diagnostic.
395 DiagnosticInfoOptimizationRemark(const char *PassName, const Function &Fn,
396 const DebugLoc &DLoc, const Twine &Msg)
397 : DiagnosticInfoOptimizationBase(DK_OptimizationRemark, DS_Remark,
398 PassName, Fn, DLoc, Msg) {}
400 static bool classof(const DiagnosticInfo *DI) {
401 return DI->getKind() == DK_OptimizationRemark;
404 /// \see DiagnosticInfoOptimizationBase::isEnabled.
405 bool isEnabled() const override;
408 /// Diagnostic information for missed-optimization remarks.
409 class DiagnosticInfoOptimizationRemarkMissed
410 : public DiagnosticInfoOptimizationBase {
412 /// \p PassName is the name of the pass emitting this diagnostic. If
413 /// this name matches the regular expression given in -Rpass-missed=, then the
414 /// diagnostic will be emitted. \p Fn is the function where the diagnostic
415 /// is being emitted. \p DLoc is the location information to use in the
416 /// diagnostic. If line table information is available, the diagnostic
417 /// will include the source code location. \p Msg is the message to show.
418 /// Note that this class does not copy this message, so this reference
419 /// must be valid for the whole life time of the diagnostic.
420 DiagnosticInfoOptimizationRemarkMissed(const char *PassName,
422 const DebugLoc &DLoc, const Twine &Msg)
423 : DiagnosticInfoOptimizationBase(DK_OptimizationRemarkMissed, DS_Remark,
424 PassName, Fn, DLoc, Msg) {}
426 static bool classof(const DiagnosticInfo *DI) {
427 return DI->getKind() == DK_OptimizationRemarkMissed;
430 /// \see DiagnosticInfoOptimizationBase::isEnabled.
431 bool isEnabled() const override;
434 /// Diagnostic information for optimization analysis remarks.
435 class DiagnosticInfoOptimizationRemarkAnalysis
436 : public DiagnosticInfoOptimizationBase {
438 /// \p PassName is the name of the pass emitting this diagnostic. If
439 /// this name matches the regular expression given in -Rpass-analysis=, then
440 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
441 /// is being emitted. \p DLoc is the location information to use in the
442 /// diagnostic. If line table information is available, the diagnostic will
443 /// include the source code location. \p Msg is the message to show. Note that
444 /// this class does not copy this message, so this reference must be valid for
445 /// the whole life time of the diagnostic.
446 DiagnosticInfoOptimizationRemarkAnalysis(const char *PassName,
448 const DebugLoc &DLoc,
450 : DiagnosticInfoOptimizationBase(DK_OptimizationRemarkAnalysis, DS_Remark,
451 PassName, Fn, DLoc, Msg) {}
453 static bool classof(const DiagnosticInfo *DI) {
454 return DI->getKind() == DK_OptimizationRemarkAnalysis;
457 /// \see DiagnosticInfoOptimizationBase::isEnabled.
458 bool isEnabled() const override;
461 DiagnosticInfoOptimizationRemarkAnalysis(enum DiagnosticKind Kind,
462 const char *PassName,
464 const DebugLoc &DLoc,
466 : DiagnosticInfoOptimizationBase(Kind, DS_Remark, PassName, Fn, DLoc,
470 /// Diagnostic information for optimization analysis remarks related to
471 /// floating-point non-commutativity.
472 class DiagnosticInfoOptimizationRemarkAnalysisFPCommute
473 : public DiagnosticInfoOptimizationRemarkAnalysis {
475 /// \p PassName is the name of the pass emitting this diagnostic. If
476 /// this name matches the regular expression given in -Rpass-analysis=, then
477 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
478 /// is being emitted. \p DLoc is the location information to use in the
479 /// diagnostic. If line table information is available, the diagnostic will
480 /// include the source code location. \p Msg is the message to show. The
481 /// front-end will append its own message related to options that address
482 /// floating-point non-commutativity. Note that this class does not copy this
483 /// message, so this reference must be valid for the whole life time of the
485 DiagnosticInfoOptimizationRemarkAnalysisFPCommute(const char *PassName,
487 const DebugLoc &DLoc,
489 : DiagnosticInfoOptimizationRemarkAnalysis(
490 DK_OptimizationRemarkAnalysisFPCommute, PassName, Fn, DLoc, Msg) {}
492 static bool classof(const DiagnosticInfo *DI) {
493 return DI->getKind() == DK_OptimizationRemarkAnalysisFPCommute;
497 /// Diagnostic information for optimization analysis remarks related to
498 /// pointer aliasing.
499 class DiagnosticInfoOptimizationRemarkAnalysisAliasing
500 : public DiagnosticInfoOptimizationRemarkAnalysis {
502 /// \p PassName is the name of the pass emitting this diagnostic. If
503 /// this name matches the regular expression given in -Rpass-analysis=, then
504 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
505 /// is being emitted. \p DLoc is the location information to use in the
506 /// diagnostic. If line table information is available, the diagnostic will
507 /// include the source code location. \p Msg is the message to show. The
508 /// front-end will append its own message related to options that address
509 /// pointer aliasing legality. Note that this class does not copy this
510 /// message, so this reference must be valid for the whole life time of the
512 DiagnosticInfoOptimizationRemarkAnalysisAliasing(const char *PassName,
514 const DebugLoc &DLoc,
516 : DiagnosticInfoOptimizationRemarkAnalysis(
517 DK_OptimizationRemarkAnalysisAliasing, PassName, Fn, DLoc, Msg) {}
519 static bool classof(const DiagnosticInfo *DI) {
520 return DI->getKind() == DK_OptimizationRemarkAnalysisAliasing;
524 /// Diagnostic information for machine IR parser.
525 class DiagnosticInfoMIRParser : public DiagnosticInfo {
526 const SMDiagnostic &Diagnostic;
529 DiagnosticInfoMIRParser(DiagnosticSeverity Severity,
530 const SMDiagnostic &Diagnostic)
531 : DiagnosticInfo(DK_MIRParser, Severity), Diagnostic(Diagnostic) {}
533 const SMDiagnostic &getDiagnostic() const { return Diagnostic; }
535 void print(DiagnosticPrinter &DP) const override;
537 static bool classof(const DiagnosticInfo *DI) {
538 return DI->getKind() == DK_MIRParser;
542 // Create wrappers for C Binding types (see CBindingWrapping.h).
543 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo, LLVMDiagnosticInfoRef)
545 /// Emit an optimization-applied message. \p PassName is the name of the pass
546 /// emitting the message. If -Rpass= is given and \p PassName matches the
547 /// regular expression in -Rpass, then the remark will be emitted. \p Fn is
548 /// the function triggering the remark, \p DLoc is the debug location where
549 /// the diagnostic is generated. \p Msg is the message string to use.
550 void emitOptimizationRemark(LLVMContext &Ctx, const char *PassName,
551 const Function &Fn, const DebugLoc &DLoc,
554 /// Emit an optimization-missed message. \p PassName is the name of the
555 /// pass emitting the message. If -Rpass-missed= is given and \p PassName
556 /// matches the regular expression in -Rpass, then the remark will be
557 /// emitted. \p Fn is the function triggering the remark, \p DLoc is the
558 /// debug location where the diagnostic is generated. \p Msg is the
559 /// message string to use.
560 void emitOptimizationRemarkMissed(LLVMContext &Ctx, const char *PassName,
561 const Function &Fn, const DebugLoc &DLoc,
564 /// Emit an optimization analysis remark message. \p PassName is the name of
565 /// the pass emitting the message. If -Rpass-analysis= is given and \p
566 /// PassName matches the regular expression in -Rpass, then the remark will be
567 /// emitted. \p Fn is the function triggering the remark, \p DLoc is the debug
568 /// location where the diagnostic is generated. \p Msg is the message string
570 void emitOptimizationRemarkAnalysis(LLVMContext &Ctx, const char *PassName,
571 const Function &Fn, const DebugLoc &DLoc,
574 /// Emit an optimization analysis remark related to messages about
575 /// floating-point non-commutativity. \p PassName is the name of the pass
576 /// emitting the message. If -Rpass-analysis= is given and \p PassName matches
577 /// the regular expression in -Rpass, then the remark will be emitted. \p Fn is
578 /// the function triggering the remark, \p DLoc is the debug location where the
579 /// diagnostic is generated. \p Msg is the message string to use.
580 void emitOptimizationRemarkAnalysisFPCommute(LLVMContext &Ctx,
581 const char *PassName,
583 const DebugLoc &DLoc,
586 /// Emit an optimization analysis remark related to messages about
587 /// pointer aliasing. \p PassName is the name of the pass emitting the message.
588 /// If -Rpass-analysis= is given and \p PassName matches the regular expression
589 /// in -Rpass, then the remark will be emitted. \p Fn is the function triggering
590 /// the remark, \p DLoc is the debug location where the diagnostic is generated.
591 /// \p Msg is the message string to use.
592 void emitOptimizationRemarkAnalysisAliasing(LLVMContext &Ctx,
593 const char *PassName,
595 const DebugLoc &DLoc,
598 /// Diagnostic information for optimization failures.
599 class DiagnosticInfoOptimizationFailure
600 : public DiagnosticInfoOptimizationBase {
602 /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
603 /// the location information to use in the diagnostic. If line table
604 /// information is available, the diagnostic will include the source code
605 /// location. \p Msg is the message to show. Note that this class does not
606 /// copy this message, so this reference must be valid for the whole life time
607 /// of the diagnostic.
608 DiagnosticInfoOptimizationFailure(const Function &Fn, const DebugLoc &DLoc,
610 : DiagnosticInfoOptimizationBase(DK_OptimizationFailure, DS_Warning,
611 nullptr, Fn, DLoc, Msg) {}
613 static bool classof(const DiagnosticInfo *DI) {
614 return DI->getKind() == DK_OptimizationFailure;
617 /// \see DiagnosticInfoOptimizationBase::isEnabled.
618 bool isEnabled() const override;
621 /// Diagnostic information for unsupported feature in backend.
622 class DiagnosticInfoUnsupported
623 : public DiagnosticInfoWithDebugLocBase {
628 /// \p Fn is the function where the diagnostic is being emitted. \p DLoc is
629 /// the location information to use in the diagnostic. If line table
630 /// information is available, the diagnostic will include the source code
631 /// location. \p Msg is the message to show. Note that this class does not
632 /// copy this message, so this reference must be valid for the whole life time
633 /// of the diagnostic.
634 DiagnosticInfoUnsupported(const Function &Fn, const Twine &Msg,
635 DebugLoc DLoc = DebugLoc())
636 : DiagnosticInfoWithDebugLocBase(DK_Unsupported, DS_Error, Fn, DLoc),
639 static bool classof(const DiagnosticInfo *DI) {
640 return DI->getKind() == DK_Unsupported;
643 const Twine &getMessage() const { return Msg; }
645 void print(DiagnosticPrinter &DP) const override;
648 /// Emit a warning when loop vectorization is specified but fails. \p Fn is the
649 /// function triggering the warning, \p DLoc is the debug location where the
650 /// diagnostic is generated. \p Msg is the message string to use.
651 void emitLoopVectorizeWarning(LLVMContext &Ctx, const Function &Fn,
652 const DebugLoc &DLoc, const Twine &Msg);
654 /// Emit a warning when loop interleaving is specified but fails. \p Fn is the
655 /// function triggering the warning, \p DLoc is the debug location where the
656 /// diagnostic is generated. \p Msg is the message string to use.
657 void emitLoopInterleaveWarning(LLVMContext &Ctx, const Function &Fn,
658 const DebugLoc &DLoc, const Twine &Msg);
660 } // end namespace llvm
662 #endif // LLVM_IR_DIAGNOSTICINFO_H