summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/InitPreprocessor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Frontend: Define __EXCEPTIONS if -fexceptions is passedDavid Majnemer2014-10-271-1/+1
| | | | | | | | | GCC defines __EXCEPTIONS, regardless of language mode, if -fexceptions is passed. We should do the same. This fixes PR21358. llvm-svn: 220714
* Follow-up commit to r211657 which introduced these macros, but not for MSVC. ↵Aaron Ballman2014-10-211-54/+48
| | | | | | This turns out to break our freestanding tests on Windows when compiling in MSVC-compatible mode. It was decided (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20141020/116942.html is the start of the thread) to support this as part of Clang's interface on all platforms. llvm-svn: 220312
* Add -fseh-exceptions for MinGW-w64Reid Kleckner2014-09-151-0/+2
| | | | | | | | | | | | | | This adds a flag called -fseh-exceptions that uses the native Windows .pdata and .xdata unwind mechanism to throw exceptions. The other EH possibilities are DWARF and SJLJ exceptions. Patch by Martell Malone! Reviewed By: asl, rnk Differential Revision: http://reviews.llvm.org/D3419 llvm-svn: 217790
* C++1y is now C++14!Aaron Ballman2014-08-191-3/+3
| | | | | | Changes diagnostic options, language standard options, diagnostic identifiers, diagnostic wording to use c++14 instead of c++1y. It also modifies related test cases to use the updated diagnostic wording. llvm-svn: 215982
* Correctly implement -include search logic.Manuel Klimek2014-08-121-14/+10
| | | | | | | | | | | | | | | According to the gcc docs, -include uses the current working directory for the lookup instead of the main source file. This patch gets rid of NormalizeIncludePath (which relied on an implementation detail of FileManager / FileEntry for the include path logic to work), and instead hands the correct lookup information down to LookupFile. This will allow us to change the FileEntry's behavior regarding its Name caching. llvm-svn: 215433
* Predefine IB_DESIGNABLE and IBInspectable macros. <rdar://problem/17441860>Bob Wilson2014-08-081-0/+2
| | | | | | | | | These macros are used as markers for Interface Builder and need to be defined to empty strings since they have no impact on the code. Patch by Ted Kremenek. llvm-svn: 215259
* If char/short are shorter than int, do not use U as suffix forJoerg Sonnenberger2014-07-171-3/+3
| | | | | | | | constants. Comparing int against a constant of the given type like UINT8_MAX will otherwise force a promotion to unsigned int, which is typically not expected. llvm-svn: 213301
* Always set the C suffix macro, even if it is empty.Joerg Sonnenberger2014-07-171-6/+2
| | | | llvm-svn: 213299
* Provide __SIG_ATOMIC_MAX__ next to __SIG_ATOMIC_WIDTH__.Joerg Sonnenberger2014-07-171-0/+1
| | | | llvm-svn: 213289
* Add __INTMAX_C_SUFFIX__ and __UINTMAX_C_SUFFIX__.Joerg Sonnenberger2014-07-151-0/+4
| | | | llvm-svn: 213097
* Don't create non-temporary twines.Joerg Sonnenberger2014-07-151-3/+2
| | | | llvm-svn: 213066
* Make sure int64_t and uint64_t are consistent.Joerg Sonnenberger2014-07-151-2/+2
| | | | llvm-svn: 213065
* Provide builtin macros as template for PRIab and SCNab, matching theJoerg Sonnenberger2014-07-151-0/+22
| | | | | | underlaying types. llvm-svn: 213063
* [x32] Add __ILP32__ macro for ILP32 platformsPavel Chupin2014-07-141-0/+6
| | | | | | | | | | | | | | | | Summary: Add __ILP32__ and _ILP32 macro for corresponding platforms. Cover x86_64-*-*-gnux32 with test. Test Plan: test added Reviewers: chandlerc, atanasyan Subscribers: cfe-commits, dschuff, zinovy.nis Differential Revision: http://reviews.llvm.org/D4473 llvm-svn: 212931
* Avoid definining more GCC specific predefined macros in clang-clEhsan Akhgari2014-07-101-29/+31
| | | | | | | | | | Reviewers: hansw, rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4419 llvm-svn: 212753
* Turn some Twine locals into const char * variables.Benjamin Kramer2014-07-081-4/+4
| | | | | | | No functionality change, just stylistic cleanup. Change made by clang-tidy and clang-format. llvm-svn: 212544
* Fix layering of file remapping and header search initializationAlp Toker2014-07-071-71/+0
| | | | | | | | These two functions initialize the source manager and header search objects and shouldn't be in InitPreprocessor which is concerned with priming the preprocessor itself and predefining macros. llvm-svn: 212434
* Do not define __STRICT_ANSI__ in clang-clEhsan Akhgari2014-06-301-1/+1
| | | | llvm-svn: 212066
* Implement predefined stdint macrosJF Bastien2014-06-251-8/+114
| | | | | | | | | | | | Add predefined stdint macros that match the given patterns: U?INT{_,_FAST,_LEAST}{8,16,32,64}_{MAX,TYPE} U?INT{PTR,MAX}_{MAX,TYPE} http://reviews.llvm.org/D4141 Author: binji llvm-svn: 211657
* Add -std=c++1z flag for C++17 features.Richard Smith2014-06-161-1/+4
| | | | llvm-svn: 211030
* Do not predefine __EXCEPTIONS in clang-cl (PR19977)Hans Wennborg2014-06-101-1/+1
| | | | | | | | Patch by Ehsan Akhgari! (Test tweak by me.) Differential Revision: http://reviews.llvm.org/D4065 llvm-svn: 210582
* [C++11] Use 'nullptr'. Frontend edition.Craig Topper2014-05-221-1/+1
| | | | llvm-svn: 209389
* Revert "Move -fms-extensions predefined macros into InitPreprocessor"Reid Kleckner2014-04-161-12/+0
| | | | | | | | | | This reverts commit r206413. This was proposed before, but it's not clear if this is really a good idea: http://reviews.llvm.org/D3034 llvm-svn: 206415
* Move -fms-extensions predefined macros into InitPreprocessorReid Kleckner2014-04-161-0/+12
| | | | | | | If someone on Linux asks for -fms-extensions, there's no reason not to define the feature test macros that MSVC defines. llvm-svn: 206413
* -fms-extensions: Don't define __PRETTY_FUNCTION__ to __FUNCTION__Reid Kleckner2014-04-071-4/+0
| | | | | | | This reverts r90596 from 2009. Having this macro definition makes Clang strictly less useful with -fms-extensions. llvm-svn: 205729
* Implement the MS extension __identifier properly: take a token and strip it ofRichard Smith2014-03-151-4/+0
| | | | | | its keywordliness. llvm-svn: 203987
* Make __LITTLE_ENDIAN__/__BIG_ENDOAN__ common PredefinedMacrosRobert Lytton2014-03-101-3/+5
| | | | llvm-svn: 203455
* [OPENMP] Updated comments and _OPENMP macro value for OpenMP 4.0 (for 'omp ↵Alexey Bataev2014-03-061-2/+2
| | | | | | simd' support) llvm-svn: 203114
* Revert "Preprocessor: Add __ALIGNOF_MAX_ALIGN_T__"David Majnemer2014-03-021-3/+0
| | | | | | | This commit reverts r201037, it's functionality is not needed given the definition of std::max_align_t in libcxx circa r201843. llvm-svn: 202667
* Update __cplusplus to match the value in the C++14 DIS preview (D3937).Richard Smith2014-02-241-3/+5
| | | | llvm-svn: 202003
* [stackprotector] Add command line option -fstack-protector-strongJosh Magee2014-02-111-1/+3
| | | | | | | | | | This option has the following effects: * It adds the sspstrong IR attribute to each function within the CU. * It defines the macro __SSP_STRONG__ with the value of 2. Differential Revision: http://llvm-reviews.chandlerc.com/D2717 llvm-svn: 201120
OpenPOWER on IntegriCloud