File tree Expand file tree Collapse file tree 3 files changed +21
-13
lines changed
Transforms/Instrumentation Expand file tree Collapse file tree 3 files changed +21
-13
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ enum DiagnosticKind {
6565 DK_Lowering,
6666 DK_DebugMetadataVersion,
6767 DK_DebugMetadataInvalid,
68+ DK_Instrumentation,
6869 DK_ISelFallback,
6970 DK_SampleProfile,
7071 DK_OptimizationRemark,
@@ -950,6 +951,22 @@ class DiagnosticInfoMIRParser : public DiagnosticInfo {
950951 }
951952};
952953
954+ // / Diagnostic information for IR instrumentation reporting.
955+ class DiagnosticInfoInstrumentation : public DiagnosticInfo {
956+ const Twine &Msg;
957+
958+ public:
959+ DiagnosticInfoInstrumentation (const Twine &DiagMsg,
960+ DiagnosticSeverity Severity = DS_Warning)
961+ : DiagnosticInfo(DK_Instrumentation, Severity), Msg(DiagMsg) {}
962+
963+ void print (DiagnosticPrinter &DP) const override ;
964+
965+ static bool classof (const DiagnosticInfo *DI) {
966+ return DI->getKind () == DK_Instrumentation;
967+ }
968+ };
969+
953970// / Diagnostic information for ISel fallback path.
954971class DiagnosticInfoISelFallback : public DiagnosticInfo {
955972 // / The function that is concerned by this diagnostic.
Original file line number Diff line number Diff line change @@ -375,6 +375,10 @@ void DiagnosticInfoUnsupported::print(DiagnosticPrinter &DP) const {
375375 DP << Str;
376376}
377377
378+ void DiagnosticInfoInstrumentation::print (DiagnosticPrinter &DP) const {
379+ DP << Msg;
380+ }
381+
378382void DiagnosticInfoISelFallback::print (DiagnosticPrinter &DP) const {
379383 DP << " Instruction selection used fallback path for " << getFunction ();
380384}
Original file line number Diff line number Diff line change @@ -24,19 +24,6 @@ static cl::opt<bool> ClIgnoreRedundantInstrumentation(
2424 " ignore-redundant-instrumentation" ,
2525 cl::desc (" Ignore redundant instrumentation" ), cl::Hidden, cl::init(false ));
2626
27- namespace {
28- // / Diagnostic information for IR instrumentation reporting.
29- class DiagnosticInfoInstrumentation : public DiagnosticInfo {
30- const Twine &Msg;
31-
32- public:
33- DiagnosticInfoInstrumentation (const Twine &DiagMsg,
34- DiagnosticSeverity Severity = DS_Warning)
35- : DiagnosticInfo(DK_Linker, Severity), Msg(DiagMsg) {}
36- void print (DiagnosticPrinter &DP) const override { DP << Msg; }
37- };
38- } // namespace
39-
4027// / Check if module has flag attached, if not add the flag.
4128bool llvm::checkIfAlreadyInstrumented (Module &M, StringRef Flag) {
4229 if (!M.getModuleFlag (Flag)) {
You can’t perform that action at this time.
0 commit comments