[clang] [clang] implement current direction of CWG2765 for string literal comparisons in constant evaluation (PR #109208)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 19 06:42:29 PDT 2024


================
@@ -324,6 +324,13 @@ class ASTContext : public RefCountedBase<ASTContext> {
   /// This is lazily created.  This is intentionally not serialized.
   mutable llvm::StringMap<StringLiteral *> StringLiteralCache;
 
+  /// The next string literal "version" to allocate during constant evaluation.
+  /// This is used to distinguish between repeated evaluations of the same
+  /// string literal.
+  ///
+  /// TODO: Ensure version numbers don't collide when deserialized.
----------------
erichkeane wrote:

This seems troublesome.  The modules case here is somewhat concerning to me.  I wonder if we could figure out some way to encode/serialize the "how we got here" via source information to provide the number?  I realize I'm being a little hand-wavy, but perhaps back to the 'line + col that caused this evaluation'? 

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


More information about the cfe-commits mailing list