[clang] [Clang] Serialize PartialDiagnostic for concepts (PR #211767)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 24 06:39:30 PDT 2026


================
@@ -18,26 +18,68 @@
 #include "clang/AST/NestedNameSpecifierBase.h"
 #include "clang/AST/TemplateBase.h"
 #include "clang/Basic/OptionalUnsigned.h"
+#include "clang/Basic/PartialDiagnostic.h"
 #include "clang/Basic/SourceLocation.h"
 #include "llvm/ADT/FoldingSet.h"
 #include "llvm/ADT/PointerUnion.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/TrailingObjects.h"
 #include <utility>
 
 namespace clang {
 
+class ASTContext;
 class ConceptDecl;
 class TemplateDecl;
 class ConceptReference;
 class Expr;
 class NamedDecl;
 struct PrintingPolicy;
 
+/// A compact, trivially-destructible stand-in for \c PartialDiagnostic suitable
+/// for storage on the AST and for serialization.
+///
+/// Unlike \c PartialDiagnostic it doesn't own a \c DiagnosticStorage and is not
+/// tied to a \c DiagStorageAllocator: only part of the arguments that are
+/// currently used by SFINAE diagnostics are kept.
+///
+class ASTPartialDiagnostic final
+    : private llvm::TrailingObjects<ASTPartialDiagnostic, uint64_t, uint32_t,
+                                    CharSourceRange> {
+  friend TrailingObjects;
+
+  /// Low bits of each packed word hold the ArgumentKind; the rest is the
+  /// (string) text length.
----------------
erichkeane wrote:

What is going on here?  

A lot of stuff in the trailing objects too?  Can you better explain the layout here? 

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


More information about the cfe-commits mailing list