[clang] [clang] Inject tokens containing #embed back into token stream (PR #97274)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 12 08:01:02 PDT 2024


================
@@ -3644,9 +3644,11 @@ bool Sema::CheckLoopHintExpr(Expr *E, SourceLocation Loc, bool AllowZero) {
 ExprResult Sema::ActOnNumericConstant(const Token &Tok, Scope *UDLScope) {
   // Fast path for a single digit (which is quite common).  A single digit
   // cannot have a trigraph, escaped newline, radix prefix, or suffix.
-  if (Tok.getLength() == 1) {
+  if (Tok.getLength() == 1 || Tok.getKind() == tok::binary_data) {
     const char Val = PP.getSpellingOfSingleCharacterNumericConstant(Tok);
-    return ActOnIntegerConstant(Tok.getLocation(), Val-'0');
+    return ActOnIntegerConstant(
+        Tok.getLocation(),
+        (Tok.getKind() == tok::binary_data) ? Val : Val - '0');
----------------
Fznamznon wrote:

Sure.

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


More information about the cfe-commits mailing list