483 Commits

Author SHA1 Message Date
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
Zixu Wang
6e1f19168b
[clang][PP] Add extension to predefine target OS macros (#74676)
Add an extension feature `define-target-os-macros` that enables clang to
provide definitions of common TARGET_OS_* conditional macros. The
extension is enabled in the Darwin toolchain driver.
2023-12-07 17:40:58 -08:00
Joseph Huber
4e80bc7d71
[Clang] Introduce scoped variants of GNU atomic functions (#72280)
Summary:
The standard GNU atomic operations are a very common way to target
hardware atomics on the device. With more heterogenous devices being
introduced, the concept of memory scopes has been in the LLVM language
for awhile via the `syncscope` modifier. For targets, such as the GPU,
this can change code generation depending on whether or not we only need
to be consistent with the memory ordering with the entire system, the
single GPU device, or lower.

Previously these scopes were only exported via the `opencl` and `hip`
variants of these functions. However, this made it difficult to use
outside of those languages and the semantics were different from the
standard GNU versions. This patch introduces a `__scoped_atomic` variant
for the common functions. There was some discussion over whether or not
these should be overloads of the existing ones, or simply new variants.
I leant towards new variants to be less disruptive.

The scope here can be one of the following

```
__MEMORY_SCOPE_SYSTEM // All devices and systems
__MEMORY_SCOPE_DEVICE // Just this device
__MEMORY_SCOPE_WRKGRP // A 'work-group' AKA CUDA block
__MEMORY_SCOPE_WVFRNT // A 'wavefront' AKA CUDA warp
__MEMORY_SCOPE_SINGLE // A single thread.
```
Naming consistency was attempted, but it is difficult to capture to full
spectrum with no many names. Suggestions appreciated.
2023-12-07 13:40:25 -06:00
Erich Keane
ff219ea9ca
[OpenACC] Initial commits to support OpenACC (#70234)
Initial commits to support OpenACC.  This patchset:

adds a clang-command line argument '-fopenacc', and starts
 to define _OPENACC, albeit to '1' instead of the standardized
value (since we don't properly implement OpenACC yet).

The OpenACC spec defines `_OPENACC` to be equal to the latest standard
implemented. However, since we're not done implementing any standard,
we've defined this by default to be `1`. As it is useful to run our
compiler against existing OpenACC workloads, we're providing a
temporary override flag to change the `_OPENACC` value to be any
entirely digit value, permitting testing against any existing OpenACC
project.

Exactly like the OpenMP parser, the OpenACC pragma parser needs to
consume and reprocess the tokens. This patch sets up the infrastructure
to do so by refactoring the OpenMP version of this into a more general
version that works for OpenACC as well.

Additionally, this adds a few diagnostics and token kinds to get us
started.
2023-11-17 06:29:02 -08:00
Pranav Kant
7d21086d0c Revert "[clang] Predefined macros for float128 support (#67196)"
This reverts commit 457f582ffe23e951380bc345c4c96ec053c09681.
2023-10-04 18:19:24 +00:00
Alex Voicu
c0f8748d44 [HIP][Clang][Preprocessor] Add Preprocessor support for hipstdpar
This patch adds the Driver changes needed for enabling HIP parallel algorithm offload on AMDGPU targets. This change merely adds two macros to inform user space if we are compiling in `hipstdpar` mode and, respectively, if the optional allocation interposition mode has been requested, as well as associated minimal tests. The macros can be used by the runtime implementation of offload to drive conditional compilation, and are only defined if the HIP language has been enabled.

Reviewed by: yaxunl

Differential Revision: https://reviews.llvm.org/D155826
2023-10-03 13:18:31 +01:00
Pranav Kant
457f582ffe
[clang] Predefined macros for float128 support (#67196)
Expose some predefined macros for Float128 support.
2023-10-02 14:14:52 -07:00
Aaron Ballman
0ce056a814 [C23] Rename C2x -> C23; NFC
This does the rename for most internal uses of C2x, but does not rename
or reword diagnostics (those will be done in a follow-up).

I also updated standards references and citations to the final wording
in the standard.
2023-08-11 07:43:43 -04:00
Aaron Ballman
13629b1408 [C2x] Support -std=c23 and -std=gnu23
C2x was finalized at the June 2023 WG14 meeting. The DIS is out for
balloting and the comment period for that closes later this year/early
next year. While that does leave an opportunity for more changes to the
standard during the DIS ballot resolution process, only editorial
changes are anticipated and as a result, the C committee considers C2x
to be final. The committee took a straw poll on what we'd prefer the
informal name of the standard be, and we decided it should be called
C23 regardless of what year ISO publishes it.

However, because the final publication is not out, this patch does not
add the language standard alias for the -std=iso9899:<year> spelling of
the standard mode; that will be added once ISO finally publishes the
document and the year chosen will match the publication date.

This also changes the value of __STDC_VERSION__ from the placeholder
value 202000L to the final value 202311L.

Subsequent patches will start renaming things from c2x to c23, cleaning
up documentation, etc.

Differential Revision: https://reviews.llvm.org/D157606
2023-08-10 13:57:40 -04:00
Corentin Jabot
a8bef8865e [Clang] Implement P2169 A nice placeholder with no name
This is a C++ feature that allows the use of `_` to
declare multiple variable of that name in the same scope;
these variables can then not be referred to.

In addition, while P2169 does not extend to parameter
declarations, we stop warning on unused parameters of that name,
for consistency.

The feature is backported to all C++ language modes.

Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D153536
2023-08-04 16:51:15 +02:00
Yaxun (Sam) Liu
e17882430e [CUDA][HIP] Rename and fix -fcuda-approx-transcendentals
Rename -fcuda-approx-transcendentals as
-fgpu-approx-transcendentals and pass it
to both device and host clang -cc1.

Fix its interaction with -ffast-math to allow
-fno-gpu-approx-transcendentals to override
the implicit -fcuda-approx-transcendentals
due to -ffast-math.

Rename the predefined macro to be
__CLANG_GPU_APPROX_TRANSCENDENTALS__.
Emit the macro for both device and host compilation.

Reviewed by: Artem Belevich, Fangrui Song

Differential Revision: https://reviews.llvm.org/D154797
2023-07-25 12:01:41 -04:00
Corentin Jabot
47ccfd7a89 [Clang] Implement P2741R3 - user-generated static_assert messages
Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D154290
2023-07-20 08:33:19 +02:00
Yaxun (Sam) Liu
f0a955d3fa [HIP] Rename predefined macros
Rename HIP_API_PER_THREAD_DEFAULT_STREAM and __HIP_NO_IMAGE_SUPPORT
so that they follow the convention with prefix and postfix __.

Reviewed by: Artem Belevich

Differential Revision: https://reviews.llvm.org/D155480
2023-07-17 15:45:49 -04:00
boxu.zhang
f05b58a946 [clang] Support '-fgpu-default-stream=per-thread' for NVIDIA CUDA
I'm using clang to compile CUDA code. And just found that clang doesn't support the per-thread stream option for NV CUDA. I don't know if there is another solution.

Reviewed By: tra

Differential Revision: https://reviews.llvm.org/D154822
2023-07-13 16:54:57 -07:00
Sergio Afonso
63ca93c7d1
[OpenMP][OMPIRBuilder] Rename IsEmbedded and IsTargetCodegen flags
This patch renames the `OpenMPIRBuilderConfig` flags to reduce confusion over
their meaning. `IsTargetCodegen` becomes `IsGPU`, whereas `IsEmbedded` becomes
`IsTargetDevice`. The `-fopenmp-is-device` compiler option is also renamed to
`-fopenmp-is-target-device` and the `omp.is_device` MLIR attribute is renamed
to `omp.is_target_device`. Getters and setters of all these renamed properties
are also updated accordingly. Many unit tests have been updated to use the new
names, but an alias for the `-fopenmp-is-device` option is created so that
external programs do not stop working after the name change.

`IsGPU` is set when the target triple is AMDGCN or NVIDIA PTX, and it is only
valid if `IsTargetDevice` is specified as well. `IsTargetDevice` is set by the
`-fopenmp-is-target-device` compiler frontend option, which is only added to
the OpenMP device invocation for offloading-enabled programs.

Differential Revision: https://reviews.llvm.org/D154591
2023-07-10 14:14:16 +01:00
Corentin Jabot
f27afedc6c [Clang] Implement P2738R1 - constexpr cast from void*
Reviewed By: #clang-language-wg, erichkeane

Differential Revision: https://reviews.llvm.org/D153702
2023-06-26 16:45:07 +02:00
Serge Pavlov
7dd387d297 [clang] Add __builtin_isfpclass
A new builtin function __builtin_isfpclass is added. It is called as:

    __builtin_isfpclass(<floating point value>, <test>)

and returns an integer value, which is non-zero if the floating point
argument falls into one of the classes specified by the second argument,
and zero otherwise. The set of classes is an integer value, where each
value class is represented by a bit. There are ten data classes, as
defined by the IEEE-754 standard, they are represented by bits:

    0x0001 (__FPCLASS_SNAN)         - Signaling NaN
    0x0002 (__FPCLASS_QNAN)         - Quiet NaN
    0x0004 (__FPCLASS_NEGINF)       - Negative infinity
    0x0008 (__FPCLASS_NEGNORMAL)    - Negative normal
    0x0010 (__FPCLASS_NEGSUBNORMAL) - Negative subnormal
    0x0020 (__FPCLASS_NEGZERO)      - Negative zero
    0x0040 (__FPCLASS_POSZERO)      - Positive zero
    0x0080 (__FPCLASS_POSSUBNORMAL) - Positive subnormal
    0x0100 (__FPCLASS_POSNORMAL)    - Positive normal
    0x0200 (__FPCLASS_POSINF)       - Positive infinity

They have corresponding builtin macros to facilitate using the builtin
function:

    if (__builtin_isfpclass(x, __FPCLASS_NEGZERO | __FPCLASS_POSZERO) {
      // x is any zero.
    }

The data class encoding is identical to that used in llvm.is.fpclass
function.

Differential Revision: https://reviews.llvm.org/D152351
2023-06-18 22:53:32 +07:00
Animesh Kumar
0c6f2f629c [OpenMP] Update the default version of OpenMP to 5.1
The default version of OpenMP is updated from 5.0 to 5.1 which means if -fopenmp is specified but -fopenmp-version is not specified with clang, the default version of OpenMP is taken to be 5.1.  After modifying the Frontend for that, various LIT tests were updated. This patch contains all such changes. At a high level, these are the patterns of changes observed in LIT tests -

  # RUN lines which mentioned `-fopenmp-version=50` need to kept only if the IR for version 5.0 and 5.1 are different. Otherwise only one RUN line with no version info(i.e. default version) needs to be there.

  # Test cases of this sort already had the RUN lines with respect to the older default version 5.0 and the version 5.1. Only swapping the version specification flag `-fopenmp-version` from newer version RUN line to older version RUN line is required.

  # Diagnostics: Remove the 5.0 version specific RUN lines if there was no difference in the Diagnostics messages with respect to the default 5.1.

  # Diagnostics: In case there was any difference in diagnostics messages between 5.0 and 5.1, mention version specific messages in tests.

  # If the test contained version specific ifdef's e.g. "#ifdef OMP5" but there were no RUN lines for any other version than 5.X, then bring the code guarded by ifdef's outside and remove the ifdef's.

  # Some tests had RUN lines for both 5.0 and 5.1 versions, but it is found that the IR for 5.0 is not different from the 5.1, therefore such RUN lines are redundant. So, such duplicated lines are removed.

  # To generate CHECK lines automatically, use the script llvm/utils/update_cc_test_checks.py

Reviewed By: saiislam, ABataev

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

(cherry picked from commit 9dd2999907dc791136a75238a6000f69bf67cf4e)
2023-06-15 12:41:09 +05:30
Yaxun (Sam) Liu
c0f0d50653 [HIP] emit macro __HIP_NO_IMAGE_SUPPORT
HIP texture/image support is optional as some devices
do not have image instructions. A macro __HIP_NO_IMAGE_SUPPORT
is defined for device not supporting images (d0448aa4c4/docs/reference/kernel_language.md (L426) )

Currently the macro is defined by HIP header based on predefined macros
for GPU, e.g __gfx*__ , which is error prone. This patch let clang
emit the predefined macro.

Reviewed by: Matt Arsenault, Artem Belevich

Differential Revision: https://reviews.llvm.org/D151349
2023-06-14 22:53:41 -04:00
Mariya Podchishchaeva
bba6ea8c2d [C++20] Claim full support for consteval again
After resolving several outstanding issues now is the time to mark it as
fully supported.

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

Reviewed By: aaron.ballman, cor3ntin, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D147717
2023-06-13 03:50:24 -04:00
Corentin Jabot
4676885270 [clang] Implement P2564 "consteval must propagate up"
Reviewed By: aaron.ballman, #clang-language-wg

Differential Revision: https://reviews.llvm.org/D151094
2023-06-07 20:45:36 +02:00
John Brawn
78bf8a0a22 [clang] Don't define predefined macros multiple times
Fix several instances of macros being defined multiple times
in several targets. Most of these are just simple duplication in a
TargetInfo or OSTargetInfo of things already defined in
InitializePredefinedMacros or InitializeStandardPredefinedMacros,
but there are a few that aren't:
 * AArch64 defines a couple of feature macros for armv8.1a that are
   handled generically by getTargetDefines.
 * CSKY needs to take care when CPUName and ArchName are the same.
 * Many os/target combinations result in __ELF__ being defined twice.
   Instead define __ELF__ just once in InitPreprocessor based on
   the Triple, which already knows what the object format is based
   on os and target.

These changes shouldn't change the final result of which macros are
defined, with the exception of the changes to __ELF__ where if you
explicitly specify the object type in the triple then this affects
if __ELF__ is defined, e.g. --target=i686-windows-elf results in it
being defined where it wasn't before, but this is more accurate as an
ELF file is in fact generated.

Differential Revision: https://reviews.llvm.org/D150966
2023-05-24 17:28:41 +01:00