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

2024-08-06 Thread Ben Barham via cfe-commits
https://github.com/bnbarham edited https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-08-06 Thread Ben Barham via cfe-commits
@@ -2123,17 +2123,18 @@ class Preprocessor { char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, bnbarham wrote: Thanks @AaronBallman! https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commit

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

2024-08-06 Thread Mariya Podchishchaeva via cfe-commits
@@ -2123,17 +2123,18 @@ class Preprocessor { char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, Fznamznon wrote: Thank you @AaronBallman https://github.com/llvm/llvm-project/pull/97274 ___ cfe-co

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

2024-08-06 Thread Aaron Ballman via cfe-commits
@@ -2123,17 +2123,18 @@ class Preprocessor { char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, AaronBallman wrote: I've updated the comment and the interface in 295e4f49aefb2b07501be9f845df598b3ee280f1 https://github.com/llvm/llvm-project

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

2024-08-05 Thread Ben Barham via cfe-commits
@@ -2123,17 +2123,18 @@ class Preprocessor { char getSpellingOfSingleCharacterNumericConstant(const Token &Tok, bnbarham wrote: Both the documentation and name of this function is incorrect now that the underlying functionality has changed - would you mind

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

2024-07-16 Thread Mariya Podchishchaeva via cfe-commits
Fznamznon wrote: FYI https://github.com/llvm/llvm-project/pull/99050 https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-16 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon closed https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-16 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. LGTM! https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-16 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I thought there was agreement that at least for C the literals have type int, That's correct; this patch gets started on addressing that issue by updating the way we expand the embedded contents but isn't intended to fix the type issue yet (that will be a follow-up patch)

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

2024-07-16 Thread Mariya Podchishchaeva via cfe-commits
Fznamznon wrote: > Just checked that one and it still fails on latest clang trunk using godbolt. Hmm, ok. https://github.com/llvm/llvm-project/pull/99023 . Thanks for pointing this out. https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits

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

2024-07-16 Thread Jakub Jelínek via cfe-commits
jakubjelinek wrote: @ThePhd @AaronBallman And even more importantly (checking on godbolt again): ```c int a = sizeof ( #embed __FILE__ limit (1) ); ``` is 1 in clang as well as clang++ trunk and 4 with clang/clang++ trunk with -save-temps. I thought there was agreement that at least for C th

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

2024-07-15 Thread Jakub Jelínek via cfe-commits
jakubjelinek wrote: I meant also e.g. basic tests like gcc/testsuite/c-c++-common/cpp/embed-20.c in https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657053.html (and various others too). Just checked that one and it still fails on latest clang trunk using godbolt. https://github.com/llvm/ll

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

2024-07-15 Thread Mariya Podchishchaeva via cfe-commits
Fznamznon wrote: I'm looking through https://gcc.gnu.org/pipermail/gcc-patches/2024-June/655012.html This patch fixes cases like: ``` const unsigned char w[] = { #embed __FILE__ prefix([0] = 42, [15] =) limit(32) }; ``` And also cases like ``` void foo (int, int, int, int); void bar (void) { f

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

2024-07-12 Thread Mariya Podchishchaeva via cfe-commits
@@ -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,

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

2024-07-12 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon updated https://github.com/llvm/llvm-project/pull/97274 >From 4d5008fcf3ac37fa213c8f2cf42c3cce6369c83d Mon Sep 17 00:00:00 2001 From: "Podchishchaeva, Mariya" Date: Thu, 20 Jun 2024 06:04:07 -0700 Subject: [PATCH 1/3] [clang] Inject tokens containing #embed back int

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

2024-07-11 Thread via cfe-commits
@@ -1018,6 +1018,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, // primary-expression case tok::numeric_constant: cor3ntin wrote: These cases ```cpp [[clang::availability( #embed "smth.txt" )]] void f(); struct S { virtual

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

2024-07-11 Thread via cfe-commits
@@ -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,

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

2024-07-09 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > I'd like to point out that most of the testcases I wrote for the GCC > implementation still fail with the latest clang on godbolt. Thank you for letting us know! The plan is to continue to polish this feature through the Clang 19 release. The branch date for us is in two

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

2024-07-09 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: > > I'd like to point out that most of the testcases I wrote for the GCC > > implementation still fail with the latest clang on godbolt. > > This patch should help with at least some of them. It'd be good to verify that it does help with them or see if there are other issu

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

2024-07-09 Thread Jakub Jelínek via cfe-commits
jakubjelinek wrote: Maybe, but I've add quite a few new testcases too... https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-09 Thread Mariya Podchishchaeva via cfe-commits
Fznamznon wrote: > I'd like to point out that most of the testcases I wrote for the GCC > implementation still fail with the latest clang on godbolt. This patch should help with at least some of them. https://github.com/llvm/llvm-project/pull/97274 _

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

2024-07-09 Thread Jakub Jelínek via cfe-commits
jakubjelinek wrote: I'd like to point out that most of the testcases I wrote for the GCC implementation still fail with the latest clang on godbolt. https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.or

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

2024-07-08 Thread Mariya Podchishchaeva via cfe-commits
@@ -1018,6 +1018,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, // primary-expression case tok::numeric_constant: Fznamznon wrote: Could you please elaborate which other places you meant? I briefly examined all mentions of `tok::

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

2024-07-08 Thread via cfe-commits
@@ -1018,6 +1018,7 @@ ExprResult Parser::ParseCastExpression(CastParseKind ParseKind, // primary-expression case tok::numeric_constant: cor3ntin wrote: Can you adapt the couple other places where we parse a numeric constant? https://github.com/llvm/ll

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

2024-07-08 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon updated https://github.com/llvm/llvm-project/pull/97274 >From 4d5008fcf3ac37fa213c8f2cf42c3cce6369c83d Mon Sep 17 00:00:00 2001 From: "Podchishchaeva, Mariya" Date: Thu, 20 Jun 2024 06:04:07 -0700 Subject: [PATCH 1/2] [clang] Inject tokens containing #embed back int

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

2024-07-08 Thread Mariya Podchishchaeva via cfe-commits
Fznamznon wrote: It's been a week. Are we good to go? @cor3ntin https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-08 Thread Mariya Podchishchaeva via cfe-commits
@@ -43,8 +43,9 @@ a }; // CHECK: store i32 107, ptr %b, align 4 -int b = +int b = ( #embed +) Fznamznon wrote: In fact, they fix several bugs. https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits ma

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

2024-07-08 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon updated https://github.com/llvm/llvm-project/pull/97274 >From 4d5008fcf3ac37fa213c8f2cf42c3cce6369c83d Mon Sep 17 00:00:00 2001 From: "Podchishchaeva, Mariya" Date: Thu, 20 Jun 2024 06:04:07 -0700 Subject: [PATCH] [clang] Inject tokens containing #embed back into to

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

2024-07-01 Thread Aaron Ballman via cfe-commits
@@ -43,8 +43,9 @@ a }; // CHECK: store i32 107, ptr %b, align 4 -int b = +int b = ( #embed +) AaronBallman wrote: Oh nice, these changes fixed a bug -- this code should not have compiled before. https://github.com/llvm/llvm-project/pull/97274 __

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

2024-07-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman edited https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-01 Thread Aaron Ballman via cfe-commits
https://github.com/AaronBallman approved this pull request. In general, I like this! LGTM, though please give others a chance to review before landing. https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm

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

2024-07-01 Thread Aaron Ballman via cfe-commits
AaronBallman wrote: CC @jakubjelinek for awareness https://github.com/llvm/llvm-project/pull/97274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

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

2024-07-01 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 8bb00cb160830ec8f6029c2aae79d3e46b04b99c 4d5008fcf3ac37fa213c8f2cf42c3cce6369c83d --

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

2024-07-01 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang Author: Mariya Podchishchaeva (Fznamznon) Changes Instead of playing "whack a mole" with places where #embed should be expanded as comma-separated list, just inject each byte as a token back into the stream, separated by commas. --- Full diff: h

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

2024-07-01 Thread Mariya Podchishchaeva via cfe-commits
https://github.com/Fznamznon created https://github.com/llvm/llvm-project/pull/97274 Instead of playing "whack a mole" with places where #embed should be expanded as comma-separated list, just inject each byte as a token back into the stream, separated by commas. >From 4d5008fcf3ac37fa213c8f2