[PATCH] D104299: Handle interactions between reserved identifier and user-defined suffixes

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 15 12:18:10 PDT 2021


aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/IdentifierTable.h:124
 
-  // 28 bits left in a 64-bit word.
+  // True if this identifier is a literal operator without whitespace.
+  unsigned IsLiteralOperatorWithoutWhitespace : 1;
----------------
I'm on the fence about adding "Leading" to the variable and function names as well. I figure the "leading" makes it clear that we're talking about the whitespace between the operator and the string literal and nowhere else.


================
Comment at: clang/include/clang/Basic/IdentifierTable.h:127
+
+  // 27 bits left in a 64-bit word.
 
----------------
I keep coming up with 25 bits (39 bits in use), so I think this got out of sync at some point.


================
Comment at: clang/include/clang/Basic/IdentifierTable.h:385
 
+  /// Determine whether this is a literal operator without whitespace
+  bool isLiteralOperatorWithoutWhitespace() const {
----------------



================
Comment at: clang/include/clang/Basic/IdentifierTable.h:390
+
+  /// Set whether this is a literal operator without whitespace.
+  void setLiteralOperatorWithoutWhitespace(bool I) {
----------------



================
Comment at: clang/lib/Basic/IdentifierTable.cpp:289
+  // [over.literal] p8
+  if(isLiteralOperatorWithoutWhitespace())
+    return ReservedIdentifierStatus::NotReserved;
----------------
You should fix the clang-format issue.


================
Comment at: clang/test/Sema/reserved-identifier.cpp:84
 
+long double operator""_SacreBleue(long double) // no-warning
+{
----------------
Can you add comments about why there's no warning, as this behavior may be a bit surprising to folks. Bonus points for the comment having a link back to the standard.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104299/new/

https://reviews.llvm.org/D104299



More information about the cfe-commits mailing list