@@ -700,13 +700,11 @@ class DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
700700 // / \p Fn is the function where the diagnostic is being emitted. \p Loc is
701701 // / the location information to use in the diagnostic. If line table
702702 // / information is available, the diagnostic will include the source code
703- // / location. \p Msg is the message to show. Note that this class does not
704- // / copy this message, so this reference must be valid for the whole life time
705- // / of the diagnostic.
703+ // / location. \p Msg is the message to show.
706704 DiagnosticInfoIROptimization (enum DiagnosticKind Kind,
707705 enum DiagnosticSeverity Severity,
708706 const char *PassName, const Function &Fn,
709- const DiagnosticLocation &Loc, StringRef Msg)
707+ const DiagnosticLocation &Loc, const Twine & Msg)
710708 : DiagnosticInfoOptimizationBase(Kind, Severity, PassName, " " , Fn, Loc) {
711709 *this << Msg.str ();
712710 }
@@ -760,10 +758,8 @@ class OptimizationRemark : public DiagnosticInfoIROptimization {
760758 // / is being emitted. \p Loc is the location information to use in the
761759 // / diagnostic. If line table information is available, the diagnostic
762760 // / will include the source code location. \p Msg is the message to show.
763- // / Note that this class does not copy this message, so this reference
764- // / must be valid for the whole life time of the diagnostic.
765761 OptimizationRemark (const char *PassName, const Function &Fn,
766- const DiagnosticLocation &Loc, StringRef Msg)
762+ const DiagnosticLocation &Loc, const Twine & Msg)
767763 : DiagnosticInfoIROptimization(DK_OptimizationRemark, DS_Remark, PassName,
768764 Fn, Loc, Msg) {}
769765};
@@ -806,10 +802,8 @@ class OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
806802 // / is being emitted. \p Loc is the location information to use in the
807803 // / diagnostic. If line table information is available, the diagnostic
808804 // / will include the source code location. \p Msg is the message to show.
809- // / Note that this class does not copy this message, so this reference
810- // / must be valid for the whole life time of the diagnostic.
811805 OptimizationRemarkMissed (const char *PassName, const Function &Fn,
812- const DiagnosticLocation &Loc, StringRef Msg)
806+ const DiagnosticLocation &Loc, const Twine & Msg)
813807 : DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed, DS_Remark,
814808 PassName, Fn, Loc, Msg) {}
815809};
@@ -862,7 +856,7 @@ class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
862856protected:
863857 OptimizationRemarkAnalysis (enum DiagnosticKind Kind, const char *PassName,
864858 const Function &Fn, const DiagnosticLocation &Loc,
865- StringRef Msg)
859+ const Twine & Msg)
866860 : DiagnosticInfoIROptimization(Kind, DS_Remark, PassName, Fn, Loc, Msg) {}
867861
868862 OptimizationRemarkAnalysis (enum DiagnosticKind Kind, const char *PassName,
@@ -877,11 +871,9 @@ class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
877871 // / the diagnostic will be emitted. \p Fn is the function where the diagnostic
878872 // / is being emitted. \p Loc is the location information to use in the
879873 // / diagnostic. If line table information is available, the diagnostic will
880- // / include the source code location. \p Msg is the message to show. Note that
881- // / this class does not copy this message, so this reference must be valid for
882- // / the whole life time of the diagnostic.
874+ // / include the source code location. \p Msg is the message to show.
883875 OptimizationRemarkAnalysis (const char *PassName, const Function &Fn,
884- const DiagnosticLocation &Loc, StringRef Msg)
876+ const DiagnosticLocation &Loc, const Twine & Msg)
885877 : DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis, DS_Remark,
886878 PassName, Fn, Loc, Msg) {}
887879};
@@ -918,12 +910,10 @@ class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
918910 // / diagnostic. If line table information is available, the diagnostic will
919911 // / include the source code location. \p Msg is the message to show. The
920912 // / front-end will append its own message related to options that address
921- // / floating-point non-commutativity. Note that this class does not copy this
922- // / message, so this reference must be valid for the whole life time of the
923- // / diagnostic.
913+ // / floating-point non-commutativity.
924914 OptimizationRemarkAnalysisFPCommute (const char *PassName, const Function &Fn,
925915 const DiagnosticLocation &Loc,
926- StringRef Msg)
916+ const Twine & Msg)
927917 : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
928918 PassName, Fn, Loc, Msg) {}
929919};
@@ -959,12 +949,10 @@ class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
959949 // / diagnostic. If line table information is available, the diagnostic will
960950 // / include the source code location. \p Msg is the message to show. The
961951 // / front-end will append its own message related to options that address
962- // / pointer aliasing legality. Note that this class does not copy this
963- // / message, so this reference must be valid for the whole life time of the
964- // / diagnostic.
952+ // / pointer aliasing legality.
965953 OptimizationRemarkAnalysisAliasing (const char *PassName, const Function &Fn,
966954 const DiagnosticLocation &Loc,
967- StringRef Msg)
955+ const Twine & Msg)
968956 : OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
969957 PassName, Fn, Loc, Msg) {}
970958};
@@ -1032,12 +1020,10 @@ class DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
10321020 // / \p Fn is the function where the diagnostic is being emitted. \p Loc is
10331021 // / the location information to use in the diagnostic. If line table
10341022 // / information is available, the diagnostic will include the source code
1035- // / location. \p Msg is the message to show. Note that this class does not
1036- // / copy this message, so this reference must be valid for the whole life time
1037- // / of the diagnostic.
1023+ // / location. \p Msg is the message to show.
10381024 DiagnosticInfoOptimizationFailure (const Function &Fn,
10391025 const DiagnosticLocation &Loc,
1040- StringRef Msg)
1026+ const Twine & Msg = " " )
10411027 : DiagnosticInfoIROptimization (DK_OptimizationFailure, DS_Warning,
10421028 nullptr , Fn, Loc, Msg) {}
10431029
0 commit comments