+ /// \brief This is ctor variant allows a pass to build an optimization remark
+ /// from an existing remark.
+ ///
+ /// This is useful when a transformation pass (e.g LV) wants to emit a remark
+ /// (\p Orig) generated by one of its analyses (e.g. LAA) as its own analysis
+ /// remark. The string \p Prepend will be emitted before the original
+ /// message.
+ DiagnosticInfoOptimizationBase(const char *PassName, StringRef Prepend,
+ const DiagnosticInfoOptimizationBase &Orig)
+ : DiagnosticInfoWithDebugLocBase((DiagnosticKind)Orig.getKind(),
+ Orig.getSeverity(), Orig.getFunction(),
+ Orig.getDebugLoc()),
+ PassName(PassName), RemarkName(Orig.RemarkName),
+ CodeRegion(Orig.getCodeRegion()) {
+ *this << Prepend;
+ std::copy(Orig.Args.begin(), Orig.Args.end(), std::back_inserter(Args));
+ }
+