================
@@ -7379,6 +7379,14 @@ class RecoveryExpr final : public Expr,
   friend class ASTStmtWriter;
 };
 
+/// Insertion operator for diagnostics.  This allows sending
+/// Expr into a diagnostic with <<.
+inline const StreamingDiagnostic &operator<<(const StreamingDiagnostic &DB,
+                                             const Expr *E) {
+  DB.AddTaggedVal(reinterpret_cast<uint64_t>(E), DiagnosticsEngine::ak_expr);
----------------
mizvekov wrote:

It's not just here though, this is the same for all other kinds, and the same 
for the parameter type, and the same for where we store this.

It wouldn't change much regarding potential UB if we wrote uintptr_t here, but 
then this would implicitly cast to uint64_t anyway.

Now if we change that to uintptr_t, then that would be bad in 32 bit platforms, 
as this is used to pack other things besides pointers. So presumably we want to 
change the parameter and structure types here to something that's at least as 
big as both types, which would be uintmax perhaps?

Or maybe just assert somewhere that uint64 is at least as big as uintptr?

https://github.com/llvm/llvm-project/pull/134693
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to