@@ -54,6 +54,11 @@ struct SwiftDiagnostic {
5454 error,
5555 };
5656
57+ // wrapper for passing optional help links to constructor
58+ struct HelpLinks {
59+ std::string_view value;
60+ };
61+
5762 static constexpr std::string_view extractorName = " swift" ;
5863
5964 std::string_view id;
@@ -72,9 +77,9 @@ struct SwiftDiagnostic {
7277
7378 // notice help links are really required only for plaintext messages, otherwise they should be
7479 // directly embedded in the markdown message
75- // optional arguments can be any of
76- // * std::string_view for setting helpLinks
77- // * Severity, Visibility or Format to set the corresponding field
80+ // optional arguments can be any of HelpLinks, Severity, Visibility or Format to set the
81+ // corresponding field
82+ // TODO(C++20) this constructor won't really be necessary anymore with designated initializers
7883 template <typename ... OptionalArgs>
7984 constexpr SwiftDiagnostic (std::string_view id,
8085 std::string_view name,
@@ -107,10 +112,14 @@ struct SwiftDiagnostic {
107112 private:
108113 bool has (Visibility v) const ;
109114
110- constexpr void setOptionalArg (std::string_view h) { helpLinks = h; }
115+ constexpr void setOptionalArg (HelpLinks h) { helpLinks = h. value ; }
111116 constexpr void setOptionalArg (Format f) { format = f; }
112117 constexpr void setOptionalArg (Visibility v) { visibility = v; }
113118 constexpr void setOptionalArg (Severity s) { severity = s; }
119+
120+ // intentionally left undefined
121+ template <typename T>
122+ constexpr void setOptionalArg (T);
114123};
115124
116125inline constexpr SwiftDiagnostic::Visibility operator |(SwiftDiagnostic::Visibility lhs,
0 commit comments