================
@@ -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);
----------------
erichkeane wrote:

> If we care that uint64_t might not round trip a pointer in theory, even 
> though it should always in practice, then do we care uintptr_t is not 
> guaranteed to be provided in theory, even though it should always be in 
> practice?

THAT we don't care about because : 1- it is a compile-time diagnosed missing 
'thing', and 2- We know all our supported host platforms have (and presumably 
always will have) that type.

So it is a matter of "potentially ill-formed" vs "potential-UB".

Either way, it doesn't MATTER very much, but from a 'most correct' perspective 
(as frankly, `uint64_t` and `uintptr_t` are probably the same type, and I would 
bet good money that none of our platforms would ever change that/never give 
`uintptr_t` its own representation to take advantage of this UB), but just 
changing the cast type here is the right thing to do.

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