summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* [c++1z] cxx_status: mark p0195r2 as done.Richard Smith2016-12-191-0/+1
| | | | llvm-svn: 290081
* Recommit r289979 [OpenCL] Allow disabling types and declarations associated ↵Yaxun Liu2016-12-181-1/+1
| | | | | | | | with extensions Fixed undefined behavior due to cast integer to bool in initializer list. llvm-svn: 290056
* Revert r289979 due to regressionsYaxun Liu2016-12-161-1/+1
| | | | llvm-svn: 289991
* [OpenCL] Allow disabling types and declarations associated with extensionsYaxun Liu2016-12-161-1/+1
| | | | | | | | | | | | | | | | | | Added a map to associate types and declarations with extensions. Refactored existing diagnostic for disabled types associated with extensions and extended it to declarations for generic situation. Fixed some bugs for types associated with extensions. Allow users to use pragma to declare types and functions for supported extensions, e.g. #pragma OPENCL EXTENSION the_new_extension_name : begin // declare types and functions associated with the extension here #pragma OPENCL EXTENSION the_new_extension_name : end Differential Revision: https://reviews.llvm.org/D21698 llvm-svn: 289979
* Replace APFloatBase static fltSemantics data members with getter functionsStephan Bergmann2016-12-141-5/+5
| | | | | | | | | | | | | At least the plugin used by the LibreOffice build (<https://wiki.documentfoundation.org/Development/Clang_plugins>) indirectly uses those members (through inline functions in LLVM/Clang include files in turn using them), but they are not exported by utils/extract_symbols.py on Windows, and accessing data across DLL/EXE boundaries on Windows is generally problematic. Differential Revision: https://reviews.llvm.org/D26671 llvm-svn: 289647
* p0012r1: define corresponding feature test macroRichard Smith2016-12-021-1/+1
| | | | llvm-svn: 288452
* [Frontend] Add a predefined macro that describes the Objective-C bool typeAlex Lorenz2016-11-211-0/+3
| | | | | | | | | | | | | This commit adds a new predefined macro named __OBJC_BOOL_IS_BOOL that describes the Objective-C boolean type: its value is zero if the Objective-C boolean uses the signed character type, otherwise its value is one as the Objective-C boolean uses the builtin boolean type. rdar://21170440 Differential Revision: https://reviews.llvm.org/D26234 llvm-svn: 287529
* Add comment explaining this mysterious macro name.Richard Smith2016-10-311-0/+3
| | | | llvm-svn: 285631
* Mark aligned allocation as done.Richard Smith2016-10-101-1/+2
| | | | llvm-svn: 283724
* [coroutines] Rename driver flag -fcoroutines to -fcoroutines-tsGor Nishanov2016-10-021-1/+1
| | | | | | | | | | | | | | | Summary: Also makes -fcoroutines_ts to be both a Driver and CC1 flag. Patch mostly by EricWF. Reviewers: rnk, cfe-commits, rsmith, EricWF Subscribers: mehdi_amini Differential Revision: https://reviews.llvm.org/D25130 llvm-svn: 283064
* P0035R4: add predefined __STDCPP_DEFAULT_NEW_ALIGNMENT__ macro. By default, weRichard Smith2016-09-301-0/+9
| | | | | | | | | assume that ::operator new provides no more alignment than is necessary for any primitive type, except when we're on a GNU OS, where glibc's malloc guarantees to provide 64-bit alignment on 32-bit systems and 128-bit alignment on 64-bit systems. This can be controlled by the command-line -fnew-alignment flag. llvm-svn: 282974
* Mark P0127R3 as done, and replace its __has_feature check with the ↵Richard Smith2016-09-291-1/+1
| | | | | | corresponding SD-6 macro. llvm-svn: 282652
* Add a couple more tentative names for upcoming SD-6 feature checks. These mightRichard Smith2016-09-281-0/+4
| | | | | | | not reflect the final chosen names, but supporting them now seems to have little downside. llvm-svn: 282629
* P0095R3: Implement the latest published revision of SD-6 (C++ feature test ↵Richard Smith2016-09-281-2/+6
| | | | | | macros). llvm-svn: 282627
* P0096R2: Implement more recent revision of SD-6 (C++ feature test macros).Richard Smith2016-09-281-2/+15
| | | | llvm-svn: 282622
* Minor tweak. Avoid hardcoding.Daniel Marjamaki2016-09-231-1/+1
| | | | llvm-svn: 282242
* Simplify Clang's version number configuration in CMake.David L. Jones2016-09-151-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the Clang version is computed as follows: 1. LLVM defines major, minor, and patch versions, all statically set. Today, these are 4, 0, and 0, respectively. 2. The static version numbers are combined into PACKAGE_VERSION along with a suffix, so the result today looks like "4.0.0svn". 3. Clang extracts CLANG_VERSION from PACKAGE_VERSION using a regexp. The regexp allows the patch level to omitted, and drops any non-digit trailing values. Today, this result looks like "4.0.0". 4. CLANG_VERSION is then split further into CLANG_VERSION_MAJOR and CLANG_VERSION_MINOR. Today, these resolve to 4 and 0, respectively. 5. If CLANG_VERSION matches a regexp with three version components, then CLANG_VERSION_PATCHLEVEL is extracted and the CLANG_HAS_VERSION_PATCHLEVEL variable is set to 1. Today, these values are 0 and 1, respectively. 6. The CLANG_VERSION_* variables (and CLANG_HAS_VERSION_PATCHLEVEL) are configured into [llvm/tools/clang/]include/clang/Basic/Version.inc verbatim by CMake. 7. In [llvm/tools/clang/]include/clang/Basic/Version.h, macros are defined conditionally, based on CLANG_HAS_VERSION_PATCHLEVEL, to compute CLANG_VERSION_STRING as either a two- or three-level version number. Today, this value is "4.0.0", because despite the patchlevel being 0, it was matched by regexp and is thus "HAS"ed by the preprocessor. This string is then used wherever Clang's "version" is needed [*]. [*] Including, notably, by compiler-rt, for computing its installation path. This change collapses steps 2-5 by defaulting Clang to use LLVM's (non-string) version components for the Clang version (see [*] for why not PACKAGE_VERSION), and collapses steps 6 and 7 by simply writing CLANG_VERSION_STRING into Version.inc. The Clang version today always uses the patchlevel form, so the collapsed Version.inc does not have logic for a version without a patch level. Historically speaking, this technique began with the VER file in r82085 (which survives in the form of the regexp in #3). The major, minor, and patchlevel versions were introduced by r106863 (which remains in #4-6). The VER file itself was deleted in favor of the LLVM version number in r106914. On the LLVM side, the individual LLVM_VERSION_MAJOR, LLVM_VERSION_MINOR, and PACKAGE_VERSION weren't introduced for nearly two more years, until r150405. llvm-svn: 281666
* OpenCL: Defining __ENDIAN_LITTLE__ and fix target endiannessMatt Arsenault2016-09-071-0/+3
| | | | | | | | | OpenCL requires __ENDIAN_LITTLE__ be set for little endian targets. The default for targets was also apparently big endian, so AMDGPU was incorrectly reported as big endian. Set this from the triple so targets don't have another place to set the endianness. llvm-svn: 280787
* Provide __GLIBCXX_TYPE_INT_N_0 and __GLIBCXX_BITSIZE_INT_N_0 when in C++ gnu ↵Yaron Keren2016-07-211-0/+5
| | | | | | | | | language extensions. These are used by libstdc++ <type_traits> for is_integral<__int128>. Addresses http://llvm.org/pr23156. llvm-svn: 276252
* [NFC] Header cleanupMehdi Amini2016-07-181-4/+1
| | | | | | | | | | Summary: Removed unused headers, replaced some headers with forward class declarations Patch by: Eugene <claprix@yandex.ru> Differential Revision: https://reviews.llvm.org/D20100 llvm-svn: 275882
* Restructure the propagation of -fPIC/-fPIE.Rafael Espindola2016-06-231-4/+4
| | | | | | | | | | | | | The PIC and PIE levels are not independent. In fact, if PIE is defined it is always the same as PIC. This is clear in the driver where ParsePICArgs returns a PIC level and a IsPIE boolean. Unfortunately that is currently lost and we pass two redundant levels down the pipeline. This patch keeps a bool and a PIC level all the way down to codegen. llvm-svn: 273566
* [OPENMP] Fixed processing of '-fopenmp-version=' option and test.Alexey Bataev2016-05-271-18/+18
| | | | llvm-svn: 270962
* [OPENMP] Add option '-fopenmp-version=[31|40|45]' allowing choosingAlexey Bataev2016-05-261-1/+12
| | | | | | | | | | OpenMP version. If '-fopenmp' option is provided '-fopenmp-version=' allows to control, which version of OpenMP must be supported. Currently it affects only the value of _OPENMP define. llvm-svn: 270838
* [OPENMP] Set '_OPENMP' macro to '201511' value to reflect support forAlexey Bataev2016-05-261-1/+1
| | | | | | | | OpenMP 4.5. According to OpenMP 4.5 the _OPENMP macro name is defined to have the decimal value yyyymm where yyyy and mm are the year and month designations of the version of the OpenMP API that the implementation supports. Clang supports OpenMP 4.5 so updated value of _OPENMP macro to 201511. llvm-svn: 270822
* [CUDA] Add -fcuda-approx-transcendentals flag.Justin Lebar2016-05-231-0/+6
| | | | | | | | | | | | | | Summary: This lets us emit e.g. sin.approx.f32. See http://docs.nvidia.com/cuda/parallel-thread-execution/#floating-point-instructions-sin Reviewers: rnk Subscribers: tra, cfe-commits Differential Revision: http://reviews.llvm.org/D20493 llvm-svn: 270484
* [OpenCL] Add supported OpenCL extensions to target info.Yaxun Liu2016-05-161-0/+9
| | | | | | | | | | Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line. Re-commit after fixing build error due to missing override attribute. Differential Revision: http://reviews.llvm.org/D19484 llvm-svn: 269670
* Revert "[OpenCL] Add supported OpenCL extensions to target info."Yaxun Liu2016-05-131-9/+0
| | | | | | | | | Revert r269431 due to build failure caused by warning msg: llvm/tools/clang/lib/Basic/Targets.cpp:2090:9: error: 'setSupportedOpenCLOpts' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override] void setSupportedOpenCLOpts() { llvm-svn: 269435
* [OpenCL] Add supported OpenCL extensions to target info.Yaxun Liu2016-05-131-0/+9
| | | | | | | | Add supported OpenCL extensions to target info. It serves as default values to save the users of the burden setting each supported extensions and optional core features in command line. Differential Revision: http://reviews.llvm.org/D19484 llvm-svn: 269431
* [OpenCL] Add predefined macros.Yaxun Liu2016-04-261-0/+33
| | | | | | | | | | | | OpenCL spec requires __OPENCL_C_VERSION__ to be defined based on -cl-std option. This patch implements that. The patch also defines __FAST_RELAXED_MATH__ based on -cl-fast-relaxed-math option. Also fixed a test using -std=c99 for OpenCL program. Limit allowed language standard of OpenCL to be OpenCL standards. Differential Revision: http://reviews.llvm.org/D19071 llvm-svn: 267590
* NFC: clarify comment on lock-free macrosJF Bastien2016-03-241-1/+1
| | | | | | Used by both libstdc++ and libc++. llvm-svn: 264226
* clang-cl: Include /FI headers in /showIncludes output.Nico Weber2016-03-231-4/+4
| | | | | | | | | | | | | | | | | -H in gcc mode doesn't print -include headers, but they are included in depfiles written by MMD and friends. Since /showIncludes is what's used instead of depfiles, printing /FI there seems important (and matches cl.exe). Instead of giving HeaderIncludeGen more options, just switch on ShowAllHeaders in clang-cl mode and let clang::InitializePreprocessor() not put -include flags in the <command line> block. This changes the behavior of -E slightly, and it removes the <command line> flag from the output triggered by setting the obscure CC_PRINT_HEADERS=1 env var to true while running clang. Both of these seem ok to change. http://reviews.llvm.org/D18401 llvm-svn: 264174
* Make TargetInfo store an actual DataLayout instead of a string.James Y Knight2016-03-041-2/+2
| | | | | | | | | | | | | | Use it to calculate UserLabelPrefix, instead of specifying it (often incorrectly). Note that the *actual* user label prefix has always come from the DataLayout, and is handled within LLVM. The main thing clang's TargetInfo::UserLabelPrefix did was to set the #define value. Having these be different from each-other is just silly. Differential Revision: http://reviews.llvm.org/D17183 llvm-svn: 262737
* [CUDA] Make CUDA compilation usable by default.Artem Belevich2015-11-171-0/+2
| | | | | | | | | | | | | | | | | | Currently clang requires several additional command line options in order to enable new features needed during CUDA compilation. This patch makes these options default. * Automatically include cuda_runtime.h if we've found a valid CUDA installation. * Disable automatic CUDA header inclusion during unit tests. * Added test case for command line construction. * Enabled target overloads and relaxed call checks that are needed in order to include CUDA headers. * Added CUDA-7.5 installation path to the CUDA installation search list. * Define __CUDA__ macro to indicate CUDA compilation. llvm-svn: 253389
* Define __unsafe_unretained and __autoreleasing in ObjC GC mode.John McCall2015-11-101-0/+2
| | | | | | This was an accidental regression from the MRC __weak patch. llvm-svn: 252668
* Sink some PTHManager includes out of Preprocessor.hReid Kleckner2015-11-021-0/+1
| | | | | | | This reduces the number of .cpp files needed to be rebuilt after touching OnDiskHashTable from 120 to 21 for me. llvm-svn: 251810
* Define weak and __weak to mean ARC-style weak references, even in MRC.John McCall2015-10-221-21/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, __weak was silently accepted and ignored in MRC mode. That makes this a potentially source-breaking change that we have to roll out cautiously. Accordingly, for the time being, actual support for __weak references in MRC is experimental, and the compiler will reject attempts to actually form such references. The intent is to eventually enable the feature by default in all non-GC modes. (It is, of course, incompatible with ObjC GC's interpretation of __weak.) If you like, you can enable this feature with -Xclang -fobjc-weak but like any -Xclang option, this option may be removed at any point, e.g. if/when it is eventually enabled by default. This patch also enables the use of the ARC __unsafe_unretained qualifier in MRC. Unlike __weak, this is being enabled immediately. Since variables are essentially __unsafe_unretained by default in MRC, the only practical uses are (1) communication and (2) changing the default behavior of by-value block capture. As an implementation matter, this means that the ObjC ownership qualifiers may appear in any ObjC language mode, and so this patch removes a number of checks for getLangOpts().ObjCAutoRefCount that were guarding the processing of these qualifiers. I don't expect this to be a significant drain on performance; it may even be faster to just check for these qualifiers directly on a type (since it's probably in a register anyway) than to do N dependent loads to grab the LangOptions. rdar://9674298 llvm-svn: 251041
* [coroutines] Add feature-test macro for coroutines, defined to 1 to indicateRichard Smith2015-10-221-0/+2
| | | | | | the implementation is incomplete. llvm-svn: 250982
* [CUDA] Allow parsing of host and device code simultaneously.Artem Belevich2015-09-221-0/+4
| | | | | | | | | | | | * adds -aux-triple option to specify target triple * propagates aux target info to AST context and Preprocessor * pulls in target specific preprocessor macros. * pulls in target-specific builtins from aux target. * sets appropriate host or device attribute on builtins. Differential Revision: http://reviews.llvm.org/D12917 llvm-svn: 248299
* Make the clang module container format selectable from the command line.Adrian Prantl2015-07-171-4/+4
| | | | | | | | | | | | | - introduces a new cc1 option -fmodule-format=[raw,obj] with 'raw' being the default - supports arbitrary module container formats that libclang is agnostic to - adds the format to the module hash to avoid collisions - splits the old PCHContainerOperations into PCHContainerWriter and a PCHContainerReader. Thanks to Richard Smith for reviewing this patch! llvm-svn: 242499
* Add __nonnull/__nullable/__null_unspecified predefines for Darwin.Douglas Gregor2015-06-241-0/+8
| | | | | | Addresses the rest of rdar://problem/21530726. llvm-svn: 240597
* Introduce a PCHContainerOperations interface (NFC).Adrian Prantl2015-06-201-6/+9
| | | | | | | | | | | | | | | | A PCHContainerOperations abstract interface provides operations for creating and unwrapping containers for serialized ASTs (precompiled headers and clang modules). The default implementation is RawPCHContainerOperations, which uses a flat file for the output. The main application for this interface will be an ObjectFilePCHContainerOperations implementation that uses LLVM to wrap the module in an ELF/Mach-O/COFF container to store debug info alongside the AST. rdar://problem/20091852 llvm-svn: 240225
* "This adds -fconcepts-ts as a cc1 option for enabling theFaisal Vali2015-05-221-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | in-progress implementation of the Concepts TS. The recommended feature test macro __cpp_experimental_concepts is set to 1 (as opposed to 201501) to indicate that the feature is enabled, but the implementation is incomplete. The link to the Concepts TS in cxx_status is updated to refer to the PDTS (N4377). Additional changes related to __has_feature and __has_extension are to follow in a later change. Relevant tests include: test/Lexer/cxx-features.cpp The test file is updated with testing of the C++14 + Concepts TS mode. The expected behaviour is the same as that of the C++14 modes except for the case of __cpp_experimental_concepts." - Hubert Tong. Being committed for Hubert (as per his understanding with Richard Smith) as we start work on the concepts-ts following our preliminary strategy session earlier today. The patch is tiny and seems quite standard. Thanks Hubert! llvm-svn: 237982
* Make GNUInline consistent with whether we use traditional GNU inline semantics.Peter Collingbourne2015-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we were setting LangOptions::GNUInline (which controls whether we use traditional GNU inline semantics) if the language did not have the C99 feature flag set. The trouble with this is that C++ family languages also do not have that flag set, so we ended up setting this flag in C++ modes (and working around it in a few places downstream by also checking CPlusPlus). The fix is to check whether the C89 flag is set for the target language, rather than whether the C99 flag is cleared. This also lets us remove most CPlusPlus checks. We continue to test CPlusPlus when deciding whether to pre-define the __GNUC_GNU_INLINE__ macro for consistency with GCC. There is a change in semantics in two other places where we weren't checking both CPlusPlus and GNUInline (FunctionDecl::doesDeclarationForceExternallyVisibleDefinition and FunctionDecl::isInlineDefinitionExternallyVisible), but this change seems to put us back into line with GCC's semantics (test case: test/CodeGen/inline.c). While at it, forbid -fgnu89-inline in C++ modes, as GCC doesn't support it, it didn't have any effect before, and supporting it just makes things more complicated. Differential Revision: http://reviews.llvm.org/D9333 llvm-svn: 237299
* Add C11 *_DECIMAL_DIG.Ed Schouten2015-02-231-2/+3
| | | | | | | | | | | | | | | Before C11 there was only the DECIMAL_DIG definition. As of C11, we now have one definition per floating point type (e.g. DBL_DECIMAL_DIG). Change the existing code to define the new versions. To remain backward compatible, define __DECIMAL_DIG__ as __LDBL_DECIMAL_DIG__. Also update the tests. It seems that some of the existing test vectors were incorrect. Change all tests for __DECIMAL_DIG__ to expect __LDBL_DECIMAL_DIG__. Add tests for *_DECIMAL_DIG for FreeBSD/amd64, as I happen to have such a system laying around. I've validated that the values are in sync with <float.h>. llvm-svn: 230207
* [mips] Partially revert r223927: Removing __SIZEOF_INT128__ macro for MIPS64Vasileios Kalintiris2015-02-121-6/+1
| | | | | | | | Partially revert r223927 because LLVM gained support for 128-bit integers in r227089. Modify and keep the tests that verify the definition of the macro __SIZEOF_INT128__ for MIPS64 BE & LE in the preprocessor. llvm-svn: 228918
* Preprocessor: support __BIGGEST_ALIGNMENT__ macroTim Northover2015-02-061-0/+4
| | | | | | | | | | | For compatibility with GCC (and because it's generally helpful information otherwise inaccessible to the preprocessor). This appears to be canonically the alignment of max_align_t (e.g. on i386, __BIGGEST_ALIGNMENT__ is 4 even though vector types will be given greater alignment). Patch mostly by Mats Petersson llvm-svn: 228367
* [mips] Removing __SIZEOF_INT128__ macro for MIPS64Simon Atanasyan2014-12-101-1/+6
| | | | | | | | | | | | | This is a temporary workaround while MIPS64 has not yet fully supported 128-bit integers. But declaration of int128 type is necessary even though `__SIZEOF_INT128__` is undefined because c++ standard header files like `limits` throw error message if `__int128` is not available. Patch by Sagar Thakur. Differential Revision: http://reviews.llvm.org/D6402 llvm-svn: 223927
* CUDA host device code with two code pathsReid Kleckner2014-12-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: Allow CUDA host device functions with two code paths using __CUDA_ARCH__ to differentiate between code path being compiled. For example: __host__ __device__ void host_device_function(void) { #ifdef __CUDA_ARCH__ device_only_function(); #else host_only_function(); #endif } Patch by Jacques Pienaar. Reviewed By: rnk Differential Revision: http://reviews.llvm.org/D6457 llvm-svn: 223271
* Remove -fseh-exceptions in favor of checking the tripleReid Kleckner2014-11-141-2/+0
| | | | | | | | | This option was misleading because it looked like it enabled the language feature of SEH (__try / __except), when this option was really controlling which EH personality function to use. Mingw only supports SEH and SjLj EH on x86_64, so we can simply do away with this flag. llvm-svn: 221963
* Update Clang's SD-6 support to match N4200 (except for __has_cpp_attribute,Richard Smith2014-11-121-0/+16
| | | | | | which we don't yet implement). llvm-svn: 221816
OpenPOWER on IntegriCloud