@@ -54,6 +54,11 @@ struct SwiftDiagnostic {
54
54
error,
55
55
};
56
56
57
+ // wrapper for passing optional help links to constructor
58
+ struct HelpLinks {
59
+ std::string_view value;
60
+ };
61
+
57
62
static constexpr std::string_view extractorName = " swift" ;
58
63
59
64
std::string_view id;
@@ -72,9 +77,9 @@ struct SwiftDiagnostic {
72
77
73
78
// notice help links are really required only for plaintext messages, otherwise they should be
74
79
// 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
78
83
template <typename ... OptionalArgs>
79
84
constexpr SwiftDiagnostic (std::string_view id,
80
85
std::string_view name,
@@ -107,10 +112,14 @@ struct SwiftDiagnostic {
107
112
private:
108
113
bool has (Visibility v) const ;
109
114
110
- constexpr void setOptionalArg (std::string_view h) { helpLinks = h; }
115
+ constexpr void setOptionalArg (HelpLinks h) { helpLinks = h. value ; }
111
116
constexpr void setOptionalArg (Format f) { format = f; }
112
117
constexpr void setOptionalArg (Visibility v) { visibility = v; }
113
118
constexpr void setOptionalArg (Severity s) { severity = s; }
119
+
120
+ // intentionally left undefined
121
+ template <typename T>
122
+ constexpr void setOptionalArg (T);
114
123
};
115
124
116
125
inline constexpr SwiftDiagnostic::Visibility operator |(SwiftDiagnostic::Visibility lhs,
0 commit comments