summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add predefined macro __gnu_linux__ for proper aux-tripleYaxun Liu2018-08-291-0/+1
| | | | | | | | | | | | Clang predefine macro __linx__ for aux-triple with Linux OS but does not predefine macro __gnu_linux__. This causes some compilation error for certain applications, e.g. Eigen. This patch fixes that. Differential Revision: https://reviews.llvm.org/D51441 llvm-svn: 340967
* [OpenMP][NVPTX] Use appropriate _CALL_ELF macro when offloadingGheorghe-Teodor Bercea2018-08-271-1/+6
| | | | | | | | | | | | | | Summary: When offloading to a device and using the powerpc64le version of the auxiliary triple, the _CALL_ELF macro is not set correctly to 2 resulting in the attempt to include a header that does not exist. This patch fixes this problem. Reviewers: Hahnfeld, ABataev, caomhin Reviewed By: Hahnfeld Subscribers: guansong, cfe-commits Differential Revision: https://reviews.llvm.org/D51312 llvm-svn: 340772
* [CUDA/OpenMP] Define only some host macros during device compilationJonas Hahnfeld2018-08-251-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When compiling CUDA or OpenMP device code Clang parses header files that expect certain predefined macros from the host architecture. To make this work the compiler passes the host triple via the -aux-triple argument and (until now) pulls in all macros for that "auxiliary triple" unconditionally. However this results in defines like __SSE_MATH__ that will trigger inline assembly making use of the "advertised" target features. See the discussion of D47849 and PR38464 for a detailed explanation of the encountered problems. Instead of blacklisting "known bad" examples this patch starts adding defines that are needed for certain headers like bits/wordsize.h and bits/mathinline.h. The disadvantage of this approach is that it decouples the definitions from their target toolchain. However in my opinion it's more important to keep definitions for one header close together. For one this will include a clear documentation why these particular defines are needed. Furthermore it simplifies maintenance because adding defines for a new header or support for a new aux-triple only needs to touch one piece of code. Differential Revision: https://reviews.llvm.org/D50845 llvm-svn: 340681
* [Preprocessor] Allow libc++ to detect when aligned allocation is unavailable.Volodymyr Sapsai2018-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Libc++ needs to know when aligned allocation is supported by clang, but is otherwise unavailable at link time. Otherwise, libc++ will incorrectly end up generating calls to `__builtin_operator_new`/`__builtin_operator_delete` with alignment arguments. This patch implements the following changes: * The `__cpp_aligned_new` feature test macro to no longer be defined when aligned allocation is otherwise enabled but unavailable. * The Darwin driver no longer passes `-faligned-alloc-unavailable` when the user manually specifies `-faligned-allocation` or `-fno-aligned-allocation`. * Instead of a warning Clang now generates a hard error when an aligned allocation or deallocation function is referenced but unavailable. Patch by Eric Fiselier. Reviewers: rsmith, vsapsai, erik.pilkington, ahatanak, dexonsmith Reviewed By: rsmith Subscribers: Quuxplusone, cfe-commits Differential Revision: https://reviews.llvm.org/D45015 llvm-svn: 338934
* P0096R5, P0941R2: Update to match latest feature test macro specification.Richard Smith2018-06-141-49/+53
| | | | llvm-svn: 334677
* As discussed with SG10, bump version of __cpp_deduction_guides macro to ↵Richard Smith2018-05-301-1/+1
| | | | | | indicate support for P0620R0. llvm-svn: 333587
* Revert "Revert r332955 "GNUstep Objective-C ABI version 2""David Chisnall2018-05-221-0/+13
| | | | llvm-svn: 332963
* Revert r332955 "GNUstep Objective-C ABI version 2"Bjorn Pettersson2018-05-221-13/+0
| | | | | | | Reverted due to buildbot failures. Seems like isnumber() is some Apple addition to cctype. llvm-svn: 332957
* GNUstep Objective-C ABI version 2David Chisnall2018-05-221-0/+13
| | | | | | | | | | | | | | | | | | | | | Summary: This includes initial support for the (hopefully final) updated Objective-C ABI, developed here: https://github.com/davidchisnall/clang-gnustep-abi-2 It also includes some cleanups and refactoring from older GNU ABIs. The current version is ELF only, other formats to follow. Reviewers: rjmccall, DHowett-MSFT Reviewed By: rjmccall Subscribers: smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D46052 llvm-svn: 332950
* [OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.Alexey Bataev2018-05-211-13/+15
| | | | | | | | if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be defined. If `-fopenmp-simd` is specified along with the `-fopenmp`, `_OPENMP` macro should be defined with the value `201511`. llvm-svn: 332852
* Remove \brief commands from doxygen comments.Adrian Prantl2018-05-091-2/+2
| | | | | | | | | | | | | | | | | | | This is similar to the LLVM change https://reviews.llvm.org/D46290. We've been running doxygen with the autobrief option for a couple of years now. This makes the \brief markers into our comments redundant. Since they are a visual distraction and we don't want to encourage more \brief markers in new code either, this patch removes them all. Patch produced by for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done Differential Revision: https://reviews.llvm.org/D46320 llvm-svn: 331834
* Implement P0482R2, support for char8_t type.Richard Smith2018-05-011-0/+6
| | | | | | | | | | | | This is not yet part of any C++ working draft, and so is controlled by the flag -fchar8_t rather than a -std= flag. (The GCC implementation is controlled by a flag with the same name.) This implementation is experimental, and will be removed or revised substantially to match the proposal as it makes its way through the C++ committee. llvm-svn: 331244
* [HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__Yaxun Liu2018-04-251-2/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D45441 llvm-svn: 330824
* [HIP] Add hip input kind and codegen for kernel launchingYaxun Liu2018-04-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | HIP is a language similar to CUDA (https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_kernel_language.md ). The language syntax is very similar, which allows a hip program to be compiled as a CUDA program by Clang. The main difference is the host API. HIP has a set of vendor neutral host API which can be implemented on different platforms. Currently there is open source implementation of HIP runtime on amdgpu target (https://github.com/ROCm-Developer-Tools/HIP). This patch adds support of input kind and language standard hip. When hip file is compiled, both LangOpts.CUDA and LangOpts.HIP is turned on. This allows compilation of hip program as CUDA in most cases and only special handling of hip program is needed LangOpts.HIP is checked. This patch also adds support of kernel launching of HIP program using HIP host API. When -x hip is not specified, there is no behaviour change for CUDA. Patch by Greg Rodgers. Revised and lit test added by Yaxun Liu. Differential Revision: https://reviews.llvm.org/D44984 llvm-svn: 330790
* [OpenCL] Added -std/-cl-std=c++Anastasia Stulova2018-04-121-31/+39
| | | | | | | | This is std option for OpenCL C++ v1.0. Differential Revision: https://reviews.llvm.org/D45363 llvm-svn: 329911
* Revert 319303: Add _Float128 as alias to __float128 to enable compilations ↵Erich Keane2018-01-151-4/+0
| | | | | | | | on Fedora27/glibc2 Differential Revision: https://reviews.llvm.org/D40673 llvm-svn: 322518
* [OPENMP] Initial support for `-fopenmp-simd` option.Alexey Bataev2017-12-291-2/+2
| | | | | | Added basic support for `-fopenmp-simd` options. llvm-svn: 321558
* Revert 320391: Certain targets are failing, pulling back to diagnose.Erich Keane2017-12-111-16/+0
| | | | llvm-svn: 320398
* For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is availableErich Keane2017-12-111-0/+16
| | | | | | | | | | | | | | | | | | | | As reported in llvm bugzilla 32377. Here’s a patch to add preinclude of stdc-predef.h. The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html; The preinclude is inhibited with –ffreestanding. Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior. I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here Note: this is a recommit after a test failure took down the original (r318669) Patch By: mibintc Differential Revision: https://reviews.llvm.org/D34158 llvm-svn: 320391
* Correct line endings that got mixed up in r320089; NFC.Aaron Ballman2017-12-071-210/+210
| | | | llvm-svn: 320113
* Add new language mode flags for C17.Aaron Ballman2017-12-071-201/+203
| | | | | | This adds -std=c17, -std=gnu17, and -std=iso9899:2017 as language mode flags for C17 and updates the value of __STDC_VERSION__ to the value based on the C17 FDIS. Given that this ballot cannot succeed until 2018, it is expected that we (and GCC) will add c18 flags as aliases once the ballot passes. llvm-svn: 320089
* [driver] Set the 'simulator' environment for Darwin when compiling forAlex Lorenz2017-12-071-0/+5
| | | | | | | | | | iOS/tvOS/watchOS simulator rdar://35135215 Differential Revision: https://reviews.llvm.org/D40682 llvm-svn: 320073
* Add __WINT_MAX__.Ed Schouten2017-12-051-0/+1
| | | | | | | This definition is similar to __WCHAR_MAX__, except that it applies to wint_t. It's also documented as being supported by GCC 4.5 and later. llvm-svn: 319746
* Add _Float128 as alias to __float128 to enable compilations on ↵Erich Keane2017-12-041-0/+4
| | | | | | | | | | | | | | | | | Fedora27/glibc2-26 Fedora27 is using a new version of glibc that refers to the _Float128 type. This patch adds that name as an alias to float128. I also added some predefined macro values for the digits, mantissa, epilon, etc (FloatMacros). For the test case, I copied an existing float128 test. This functionality needs work long term, but it should be sufficient to tread water for a while. At Intel we have test servers running our LLVM compiler with various open source workloads, the server has been upgraded to Fedora27 so many workloads are failing due to _Float128. Patch-By: mibintc Differential Revision: https://reviews.llvm.org/D40673 llvm-svn: 319703
* Now that C++17 is official (https://www.iso.org/standard/68564.html), start ↵Aaron Ballman2017-12-041-5/+5
| | | | | | changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes. llvm-svn: 319688
* [OpenCL] Define __IMAGE_SUPPORT__ macro for SPIRSven van Haastregt2017-12-041-0/+4
| | | | | | | | | | | Add #define __IMAGE_SUPPORT__ 1 for SPIR targets to indicate that SPIR supports images. Patch by Dmitry Borisenkov. Differential Revision: https://reviews.llvm.org/D40252 llvm-svn: 319658
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a re-apply of r319294. adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319297
* Revert "Toolchain: Normalize dwarf, sjlj and seh eh"Martell Malone2017-11-291-6/+0
| | | | | | | | This reverts rL319294. The windows sanitizer does not like seh on x86. Will re apply with None type for x86 llvm-svn: 319295
* Toolchain: Normalize dwarf, sjlj and seh ehMartell Malone2017-11-291-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | adds -fseh-exceptions and -fdwarf-exceptions flags clang will check if the user has specified an exception model flag, in the absense of specifying the exception model clang will then check the driver default and append the model flag for that target to cc1 clang cc1 assumes dwarf is the default if none is passed and -fno-exceptions has a higher priority then specifying the model move __SEH__ macro definitions out of Targets into InitPreprocessor behind the -fseh-exceptions flag move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check remove unused USESEHExceptions from the MinGW Driver fold USESjLjExceptions into a new GetExceptionModel function that gives the toolchain classes more flexibility with eh models Reviewers: rnk, mstorsjo Differential Revision: https://reviews.llvm.org/D39673 llvm-svn: 319294
* Revert r318669/318694Erich Keane2017-11-201-16/+0
| | | | | | Broke some libclang tests, so reverting for now. llvm-svn: 318698
* For Linux/gnu compatibility, preinclude <stdc-predef.h> if the file is availableErich Keane2017-11-201-0/+16
| | | | | | | | | | | | | | | | | | | | | | As reported in llvm bugzilla 32377. Here’s a patch to add preinclude of stdc-predef.h. The gcc documentation says “On GNU/Linux, <stdc-predef.h> is pre-included.” See https://gcc.gnu.org/gcc-4.8/porting_to.html; The preinclude is inhibited with –ffreestanding. Basically I fixed the failing test cases by adding –ffreestanding which inhibits this behavior. I fixed all the failing tests, including some in extra/test, there's a separate patch for that which is linked here Patch By: mibintc Differential Revision: https://reviews.llvm.org/D34158 llvm-svn: 318669
* This adds the _Float16 preprocessor macro definitions.Sjoerd Meijer2017-09-131-14/+17
| | | | | | Differential Revision: https://reviews.llvm.org/D34695 llvm-svn: 313152
* Fix comments about __OPENCL_MEMORY_SCOPE_* macrosYaxun Liu2017-08-161-1/+1
| | | | llvm-svn: 310986
* [OpenCL] Support variable memory scope in atomic builtinsYaxun Liu2017-08-151-4/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D36580 llvm-svn: 310924
* Implement latest feature test macro recommendations, P0096R4.Richard Smith2017-08-111-2/+3
| | | | llvm-svn: 310694
* Add OpenCL 2.0 atomic builtin functions as Clang builtinYaxun Liu2017-08-041-0/+13
| | | | | | | | | | | | | | | | | | | | | OpenCL 2.0 atomic builtin functions have a scope argument which is ideally represented as synchronization scope argument in LLVM atomic instructions. Clang supports translating Clang atomic builtin functions to LLVM atomic instructions. However it currently does not support synchronization scope of LLVM atomic instructions. Without this, users have to use LLVM assembly code to implement OpenCL atomic builtin functions. This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin functions, which supports generating LLVM atomic instructions with synchronization scope operand. Currently only constant memory scope argument is supported. Support of non-constant memory scope argument will be added later. Differential Revision: https://reviews.llvm.org/D28691 llvm-svn: 310082
* [c++2a] Add option -std=c++2a to enable support for potential/transitional ↵Faisal Vali2017-07-161-1/+4
| | | | | | | | | | C++2a features - as usual C++2a implies all the C++'s that came before it. Thank you Aaron for the feedback here: https://reviews.llvm.org/D35454 llvm-svn: 308118
* [OpenMP] Add support for auxiliary triple specificationGheorghe-Teodor Bercea2017-06-291-1/+1
| | | | | | | | | | | | | | Summary: Device offloading requires the specification of an additional flag containing the triple of the //other// architecture the code is being compiled on if such an architecture exists. If compiling for the host, the auxiliary triple flag will contain the triple describing the device and vice versa. Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar Reviewed By: Hahnfeld Subscribers: rengolin, cfe-commits Differential Revision: https://reviews.llvm.org/D29339 llvm-svn: 306689
* Only define __SIZEOF_FLOAT128__ on x86 as intended in r304012Reid Kleckner2017-05-261-2/+0
| | | | | | GCC only defines it on x86. llvm-svn: 304013
* Enable __float128 for mingw for GCC compatibility and define ↵Reid Kleckner2017-05-261-0/+2
| | | | | | | | | | | | __SIZEOF_FLOAT128__ on x86 GCC defines __FLOAT128__ on Power and __SIZEOF_FLOAT128__ on x86. We're just following the inconsistency for now so users have some way to test. Effectively merges this patch as requested by Martell Malone: https://github.com/Alexpux/MINGW-packages/blob/master/mingw-w64-clang/0107-enable-__float128-for-X86-MinGW.patch llvm-svn: 304012
* [coroutines] Bump __cpp_coroutines versionEric Fiselier2017-05-251-1/+1
| | | | | | | | | | | | | | Summary: This patch is needed so that Libc++ can actually tess if Clang supports coroutines, instead of just paying lip service with a partial implementation. Otherwise the libc++ test suite will fail against older versions of Clang Reviewers: GorNishanov, rsmith Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D33536 llvm-svn: 303867
* Refactor frontend InputKind to prepare for treating module maps as a ↵Richard Smith2017-04-261-0/+2
| | | | | | | | distinct kind of input. No functionality change intended. llvm-svn: 301442
* Add __CLANG_ATOMIC_<TYPE>_LOCK_FREE macros for use in MSVC compatibility mode.Eric Fiselier2017-04-201-7/+12
| | | | | | | | | | | | | | | | | Summary: Libc++ currently implements the `ATOMIC_<TYPE>_LOCK_FREE` macros using the `__GCC_ATOMIC_<TYPE>_LOCK_FREE` macros. However these are not available when MSVC compatibility is enabled even though C11 `_Atomic` is. This prevents libc++ from correctly implementing `ATOMIC_<TYPE>_LOCK_FREE`. This patch adds an alternative spelling `__CLANG_ATOMIC_<TYPE>_LOCK_FREE` that is enabled with `-fms-compatibility`. Reviewers: rsmith, aaron.ballman, majnemer, zturner, compnerd, jfb, rnk Reviewed By: rsmith Subscribers: BillyONeal, smeenai, jfb, cfe-commits, dschuff Differential Revision: https://reviews.llvm.org/D32265 llvm-svn: 300914
* Bump __cplusplus for C++17 to 201703L per the C++17 DIS.Richard Smith2017-03-201-2/+4
| | | | llvm-svn: 298299
* Revert r291477 "[Frontend] Correct values of ATOMIC_*_LOCK_FREE to match ↵Hans Wennborg2017-02-241-4/+6
| | | | | | | | | builtin" It caused PR31864. There is a patch in progress to fix that, but let's revert in the meantime. llvm-svn: 296063
* [c++1z] Mark constexpr lambdas as done on status page and start advertisingRichard Smith2017-02-211-0/+1
| | | | | | | | them via feature test macro __cpp_constexpr. Thanks to Faisal for implementing this feature! llvm-svn: 295791
* [c++1z] Add some more tests for class template argument deduction, addRichard Smith2017-02-141-0/+2
| | | | | | feature-test macro, and mark feature as done on status page. llvm-svn: 295011
* [Frontend] The macro that describes the Objective-C bool type shouldAlex Lorenz2017-01-201-3/+5
| | | | | | | | | | be defined for non Objective-C code as well rdar://29794915 Differential Revision: https://reviews.llvm.org/D28349 llvm-svn: 292617
* [Frontend] Correct values of ATOMIC_*_LOCK_FREE to match builtinMichal Gorny2017-01-091-6/+4
| | | | | | | | | | | | | | | | | | | | | | | Correct the logic used to set ATOMIC_*_LOCK_FREE preprocessor macros not to rely on the ABI alignment of types. Instead, just assume all those types are aligned correctly by default since clang uses safe alignment for _Atomic types even if the underlying types are aligned to a lower boundary by default. For example, the 'long long' and 'double' types on x86 are aligned to 32-bit boundary by default. However, '_Atomic long long' and '_Atomic double' are aligned to 64-bit boundary, therefore satisfying the requirements of lock-free atomic operations. This fixes PR #19355 by correcting the value of __GCC_ATOMIC_LLONG_LOCK_FREE on x86, and therefore also fixing the assumption made in libc++ tests. This also fixes PR #30581 by applying a consistent logic between the functions used to implement both interfaces. Differential Revision: https://reviews.llvm.org/D28213 llvm-svn: 291477
* Add __cpp_structured_bindings feature test macro for structured bindings, perRichard Smith2016-12-191-0/+1
| | | | | | latest (provisional) draft of SD-6. llvm-svn: 290082
OpenPOWER on IntegriCloud