[clang] [NFC][clang] Replace unreachable code in literal processing with assert (PR #96579)

2024-06-25 Thread Mike Rice via cfe-commits

https://github.com/mikerice1969 closed 
https://github.com/llvm/llvm-project/pull/96579
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] [NFC][clang] Replace unreachable code in literal processing with assert (PR #96579)

2024-06-25 Thread Aaron Ballman via cfe-commits

https://github.com/AaronBallman approved this pull request.

LGTM!

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


[clang] [NFC][clang] Replace unreachable code in literal processing with assert (PR #96579)

2024-06-24 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Mike Rice (mikerice1969)


Changes

Address static verifier concerns about dead code in DoubleUnderscore check. 
Replace it with an assert.

---
Full diff: https://github.com/llvm/llvm-project/pull/96579.diff


1 Files Affected:

- (modified) clang/lib/Lex/LiteralSupport.cpp (+3-2) 


``diff
diff --git a/clang/lib/Lex/LiteralSupport.cpp b/clang/lib/Lex/LiteralSupport.cpp
index 3df0391bdda77..9d2720af5dbd9 100644
--- a/clang/lib/Lex/LiteralSupport.cpp
+++ b/clang/lib/Lex/LiteralSupport.cpp
@@ -1123,8 +1123,9 @@ NumericLiteralParser::NumericLiteralParser(StringRef 
TokSpelling,
 break; // Invalid for floats
   if (HasSize)
 break;
-  if (DoubleUnderscore)
-break; // Cannot be repeated.
+  // There is currently no way to reach this with DoubleUnderscore set.
+  // If new double underscope literals are added handle it here as above.
+  assert(!DoubleUnderscore && "unhandled double underscore case");
   if (LangOpts.CPlusPlus && s + 2 < ThisTokEnd &&
   s[1] == '_') { // s + 2 < ThisTokEnd to ensure some character exists
  // after __

``




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