@@ -700,13 +700,11 @@ class DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase {
700
700
// / \p Fn is the function where the diagnostic is being emitted. \p Loc is
701
701
// / the location information to use in the diagnostic. If line table
702
702
// / 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.
706
704
DiagnosticInfoIROptimization (enum DiagnosticKind Kind,
707
705
enum DiagnosticSeverity Severity,
708
706
const char *PassName, const Function &Fn,
709
- const DiagnosticLocation &Loc, StringRef Msg)
707
+ const DiagnosticLocation &Loc, const Twine & Msg)
710
708
: DiagnosticInfoOptimizationBase(Kind, Severity, PassName, " " , Fn, Loc) {
711
709
*this << Msg.str ();
712
710
}
@@ -760,10 +758,8 @@ class OptimizationRemark : public DiagnosticInfoIROptimization {
760
758
// / is being emitted. \p Loc is the location information to use in the
761
759
// / diagnostic. If line table information is available, the diagnostic
762
760
// / 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.
765
761
OptimizationRemark (const char *PassName, const Function &Fn,
766
- const DiagnosticLocation &Loc, StringRef Msg)
762
+ const DiagnosticLocation &Loc, const Twine & Msg)
767
763
: DiagnosticInfoIROptimization(DK_OptimizationRemark, DS_Remark, PassName,
768
764
Fn, Loc, Msg) {}
769
765
};
@@ -806,10 +802,8 @@ class OptimizationRemarkMissed : public DiagnosticInfoIROptimization {
806
802
// / is being emitted. \p Loc is the location information to use in the
807
803
// / diagnostic. If line table information is available, the diagnostic
808
804
// / 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.
811
805
OptimizationRemarkMissed (const char *PassName, const Function &Fn,
812
- const DiagnosticLocation &Loc, StringRef Msg)
806
+ const DiagnosticLocation &Loc, const Twine & Msg)
813
807
: DiagnosticInfoIROptimization(DK_OptimizationRemarkMissed, DS_Remark,
814
808
PassName, Fn, Loc, Msg) {}
815
809
};
@@ -862,7 +856,7 @@ class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
862
856
protected:
863
857
OptimizationRemarkAnalysis (enum DiagnosticKind Kind, const char *PassName,
864
858
const Function &Fn, const DiagnosticLocation &Loc,
865
- StringRef Msg)
859
+ const Twine & Msg)
866
860
: DiagnosticInfoIROptimization(Kind, DS_Remark, PassName, Fn, Loc, Msg) {}
867
861
868
862
OptimizationRemarkAnalysis (enum DiagnosticKind Kind, const char *PassName,
@@ -877,11 +871,9 @@ class OptimizationRemarkAnalysis : public DiagnosticInfoIROptimization {
877
871
// / the diagnostic will be emitted. \p Fn is the function where the diagnostic
878
872
// / is being emitted. \p Loc is the location information to use in the
879
873
// / 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.
883
875
OptimizationRemarkAnalysis (const char *PassName, const Function &Fn,
884
- const DiagnosticLocation &Loc, StringRef Msg)
876
+ const DiagnosticLocation &Loc, const Twine & Msg)
885
877
: DiagnosticInfoIROptimization(DK_OptimizationRemarkAnalysis, DS_Remark,
886
878
PassName, Fn, Loc, Msg) {}
887
879
};
@@ -918,12 +910,10 @@ class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis {
918
910
// / diagnostic. If line table information is available, the diagnostic will
919
911
// / include the source code location. \p Msg is the message to show. The
920
912
// / 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.
924
914
OptimizationRemarkAnalysisFPCommute (const char *PassName, const Function &Fn,
925
915
const DiagnosticLocation &Loc,
926
- StringRef Msg)
916
+ const Twine & Msg)
927
917
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisFPCommute,
928
918
PassName, Fn, Loc, Msg) {}
929
919
};
@@ -959,12 +949,10 @@ class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis {
959
949
// / diagnostic. If line table information is available, the diagnostic will
960
950
// / include the source code location. \p Msg is the message to show. The
961
951
// / 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.
965
953
OptimizationRemarkAnalysisAliasing (const char *PassName, const Function &Fn,
966
954
const DiagnosticLocation &Loc,
967
- StringRef Msg)
955
+ const Twine & Msg)
968
956
: OptimizationRemarkAnalysis(DK_OptimizationRemarkAnalysisAliasing,
969
957
PassName, Fn, Loc, Msg) {}
970
958
};
@@ -1032,12 +1020,10 @@ class DiagnosticInfoOptimizationFailure : public DiagnosticInfoIROptimization {
1032
1020
// / \p Fn is the function where the diagnostic is being emitted. \p Loc is
1033
1021
// / the location information to use in the diagnostic. If line table
1034
1022
// / 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.
1038
1024
DiagnosticInfoOptimizationFailure (const Function &Fn,
1039
1025
const DiagnosticLocation &Loc,
1040
- StringRef Msg)
1026
+ const Twine & Msg = " " )
1041
1027
: DiagnosticInfoIROptimization (DK_OptimizationFailure, DS_Warning,
1042
1028
nullptr , Fn, Loc, Msg) {}
1043
1029
0 commit comments