Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
DiagnosticInfo.h
Go to the documentation of this file.
1//===- llvm/IR/DiagnosticInfo.h - Diagnostic Declaration --------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file declares the different classes involved in low level diagnostics.
10//
11// Diagnostics reporting is still done as part of the LLVMContext.
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_IR_DIAGNOSTICINFO_H
15#define LLVM_IR_DIAGNOSTICINFO_H
16
17#include "llvm-c/Types.h"
18#include "llvm/ADT/ArrayRef.h"
19#include "llvm/ADT/SmallVector.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/ADT/Twine.h"
22#include "llvm/IR/DebugLoc.h"
23#include "llvm/Support/CBindingWrapping.h"
24#include "llvm/Support/ErrorHandling.h"
25#include "llvm/Support/SourceMgr.h"
26#include "llvm/Support/TypeSize.h"
27#include <algorithm>
28#include <cstdint>
29#include <functional>
30#include <iterator>
31#include <optional>
32#include <string>
33
34namespacellvm {
35
36// Forward declarations.
37classDiagnosticPrinter;
38classDIFile;
39classDISubprogram;
40classCallInst;
41classFunction;
42classInstruction;
43classInstructionCost;
44classModule;
45classType;
46classValue;
47
48/// Defines the different supported severity of a diagnostic.
49enumDiagnosticSeverity :char {
50DS_Error,
51DS_Warning,
52DS_Remark,
53// A note attaches additional information to one of the previous diagnostic
54// types.
55DS_Note
56};
57
58/// Defines the different supported kind of a diagnostic.
59/// This enum should be extended with a new ID for each added concrete subclass.
60enumDiagnosticKind {
61DK_Generic,
62DK_GenericWithLoc,
63DK_InlineAsm,
64DK_RegAllocFailure,
65DK_ResourceLimit,
66DK_StackSize,
67DK_Linker,
68DK_Lowering,
69DK_DebugMetadataVersion,
70DK_DebugMetadataInvalid,
71DK_Instrumentation,
72DK_ISelFallback,
73DK_SampleProfile,
74DK_OptimizationRemark,
75DK_OptimizationRemarkMissed,
76DK_OptimizationRemarkAnalysis,
77DK_OptimizationRemarkAnalysisFPCommute,
78DK_OptimizationRemarkAnalysisAliasing,
79DK_OptimizationFailure,
80DK_FirstRemark =DK_OptimizationRemark,
81DK_LastRemark =DK_OptimizationFailure,
82DK_MachineOptimizationRemark,
83DK_MachineOptimizationRemarkMissed,
84DK_MachineOptimizationRemarkAnalysis,
85DK_FirstMachineRemark =DK_MachineOptimizationRemark,
86DK_LastMachineRemark =DK_MachineOptimizationRemarkAnalysis,
87DK_MIRParser,
88DK_PGOProfile,
89DK_Unsupported,
90DK_SrcMgr,
91DK_DontCall,
92DK_MisExpect,
93DK_FirstPluginKind// Must be last value to work with
94// getNextAvailablePluginDiagnosticKind
95};
96
97/// Get the next available kind ID for a plugin diagnostic.
98/// Each time this function is called, it returns a different number.
99/// Therefore, a plugin that wants to "identify" its own classes
100/// with a dynamic identifier, just have to use this method to get a new ID
101/// and assign it to each of its classes.
102/// The returned ID will be greater than or equal to DK_FirstPluginKind.
103/// Thus, the plugin identifiers will not conflict with the
104/// DiagnosticKind values.
105intgetNextAvailablePluginDiagnosticKind();
106
107/// This is the base abstract class for diagnostic reporting in
108/// the backend.
109/// The print method must be overloaded by the subclasses to print a
110/// user-friendly message in the client of the backend (let us call it a
111/// frontend).
112classDiagnosticInfo {
113private:
114 /// Kind defines the kind of report this is about.
115const/* DiagnosticKind */int Kind;
116 /// Severity gives the severity of the diagnostic.
117constDiagnosticSeverity Severity;
118
119virtualvoid anchor();
120public:
121DiagnosticInfo(/* DiagnosticKind */int Kind,DiagnosticSeverity Severity)
122 : Kind(Kind), Severity(Severity) {}
123
124virtual~DiagnosticInfo() =default;
125
126/* DiagnosticKind */intgetKind() const{return Kind; }
127DiagnosticSeveritygetSeverity() const{return Severity; }
128
129 /// Print using the given \p DP a user-friendly message.
130 /// This is the default message that will be printed to the user.
131 /// It is used when the frontend does not directly take advantage
132 /// of the information contained in fields of the subclasses.
133 /// The printed message must not end with '.' nor start with a severity
134 /// keyword.
135virtualvoidprint(DiagnosticPrinter &DP)const = 0;
136};
137
138usingDiagnosticHandlerFunction = std::function<void(constDiagnosticInfo &)>;
139
140classDiagnosticInfoGeneric :publicDiagnosticInfo {
141constTwine &MsgStr;
142constInstruction *Inst =nullptr;
143
144public:
145 /// \p MsgStr is the message to be reported to the frontend.
146 /// This class does not copy \p MsgStr, therefore the reference must be valid
147 /// for the whole life time of the Diagnostic.
148DiagnosticInfoGeneric(constTwine &MsgStr,
149DiagnosticSeverity Severity =DS_Error)
150 :DiagnosticInfo(DK_Generic, Severity), MsgStr(MsgStr) {}
151
152DiagnosticInfoGeneric(constInstruction *I,constTwine &ErrMsg,
153DiagnosticSeverity Severity =DS_Error)
154 :DiagnosticInfo(DK_Generic, Severity), MsgStr(ErrMsg), Inst(I) {}
155
156constTwine &getMsgStr() const{return MsgStr; }
157constInstruction *getInstruction() const{return Inst; }
158
159 /// \see DiagnosticInfo::print.
160voidprint(DiagnosticPrinter &DP)const override;
161
162staticboolclassof(constDiagnosticInfo *DI) {
163return DI->getKind() ==DK_Generic;
164 }
165};
166
167/// Diagnostic information for inline asm reporting.
168/// This is basically a message and an optional location.
169classDiagnosticInfoInlineAsm :publicDiagnosticInfo {
170private:
171 /// Optional line information. 0 if not set.
172uint64_t LocCookie = 0;
173 /// Message to be reported.
174constTwine &MsgStr;
175 /// Optional origin of the problem.
176constInstruction *Instr =nullptr;
177
178public:
179 /// \p LocCookie if non-zero gives the line number for this report.
180 /// \p MsgStr gives the message.
181 /// This class does not copy \p MsgStr, therefore the reference must be valid
182 /// for the whole life time of the Diagnostic.
183DiagnosticInfoInlineAsm(uint64_t LocCookie,constTwine &MsgStr,
184DiagnosticSeverity Severity =DS_Error);
185
186 /// \p Instr gives the original instruction that triggered the diagnostic.
187 /// \p MsgStr gives the message.
188 /// This class does not copy \p MsgStr, therefore the reference must be valid
189 /// for the whole life time of the Diagnostic.
190 /// Same for \p I.
191DiagnosticInfoInlineAsm(constInstruction &I,constTwine &MsgStr,
192DiagnosticSeverity Severity =DS_Error);
193
194uint64_tgetLocCookie() const{return LocCookie; }
195constTwine &getMsgStr() const{return MsgStr; }
196constInstruction *getInstruction() const{return Instr; }
197
198 /// \see DiagnosticInfo::print.
199voidprint(DiagnosticPrinter &DP)const override;
200
201staticboolclassof(constDiagnosticInfo *DI) {
202return DI->getKind() ==DK_InlineAsm;
203 }
204};
205
206/// Diagnostic information for debug metadata version reporting.
207/// This is basically a module and a version.
208classDiagnosticInfoDebugMetadataVersion :publicDiagnosticInfo {
209private:
210 /// The module that is concerned by this debug metadata version diagnostic.
211constModule &M;
212 /// The actual metadata version.
213unsigned MetadataVersion;
214
215public:
216 /// \p The module that is concerned by this debug metadata version diagnostic.
217 /// \p The actual metadata version.
218DiagnosticInfoDebugMetadataVersion(constModule &M,unsigned MetadataVersion,
219DiagnosticSeverity Severity =DS_Warning)
220 :DiagnosticInfo(DK_DebugMetadataVersion, Severity), M(M),
221 MetadataVersion(MetadataVersion) {}
222
223constModule &getModule() const{return M; }
224unsignedgetMetadataVersion() const{return MetadataVersion; }
225
226 /// \see DiagnosticInfo::print.
227voidprint(DiagnosticPrinter &DP)const override;
228
229staticboolclassof(constDiagnosticInfo *DI) {
230return DI->getKind() ==DK_DebugMetadataVersion;
231 }
232};
233
234/// Diagnostic information for stripping invalid debug metadata.
235classDiagnosticInfoIgnoringInvalidDebugMetadata :publicDiagnosticInfo {
236private:
237 /// The module that is concerned by this debug metadata version diagnostic.
238constModule &M;
239
240public:
241 /// \p The module that is concerned by this debug metadata version diagnostic.
242DiagnosticInfoIgnoringInvalidDebugMetadata(
243constModule &M,DiagnosticSeverity Severity =DS_Warning)
244 :DiagnosticInfo(DK_DebugMetadataVersion, Severity), M(M) {}
245
246constModule &getModule() const{return M; }
247
248 /// \see DiagnosticInfo::print.
249voidprint(DiagnosticPrinter &DP)const override;
250
251staticboolclassof(constDiagnosticInfo *DI) {
252return DI->getKind() ==DK_DebugMetadataInvalid;
253 }
254};
255
256/// Diagnostic information for the sample profiler.
257classDiagnosticInfoSampleProfile :publicDiagnosticInfo {
258public:
259DiagnosticInfoSampleProfile(StringRef FileName,unsigned LineNum,
260constTwine &Msg,
261DiagnosticSeverity Severity =DS_Error)
262 :DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
263 LineNum(LineNum), Msg(Msg) {}
264DiagnosticInfoSampleProfile(StringRef FileName,constTwine &Msg,
265DiagnosticSeverity Severity =DS_Error)
266 :DiagnosticInfo(DK_SampleProfile, Severity), FileName(FileName),
267 Msg(Msg) {}
268DiagnosticInfoSampleProfile(constTwine &Msg,
269DiagnosticSeverity Severity =DS_Error)
270 :DiagnosticInfo(DK_SampleProfile, Severity), Msg(Msg) {}
271
272 /// \see DiagnosticInfo::print.
273voidprint(DiagnosticPrinter &DP)const override;
274
275staticboolclassof(constDiagnosticInfo *DI) {
276return DI->getKind() ==DK_SampleProfile;
277 }
278
279StringRefgetFileName() const{return FileName; }
280unsignedgetLineNum() const{return LineNum; }
281constTwine &getMsg() const{return Msg; }
282
283private:
284 /// Name of the input file associated with this diagnostic.
285StringRef FileName;
286
287 /// Line number where the diagnostic occurred. If 0, no line number will
288 /// be emitted in the message.
289unsigned LineNum = 0;
290
291 /// Message to report.
292constTwine &Msg;
293};
294
295/// Diagnostic information for the PGO profiler.
296classDiagnosticInfoPGOProfile :publicDiagnosticInfo {
297public:
298DiagnosticInfoPGOProfile(constchar *FileName,constTwine &Msg,
299DiagnosticSeverity Severity =DS_Error)
300 :DiagnosticInfo(DK_PGOProfile, Severity), FileName(FileName), Msg(Msg) {}
301
302 /// \see DiagnosticInfo::print.
303voidprint(DiagnosticPrinter &DP)const override;
304
305staticboolclassof(constDiagnosticInfo *DI) {
306return DI->getKind() ==DK_PGOProfile;
307 }
308
309constchar *getFileName() const{return FileName; }
310constTwine &getMsg() const{return Msg; }
311
312private:
313 /// Name of the input file associated with this diagnostic.
314constchar *FileName;
315
316 /// Message to report.
317constTwine &Msg;
318};
319
320classDiagnosticLocation {
321DIFile *File =nullptr;
322unsigned Line = 0;
323unsigned Column = 0;
324
325public:
326DiagnosticLocation() =default;
327DiagnosticLocation(constDebugLoc &DL);
328DiagnosticLocation(constDISubprogram *SP);
329
330boolisValid() const{return File; }
331 /// Return the full path to the file.
332 std::stringgetAbsolutePath()const;
333 /// Return the file name relative to the compilation directory.
334StringRefgetRelativePath()const;
335unsignedgetLine() const{return Line; }
336unsignedgetColumn() const{return Column; }
337};
338
339/// Common features for diagnostics with an associated location.
340classDiagnosticInfoWithLocationBase :publicDiagnosticInfo {
341void anchor()override;
342public:
343 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is
344 /// the location information to use in the diagnostic.
345DiagnosticInfoWithLocationBase(enumDiagnosticKind Kind,
346enumDiagnosticSeverity Severity,
347constFunction &Fn,
348constDiagnosticLocation &Loc)
349 :DiagnosticInfo(Kind, Severity), Fn(Fn), Loc(Loc) {}
350
351 /// Return true if location information is available for this diagnostic.
352boolisLocationAvailable() const{return Loc.isValid(); }
353
354 /// Return a string with the location information for this diagnostic
355 /// in the format "file:line:col". If location information is not available,
356 /// it returns "<unknown>:0:0".
357 std::stringgetLocationStr()const;
358
359 /// Return location information for this diagnostic in three parts:
360 /// the relative source file path, line number and column.
361voidgetLocation(StringRef &RelativePath,unsigned &Line,
362unsigned &Column)const;
363
364 /// Return the absolute path tot the file.
365 std::stringgetAbsolutePath()const;
366
367constFunction &getFunction() const{return Fn; }
368DiagnosticLocationgetLocation() const{return Loc; }
369
370private:
371 /// Function where this diagnostic is triggered.
372constFunction &Fn;
373
374 /// Debug location where this diagnostic is triggered.
375DiagnosticLocation Loc;
376};
377
378classDiagnosticInfoGenericWithLoc :publicDiagnosticInfoWithLocationBase {
379private:
380 /// Message to be reported.
381constTwine &MsgStr;
382
383public:
384 /// \p MsgStr is the message to be reported to the frontend.
385 /// This class does not copy \p MsgStr, therefore the reference must be valid
386 /// for the whole life time of the Diagnostic.
387DiagnosticInfoGenericWithLoc(constTwine &MsgStr,constFunction &Fn,
388constDiagnosticLocation &Loc,
389DiagnosticSeverity Severity =DS_Error)
390 :DiagnosticInfoWithLocationBase(DK_GenericWithLoc, Severity, Fn, Loc),
391 MsgStr(MsgStr) {}
392
393constTwine &getMsgStr() const{return MsgStr; }
394
395 /// \see DiagnosticInfo::print.
396voidprint(DiagnosticPrinter &DP)const override;
397
398staticboolclassof(constDiagnosticInfo *DI) {
399return DI->getKind() ==DK_GenericWithLoc;
400 }
401};
402
403classDiagnosticInfoRegAllocFailure :publicDiagnosticInfoWithLocationBase {
404private:
405 /// Message to be reported.
406constTwine &MsgStr;
407
408public:
409 /// \p MsgStr is the message to be reported to the frontend.
410 /// This class does not copy \p MsgStr, therefore the reference must be valid
411 /// for the whole life time of the Diagnostic.
412DiagnosticInfoRegAllocFailure(constTwine &MsgStr,constFunction &Fn,
413constDiagnosticLocation &DL,
414DiagnosticSeverity Severity =DS_Error);
415
416DiagnosticInfoRegAllocFailure(constTwine &MsgStr,constFunction &Fn,
417DiagnosticSeverity Severity =DS_Error);
418
419constTwine &getMsgStr() const{return MsgStr; }
420
421 /// \see DiagnosticInfo::print.
422voidprint(DiagnosticPrinter &DP)const override;
423
424staticboolclassof(constDiagnosticInfo *DI) {
425return DI->getKind() ==DK_RegAllocFailure;
426 }
427};
428
429/// Diagnostic information for stack size etc. reporting.
430/// This is basically a function and a size.
431classDiagnosticInfoResourceLimit :publicDiagnosticInfoWithLocationBase {
432private:
433 /// The function that is concerned by this resource limit diagnostic.
434constFunction &Fn;
435
436 /// Description of the resource type (e.g. stack size)
437constchar *ResourceName;
438
439 /// The computed size usage
440uint64_t ResourceSize;
441
442// Threshould passed
443uint64_t ResourceLimit;
444
445public:
446 /// \p The function that is concerned by this stack size diagnostic.
447 /// \p The computed stack size.
448DiagnosticInfoResourceLimit(constFunction &Fn,constchar *ResourceName,
449uint64_t ResourceSize,uint64_t ResourceLimit,
450DiagnosticSeverity Severity =DS_Warning,
451DiagnosticKind Kind =DK_ResourceLimit);
452
453constFunction &getFunction() const{return Fn; }
454constchar *getResourceName() const{return ResourceName; }
455uint64_tgetResourceSize() const{return ResourceSize; }
456uint64_tgetResourceLimit() const{return ResourceLimit; }
457
458 /// \see DiagnosticInfo::print.
459voidprint(DiagnosticPrinter &DP)const override;
460
461staticboolclassof(constDiagnosticInfo *DI) {
462return DI->getKind() ==DK_ResourceLimit || DI->getKind() ==DK_StackSize;
463 }
464};
465
466classDiagnosticInfoStackSize :publicDiagnosticInfoResourceLimit {
467void anchor()override;
468
469public:
470DiagnosticInfoStackSize(constFunction &Fn,uint64_t StackSize,
471uint64_t StackLimit,
472DiagnosticSeverity Severity =DS_Warning)
473 :DiagnosticInfoResourceLimit(Fn,"stack frame size", StackSize,
474 StackLimit, Severity,DK_StackSize) {}
475
476uint64_tgetStackSize() const{returngetResourceSize(); }
477uint64_tgetStackLimit() const{returngetResourceLimit(); }
478
479staticboolclassof(constDiagnosticInfo *DI) {
480return DI->getKind() ==DK_StackSize;
481 }
482};
483
484/// Common features for diagnostics dealing with optimization remarks
485/// that are used by both IR and MIR passes.
486classDiagnosticInfoOptimizationBase :publicDiagnosticInfoWithLocationBase {
487public:
488 /// Used to set IsVerbose via the stream interface.
489structsetIsVerbose {};
490
491 /// When an instance of this is inserted into the stream, the arguments
492 /// following will not appear in the remark printed in the compiler output
493 /// (-Rpass) but only in the optimization record file
494 /// (-fsave-optimization-record).
495structsetExtraArgs {};
496
497 /// Used in the streaming interface as the general argument type. It
498 /// internally converts everything into a key-value pair.
499structArgument {
500 std::stringKey;
501 std::stringVal;
502// If set, the debug location corresponding to the value.
503DiagnosticLocationLoc;
504
505explicitArgument(StringRef Str ="") :Key("String"),Val(Str) {}
506Argument(StringRefKey,constValue *V);
507Argument(StringRefKey,constType *T);
508Argument(StringRefKey,StringRef S);
509Argument(StringRefKey,constchar *S) :Argument(Key,StringRef(S)) {};
510Argument(StringRefKey,intN);
511Argument(StringRefKey,floatN);
512Argument(StringRefKey,longN);
513Argument(StringRefKey,longlongN);
514Argument(StringRefKey,unsignedN);
515Argument(StringRefKey,unsignedlongN);
516Argument(StringRefKey,unsignedlonglongN);
517Argument(StringRefKey,ElementCount EC);
518Argument(StringRefKey,boolB) :Key(Key),Val(B ?"true" :"false") {}
519Argument(StringRefKey,DebugLoc dl);
520Argument(StringRefKey,InstructionCostC);
521 };
522
523 /// \p PassName is the name of the pass emitting this diagnostic. \p
524 /// RemarkName is a textual identifier for the remark (single-word,
525 /// camel-case). \p Fn is the function where the diagnostic is being emitted.
526 /// \p Loc is the location information to use in the diagnostic. If line table
527 /// information is available, the diagnostic will include the source code
528 /// location.
529DiagnosticInfoOptimizationBase(enumDiagnosticKind Kind,
530enumDiagnosticSeverity Severity,
531constchar *PassName,StringRefRemarkName,
532constFunction &Fn,
533constDiagnosticLocation &Loc)
534 :DiagnosticInfoWithLocationBase(Kind, Severity, Fn, Loc),
535PassName(PassName),RemarkName(RemarkName) {}
536
537voidinsert(StringRef S);
538voidinsert(ArgumentA);
539voidinsert(setIsVerbose V);
540voidinsert(setExtraArgs EA);
541
542 /// \see DiagnosticInfo::print.
543voidprint(DiagnosticPrinter &DP)const override;
544
545 /// Return true if this optimization remark is enabled by one of
546 /// of the LLVM command line flags (-pass-remarks, -pass-remarks-missed,
547 /// or -pass-remarks-analysis). Note that this only handles the LLVM
548 /// flags. We cannot access Clang flags from here (they are handled
549 /// in BackendConsumer::OptimizationRemarkHandler).
550virtualboolisEnabled()const = 0;
551
552StringRefgetPassName() const{returnPassName; }
553StringRefgetRemarkName() const{returnRemarkName; }
554 std::stringgetMsg()const;
555 std::optional<uint64_t>getHotness() const{returnHotness; }
556voidsetHotness(std::optional<uint64_t>H) {Hotness =H; }
557
558boolisVerbose() const{returnIsVerbose; }
559
560ArrayRef<Argument>getArgs() const{returnArgs; }
561
562staticboolclassof(constDiagnosticInfo *DI) {
563return (DI->getKind() >=DK_FirstRemark &&
564 DI->getKind() <=DK_LastRemark) ||
565 (DI->getKind() >=DK_FirstMachineRemark &&
566 DI->getKind() <=DK_LastMachineRemark);
567 }
568
569boolisPassed() const{
570return (getKind() ==DK_OptimizationRemark ||
571getKind() ==DK_MachineOptimizationRemark);
572 }
573
574boolisMissed() const{
575return (getKind() ==DK_OptimizationRemarkMissed ||
576getKind() ==DK_MachineOptimizationRemarkMissed);
577 }
578
579boolisAnalysis() const{
580return (getKind() ==DK_OptimizationRemarkAnalysis ||
581getKind() ==DK_MachineOptimizationRemarkAnalysis);
582 }
583
584protected:
585 /// Name of the pass that triggers this report. If this matches the
586 /// regular expression given in -Rpass=regexp, then the remark will
587 /// be emitted.
588constchar *PassName;
589
590 /// Textual identifier for the remark (single-word, camel-case). Can be used
591 /// by external tools reading the output file for optimization remarks to
592 /// identify the remark.
593StringRefRemarkName;
594
595 /// If profile information is available, this is the number of times the
596 /// corresponding code was executed in a profile instrumentation run.
597 std::optional<uint64_t>Hotness;
598
599 /// Arguments collected via the streaming interface.
600SmallVector<Argument, 4>Args;
601
602 /// The remark is expected to be noisy.
603boolIsVerbose =false;
604
605 /// If positive, the index of the first argument that only appear in
606 /// the optimization records and not in the remark printed in the compiler
607 /// output.
608intFirstExtraArgIndex = -1;
609};
610
611/// Allow the insertion operator to return the actual remark type rather than a
612/// common base class. This allows returning the result of the insertion
613/// directly by value, e.g. return OptimizationRemarkAnalysis(...) << "blah".
614template <class RemarkT>
615RemarkT &
616operator<<(RemarkT &R,
617 std::enable_if_t<
618 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
619StringRef>
620 S) {
621 R.insert(S);
622return R;
623}
624
625/// Also allow r-value for the remark to allow insertion into a
626/// temporarily-constructed remark.
627template <class RemarkT>
628RemarkT &
629operator<<(RemarkT &&R,
630 std::enable_if_t<
631 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
632StringRef>
633 S) {
634 R.insert(S);
635return R;
636}
637
638template <class RemarkT>
639RemarkT &
640operator<<(RemarkT &R,
641 std::enable_if_t<
642 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
643DiagnosticInfoOptimizationBase::Argument>
644A) {
645 R.insert(A);
646return R;
647}
648
649template <class RemarkT>
650RemarkT &
651operator<<(RemarkT &&R,
652 std::enable_if_t<
653 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
654DiagnosticInfoOptimizationBase::Argument>
655A) {
656 R.insert(A);
657return R;
658}
659
660template <class RemarkT>
661RemarkT &
662operator<<(RemarkT &R,
663 std::enable_if_t<
664 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
665DiagnosticInfoOptimizationBase::setIsVerbose>
666 V) {
667 R.insert(V);
668return R;
669}
670
671template <class RemarkT>
672RemarkT &
673operator<<(RemarkT &&R,
674 std::enable_if_t<
675 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
676DiagnosticInfoOptimizationBase::setIsVerbose>
677 V) {
678 R.insert(V);
679return R;
680}
681
682template <class RemarkT>
683RemarkT &
684operator<<(RemarkT &R,
685 std::enable_if_t<
686 std::is_base_of<DiagnosticInfoOptimizationBase, RemarkT>::value,
687DiagnosticInfoOptimizationBase::setExtraArgs>
688 EA) {
689 R.insert(EA);
690return R;
691}
692
693/// Common features for diagnostics dealing with optimization remarks
694/// that are used by IR passes.
695classDiagnosticInfoIROptimization :publicDiagnosticInfoOptimizationBase {
696void anchor()override;
697public:
698 /// \p PassName is the name of the pass emitting this diagnostic. \p
699 /// RemarkName is a textual identifier for the remark (single-word,
700 /// camel-case). \p Fn is the function where the diagnostic is being emitted.
701 /// \p Loc is the location information to use in the diagnostic. If line table
702 /// information is available, the diagnostic will include the source code
703 /// location. \p CodeRegion is IR value (currently basic block) that the
704 /// optimization operates on. This is currently used to provide run-time
705 /// hotness information with PGO.
706DiagnosticInfoIROptimization(enumDiagnosticKind Kind,
707enumDiagnosticSeverity Severity,
708constchar *PassName,StringRefRemarkName,
709constFunction &Fn,
710constDiagnosticLocation &Loc,
711constValue *CodeRegion =nullptr)
712 :DiagnosticInfoOptimizationBase(Kind, Severity,PassName,RemarkName, Fn,
713 Loc),
714 CodeRegion(CodeRegion) {}
715
716 /// This is ctor variant allows a pass to build an optimization remark
717 /// from an existing remark.
718 ///
719 /// This is useful when a transformation pass (e.g LV) wants to emit a remark
720 /// (\p Orig) generated by one of its analyses (e.g. LAA) as its own analysis
721 /// remark. The string \p Prepend will be emitted before the original
722 /// message.
723DiagnosticInfoIROptimization(constchar *PassName,StringRef Prepend,
724constDiagnosticInfoIROptimization &Orig)
725 :DiagnosticInfoOptimizationBase(
726 (DiagnosticKind)Orig.getKind(), Orig.getSeverity(),PassName,
727 Orig.RemarkName, Orig.getFunction(), Orig.getLocation()),
728 CodeRegion(Orig.getCodeRegion()) {
729 *this << Prepend;
730 std::copy(Orig.Args.begin(), Orig.Args.end(), std::back_inserter(Args));
731 }
732
733 /// Legacy interface.
734 /// \p PassName is the name of the pass emitting this diagnostic.
735 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is
736 /// the location information to use in the diagnostic. If line table
737 /// information is available, the diagnostic will include the source code
738 /// location. \p Msg is the message to show. Note that this class does not
739 /// copy this message, so this reference must be valid for the whole life time
740 /// of the diagnostic.
741DiagnosticInfoIROptimization(enumDiagnosticKind Kind,
742enumDiagnosticSeverity Severity,
743constchar *PassName,constFunction &Fn,
744constDiagnosticLocation &Loc,constTwine &Msg)
745 :DiagnosticInfoOptimizationBase(Kind, Severity,PassName,"", Fn, Loc) {
746 *this << Msg.str();
747 }
748
749constValue *getCodeRegion() const{return CodeRegion; }
750
751staticboolclassof(constDiagnosticInfo *DI) {
752return DI->getKind() >=DK_FirstRemark && DI->getKind() <=DK_LastRemark;
753 }
754
755private:
756 /// The IR value (currently basic block) that the optimization operates on.
757 /// This is currently used to provide run-time hotness information with PGO.
758constValue *CodeRegion =nullptr;
759};
760
761/// Diagnostic information for applied optimization remarks.
762classOptimizationRemark :publicDiagnosticInfoIROptimization {
763public:
764 /// \p PassName is the name of the pass emitting this diagnostic. If this name
765 /// matches the regular expression given in -Rpass=, then the diagnostic will
766 /// be emitted. \p RemarkName is a textual identifier for the remark (single-
767 /// word, camel-case). \p Loc is the debug location and \p CodeRegion is the
768 /// region that the optimization operates on (currently only block is
769 /// supported).
770OptimizationRemark(constchar *PassName,StringRefRemarkName,
771constDiagnosticLocation &Loc,constValue *CodeRegion);
772
773 /// Same as above, but the debug location and code region are derived from \p
774 /// Instr.
775OptimizationRemark(constchar *PassName,StringRefRemarkName,
776constInstruction *Inst);
777
778 /// Same as above, but the debug location and code region are derived from \p
779 /// Func.
780OptimizationRemark(constchar *PassName,StringRefRemarkName,
781constFunction *Func);
782
783staticboolclassof(constDiagnosticInfo *DI) {
784return DI->getKind() ==DK_OptimizationRemark;
785 }
786
787 /// \see DiagnosticInfoOptimizationBase::isEnabled.
788boolisEnabled()const override;
789
790private:
791 /// This is deprecated now and only used by the function API below.
792 /// \p PassName is the name of the pass emitting this diagnostic. If
793 /// this name matches the regular expression given in -Rpass=, then the
794 /// diagnostic will be emitted. \p Fn is the function where the diagnostic
795 /// is being emitted. \p Loc is the location information to use in the
796 /// diagnostic. If line table information is available, the diagnostic
797 /// will include the source code location. \p Msg is the message to show.
798 /// Note that this class does not copy this message, so this reference
799 /// must be valid for the whole life time of the diagnostic.
800OptimizationRemark(constchar *PassName,constFunction &Fn,
801constDiagnosticLocation &Loc,constTwine &Msg)
802 :DiagnosticInfoIROptimization(DK_OptimizationRemark,DS_Remark,PassName,
803 Fn, Loc, Msg) {}
804};
805
806/// Diagnostic information for missed-optimization remarks.
807classOptimizationRemarkMissed :publicDiagnosticInfoIROptimization {
808public:
809 /// \p PassName is the name of the pass emitting this diagnostic. If this name
810 /// matches the regular expression given in -Rpass-missed=, then the
811 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the
812 /// remark (single-word, camel-case). \p Loc is the debug location and \p
813 /// CodeRegion is the region that the optimization operates on (currently only
814 /// block is supported).
815OptimizationRemarkMissed(constchar *PassName,StringRefRemarkName,
816constDiagnosticLocation &Loc,
817constValue *CodeRegion);
818
819 /// Same as above but \p Inst is used to derive code region and debug
820 /// location.
821OptimizationRemarkMissed(constchar *PassName,StringRefRemarkName,
822constInstruction *Inst);
823
824 /// Same as above but \p F is used to derive code region and debug
825 /// location.
826OptimizationRemarkMissed(constchar *PassName,StringRefRemarkName,
827constFunction *F);
828
829staticboolclassof(constDiagnosticInfo *DI) {
830return DI->getKind() ==DK_OptimizationRemarkMissed;
831 }
832
833 /// \see DiagnosticInfoOptimizationBase::isEnabled.
834boolisEnabled()const override;
835
836private:
837 /// This is deprecated now and only used by the function API below.
838 /// \p PassName is the name of the pass emitting this diagnostic. If
839 /// this name matches the regular expression given in -Rpass-missed=, then the
840 /// diagnostic will be emitted. \p Fn is the function where the diagnostic
841 /// is being emitted. \p Loc is the location information to use in the
842 /// diagnostic. If line table information is available, the diagnostic
843 /// will include the source code location. \p Msg is the message to show.
844 /// Note that this class does not copy this message, so this reference
845 /// must be valid for the whole life time of the diagnostic.
846OptimizationRemarkMissed(constchar *PassName,constFunction &Fn,
847constDiagnosticLocation &Loc,constTwine &Msg)
848 :DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed,DS_Remark,
849PassName, Fn, Loc, Msg) {}
850};
851
852/// Diagnostic information for optimization analysis remarks.
853classOptimizationRemarkAnalysis :publicDiagnosticInfoIROptimization {
854public:
855 /// \p PassName is the name of the pass emitting this diagnostic. If this name
856 /// matches the regular expression given in -Rpass-analysis=, then the
857 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the
858 /// remark (single-word, camel-case). \p Loc is the debug location and \p
859 /// CodeRegion is the region that the optimization operates on (currently only
860 /// block is supported).
861OptimizationRemarkAnalysis(constchar *PassName,StringRefRemarkName,
862constDiagnosticLocation &Loc,
863constValue *CodeRegion);
864
865 /// This is ctor variant allows a pass to build an optimization remark
866 /// from an existing remark.
867 ///
868 /// This is useful when a transformation pass (e.g LV) wants to emit a remark
869 /// (\p Orig) generated by one of its analyses (e.g. LAA) as its own analysis
870 /// remark. The string \p Prepend will be emitted before the original
871 /// message.
872OptimizationRemarkAnalysis(constchar *PassName,StringRef Prepend,
873constOptimizationRemarkAnalysis &Orig)
874 :DiagnosticInfoIROptimization(PassName, Prepend, Orig) {}
875
876 /// Same as above but \p Inst is used to derive code region and debug
877 /// location.
878OptimizationRemarkAnalysis(constchar *PassName,StringRefRemarkName,
879constInstruction *Inst);
880
881 /// Same as above but \p F is used to derive code region and debug
882 /// location.
883OptimizationRemarkAnalysis(constchar *PassName,StringRefRemarkName,
884constFunction *F);
885
886staticboolclassof(constDiagnosticInfo *DI) {
887return DI->getKind() ==DK_OptimizationRemarkAnalysis;
888 }
889
890 /// \see DiagnosticInfoOptimizationBase::isEnabled.
891boolisEnabled()const override;
892
893staticconstchar *AlwaysPrint;
894
895boolshouldAlwaysPrint() const{returngetPassName() ==AlwaysPrint; }
896
897protected:
898OptimizationRemarkAnalysis(enumDiagnosticKind Kind,constchar *PassName,
899constFunction &Fn,constDiagnosticLocation &Loc,
900constTwine &Msg)
901 :DiagnosticInfoIROptimization(Kind,DS_Remark,PassName, Fn, Loc, Msg) {}
902
903OptimizationRemarkAnalysis(enumDiagnosticKind Kind,constchar *PassName,
904StringRefRemarkName,
905constDiagnosticLocation &Loc,
906constValue *CodeRegion);
907
908private:
909 /// This is deprecated now and only used by the function API below.
910 /// \p PassName is the name of the pass emitting this diagnostic. If
911 /// this name matches the regular expression given in -Rpass-analysis=, then
912 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
913 /// is being emitted. \p Loc is the location information to use in the
914 /// diagnostic. If line table information is available, the diagnostic will
915 /// include the source code location. \p Msg is the message to show. Note that
916 /// this class does not copy this message, so this reference must be valid for
917 /// the whole life time of the diagnostic.
918OptimizationRemarkAnalysis(constchar *PassName,constFunction &Fn,
919constDiagnosticLocation &Loc,constTwine &Msg)
920 :DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis,DS_Remark,
921PassName, Fn, Loc, Msg) {}
922};
923
924/// Diagnostic information for optimization analysis remarks related to
925/// floating-point non-commutativity.
926classOptimizationRemarkAnalysisFPCommute :publicOptimizationRemarkAnalysis {
927void anchor()override;
928public:
929 /// \p PassName is the name of the pass emitting this diagnostic. If this name
930 /// matches the regular expression given in -Rpass-analysis=, then the
931 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the
932 /// remark (single-word, camel-case). \p Loc is the debug location and \p
933 /// CodeRegion is the region that the optimization operates on (currently only
934 /// block is supported). The front-end will append its own message related to
935 /// options that address floating-point non-commutativity.
936OptimizationRemarkAnalysisFPCommute(constchar *PassName,
937StringRefRemarkName,
938constDiagnosticLocation &Loc,
939constValue *CodeRegion)
940 :OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
941PassName,RemarkName, Loc, CodeRegion) {}
942
943staticboolclassof(constDiagnosticInfo *DI) {
944return DI->getKind() ==DK_OptimizationRemarkAnalysisFPCommute;
945 }
946
947private:
948 /// This is deprecated now and only used by the function API below.
949 /// \p PassName is the name of the pass emitting this diagnostic. If
950 /// this name matches the regular expression given in -Rpass-analysis=, then
951 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
952 /// is being emitted. \p Loc is the location information to use in the
953 /// diagnostic. If line table information is available, the diagnostic will
954 /// include the source code location. \p Msg is the message to show. The
955 /// front-end will append its own message related to options that address
956 /// floating-point non-commutativity. Note that this class does not copy this
957 /// message, so this reference must be valid for the whole life time of the
958 /// diagnostic.
959OptimizationRemarkAnalysisFPCommute(constchar *PassName,constFunction &Fn,
960constDiagnosticLocation &Loc,
961constTwine &Msg)
962 :OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
963PassName, Fn, Loc, Msg) {}
964};
965
966/// Diagnostic information for optimization analysis remarks related to
967/// pointer aliasing.
968classOptimizationRemarkAnalysisAliasing :publicOptimizationRemarkAnalysis {
969void anchor()override;
970public:
971 /// \p PassName is the name of the pass emitting this diagnostic. If this name
972 /// matches the regular expression given in -Rpass-analysis=, then the
973 /// diagnostic will be emitted. \p RemarkName is a textual identifier for the
974 /// remark (single-word, camel-case). \p Loc is the debug location and \p
975 /// CodeRegion is the region that the optimization operates on (currently only
976 /// block is supported). The front-end will append its own message related to
977 /// options that address pointer aliasing legality.
978OptimizationRemarkAnalysisAliasing(constchar *PassName,StringRefRemarkName,
979constDiagnosticLocation &Loc,
980constValue *CodeRegion)
981 :OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
982PassName,RemarkName, Loc, CodeRegion) {}
983
984staticboolclassof(constDiagnosticInfo *DI) {
985return DI->getKind() ==DK_OptimizationRemarkAnalysisAliasing;
986 }
987
988private:
989 /// This is deprecated now and only used by the function API below.
990 /// \p PassName is the name of the pass emitting this diagnostic. If
991 /// this name matches the regular expression given in -Rpass-analysis=, then
992 /// the diagnostic will be emitted. \p Fn is the function where the diagnostic
993 /// is being emitted. \p Loc is the location information to use in the
994 /// diagnostic. If line table information is available, the diagnostic will
995 /// include the source code location. \p Msg is the message to show. The
996 /// front-end will append its own message related to options that address
997 /// pointer aliasing legality. Note that this class does not copy this
998 /// message, so this reference must be valid for the whole life time of the
999 /// diagnostic.
1000OptimizationRemarkAnalysisAliasing(constchar *PassName,constFunction &Fn,
1001constDiagnosticLocation &Loc,
1002constTwine &Msg)
1003 :OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
1004PassName, Fn, Loc, Msg) {}
1005};
1006
1007/// Diagnostic information for machine IR parser.
1008// FIXME: Remove this, use DiagnosticInfoSrcMgr instead.
1009classDiagnosticInfoMIRParser :publicDiagnosticInfo {
1010constSMDiagnostic &Diagnostic;
1011
1012public:
1013DiagnosticInfoMIRParser(DiagnosticSeverity Severity,
1014constSMDiagnostic &Diagnostic)
1015 :DiagnosticInfo(DK_MIRParser, Severity), Diagnostic(Diagnostic) {}
1016
1017constSMDiagnostic &getDiagnostic() const{return Diagnostic; }
1018
1019voidprint(DiagnosticPrinter &DP)const override;
1020
1021staticboolclassof(constDiagnosticInfo *DI) {
1022return DI->getKind() ==DK_MIRParser;
1023 }
1024};
1025
1026/// Diagnostic information for IR instrumentation reporting.
1027classDiagnosticInfoInstrumentation :publicDiagnosticInfo {
1028constTwine &Msg;
1029
1030public:
1031DiagnosticInfoInstrumentation(constTwine &DiagMsg,
1032DiagnosticSeverity Severity =DS_Warning)
1033 :DiagnosticInfo(DK_Instrumentation, Severity), Msg(DiagMsg) {}
1034
1035voidprint(DiagnosticPrinter &DP)const override;
1036
1037staticboolclassof(constDiagnosticInfo *DI) {
1038return DI->getKind() ==DK_Instrumentation;
1039 }
1040};
1041
1042/// Diagnostic information for ISel fallback path.
1043classDiagnosticInfoISelFallback :publicDiagnosticInfo {
1044 /// The function that is concerned by this diagnostic.
1045constFunction &Fn;
1046
1047public:
1048DiagnosticInfoISelFallback(constFunction &Fn,
1049DiagnosticSeverity Severity =DS_Warning)
1050 :DiagnosticInfo(DK_ISelFallback, Severity), Fn(Fn) {}
1051
1052constFunction &getFunction() const{return Fn; }
1053
1054voidprint(DiagnosticPrinter &DP)const override;
1055
1056staticboolclassof(constDiagnosticInfo *DI) {
1057return DI->getKind() ==DK_ISelFallback;
1058 }
1059};
1060
1061// Create wrappers for C Binding types (see CBindingWrapping.h).
1062DEFINE_SIMPLE_CONVERSION_FUNCTIONS(DiagnosticInfo,LLVMDiagnosticInfoRef)
1063
1064/// Diagnostic information for optimization failures.
1065classDiagnosticInfoOptimizationFailure : publicDiagnosticInfoIROptimization {
1066public:
1067 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is
1068 /// the location information to use in the diagnostic. If line table
1069 /// information is available, the diagnostic will include the source code
1070 /// location. \p Msg is the message to show. Note that this class does not
1071 /// copy this message, so this reference must be valid for the whole life time
1072 /// of the diagnostic.
1073DiagnosticInfoOptimizationFailure(constFunction &Fn,
1074constDiagnosticLocation &Loc,
1075constTwine &Msg)
1076 :DiagnosticInfoIROptimization(DK_OptimizationFailure,DS_Warning,
1077 nullptr, Fn, Loc, Msg) {}
1078
1079 /// \p PassName is the name of the pass emitting this diagnostic. \p
1080 /// RemarkName is a textual identifier for the remark (single-word,
1081 /// camel-case). \p Loc is the debug location and \p CodeRegion is the
1082 /// region that the optimization operates on (currently basic block is
1083 /// supported).
1084DiagnosticInfoOptimizationFailure(constchar *PassName,StringRef RemarkName,
1085constDiagnosticLocation &Loc,
1086constValue *CodeRegion);
1087
1088staticboolclassof(constDiagnosticInfo *DI) {
1089return DI->getKind() ==DK_OptimizationFailure;
1090 }
1091
1092 /// \see DiagnosticInfoOptimizationBase::isEnabled.
1093bool isEnabled()const override;
1094};
1095
1096/// Diagnostic information for unsupported feature in backend.
1097classDiagnosticInfoUnsupported :publicDiagnosticInfoWithLocationBase {
1098private:
1099Twine Msg;
1100
1101public:
1102 /// \p Fn is the function where the diagnostic is being emitted. \p Loc is
1103 /// the location information to use in the diagnostic. If line table
1104 /// information is available, the diagnostic will include the source code
1105 /// location. \p Msg is the message to show. Note that this class does not
1106 /// copy this message, so this reference must be valid for the whole life time
1107 /// of the diagnostic.
1108DiagnosticInfoUnsupported(
1109constFunction &Fn,constTwine &Msg,
1110constDiagnosticLocation &Loc =DiagnosticLocation(),
1111DiagnosticSeverity Severity =DS_Error)
1112 :DiagnosticInfoWithLocationBase(DK_Unsupported, Severity, Fn, Loc),
1113 Msg(Msg) {}
1114
1115staticboolclassof(constDiagnosticInfo *DI) {
1116return DI->getKind() ==DK_Unsupported;
1117 }
1118
1119constTwine &getMessage() const{return Msg; }
1120
1121voidprint(DiagnosticPrinter &DP)const override;
1122};
1123
1124/// Diagnostic information for MisExpect analysis.
1125classDiagnosticInfoMisExpect :publicDiagnosticInfoWithLocationBase {
1126public:
1127DiagnosticInfoMisExpect(constInstruction *Inst,Twine &Msg);
1128
1129 /// \see DiagnosticInfo::print.
1130voidprint(DiagnosticPrinter &DP)const override;
1131
1132staticboolclassof(constDiagnosticInfo *DI) {
1133return DI->getKind() ==DK_MisExpect;
1134 }
1135
1136constTwine &getMsg() const{return Msg; }
1137
1138private:
1139 /// Message to report.
1140constTwine &Msg;
1141};
1142
1143staticDiagnosticSeveritygetDiagnosticSeverity(SourceMgr::DiagKind DK) {
1144switch (DK) {
1145casellvm::SourceMgr::DK_Error:
1146returnDS_Error;
1147break;
1148casellvm::SourceMgr::DK_Warning:
1149returnDS_Warning;
1150break;
1151casellvm::SourceMgr::DK_Note:
1152returnDS_Note;
1153break;
1154casellvm::SourceMgr::DK_Remark:
1155returnDS_Remark;
1156break;
1157 }
1158llvm_unreachable("unknown SourceMgr::DiagKind");
1159}
1160
1161/// Diagnostic information for SMDiagnostic reporting.
1162classDiagnosticInfoSrcMgr :publicDiagnosticInfo {
1163constSMDiagnostic &Diagnostic;
1164StringRef ModName;
1165
1166// For inlineasm !srcloc translation.
1167bool InlineAsmDiag;
1168uint64_t LocCookie;
1169
1170public:
1171DiagnosticInfoSrcMgr(constSMDiagnostic &Diagnostic,StringRef ModName,
1172bool InlineAsmDiag =true,uint64_t LocCookie = 0)
1173 :DiagnosticInfo(DK_SrcMgr,getDiagnosticSeverity(Diagnostic.getKind())),
1174 Diagnostic(Diagnostic), ModName(ModName), InlineAsmDiag(InlineAsmDiag),
1175 LocCookie(LocCookie) {}
1176
1177StringRefgetModuleName() const{return ModName; }
1178boolisInlineAsmDiag() const{return InlineAsmDiag; }
1179constSMDiagnostic &getSMDiag() const{return Diagnostic; }
1180uint64_tgetLocCookie() const{return LocCookie; }
1181voidprint(DiagnosticPrinter &DP)const override;
1182
1183staticboolclassof(constDiagnosticInfo *DI) {
1184return DI->getKind() ==DK_SrcMgr;
1185 }
1186};
1187
1188voiddiagnoseDontCall(const CallInst &CI);
1189
1190classDiagnosticInfoDontCall :publicDiagnosticInfo {
1191StringRef CalleeName;
1192StringRef Note;
1193uint64_t LocCookie;
1194
1195public:
1196DiagnosticInfoDontCall(StringRef CalleeName,StringRef Note,
1197DiagnosticSeverity DS,uint64_t LocCookie)
1198 :DiagnosticInfo(DK_DontCall, DS), CalleeName(CalleeName),Note(Note),
1199 LocCookie(LocCookie) {}
1200StringRefgetFunctionName() const{return CalleeName; }
1201StringRefgetNote() const{returnNote; }
1202uint64_tgetLocCookie() const{return LocCookie; }
1203voidprint(DiagnosticPrinter &DP)const override;
1204staticboolclassof(constDiagnosticInfo *DI) {
1205return DI->getKind() ==DK_DontCall;
1206 }
1207};
1208
1209}// end namespace llvm
1210
1211#endif// LLVM_IR_DIAGNOSTICINFO_H
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
ArrayRef.h
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
A
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
CBindingWrapping.h
DEFINE_SIMPLE_CONVERSION_FUNCTIONS
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Definition:CBindingWrapping.h:19
Type
RelocType Type
Definition:COFFYAML.cpp:410
DebugLoc.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
I
#define I(x, y, z)
Definition:MD5.cpp:58
H
#define H(x, y, z)
Definition:MD5.cpp:57
Module
Machine Check Debug Module
Definition:MachineCheckDebugify.cpp:124
SmallVector.h
This file defines the SmallVector class.
StringRef.h
SourceMgr.h
Twine.h
TypeSize.h
Types.h
PassName
static const char PassName[]
Definition:X86LowerAMXIntrinsics.cpp:666
T
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition:Argument.h:31
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::DIFile
File.
Definition:DebugInfoMetadata.h:573
llvm::DISubprogram
Subprogram description.
Definition:DebugInfoMetadata.h:1710
llvm::DebugLoc
A debug info location.
Definition:DebugLoc.h:33
llvm::DiagnosticInfoDebugMetadataVersion
Diagnostic information for debug metadata version reporting.
Definition:DiagnosticInfo.h:208
llvm::DiagnosticInfoDebugMetadataVersion::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:229
llvm::DiagnosticInfoDebugMetadataVersion::DiagnosticInfoDebugMetadataVersion
DiagnosticInfoDebugMetadataVersion(const Module &M, unsigned MetadataVersion, DiagnosticSeverity Severity=DS_Warning)
The module that is concerned by this debug metadata version diagnostic.
Definition:DiagnosticInfo.h:218
llvm::DiagnosticInfoDebugMetadataVersion::getModule
const Module & getModule() const
Definition:DiagnosticInfo.h:223
llvm::DiagnosticInfoDebugMetadataVersion::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:114
llvm::DiagnosticInfoDebugMetadataVersion::getMetadataVersion
unsigned getMetadataVersion() const
Definition:DiagnosticInfo.h:224
llvm::DiagnosticInfoDontCall
Definition:DiagnosticInfo.h:1190
llvm::DiagnosticInfoDontCall::getNote
StringRef getNote() const
Definition:DiagnosticInfo.h:1201
llvm::DiagnosticInfoDontCall::DiagnosticInfoDontCall
DiagnosticInfoDontCall(StringRef CalleeName, StringRef Note, DiagnosticSeverity DS, uint64_t LocCookie)
Definition:DiagnosticInfo.h:1196
llvm::DiagnosticInfoDontCall::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1204
llvm::DiagnosticInfoDontCall::getLocCookie
uint64_t getLocCookie() const
Definition:DiagnosticInfo.h:1202
llvm::DiagnosticInfoDontCall::getFunctionName
StringRef getFunctionName() const
Definition:DiagnosticInfo.h:1200
llvm::DiagnosticInfoDontCall::print
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
Definition:DiagnosticInfo.cpp:483
llvm::DiagnosticInfoGenericWithLoc
Definition:DiagnosticInfo.h:378
llvm::DiagnosticInfoGenericWithLoc::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:55
llvm::DiagnosticInfoGenericWithLoc::getMsgStr
const Twine & getMsgStr() const
Definition:DiagnosticInfo.h:393
llvm::DiagnosticInfoGenericWithLoc::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:398
llvm::DiagnosticInfoGenericWithLoc::DiagnosticInfoGenericWithLoc
DiagnosticInfoGenericWithLoc(const Twine &MsgStr, const Function &Fn, const DiagnosticLocation &Loc, DiagnosticSeverity Severity=DS_Error)
MsgStr is the message to be reported to the frontend.
Definition:DiagnosticInfo.h:387
llvm::DiagnosticInfoGeneric
Definition:DiagnosticInfo.h:140
llvm::DiagnosticInfoGeneric::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:162
llvm::DiagnosticInfoGeneric::DiagnosticInfoGeneric
DiagnosticInfoGeneric(const Twine &MsgStr, DiagnosticSeverity Severity=DS_Error)
MsgStr is the message to be reported to the frontend.
Definition:DiagnosticInfo.h:148
llvm::DiagnosticInfoGeneric::getMsgStr
const Twine & getMsgStr() const
Definition:DiagnosticInfo.h:156
llvm::DiagnosticInfoGeneric::DiagnosticInfoGeneric
DiagnosticInfoGeneric(const Instruction *I, const Twine &ErrMsg, DiagnosticSeverity Severity=DS_Error)
Definition:DiagnosticInfo.h:152
llvm::DiagnosticInfoGeneric::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:51
llvm::DiagnosticInfoGeneric::getInstruction
const Instruction * getInstruction() const
Definition:DiagnosticInfo.h:157
llvm::DiagnosticInfoIROptimization
Common features for diagnostics dealing with optimization remarks that are used by IR passes.
Definition:DiagnosticInfo.h:695
llvm::DiagnosticInfoIROptimization::getCodeRegion
const Value * getCodeRegion() const
Definition:DiagnosticInfo.h:749
llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization
DiagnosticInfoIROptimization(const char *PassName, StringRef Prepend, const DiagnosticInfoIROptimization &Orig)
This is ctor variant allows a pass to build an optimization remark from an existing remark.
Definition:DiagnosticInfo.h:723
llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization
DiagnosticInfoIROptimization(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, StringRef RemarkName, const Function &Fn, const DiagnosticLocation &Loc, const Value *CodeRegion=nullptr)
PassName is the name of the pass emitting this diagnostic.
Definition:DiagnosticInfo.h:706
llvm::DiagnosticInfoIROptimization::DiagnosticInfoIROptimization
DiagnosticInfoIROptimization(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Legacy interface.
Definition:DiagnosticInfo.h:741
llvm::DiagnosticInfoIROptimization::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:751
llvm::DiagnosticInfoISelFallback
Diagnostic information for ISel fallback path.
Definition:DiagnosticInfo.h:1043
llvm::DiagnosticInfoISelFallback::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1056
llvm::DiagnosticInfoISelFallback::getFunction
const Function & getFunction() const
Definition:DiagnosticInfo.h:1052
llvm::DiagnosticInfoISelFallback::print
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
Definition:DiagnosticInfo.cpp:414
llvm::DiagnosticInfoISelFallback::DiagnosticInfoISelFallback
DiagnosticInfoISelFallback(const Function &Fn, DiagnosticSeverity Severity=DS_Warning)
Definition:DiagnosticInfo.h:1048
llvm::DiagnosticInfoIgnoringInvalidDebugMetadata
Diagnostic information for stripping invalid debug metadata.
Definition:DiagnosticInfo.h:235
llvm::DiagnosticInfoIgnoringInvalidDebugMetadata::DiagnosticInfoIgnoringInvalidDebugMetadata
DiagnosticInfoIgnoringInvalidDebugMetadata(const Module &M, DiagnosticSeverity Severity=DS_Warning)
The module that is concerned by this debug metadata version diagnostic.
Definition:DiagnosticInfo.h:242
llvm::DiagnosticInfoIgnoringInvalidDebugMetadata::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:251
llvm::DiagnosticInfoIgnoringInvalidDebugMetadata::getModule
const Module & getModule() const
Definition:DiagnosticInfo.h:246
llvm::DiagnosticInfoIgnoringInvalidDebugMetadata::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:119
llvm::DiagnosticInfoInlineAsm
Diagnostic information for inline asm reporting.
Definition:DiagnosticInfo.h:169
llvm::DiagnosticInfoInlineAsm::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:201
llvm::DiagnosticInfoInlineAsm::getInstruction
const Instruction * getInstruction() const
Definition:DiagnosticInfo.h:196
llvm::DiagnosticInfoInlineAsm::getMsgStr
const Twine & getMsgStr() const
Definition:DiagnosticInfo.h:195
llvm::DiagnosticInfoInlineAsm::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:77
llvm::DiagnosticInfoInlineAsm::getLocCookie
uint64_t getLocCookie() const
Definition:DiagnosticInfo.h:194
llvm::DiagnosticInfoInstrumentation
Diagnostic information for IR instrumentation reporting.
Definition:DiagnosticInfo.h:1027
llvm::DiagnosticInfoInstrumentation::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1037
llvm::DiagnosticInfoInstrumentation::DiagnosticInfoInstrumentation
DiagnosticInfoInstrumentation(const Twine &DiagMsg, DiagnosticSeverity Severity=DS_Warning)
Definition:DiagnosticInfo.h:1031
llvm::DiagnosticInfoInstrumentation::print
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
Definition:DiagnosticInfo.cpp:410
llvm::DiagnosticInfoMIRParser
Diagnostic information for machine IR parser.
Definition:DiagnosticInfo.h:1009
llvm::DiagnosticInfoMIRParser::print
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
Definition:DiagnosticInfo.cpp:380
llvm::DiagnosticInfoMIRParser::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1021
llvm::DiagnosticInfoMIRParser::DiagnosticInfoMIRParser
DiagnosticInfoMIRParser(DiagnosticSeverity Severity, const SMDiagnostic &Diagnostic)
Definition:DiagnosticInfo.h:1013
llvm::DiagnosticInfoMIRParser::getDiagnostic
const SMDiagnostic & getDiagnostic() const
Definition:DiagnosticInfo.h:1017
llvm::DiagnosticInfoMisExpect
Diagnostic information for MisExpect analysis.
Definition:DiagnosticInfo.h:1125
llvm::DiagnosticInfoMisExpect::getMsg
const Twine & getMsg() const
Definition:DiagnosticInfo.h:1136
llvm::DiagnosticInfoMisExpect::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:452
llvm::DiagnosticInfoMisExpect::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1132
llvm::DiagnosticInfoOptimizationBase
Common features for diagnostics dealing with optimization remarks that are used by both IR and MIR pa...
Definition:DiagnosticInfo.h:486
llvm::DiagnosticInfoOptimizationBase::isMissed
bool isMissed() const
Definition:DiagnosticInfo.h:574
llvm::DiagnosticInfoOptimizationBase::isVerbose
bool isVerbose() const
Definition:DiagnosticInfo.h:558
llvm::DiagnosticInfoOptimizationBase::getArgs
ArrayRef< Argument > getArgs() const
Definition:DiagnosticInfo.h:560
llvm::DiagnosticInfoOptimizationBase::FirstExtraArgIndex
int FirstExtraArgIndex
If positive, the index of the first argument that only appear in the optimization records and not in ...
Definition:DiagnosticInfo.h:608
llvm::DiagnosticInfoOptimizationBase::PassName
const char * PassName
Name of the pass that triggers this report.
Definition:DiagnosticInfo.h:588
llvm::DiagnosticInfoOptimizationBase::insert
void insert(StringRef S)
Definition:DiagnosticInfo.cpp:418
llvm::DiagnosticInfoOptimizationBase::getPassName
StringRef getPassName() const
Definition:DiagnosticInfo.h:552
llvm::DiagnosticInfoOptimizationBase::RemarkName
StringRef RemarkName
Textual identifier for the remark (single-word, camel-case).
Definition:DiagnosticInfo.h:593
llvm::DiagnosticInfoOptimizationBase::getMsg
std::string getMsg() const
Definition:DiagnosticInfo.cpp:434
llvm::DiagnosticInfoOptimizationBase::isAnalysis
bool isAnalysis() const
Definition:DiagnosticInfo.h:579
llvm::DiagnosticInfoOptimizationBase::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:278
llvm::DiagnosticInfoOptimizationBase::IsVerbose
bool IsVerbose
The remark is expected to be noisy.
Definition:DiagnosticInfo.h:603
llvm::DiagnosticInfoOptimizationBase::isPassed
bool isPassed() const
Definition:DiagnosticInfo.h:569
llvm::DiagnosticInfoOptimizationBase::Hotness
std::optional< uint64_t > Hotness
If profile information is available, this is the number of times the corresponding code was executed ...
Definition:DiagnosticInfo.h:597
llvm::DiagnosticInfoOptimizationBase::Args
SmallVector< Argument, 4 > Args
Arguments collected via the streaming interface.
Definition:DiagnosticInfo.h:600
llvm::DiagnosticInfoOptimizationBase::getRemarkName
StringRef getRemarkName() const
Definition:DiagnosticInfo.h:553
llvm::DiagnosticInfoOptimizationBase::setHotness
void setHotness(std::optional< uint64_t > H)
Definition:DiagnosticInfo.h:556
llvm::DiagnosticInfoOptimizationBase::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:562
llvm::DiagnosticInfoOptimizationBase::DiagnosticInfoOptimizationBase
DiagnosticInfoOptimizationBase(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const char *PassName, StringRef RemarkName, const Function &Fn, const DiagnosticLocation &Loc)
PassName is the name of the pass emitting this diagnostic.
Definition:DiagnosticInfo.h:529
llvm::DiagnosticInfoOptimizationBase::isEnabled
virtual bool isEnabled() const =0
Return true if this optimization remark is enabled by one of of the LLVM command line flags (-pass-re...
llvm::DiagnosticInfoOptimizationBase::getHotness
std::optional< uint64_t > getHotness() const
Definition:DiagnosticInfo.h:555
llvm::DiagnosticInfoOptimizationFailure
Diagnostic information for optimization failures.
Definition:DiagnosticInfo.h:1065
llvm::DiagnosticInfoOptimizationFailure::DiagnosticInfoOptimizationFailure
DiagnosticInfoOptimizationFailure(const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Fn is the function where the diagnostic is being emitted.
Definition:DiagnosticInfo.h:1073
llvm::DiagnosticInfoOptimizationFailure::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1088
llvm::DiagnosticInfoPGOProfile
Diagnostic information for the PGO profiler.
Definition:DiagnosticInfo.h:296
llvm::DiagnosticInfoPGOProfile::getFileName
const char * getFileName() const
Definition:DiagnosticInfo.h:309
llvm::DiagnosticInfoPGOProfile::DiagnosticInfoPGOProfile
DiagnosticInfoPGOProfile(const char *FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
Definition:DiagnosticInfo.h:298
llvm::DiagnosticInfoPGOProfile::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:305
llvm::DiagnosticInfoPGOProfile::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:134
llvm::DiagnosticInfoPGOProfile::getMsg
const Twine & getMsg() const
Definition:DiagnosticInfo.h:310
llvm::DiagnosticInfoRegAllocFailure
Definition:DiagnosticInfo.h:403
llvm::DiagnosticInfoRegAllocFailure::getMsgStr
const Twine & getMsgStr() const
Definition:DiagnosticInfo.h:419
llvm::DiagnosticInfoRegAllocFailure::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:96
llvm::DiagnosticInfoRegAllocFailure::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:424
llvm::DiagnosticInfoResourceLimit
Diagnostic information for stack size etc.
Definition:DiagnosticInfo.h:431
llvm::DiagnosticInfoResourceLimit::getFunction
const Function & getFunction() const
Definition:DiagnosticInfo.h:453
llvm::DiagnosticInfoResourceLimit::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:108
llvm::DiagnosticInfoResourceLimit::getResourceName
const char * getResourceName() const
Definition:DiagnosticInfo.h:454
llvm::DiagnosticInfoResourceLimit::getResourceLimit
uint64_t getResourceLimit() const
Definition:DiagnosticInfo.h:456
llvm::DiagnosticInfoResourceLimit::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:461
llvm::DiagnosticInfoResourceLimit::getResourceSize
uint64_t getResourceSize() const
Definition:DiagnosticInfo.h:455
llvm::DiagnosticInfoSampleProfile
Diagnostic information for the sample profiler.
Definition:DiagnosticInfo.h:257
llvm::DiagnosticInfoSampleProfile::DiagnosticInfoSampleProfile
DiagnosticInfoSampleProfile(StringRef FileName, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
Definition:DiagnosticInfo.h:264
llvm::DiagnosticInfoSampleProfile::print
void print(DiagnosticPrinter &DP) const override
Definition:DiagnosticInfo.cpp:124
llvm::DiagnosticInfoSampleProfile::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:275
llvm::DiagnosticInfoSampleProfile::getLineNum
unsigned getLineNum() const
Definition:DiagnosticInfo.h:280
llvm::DiagnosticInfoSampleProfile::DiagnosticInfoSampleProfile
DiagnosticInfoSampleProfile(StringRef FileName, unsigned LineNum, const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
Definition:DiagnosticInfo.h:259
llvm::DiagnosticInfoSampleProfile::DiagnosticInfoSampleProfile
DiagnosticInfoSampleProfile(const Twine &Msg, DiagnosticSeverity Severity=DS_Error)
Definition:DiagnosticInfo.h:268
llvm::DiagnosticInfoSampleProfile::getFileName
StringRef getFileName() const
Definition:DiagnosticInfo.h:279
llvm::DiagnosticInfoSampleProfile::getMsg
const Twine & getMsg() const
Definition:DiagnosticInfo.h:281
llvm::DiagnosticInfoSrcMgr
Diagnostic information for SMDiagnostic reporting.
Definition:DiagnosticInfo.h:1162
llvm::DiagnosticInfoSrcMgr::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1183
llvm::DiagnosticInfoSrcMgr::getSMDiag
const SMDiagnostic & getSMDiag() const
Definition:DiagnosticInfo.h:1179
llvm::DiagnosticInfoSrcMgr::DiagnosticInfoSrcMgr
DiagnosticInfoSrcMgr(const SMDiagnostic &Diagnostic, StringRef ModName, bool InlineAsmDiag=true, uint64_t LocCookie=0)
Definition:DiagnosticInfo.h:1171
llvm::DiagnosticInfoSrcMgr::getLocCookie
uint64_t getLocCookie() const
Definition:DiagnosticInfo.h:1180
llvm::DiagnosticInfoSrcMgr::isInlineAsmDiag
bool isInlineAsmDiag() const
Definition:DiagnosticInfo.h:1178
llvm::DiagnosticInfoSrcMgr::print
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
Definition:DiagnosticInfo.cpp:384
llvm::DiagnosticInfoSrcMgr::getModuleName
StringRef getModuleName() const
Definition:DiagnosticInfo.h:1177
llvm::DiagnosticInfoStackSize
Definition:DiagnosticInfo.h:466
llvm::DiagnosticInfoStackSize::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:479
llvm::DiagnosticInfoStackSize::DiagnosticInfoStackSize
DiagnosticInfoStackSize(const Function &Fn, uint64_t StackSize, uint64_t StackLimit, DiagnosticSeverity Severity=DS_Warning)
Definition:DiagnosticInfo.h:470
llvm::DiagnosticInfoStackSize::getStackLimit
uint64_t getStackLimit() const
Definition:DiagnosticInfo.h:477
llvm::DiagnosticInfoStackSize::getStackSize
uint64_t getStackSize() const
Definition:DiagnosticInfo.h:476
llvm::DiagnosticInfoUnsupported
Diagnostic information for unsupported feature in backend.
Definition:DiagnosticInfo.h:1097
llvm::DiagnosticInfoUnsupported::print
void print(DiagnosticPrinter &DP) const override
Print using the given DP a user-friendly message.
Definition:DiagnosticInfo.cpp:400
llvm::DiagnosticInfoUnsupported::getMessage
const Twine & getMessage() const
Definition:DiagnosticInfo.h:1119
llvm::DiagnosticInfoUnsupported::DiagnosticInfoUnsupported
DiagnosticInfoUnsupported(const Function &Fn, const Twine &Msg, const DiagnosticLocation &Loc=DiagnosticLocation(), DiagnosticSeverity Severity=DS_Error)
Fn is the function where the diagnostic is being emitted.
Definition:DiagnosticInfo.h:1108
llvm::DiagnosticInfoUnsupported::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:1115
llvm::DiagnosticInfoWithLocationBase
Common features for diagnostics with an associated location.
Definition:DiagnosticInfo.h:340
llvm::DiagnosticInfoWithLocationBase::getLocationStr
std::string getLocationStr() const
Return a string with the location information for this diagnostic in the format "file:line:col".
Definition:DiagnosticInfo.cpp:188
llvm::DiagnosticInfoWithLocationBase::getAbsolutePath
std::string getAbsolutePath() const
Return the absolute path tot the file.
Definition:DiagnosticInfo.cpp:176
llvm::DiagnosticInfoWithLocationBase::isLocationAvailable
bool isLocationAvailable() const
Return true if location information is available for this diagnostic.
Definition:DiagnosticInfo.h:352
llvm::DiagnosticInfoWithLocationBase::getFunction
const Function & getFunction() const
Definition:DiagnosticInfo.h:367
llvm::DiagnosticInfoWithLocationBase::getLocation
DiagnosticLocation getLocation() const
Definition:DiagnosticInfo.h:368
llvm::DiagnosticInfoWithLocationBase::DiagnosticInfoWithLocationBase
DiagnosticInfoWithLocationBase(enum DiagnosticKind Kind, enum DiagnosticSeverity Severity, const Function &Fn, const DiagnosticLocation &Loc)
Fn is the function where the diagnostic is being emitted.
Definition:DiagnosticInfo.h:345
llvm::DiagnosticInfo
This is the base abstract class for diagnostic reporting in the backend.
Definition:DiagnosticInfo.h:112
llvm::DiagnosticInfo::getSeverity
DiagnosticSeverity getSeverity() const
Definition:DiagnosticInfo.h:127
llvm::DiagnosticInfo::getKind
int getKind() const
Definition:DiagnosticInfo.h:126
llvm::DiagnosticInfo::DiagnosticInfo
DiagnosticInfo(int Kind, DiagnosticSeverity Severity)
Definition:DiagnosticInfo.h:121
llvm::DiagnosticInfo::~DiagnosticInfo
virtual ~DiagnosticInfo()=default
llvm::DiagnosticInfo::print
virtual void print(DiagnosticPrinter &DP) const =0
Print using the given DP a user-friendly message.
llvm::DiagnosticLocation
Definition:DiagnosticInfo.h:320
llvm::DiagnosticLocation::getLine
unsigned getLine() const
Definition:DiagnosticInfo.h:335
llvm::DiagnosticLocation::isValid
bool isValid() const
Definition:DiagnosticInfo.h:330
llvm::DiagnosticLocation::getAbsolutePath
std::string getAbsolutePath() const
Return the full path to the file.
Definition:DiagnosticInfo.cpp:166
llvm::DiagnosticLocation::getRelativePath
StringRef getRelativePath() const
Return the file name relative to the compilation directory.
Definition:DiagnosticInfo.cpp:162
llvm::DiagnosticLocation::getColumn
unsigned getColumn() const
Definition:DiagnosticInfo.h:336
llvm::DiagnosticLocation::DiagnosticLocation
DiagnosticLocation()=default
llvm::DiagnosticPrinter
Interface for custom diagnostic printing.
Definition:DiagnosticPrinter.h:31
llvm::ElementCount
Definition:TypeSize.h:300
llvm::Function
Definition:Function.h:63
llvm::InstructionCost
Definition:InstructionCost.h:29
llvm::Instruction
Definition:Instruction.h:68
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::OptimizationRemarkAnalysisAliasing
Diagnostic information for optimization analysis remarks related to pointer aliasing.
Definition:DiagnosticInfo.h:968
llvm::OptimizationRemarkAnalysisAliasing::OptimizationRemarkAnalysisAliasing
OptimizationRemarkAnalysisAliasing(const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc, const Value *CodeRegion)
PassName is the name of the pass emitting this diagnostic.
Definition:DiagnosticInfo.h:978
llvm::OptimizationRemarkAnalysisAliasing::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:984
llvm::OptimizationRemarkAnalysisFPCommute
Diagnostic information for optimization analysis remarks related to floating-point non-commutativity.
Definition:DiagnosticInfo.h:926
llvm::OptimizationRemarkAnalysisFPCommute::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:943
llvm::OptimizationRemarkAnalysisFPCommute::OptimizationRemarkAnalysisFPCommute
OptimizationRemarkAnalysisFPCommute(const char *PassName, StringRef RemarkName, const DiagnosticLocation &Loc, const Value *CodeRegion)
PassName is the name of the pass emitting this diagnostic.
Definition:DiagnosticInfo.h:936
llvm::OptimizationRemarkAnalysis
Diagnostic information for optimization analysis remarks.
Definition:DiagnosticInfo.h:853
llvm::OptimizationRemarkAnalysis::isEnabled
bool isEnabled() const override
Definition:DiagnosticInfo.cpp:373
llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis
OptimizationRemarkAnalysis(const char *PassName, StringRef Prepend, const OptimizationRemarkAnalysis &Orig)
This is ctor variant allows a pass to build an optimization remark from an existing remark.
Definition:DiagnosticInfo.h:872
llvm::OptimizationRemarkAnalysis::OptimizationRemarkAnalysis
OptimizationRemarkAnalysis(enum DiagnosticKind Kind, const char *PassName, const Function &Fn, const DiagnosticLocation &Loc, const Twine &Msg)
Definition:DiagnosticInfo.h:898
llvm::OptimizationRemarkAnalysis::AlwaysPrint
static const char * AlwaysPrint
Definition:DiagnosticInfo.h:893
llvm::OptimizationRemarkAnalysis::shouldAlwaysPrint
bool shouldAlwaysPrint() const
Definition:DiagnosticInfo.h:895
llvm::OptimizationRemarkAnalysis::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:886
llvm::OptimizationRemarkMissed
Diagnostic information for missed-optimization remarks.
Definition:DiagnosticInfo.h:807
llvm::OptimizationRemarkMissed::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:829
llvm::OptimizationRemarkMissed::isEnabled
bool isEnabled() const override
Definition:DiagnosticInfo.cpp:338
llvm::OptimizationRemark
Diagnostic information for applied optimization remarks.
Definition:DiagnosticInfo.h:762
llvm::OptimizationRemark::classof
static bool classof(const DiagnosticInfo *DI)
Definition:DiagnosticInfo.h:783
llvm::OptimizationRemark::isEnabled
bool isEnabled() const override
Definition:DiagnosticInfo.cpp:310
llvm::SMDiagnostic
Instances of this class encapsulate one diagnostic report, allowing printing to a raw_ostream as a ca...
Definition:SourceMgr.h:281
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::SourceMgr::DiagKind
DiagKind
Definition:SourceMgr.h:33
llvm::SourceMgr::DK_Warning
@ DK_Warning
Definition:SourceMgr.h:35
llvm::SourceMgr::DK_Note
@ DK_Note
Definition:SourceMgr.h:37
llvm::SourceMgr::DK_Error
@ DK_Error
Definition:SourceMgr.h:34
llvm::SourceMgr::DK_Remark
@ DK_Remark
Definition:SourceMgr.h:36
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition:Twine.h:81
llvm::Twine::str
std::string str() const
Return the twine contents as a std::string.
Definition:Twine.cpp:17
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
uint64_t
LLVMDiagnosticInfoRef
struct LLVMOpaqueDiagnosticInfo * LLVMDiagnosticInfoRef
Definition:Types.h:150
ErrorHandling.h
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition:ErrorHandling.h:143
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm::TargetStackID::Value
Value
Definition:TargetFrameLowering.h:29
llvm::codeview::PublicSymFlags::Function
@ Function
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::diagnoseDontCall
void diagnoseDontCall(const CallInst &CI)
Definition:DiagnosticInfo.cpp:459
llvm::DiagnosticKind
DiagnosticKind
Defines the different supported kind of a diagnostic.
Definition:DiagnosticInfo.h:60
llvm::DK_DebugMetadataInvalid
@ DK_DebugMetadataInvalid
Definition:DiagnosticInfo.h:70
llvm::DK_SrcMgr
@ DK_SrcMgr
Definition:DiagnosticInfo.h:90
llvm::DK_Instrumentation
@ DK_Instrumentation
Definition:DiagnosticInfo.h:71
llvm::DK_OptimizationRemarkAnalysis
@ DK_OptimizationRemarkAnalysis
Definition:DiagnosticInfo.h:76
llvm::DK_LastMachineRemark
@ DK_LastMachineRemark
Definition:DiagnosticInfo.h:86
llvm::DK_OptimizationRemarkAnalysisAliasing
@ DK_OptimizationRemarkAnalysisAliasing
Definition:DiagnosticInfo.h:78
llvm::DK_StackSize
@ DK_StackSize
Definition:DiagnosticInfo.h:66
llvm::DK_SampleProfile
@ DK_SampleProfile
Definition:DiagnosticInfo.h:73
llvm::DK_MachineOptimizationRemark
@ DK_MachineOptimizationRemark
Definition:DiagnosticInfo.h:82
llvm::DK_Unsupported
@ DK_Unsupported
Definition:DiagnosticInfo.h:89
llvm::DK_LastRemark
@ DK_LastRemark
Definition:DiagnosticInfo.h:81
llvm::DK_OptimizationRemarkMissed
@ DK_OptimizationRemarkMissed
Definition:DiagnosticInfo.h:75
llvm::DK_MIRParser
@ DK_MIRParser
Definition:DiagnosticInfo.h:87
llvm::DK_GenericWithLoc
@ DK_GenericWithLoc
Definition:DiagnosticInfo.h:62
llvm::DK_ResourceLimit
@ DK_ResourceLimit
Definition:DiagnosticInfo.h:65
llvm::DK_MachineOptimizationRemarkAnalysis
@ DK_MachineOptimizationRemarkAnalysis
Definition:DiagnosticInfo.h:84
llvm::DK_ISelFallback
@ DK_ISelFallback
Definition:DiagnosticInfo.h:72
llvm::DK_Lowering
@ DK_Lowering
Definition:DiagnosticInfo.h:68
llvm::DK_OptimizationRemark
@ DK_OptimizationRemark
Definition:DiagnosticInfo.h:74
llvm::DK_FirstMachineRemark
@ DK_FirstMachineRemark
Definition:DiagnosticInfo.h:85
llvm::DK_DontCall
@ DK_DontCall
Definition:DiagnosticInfo.h:91
llvm::DK_MachineOptimizationRemarkMissed
@ DK_MachineOptimizationRemarkMissed
Definition:DiagnosticInfo.h:83
llvm::DK_PGOProfile
@ DK_PGOProfile
Definition:DiagnosticInfo.h:88
llvm::DK_InlineAsm
@ DK_InlineAsm
Definition:DiagnosticInfo.h:63
llvm::DK_Generic
@ DK_Generic
Definition:DiagnosticInfo.h:61
llvm::DK_DebugMetadataVersion
@ DK_DebugMetadataVersion
Definition:DiagnosticInfo.h:69
llvm::DK_OptimizationFailure
@ DK_OptimizationFailure
Definition:DiagnosticInfo.h:79
llvm::DK_FirstRemark
@ DK_FirstRemark
Definition:DiagnosticInfo.h:80
llvm::DK_MisExpect
@ DK_MisExpect
Definition:DiagnosticInfo.h:92
llvm::DK_OptimizationRemarkAnalysisFPCommute
@ DK_OptimizationRemarkAnalysisFPCommute
Definition:DiagnosticInfo.h:77
llvm::DK_FirstPluginKind
@ DK_FirstPluginKind
Definition:DiagnosticInfo.h:93
llvm::DK_RegAllocFailure
@ DK_RegAllocFailure
Definition:DiagnosticInfo.h:64
llvm::DK_Linker
@ DK_Linker
Definition:DiagnosticInfo.h:67
llvm::getNextAvailablePluginDiagnosticKind
int getNextAvailablePluginDiagnosticKind()
Get the next available kind ID for a plugin diagnostic.
Definition:DiagnosticInfo.cpp:44
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition:APFixedPoint.h:303
llvm::DiagnosticSeverity
DiagnosticSeverity
Defines the different supported severity of a diagnostic.
Definition:DiagnosticInfo.h:49
llvm::DS_Remark
@ DS_Remark
Definition:DiagnosticInfo.h:52
llvm::DS_Warning
@ DS_Warning
Definition:DiagnosticInfo.h:51
llvm::DS_Note
@ DS_Note
Definition:DiagnosticInfo.h:55
llvm::DS_Error
@ DS_Error
Definition:DiagnosticInfo.h:50
llvm::getDiagnosticSeverity
static DiagnosticSeverity getDiagnosticSeverity(SourceMgr::DiagKind DK)
Definition:DiagnosticInfo.h:1143
llvm::HighlightColor::Note
@ Note
llvm::DiagnosticHandlerFunction
std::function< void(const DiagnosticInfo &)> DiagnosticHandlerFunction
Definition:DiagnosticInfo.h:138
N
#define N
llvm::DiagnosticInfoOptimizationBase::Argument
Used in the streaming interface as the general argument type.
Definition:DiagnosticInfo.h:499
llvm::DiagnosticInfoOptimizationBase::Argument::Argument
Argument(StringRef Str="")
Definition:DiagnosticInfo.h:505
llvm::DiagnosticInfoOptimizationBase::Argument::Loc
DiagnosticLocation Loc
Definition:DiagnosticInfo.h:503
llvm::DiagnosticInfoOptimizationBase::Argument::Argument
Argument(StringRef Key, const char *S)
Definition:DiagnosticInfo.h:509
llvm::DiagnosticInfoOptimizationBase::Argument::Val
std::string Val
Definition:DiagnosticInfo.h:501
llvm::DiagnosticInfoOptimizationBase::Argument::Key
std::string Key
Definition:DiagnosticInfo.h:500
llvm::DiagnosticInfoOptimizationBase::Argument::Argument
Argument(StringRef Key, bool B)
Definition:DiagnosticInfo.h:518
llvm::DiagnosticInfoOptimizationBase::setExtraArgs
When an instance of this is inserted into the stream, the arguments following will not appear in the ...
Definition:DiagnosticInfo.h:495
llvm::DiagnosticInfoOptimizationBase::setIsVerbose
Used to set IsVerbose via the stream interface.
Definition:DiagnosticInfo.h:489

Generated on Sun Jul 20 2025 07:23:11 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp