[clang] [DiagnosticInfo] Allow std::string_view in DiagnosticBuilder operator<<. (PR #190374)

Jackson Stogel via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 3 14:43:44 PDT 2026


================
@@ -42,8 +43,19 @@ void clang::DiagnosticsTestHelper(DiagnosticsEngine &diag) {
 namespace {
 using testing::AllOf;
 using testing::ElementsAre;
+using testing::HasSubstr;
 using testing::IsEmpty;
 
+MATCHER_P(WithMessage, M,
+          "has diagnostic message that " +
+              ::testing::DescribeMatcher<std::string>(M)) {
+  return testing::ExplainMatchResult(M, arg.getMessage().str(),
+                                     result_listener);
+}
+MATCHER(IsError, "has error severity") {
----------------
jtstogel wrote:

Moved so that WithMessage is defined before use in `reportAcceptsStringViewMessage`

https://github.com/llvm/llvm-project/pull/190374


More information about the cfe-commits mailing list