[clang] [clang][bytecode][NFC] Implement Reflect::toDiagnosticString() (PR #248852)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 4 02:09:35 PST 2026


https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/248852

Currently unused, but needed in a future patch (where it is still unreachable though).

>From 97e8da91faa962ea3d7c0c8200283c59ee9187d5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbaeder at redhat.com>
Date: Fri, 4 Dec 2026 11:07:29 +0100
Subject: [PATCH] [clang][bytecode][NFC] Implement
 Reflect::toDiagnosticString()

Currently unused, but needed in a future patch (where it is still
unreachable though).
---
 clang/lib/AST/ByteCode/Reflect.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/clang/lib/AST/ByteCode/Reflect.h b/clang/lib/AST/ByteCode/Reflect.h
index 4be80f281bb898..8d93b86c01bc71 100644
--- a/clang/lib/AST/ByteCode/Reflect.h
+++ b/clang/lib/AST/ByteCode/Reflect.h
@@ -45,6 +45,14 @@ class Reflect final {
   APValue toAPValue(const ASTContext &Ctx) const {
     return APValue(Kind, Operand);
   }
+
+  std::string toDiagnosticString(const ASTContext &) const {
+    // FIXME: Properly implement.
+    std::string Str;
+    llvm::raw_string_ostream OS(Str);
+    print(OS);
+    return Str;
+  }
 };
 
 inline llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, const Reflect &R) {



More information about the cfe-commits mailing list