504 Commits

Author SHA1 Message Date
macurtis-amd
2ddf0caaed
[clang][driver] Suppress gnu-line-marker when saving temps (#134621)
When passing `-save-temps` to clang, the generated preprocessed output
uses gnu line markers. This unexpectedly triggers gnu-line-marker
warnings when used with `-Weverything` or `-pedantic`. Even worse,
compilation fails if `-Werror` is used.

This change suppresses gnu-line-marker warnings when invoking clang with
input from a preprocessor job and the user has not otherwise explictly
specified `-Wgnu-line-marker` somewhere on the command line. Note that
this does apply to user provided preprocessed files.

fixes #63802
2025-06-10 11:54:50 -05:00
Kazu Hirata
52e3b100d4
[Frontend] Remove unused includes (NFC) (#142256)
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.
2025-05-31 15:03:52 -07:00
Alex Voicu
3feb8b42e9
[HIP][HIPSTDPAR] Re-work allocation interposition for hipstdpar (#138790)
The allocation interposition mode had a number of issues, which are
primarily addressed in the library component via
<https://github.com/ROCm/rocThrust/pull/543>. However, it is necessary
to interpose some additional symbols, which this patch does.
Furthermore, to implement this in a compatible way, we guard the new
implementation under a V1 macro, which is defined in addition to the
existing `__HIPSTDPAR_INTERPOSE_ALLOC__` one.
2025-05-07 14:14:25 +01:00
cor3ntin
300d4026f7
[Clang] Implement the core language parts of P2786 - Trivial relocation (#127636)
This adds

- The parsing of `trivially_relocatable_if_eligible`,
`replaceable_if_eligible` keywords
- `__builtin_trivially_relocate`, implemented in terms of memmove. In
the future this should
- Add the appropriate start/end lifetime markers that llvm does not have
(`start_lifetime_as`)
     - Add support for ptrauth when that's upstreamed

- the `__builtin_is_cpp_trivially_relocatable` and
`__builtin_is_replaceable` traits


Fixes #127609
2025-05-06 14:13:32 +02:00
Kazu Hirata
f002f300c5
[clang] Remove unused local variables (NFC) (#138453) 2025-05-04 10:51:40 -07:00
Kazu Hirata
0f97cd87de
[Frontend] Use StringRef::ends_with (NFC) (#135988) 2025-04-16 12:29:04 -07:00
Oliver Hunt
1cd59264aa
[RFC] Initial implementation of P2719 (#113510)
This is a basic implementation of P2719: "Type-aware allocation and
deallocation functions" described at http://wg21.link/P2719

The proposal includes some more details but the basic change in
functionality is the addition of support for an additional implicit
parameter in operators `new` and `delete` to act as a type tag. Tag is
of type `std::type_identity<T>` where T is the concrete type being
allocated. So for example, a custom type specific allocator for `int`
say can be provided by the declaration of

  void *operator new(std::type_identity<int>, size_t, std::align_val_t);
  void  operator delete(std::type_identity<int>, void*, size_t, std::align_val_t);

However this becomes more powerful by specifying templated declarations,
for example

template <typename T> void *operator new(std::type_identity<T>, size_t, std::align_val_t);
template <typename T> void operator delete(std::type_identity<T>, void*, size_t, std::align_val_t););

Where the operators being resolved will be the concrete type being
operated over (NB. A completely unconstrained global definition as above
is not recommended as it triggers many problems similar to a general
override of the global operators).

These type aware operators can be declared as either free functions or
in class, and can be specified with or without the other implicit
parameters, with overload resolution performed according to the existing
standard parameter prioritisation, only with type parameterised
operators having higher precedence than non-type aware operators. The
only exception is destroying_delete which for reasons discussed in the
paper we do not support type-aware variants by default.
2025-04-10 17:13:10 -07:00
Nick Sarnie
48b7530273
[clang][flang][Triple][llvm] Add isOffload function to LangOpts and isGPU function to Triple (#126956)
I'm adding support for SPIR-V, so let's consolidate these checks.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-03-28 14:19:20 +00:00
Sarah Spall
c3e08c8f07
[HLSL] Add new double overloads for math builtins (#132979)
Add double overloads which cast the double to a float and call the float
builtin.
Makes these double overloads conditional on hlsl version 202x or
earlier.
Add tests
Closes #128228
2025-03-26 07:54:13 -07:00
A. Jiang
d1bcac06c7
[Clang] Bump __cpp_constexpr to 202002L in C++20 mode (#129814)
Per P2493R0 and SD6, `__cpp_constexpr` of value `202002L` indicates that
P1330R0 "Changing the active member of a union inside constexpr" is
implemented, which is true for Clang 9 and later.
2025-03-05 18:25:06 +08:00
cor3ntin
12f8ed58a0
[Clang] Mark P1061 (Structured Bindings can introduce a Pack) as implemented (#127980)
Implemented in abc8812df02599fc413d9ed77b992f8236ed2af9
2025-02-20 13:55:32 +01:00
Matheus Izvekov
8a334af417
[clang] Remove the deprecated flag -frelaxed-template-template-args. (#111894)
This flag has been deprecated since Clang 19, having been the default
since then.

It has remained because its negation was still useful to work around
backwards compatibility breaking changes from P0522.

However, in Clang 20 we have landed various changes which implemented
P3310R2 and beyond, which solve almost all of the expected issues, the
known remaining few being a bit obscure.

So this change removes the flag completely and all of its implementation
and support code.

Hopefully any remaining users can just stop using the flag. If there are
still important issues remaining, this removal will also shake the tree
and help us know.
2025-01-29 16:57:05 -03:00
Zahira Ammarguellat
978e0839ae
[OpenMP] Allow OMP6.0 features. (#122108)
Add support for the `-fopenmp-version=60` command line argument. It is
needed for https://github.com/llvm/llvm-project/pull/119891 (`#pragma
omp stripe`) which will be the first OpenMP 6.0 directive implemented.
Add regression tests for Clang in `-fopenmp-version=60` mode.
2025-01-29 07:51:02 -05:00
Manuel Sainz de Baranda y Goñi
33ad474c45
[Clang] Add predefined macros for integer constants (#123514)
This adds predefined macros for integer constants to implement section 7.18.4 of ISO/IEC 9899:1999 in `<stdint.h>` in a safe way:

```
__INT8_C(c)
__INT16_C(c)
__INT32_C(c)
__INT64_C(c)
__INTMAX_C(c)
__UINT8_C(c)
__UINT16_C(c)
__UINT32_C(c)
__UINT64_C(c)
__UINTMAX_C(c)
```

Which improves compatibility with GCC and makes it trivial to implement
section 7.18.4 of ISO/IEC 9899:1999.

Clang defines `__INT<N>_C_SUFFIX__`, `__UINT<N>_C_SUFFIX__`,
`__INTAX_C_SUFFIX__` and `__UINTMAX_C_SUFFIX__`, but these macros are
useless for this purpose.

Let's say, for example, that `__INT64_C_SUFFIX__` expands to `L` or
`LL`. If the user defines them as a macros, the compiler will produce
errors if `INT64_C` is implemented in `<stdint.h>` using
`__INT64_C_SUFFIX__`:

**minimal-test.c:**
```cpp
#if defined(__clang__) & !defined(__INT64_C)
#	pragma clang diagnostic push
#	pragma clang diagnostic ignored "-Wreserved-identifier"
#	define __PSTDC_INT_C_(literal, suffix) literal##suffix
#	define __PSTDC_INT_C(literal, suffix) __PSTDC_INT_C_(literal, suffix)
#	define INT64_C(literal) __PSTDC_INT_C(literal, __INT64_C_SUFFIX__)
#	pragma clang diagnostic pop
#elif defined(__GNUC__)
#	define INT64_C __INT64_C
#endif

typedef __INT64_TYPE__ int64_t;

#define L  "Make Clang produce an error"
#define LL "Make Clang produce an error"

int main(int argc, char **argv)
	{
	(void)argc; (void)argv;
	int64_t v = INT64_C(9223372036854775807);
	(void)v;
	return 0;
	}

```

<img width="697" alt="imagen"
src="https://github.com/user-attachments/assets/6df97af6-7cfd-4cf9-85b7-d7c854509325"
/>

**test.c:**
```cpp
#if defined(__clang__) && !defined(__INT8_C)
#	pragma clang diagnostic push
#	pragma clang diagnostic ignored "-Wreserved-identifier"

#	define __PSTDC_INT_C_(literal, suffix) literal##suffix
#	define __PSTDC_INT_C(literal, suffix) __PSTDC_INT_C_(literal, suffix)

#	define INT8_C(literal)    __PSTDC_INT_C(literal, __INT8_C_SUFFIX__)
#	define INT16_C(literal)   __PSTDC_INT_C(literal, __INT16_C_SUFFIX__)
#	define INT32_C(literal)   __PSTDC_INT_C(literal, __INT32_C_SUFFIX__)
#	define INT64_C(literal)   __PSTDC_INT_C(literal, __INT64_C_SUFFIX__)
#	define INTMAX_C(literal)  __PSTDC_INT_C(literal, __INTMAX_C_SUFFIX__)
#	define UINT8_C(literal)   __PSTDC_INT_C(literal, __UINT8_C_SUFFIX__)
#	define UINT16_C(literal)  __PSTDC_INT_C(literal, __UINT16_C_SUFFIX__)
#	define UINT32_C(literal)  __PSTDC_INT_C(literal, __UINT32_C_SUFFIX__)
#	define UINT64_C(literal)  __PSTDC_INT_C(literal, __UINT64_C_SUFFIX__)
#	define UINTMAX_C(literal) __PSTDC_INT_C(literal, __UINTMAX_C_SUFFIX__)

#	pragma clang diagnostic pop

#else
#	define INT8_C    __INT8_C
#	define INT16_C   __INT16_C
#	define INT32_C   __INT32_C
#	define INT64_C   __INT64_C
#	define INTMAX_C  __INTMAX_C
#	define UINT8_C   __UINT8_C
#	define UINT16_C  __UINT16_C
#	define UINT32_C  __UINT32_C
#	define UINT64_C  __UINT64_C
#	define UINTMAX_C __UINTMAX_C
#endif

typedef __INT8_TYPE__    int8_t;
typedef __INT16_TYPE__   int16_t;
typedef __INT32_TYPE__   int32_t;
typedef __INT64_TYPE__   int64_t;
typedef __INTMAX_TYPE__  intmax_t;
typedef __UINT8_TYPE__   uint8_t;
typedef __UINT16_TYPE__  uint16_t;
typedef __UINT32_TYPE__  uint32_t;
typedef __UINT64_TYPE__  uint64_t;
typedef __UINTMAX_TYPE__ uintmax_t;

#define L   "Make Clang produce an error"
#define LL  "Make Clang produce an error"
#define U   "Make Clang produce an error"
#define UL  "Make Clang produce an error"
#define ULL "Make Clang produce an error"

int main(int argc, char **argv)
	{
	(void)argc; (void)argv;

	int8_t    a = INT8_C   (127);
	int16_t   b = INT16_C  (32767);
	int32_t   c = INT32_C  (2147483647);
	int64_t   d = INT64_C  (9223372036854775807);
	intmax_t  e = INTMAX_C (9223372036854775807);
	uint8_t   f = UINT8_C  (255);
	uint16_t  g = UINT16_C (65535);
	uint32_t  h = UINT32_C (4294967295);
	uint64_t  i = UINT64_C (18446744073709551615);
	uintmax_t j = UINTMAX_C(18446744073709551615);

	(void)a; (void)b; (void)c; (void)d; (void)e;
	(void)f; (void)g; (void)h; (void)i; (void)j;
	return 0;
	}
```
2025-01-26 16:48:42 +01:00
Ian Anderson
8a1174f06c
[Darwin][Driver][clang] arm64-apple-none-macho is missing the Apple macros from arm-apple-none-macho (#122427)
arm-apple-none-macho uses DarwinTargetInfo which provides several Apple
specific macros. arm64-apple-none-macho however just uses the generic
AArch64leTargetInfo and doesn't get any of those macros. It's not clear
if everything from DarwinTargetInfo is desirable for
arm64-apple-none-macho, so make an AppleMachOTargetInfo to hold the
generic Apple macros and a few other basic things.
2025-01-10 15:50:54 -08:00
Ian Anderson
d6bfe10ac9
[Darwin][Driver][clang] apple-none-macho orders the resource directory after internal-externc-isystem when nostdlibinc is used (#122035)
Embedded development often needs to use a different C standard library,
replacing the existing one normally passed as -internal-externc-isystem.
This works fine for an apple-macos target, but apple-none-macho doesn't
work because the MachO driver doesn't implement
AddClangSystemIncludeArgs to add the resource directory as
-internal-isystem like most other drivers do. Move most of the search
path logic from Darwin and DarwinClang down into an AppleMachO toolchain
between the MachO and Darwin toolchains.

Also define __MACH__ for apple-none-macho, as Swift expects all MachO
targets to have that defined.
2025-01-07 21:13:49 -08:00
Nico Weber
ab5133bbc6 Revert "[Darwin][Driver][clang] apple-none-macho orders the resource directory after internal-externc-isystem when nostdlibinc is used (#120507)"
This reverts commit 653a54727eaa18c43447ad686c987db67f1dda74.
Breaks tests, see https://github.com/llvm/llvm-project/pull/120507#issuecomment-2575246281
2025-01-07 09:23:50 -05:00
Ian Anderson
653a54727e
[Darwin][Driver][clang] apple-none-macho orders the resource directory after internal-externc-isystem when nostdlibinc is used (#120507)
Embedded development often needs to use a different C standard library,
replacing the existing one normally passed as -internal-externc-isystem.
This works fine for an apple-macos target, but apple-none-macho doesn't
work because the MachO driver doesn't implement
AddClangSystemIncludeArgs to add the resource directory as
-internal-isystem like most other drivers do. Move most of the search
path logic from Darwin and DarwinClang down into an AppleMachO toolchain
between the MachO and Darwin toolchains.

Also define \_\_MACH__ for apple-none-macho, as Swift expects all MachO
targets to have that defined.
2025-01-06 21:33:51 -08:00
cor3ntin
72e58e00c2
[Clang] Set __cpp_explicit_this_parameter (#107451)
There are not a lot of outstanding known issues
with deducing this (besides #95112), so it
seems reasonable to claim full support.

Fixes #82780
2024-12-18 17:36:47 +01:00
dklochkov-intel
6b0785390d
[SYCL] Change SYCL version according to standard (#114790)
Version of SYCL was changed according to the latest agreement:
The lower 2 digits are not formally specified, but we plan to use these
to identify the month in which we submit the specification for
ratification, which is similar to the C++ macro __cplusplus.

Since the SYCL 2020 specification was submitted for ratification in
December of 2020, the macro's value is now 202012 for SYCL 2020.
see PR for details 
https://github.com/KhronosGroup/SYCL-Docs/pull/634
2024-12-05 10:16:45 -08:00
Aaron Ballman
00770489e4
[C23] Fixed the value of BOOL_WIDTH (#117364)
The standard mandates that this returns the width of the type, which is
the number of bits in the value. For bool, that's required to be `1`
explicitly.

Fixes #117348
2024-11-25 13:01:25 -05:00
Mital Ashok
be427dfb9e
[Clang][Parser] Accept P2741R3 (static_assert with user-generated message) in C++11 as an extension (#102044)
Added a new `-Wpre-c++26-compat` warning for when this feature is used
in C++26 and a `-Wc++26-extensions` warning for when this is used in
C++11 through C++23.

---------

Co-authored-by: cor3ntin <corentinjabot@gmail.com>
2024-09-05 17:38:08 +02:00
cor3ntin
6e78aef646
[Clang] Implement P2747 constexpr placement new (#104586)
The implementation follows the resolution of CWG2922
2024-08-23 17:24:08 +02:00
Sirraide
2b0a8fcf70
[Clang] Implement C++26’s P2893R3 ‘Variadic friends’ (#101448)
Implement P2893R3 ‘Variadic friends’ for C++26.

This closes #98587.

Co-authored-by: Younan Zhang <zyn7109@gmail.com>
2024-08-15 21:16:30 +02:00
Sirraide
c65afad9c5
[Clang] Define __cpp_pack_indexing (#101956)
Following the discussion on #101448 this defines 
`__cpp_pack_indexing`. Since pack indexing is currently
supported in all language modes, the feature test macro 
is also defined in all language modes.
2024-08-05 14:02:15 +02:00
Zahira Ammarguellat
c9c91f59c3
Remove FiniteMathOnly and use only NoHonorINFs and NoHonorNANs. (#97342)
Currently `__FINITE_MATH_ONLY__` is set when `FiniteMathOnly`. And
`FiniteMathOnly` is set when `NoHonorInfs` && `NoHonorNans` is true. But
what happens one of the latter flags is false?
To avoid potential inconsistencies, the internal option `FiniteMathOnly`
is removed option and the macro `__FINITE_MATH_ONLY__` is set when
`NoHonorInfs` && `NoHonorNans`.
2024-07-26 08:16:38 -04:00
Mital Ashok
329e7c80ac
[Clang] [C23] Implement N2653: u8 strings are char8_t[] (#97208)
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2653.htm

Closes #97202

---------

Co-authored-by: cor3ntin <corentinjabot@gmail.com>
2024-07-17 14:14:31 +02:00
Aaron Ballman
0e7590a25c
[C23] Add *_NORM_MAX macros to <float.h> (#96643)
This adds the *_NORM_MAX macros to <float.h> for freestanding mode in
Clang; the values were chosen based on the behavior seen coming from GCC
and the values already produced for the *_MAX macros by Clang.
2024-07-10 09:49:21 -04:00
Aaron Ballman
b67d557bd3 [C2y] Add -std=c2y and -std=gnu2y
This adds a language standard mode for the latest C standard. While
WG14 is hoping for a three-year cycle, it is not clear that the next
revision of C will be in 2026 and so a flag was not created for c26
specifically.
2024-07-02 07:00:19 -04:00
Martin Storsjö
4e6c8f1d30
[clang] [MinGW] Set a predefined __GXX_TYPEINFO_EQUALITY_INLINE=0 for MinGW targets (#96062)
libstdc++ requires this define to match what is predefined in GCC for
the ABI of this platform; GCC hardcodes this define for all mingw
configurations in gcc/config/i386/cygming.h.

(It also defines __GXX_MERGED_TYPEINFO_NAMES=0, but that happens to
match the defaults in libstdc++ headers, so there's no similar need to
define it in Clang.)

This fixes a Clang/libstdc++ interop issue discussed at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110572.
2024-06-24 14:02:28 +03:00
Mariya Podchishchaeva
41c6e43792
Reland [clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (#95802)
This commit implements the entirety of the now-accepted [N3017
-Preprocessor
Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and
its sister C++ paper [p1967](https://wg21.link/p1967). It implements
everything in the specification, and includes an implementation that
drastically improves the time it takes to embed data in specific
scenarios (the initialization of character type arrays). The mechanisms
used to do this are used under the "as-if" rule, and in general when the
system cannot detect it is initializing an array object in a variable
declaration, will generate EmbedExpr AST node which will be expanded by
AST consumers (CodeGen or constant expression evaluators) or expand
embed directive as a comma expression.

This reverts commit
682d461d5a.

---------

Co-authored-by: The Phantom Derpstorm <phdofthehouse@gmail.com>
Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: H. Vetinari <h.vetinari@gmx.com>
2024-06-20 14:38:46 +02:00
Vitaly Buka
682d461d5a
Revert " [Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy)" (#95299)
Reverts llvm/llvm-project#68620

Introduce or expose a memory leak and UB, see llvm/llvm-project#68620
2024-06-12 13:14:26 -07:00
The Phantom Derpstorm
5989450e00
[clang][Sema, Lex, Parse] Preprocessor embed in C and C++ (and Obj-C and Obj-C++ by-proxy) (#68620)
This commit implements the entirety of the now-accepted [N3017 -
Preprocessor
Embed](https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3017.htm) and
its sister C++ paper [p1967](https://wg21.link/p1967). It implements
everything in the specification, and includes an implementation that
drastically improves the time it takes to embed data in specific
scenarios (the initialization of character type arrays). The mechanisms
used to do this are used under the "as-if" rule, and in general when the
system cannot detect it is initializing an array object in a variable
declaration, will generate EmbedExpr AST node which will be expanded
by AST consumers (CodeGen or constant expression evaluators) or
expand embed directive as a comma expression.

---------

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Co-authored-by: cor3ntin <corentinjabot@gmail.com>
Co-authored-by: H. Vetinari <h.vetinari@gmx.com>
Co-authored-by: Podchishchaeva, Mariya <mariya.podchishchaeva@intel.com>
2024-06-12 09:16:02 +02:00
Reagan
778dbcbbb5
[clang] Add /Zc:__STDC__ flag to clang-cl (#68690)
This commit adds the /Zc:\_\_STDC\_\_ argument from MSVC, which defines
\_\_STDC_\_.
This means, alongside stronger feature parity with MSVC, that things
that rely on \_\_STDC\_\_, such as autoconf, can work.
Link to MSVC documentation of this flag:
https://learn.microsoft.com/en-us/cpp/build/reference/zc-stdc?view=msvc-170
2024-05-24 23:48:13 -04:00
Heejin Ahn
d1aca0ae2e
[WebAssembly] Define __WASM_EXCEPTIONS__ for -fwasm-exceptions (#92604)
When using other specific exception options in Clang, such as
`-fseh-exceptions` or `-fsjlj-exceptions`, Clang defines a corresponding
preprocessor such as `-D__USING_SJLJ_EXCEPTIONS__`. Emscripten does that
in our own build system:

7dcd7f4074/tools/system_libs.py (L1577-L1578)

But to make Wasm EH usable in non-Emscripten toolchain, this has to be
defined somewhere else. This PR makes Wasm EH consistent with other
exception scheme by letting it defined by Clang depending on the
exception option.

We have been using `__USING_WASM_EXCEPTIONS__` in our current library
code, but this changes it to `__WASM_EXCEPTIONS__` for its conciseness,
and I will update other parts of LLVM as follow-ups. This does not break
anything currently working, because we have not been defining anything
in Clang so far.
2024-05-20 18:43:13 -07:00
cor3ntin
6dd90616c4
[Clang] Implement C++26 Attributes for Structured Bindings (P0609R3) (#89906)
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p0609r3.pdf

We support this feature in all language mode.

maybe_unused applied to a binding makes the whole declaration unused.
2024-04-28 20:25:44 +02:00
Aaron Ballman
72c373bfdc
[C++17] Support __GCC_[CON|DE]STRUCTIVE_SIZE (#89446)
These macros are used by STL implementations to support implementation
of std::hardware_destructive_interference_size and
std::hardware_constructive_interference_size

Fixes #60174

---------

Co-authored-by: Louis Dionne <ldionne.2@gmail.com>
2024-04-26 12:05:15 -04:00
Chris B
f2d9950695
[HLSL] Correctly set __HLSL_ENABLE_16_BIT (#89788)
The preprocessor define `__HLSL_ENABLE_16_BIT` should be set to 1 if
native 16-bit types are enabled and not set if they are not.

Previously we were setting the value to match the HLSL active language
version, and we had no test coverage verifing the value was set and not
set as expected.

Fixes #89787
2024-04-25 15:36:19 -05:00
Sirraide
ef164cee90
[Clang] [C++26] Implement P2573R2: = delete("should have a reason"); (#86526)
This implements support for the `= delete("message")` syntax that was
only just added to C++26
([P2573R2](https://isocpp.org/files/papers/P2573R2.html#proposal-scope)).
2024-04-14 12:30:01 +02:00
Erich Keane
2875e2448c
Update __cpp_concepts macro (#87998)
After discussion with a few others, and seeing the state of our concepts
support, I believe it is worth trying to see if we can update this for
Clang19. The forcing function is that libstdc++'s `<expected>` header is
guarded by this macro, so we need to update it to support that.
2024-04-09 06:59:31 -07:00
aniplcc
2acccf6717
[Clang] Update value for __cpp_implicit_move (#84216) (#84228)
Fixes #84216
2024-03-07 14:39:04 +01:00
Aaron Ballman
052ee74dae
[C23] Add __TYPE_FMTB__ and __TYPE_FMTb__ predefined macros (#82361)
This adds predefined formatting macros in C23 mode for printing unsigned
integers in binary format (e.g, UINT_FAST64_FMTB). These are used to
implement the PRIb (et al) macros in inttypes.h

Fixes https://github.com/llvm/llvm-project/issues/81896

(Was previously reviewed in
[82037](https://github.com/llvm/llvm-project/pull/82037), this is fixing
some failures found post-commit.)
2024-02-20 09:32:23 -05:00
Aaron Ballman
bfbd0da01d
Revert "[C23] Add __TYPE_FMTB__ and __TYPE_FMTb__ predefined macros" (#82070)
Reverts llvm/llvm-project#82037

Breaks various buildbots:
http://45.33.8.238/linux/131051/step_7.txt
https://lab.llvm.org/buildbot/#/builders/231/builds/20751
others
2024-02-16 18:53:22 -05:00
Aaron Ballman
b3050f518c
[C23] Add __TYPE_FMTB__ and __TYPE_FMTb__ predefined macros (#82037)
This adds predefined formatting macros in C23 mode for printing unsigned
integers in binary format (e.g, __UINT_FAST64_FMTB__). These are used to
implement the PRIb (et al) macros in inttypes.h

Fixes https://github.com/llvm/llvm-project/issues/81896
2024-02-16 17:18:27 -05:00
PiJoules
ad49657a42
[clang] Add fixed point precision macros (#81207)
This defines the builtin macros specified in `7.18a.3 Precision macros`
of ISO/IEC TR 18037:2008. These are the `__*__` versions of them and the
formal definitions in stdfix.h can use them.
2024-02-14 14:11:56 -08:00
yronglin
0aff71c178
[Clang] Implement P2718R0 "Lifetime extension in range-based for loops" (#76361)
Implement P2718R0 "Lifetime extension in range-based for loops"
(https://wg21.link/P2718R0)

Differential Revision: https://reviews.llvm.org/D153701

---------

Signed-off-by: yronglin <yronglin777@gmail.com>
2024-01-30 06:48:14 +08:00
cor3ntin
02a28ee8d9
[Clang] Update feature test macros for Clang 18 (#78991)
* Set `__cpp_auto_cast`, as per
https://github.com/cplusplus/CWG/issues/281
* Support `__has_extension(cxx_generalized_nttp)` in C++20 as the
feature isn't stable enough for a feature test macro
* Support `__has_extension(cxx_explicit_this_parameter)` in c++23 as the
feature isn't stable enough for a feature test macro
2024-01-22 21:19:29 +01:00
Qiongsi Wu
4f21fb8447
[PGO] Reland PGO's Counter Reset and File Dumping APIs #76471 (#78285)
https://github.com/llvm/llvm-project/pull/76471 caused buildbot failures
on Windows. For more details, see
https://github.com/llvm/llvm-project/issues/77546.

This PR revises the test and relands
https://github.com/llvm/llvm-project/pull/76471.
2024-01-22 14:54:58 -05:00
Vitaly Buka
a828cda9c8 Revert "[PGO] Exposing PGO's Counter Reset and File Dumping APIs (#76471)"
Issue #77546

This reverts commit 07c9189fcc063bdf6219d2733843c89cde3991e1.
2024-01-09 18:37:04 -08:00
Qiongsi Wu
07c9189fcc
[PGO] Exposing PGO's Counter Reset and File Dumping APIs (#76471)
This PR exposes four PGO functions 

- `__llvm_profile_set_filename`
- `__llvm_profile_reset_counters`, 
- `__llvm_profile_dump` 
- `__llvm_orderfile_dump` 

to user programs through the new header `instr_prof_interface.h` under
`compiler-rt/include/profile`. This way, the user can include the header
`profile/instr_prof_interface.h` to introduce these four names to their
programs.

Additionally, this PR defines macro `__LLVM_INSTR_PROFILE_GENERATE` when
the program is compiled with profile generation, and defines macro
`__LLVM_INSTR_PROFILE_USE` when the program is compiled with profile
use. `__LLVM_INSTR_PROFILE_GENERATE` together with
`instr_prof_interface.h` define the PGO functions only when the program
is compiled with profile generation. When profile generation is off,
these PGO functions are defined away and leave no trace in the user's
program.

Background:
https://discourse.llvm.org/t/pgo-are-the-llvm-profile-functions-stable-c-apis-across-llvm-releases/75832
2024-01-09 10:38:17 -05:00