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

>From 6b8b34a84f1fb8ba66dc0b2f20e3870a43291715 Mon Sep 17 00:00:00 2001
From: jtstogel <[email protected]>
Date: Fri, 3 Apr 2026 10:31:09 -0700
Subject: [PATCH 1/2] [DiagnosticInfo] Allow std::string_view in
 DiagnosticBuilder opeartor<<.

After a68ae7b0cc0922b79114aabe8cf1ec8dc68524d7, calling `<<` with a 
`std::string_view` gives:

```
clang/include/clang/Basic/Diagnostic.h:1319:8: error: use of overloaded 
operator '<<' is ambiguous (with operand types 'const StreamingDiagnostic' and 
'const std::string_view')
 1319 |     DB << V;
      |     ~~ ^  ~
```
---
 clang/include/clang/Basic/Diagnostic.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/clang/include/clang/Basic/Diagnostic.h 
b/clang/include/clang/Basic/Diagnostic.h
index 5a6f5fd61a5db..6dc2eb040c9ca 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -1374,6 +1374,12 @@ inline const StreamingDiagnostic &operator<<(const 
StreamingDiagnostic &DB,
   return DB;
 }
 
+inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+                                             std::string_view S) {
+  DB.AddString(S);
+  return DB;
+}
+
 inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
                                              const std::string &S) {
   DB.AddString(S);

>From e1578e5caa8ca7a0090eb1112492e567322497eb Mon Sep 17 00:00:00 2001
From: jtstogel <[email protected]>
Date: Fri, 3 Apr 2026 11:20:40 -0700
Subject: [PATCH 2/2] Include string_view

---
 clang/include/clang/Basic/Diagnostic.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/clang/include/clang/Basic/Diagnostic.h 
b/clang/include/clang/Basic/Diagnostic.h
index 6dc2eb040c9ca..c7c98c0a460fb 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -35,6 +35,7 @@
 #include <map>
 #include <memory>
 #include <optional>
+#include <string_view>
 #include <string>
 #include <type_traits>
 #include <utility>

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to