[clang] [compiler-rt] [ubsan] Display correct runtime messages for negative _BitInt (PR #96240)

2024-09-02 Thread Jakub Jelínek via cfe-commits
jakubjelinek wrote: I'm not suggesting to encode the number of limbs anywhere, I'm suggesting encoding the bit precision of a limb somewhere. And the limb ordering. On little endian of bits in a limb and little endian ordering of limbs in the limb array, at least if the limbs are sane (have pr

[clang] [compiler-rt] [ubsan] Display correct runtime messages for negative _BitInt (PR #96240)

2024-09-02 Thread Jakub Jelínek via cfe-commits
@@ -125,6 +137,25 @@ class TypeDescriptor { return 1 << (TypeInfo >> 1); } + const char *getBitIntBitCountPointer() const { +DCHECK(isBitIntTy()); +DCHECK(isSignedBitIntTy()); +// Scan Name for zero and return the next address +const char *p = getTypeNam

[clang] [compiler-rt] [ubsan] Display correct runtime messages for negative _BitInt (PR #96240)

2024-08-23 Thread Jakub Jelínek via cfe-commits
@@ -103,6 +103,13 @@ class TypeDescriptor { /// representation is that of bitcasting the floating-point value to an /// integer type. TK_Float = 0x0001, +/// An _BitInt(N) type. Lowest bit is 1 for a signed value, 0 for an +/// unsigned value. Remaining bits

[clang] [compiler-rt] [ubsan] Display correct runtime messages for negative _BitInt (PR #96240)

2024-08-23 Thread Jakub Jelínek via cfe-commits
@@ -125,6 +137,25 @@ class TypeDescriptor { return 1 << (TypeInfo >> 1); } + const char *getBitIntBitCountPointer() const { +DCHECK(isBitIntTy()); +DCHECK(isSignedBitIntTy()); +// Scan Name for zero and return the next address +const char *p = getTypeNam

[clang] [clang-tools-extra] Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (PR #95802)

2024-08-15 Thread Jakub Jelínek via cfe-commits
jakubjelinek wrote: @ThePhD @AaronBallman @cor3ntin Joseph Myers raised an interesting question whether the tokens in embed-parameter-sequence are macro expanded or not. Consider ```c #define FILE "/etc/passwd" #define LIMIT limit(1) #define THIS , 1, 2, 3 #define PRE prefix (42, ONE #embed FILE

[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-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 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-tools-extra] Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (PR #95802)

2024-06-19 Thread Jakub Jelínek via cfe-commits
@@ -0,0 +1,98 @@ +// RUN: %clang_cc1 %s -fsyntax-only --embed-dir=%S/Inputs -verify=expected,cxx -Wno-c23-extensions +// RUN: %clang_cc1 -x c -std=c23 %s -fsyntax-only --embed-dir=%S/Inputs -verify=expected,c +#embed +; + +void f (unsigned char x) { (void)x;} +void g () {} +voi