[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 13:27:17 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:

> Maybe we can think of a better way? (Initializing the counter to a hash is sounding a bit better now, huh?)

Thats probably at least as good as my line/column/file info suggestion, but based on the above/thinking further, I think anything besides "start at the same number for all" is perfectly acceptable.

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


More information about the cfe-commits mailing list