Commit Graph

419 Commits

Author SHA1 Message Date
Benjamin Kramer 8ac9c22391 Define __SSE4A__ when targeting new AMD CPUs.
This doesn't really fit the existing SSELevel so it gets an extra flag.

llvm-svn: 157630
2012-05-29 17:48:39 +00:00
Argyrios Kyrtzidis 671ce47d60 [preprocessor] Make sure that MacroExpands callbacks are always in source order.
Fixes assertion hit in the preprocessing record. rdar://11426523

llvm-svn: 156557
2012-05-10 18:57:19 +00:00
Simon Atanasyan ce005eb2c6 Pass a target triple explicitly to check platform specific macros definitions.
That allows to run the tests on all platforms successfully.

llvm-svn: 156500
2012-05-09 18:49:52 +00:00
Richard Smith d106a98fe9 Use the standard values for the __cplusplus macro, even when in GNU mode. GCC
dropped its prior behavior of always defining __cplusplus to 1 in GNU mode in
version 4.7.

llvm-svn: 156113
2012-05-03 22:18:20 +00:00
Evgeniy Stepanov 94dc4c9783 Define __ANDROID__ macro on -androideabi targets.
llvm-svn: 155632
2012-04-26 12:08:09 +00:00
Craig Topper 5f365e94c3 Enable AVX/AVX2 for Sandy Bridge, Ivy Bridge, and Haswell CPUs.
llvm-svn: 155624
2012-04-26 07:31:30 +00:00
David Blaikie 83261063d1 Fix tests that weren't actually verifying anything.
Passing -verify to clang without -cc1 or -Xclang silently passes (with a
printed warning, but lit doesn't care about that). This change adds -cc1 or,
as is necessary in one case, -Xclang to fix this so that these tests are
actually verifying as intended.

I'd like to change the driver so this kind of mistake could not be made, but
I'm not entirely sure how. Further, since the driver only warns about unknown
flags in general, we could have similar bugs with a misspellings of arguments
that would be nice to find.

llvm-svn: 154776
2012-04-15 22:09:44 +00:00
Richard Smith b1e36c662b Provide, and document, a set of __c11_atomic_* intrinsics to implement C11's
<stdatomic.h> header.

In passing, fix LanguageExtensions to note that C11 and C++11 are no longer
"upcoming standards" but are now actually standardized.

llvm-svn: 154513
2012-04-11 17:55:32 +00:00
Chandler Carruth c0c0455f55 Teach Clang about PIE compilations. This is the first step of PR12380.
First, this patch cleans up the parsing of the PIC and PIE family of
options in the driver. The existing logic failed to claim arguments all
over the place resulting in kludges that marked the options as unused.
Instead actually walk all of the arguments and claim them properly.

We now treat -f{,no-}{pic,PIC,pie,PIE} as a single set, accepting the
last one on the commandline. Previously there were lots of ordering bugs
that could creep in due to the nature of the parsing. Let me know if
folks would like weird things such as "-fPIE -fno-pic" to turn on PIE,
but disable full PIC. This doesn't make any sense to me, but we could in
theory support it.

Options that seem to have intentional "trump" status (-static, -mkernel,
etc) continue to do so and are commented as such.

Next, a -pie-level flag is threaded into the frontend, rigged to
a language option, and handled preprocessor, setting up the appropriate
defines. We'll now have the correct defines when compiling with -fpie.

The one place outside of the preprocessor that was inspecting the PIC
level (as opposed to the relocation model, which is set and handled
separately, yay!) is in the GNU ObjC runtime. I changed it to exactly
preserve existing behavior. If folks want to change its behavior in the
face of PIE, they can do that in a separate patch.

Essentially the only functionality changed here is the preprocessor
defines and bug-fixes to the argument management.

Tests have been updated and extended to test all of this a bit more
thoroughly.

llvm-svn: 154291
2012-04-08 16:40:35 +00:00
Chandler Carruth 4e97337914 Rephrase the preprocessor test to directly use CC1 and not bother
testing any of the strange driver behavior. We already have some tiny
tests for the driver behavior, and I'm going to expand them greatly in
the next commit.

llvm-svn: 154290
2012-04-08 16:40:31 +00:00
Chandler Carruth f4725b468e FileCheck-ize this test.
llvm-svn: 154289
2012-04-08 16:40:30 +00:00
Simon Atanasyan 5e21c800e8 MIPS: Move tests check float ABI macros definitions to the more appropriate place.
llvm-svn: 154184
2012-04-06 17:51:49 +00:00
Simon Atanasyan c3e45fece1 MIPS: Add tests for predefined macros for MIPS targets.
llvm-svn: 154168
2012-04-06 08:37:24 +00:00
Daniel Dunbar 3c9bc4dbdb [Lex] Add support for 'user specified system frameworks' (see test case).
- Developers of system frameworks need a way for their framework to be treated as a "system framework" during development. Otherwise, they are unable to properly test how their framework behaves when installed because of the semantic changes (in warning behavior) applied to system frameworks.

llvm-svn: 154105
2012-04-05 17:10:06 +00:00
Argyrios Kyrtzidis 4a1049c8a2 [preprocessor] In Preprocessor::CachingLex() check whether there were more tokens
cached during the non-cached lex, otherwise we are going to drop them.

Fixes a bogus "_Pragma takes a parenthesized string literal" error when
expanding consecutive _Pragmas in a macro argument.

Part of rdar://11168596

llvm-svn: 153994
2012-04-04 02:57:01 +00:00
Argyrios Kyrtzidis f1b64c6198 Correct handling of _Pragma macro inside a macro argument.
If we are pre-expanding a macro argument don't actually "activate"
the pragma at that point, activate the pragma whenever we encounter
it again in the token stream.
This ensures that we will activate it in the correct location
or that we will ignore it if it never enters the token stream, e.g:

     \#define EMPTY(x)
     \#define INACTIVE(x) EMPTY(x)
     INACTIVE(_Pragma("clang diagnostic ignored \"-Wconversion\""))

This also fixes the crash in rdar://11168596.

llvm-svn: 153959
2012-04-03 16:47:40 +00:00
Argyrios Kyrtzidis a956450eb7 [preprocessor] Handle correctly inclusion directives that have macro expansions, e.g
"#include MACRO(STUFF)".

-As an inclusion position for the included file, use the file location of the file where it
was included but *after* the macro expansions. We want the macro expansions to be considered
as before-in-translation-unit for everything in the included file.

-In the preprocessing record take into account that only inclusion directives can be encountered
as "out-of-order" (by comparing the start of the range which for inclusions is the hash location)
and use binary search if there is an extreme number of macro expansions in the include directive.

Fixes rdar://11111779

llvm-svn: 153527
2012-03-27 18:47:48 +00:00
Matt Beaumont-Gay ee570a2510 line endings
llvm-svn: 153046
2012-03-19 18:47:12 +00:00
Aaron Ballman 0467f55d62 Turns #import in MS Mode into an error.
llvm-svn: 153009
2012-03-18 03:10:37 +00:00
Aaron Ballman a97fc66ef3 Updated the test so that it checks for ms-compatibility in addition to ms-extensions.
llvm-svn: 152516
2012-03-10 22:52:10 +00:00
Aaron Ballman b4489162b6 No longer defining GNUC mode when compiling for Microsoft compatibility. This allows people's cross-platform compiler-specific macros to work properly.
llvm-svn: 152512
2012-03-10 22:21:14 +00:00
Aaron Ballman 611306eae6 Adding support for #pragma include_alias in MS compatibility mode. This implements PR 10705.
llvm-svn: 151949
2012-03-02 22:51:54 +00:00
Hal Finkel 2690838227 Fix an ABI problem with ptrdiff_t and intptr_t on PPC32
ptrdiff_t on PPC32 on Linux, etc. should be int not long.
This does not matter for C, but it does matter for C++ because of
name mangling.

The preprocessor test has been changed accordingly.

llvm-svn: 151935
2012-03-02 20:54:36 +00:00
Jean-Daniel Dupas 7598fadd78 Merge __has_attribute tests. Patch by Jonathan Sauer!
llvm-svn: 151819
2012-03-01 17:45:53 +00:00
Jean-Daniel Dupas 908f130d58 Implement double underscore names support in __has_attribute
llvm-svn: 151809
2012-03-01 14:53:16 +00:00
Richard Smith ead9a05596 Revert r151800, which was committed without review and has correctness issues.
llvm-svn: 151804
2012-03-01 06:49:39 +00:00
Aaron Ballman cd5092dfba Implements support for #pragma include_alias in ms compatibility mode. Fixes PR10705.
llvm-svn: 151800
2012-03-01 04:18:49 +00:00
Nico Weber 2c21c449d9 Move suport for redefining operator keywords from -fms-extensions to -fms-compatibility.
llvm-svn: 151776
2012-03-01 00:13:46 +00:00
Nico Weber 2e686205e8 Allow operator keywords to be #defined in ms-ext mode.
Fixes PR10606.

I'm not sure if this is the best way to go about it, but
I locally enabled this code path without the msext conditional,
and all tests pass, except for test/Preprocessor/cxx_oper_keyword.cpp
which explicitly checks that operator keywords can't be redefined.

I also parsed chromium/win with a clang with and without this patch.
It introduced no new errors, but removes 43 existing errors.

llvm-svn: 151768
2012-02-29 22:54:43 +00:00
Richard Smith 2cca7b5ca9 Accept __has_feature(__feature__) as a synonym for __has_feature(feature) (and
likewise for __has_extension). Patch by Jonathan Sauer!

llvm-svn: 151445
2012-02-25 10:41:10 +00:00
Ted Kremenek 7f4bd16b53 Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
llvm-svn: 149566
2012-02-02 00:16:13 +00:00
Nico Weber 3435ede0ca Fix "long double" and __SIZE_TYPE__ on powerpc, now with test fix.
Fixes PR11867. Patch from Jeremy Huddleston!

llvm-svn: 149334
2012-01-31 02:07:33 +00:00
Sebastian Pop 422377cfd3 rename -ccc-host-triple into -target
llvm-svn: 148582
2012-01-20 22:01:23 +00:00
Eli Friedman d749c6bf2e Revert r148138; it's causing test failures.
llvm-svn: 148141
2012-01-13 21:33:06 +00:00
Sebastian Pop 9a8d528ddf rename -ccc-host-triple into -target
llvm-svn: 148138
2012-01-13 20:37:02 +00:00
Douglas Gregor 7363fb05fd C11 allows typedefs to be redefined. Implement this in C11 mode, and
downgrade the default-error warning to an ExtWarn in
C90/99. <rdar://problem/10668057>

llvm-svn: 147925
2012-01-11 04:25:01 +00:00
Abramo Bagnara 9f3d1ac419 Added testcases for -Wdisabled-macro-expansion.
llvm-svn: 147473
2012-01-03 20:13:03 +00:00
Chandler Carruth 3a5ff5cbd2 Teach the frontend to provide the builtin preprocessor defines for
-ffast-math.

llvm-svn: 147440
2012-01-03 02:46:46 +00:00
Benjamin Kramer cf5014771d Add a target hook for FLT_EVAL_METHOD and use it to set the value on x86 with sse disabled.
x87 math evaluates everything with 80 bits precision, so we have to set FLT_EVAL_METHOD
to "2".

llvm-svn: 147311
2011-12-28 15:47:06 +00:00
Richard Smith eb3ce7c3db Don't allow #include (and its friends #import, #include_next and
#__include_macros) in the arguments of a function-style macro. Directives in the
arguments of such macros have undefined behaviour, and GCC does not correctly
support these cases. In some situations, this can lead to better diagnostics.

llvm-svn: 146765
2011-12-16 22:50:01 +00:00
Eli Friedman 206dba0538 Switch test over to using -verify instead of using grep. PR11552.
llvm-svn: 146544
2011-12-14 02:16:13 +00:00
Rafael Espindola a6416a7c73 Make our handling of MMX x SSE closer to what gcc does:
* Enabling sse enables mmx.
* Disabling (-mno-mmx) mmx, doesn't disable sse (we got this right already).
* The order in not important. -msse -mno-mmx is the same as -mno-mmx -msse.

llvm-svn: 145194
2011-11-27 20:00:43 +00:00
Rafael Espindola 04268df8ed Set __OPTIMIZE_SIZE__ on -Os and -Oz. This matches gcc's behaviour on both OS X
and linux.

llvm-svn: 145142
2011-11-26 06:21:20 +00:00
James Molloy c445be4b4b AAPCS compliance - 32-bit wchar_t should be unsigned for both aapcs and aapcs-linux.
Original behaviour of defining wchar_t as signed int has been kept for apcs-gnu as I don't have any spec for this to validate against.

llvm-svn: 145102
2011-11-23 13:35:08 +00:00
Chandler Carruth 979272c01c Change this test to reflect the state we are moving in. The Clang
builtin headers are no longer going to receive the old 'implicit extern
"C" block' semantics. This hint is actually ignored by both Clang and
GCC at this point, and Clang's own builtin headers can simply be changed
if there is any issue with this. Clang should be free to include these
however it wants, and so shorter and simpler is better.

Note: *nothing* is changing about the *system* stddef.h include. That
should always have the exact same include semantics, whether with Clang
or GCC or any other compiler. Only the compiler-builtin header search
path is changing.

If anyone knows of some risk that this introduces that I've not thought
of, please chime in. So far, only Windows has switched to the Brave New
World, but others should be switching soon.

llvm-svn: 143806
2011-11-05 10:15:33 +00:00
Dan Gohman c44b95c3b5 Remove more SystemZ (s390) tests.
llvm-svn: 142883
2011-10-25 00:15:21 +00:00
Dan Gohman 93127aecb9 Remove the Blackfin backend.
llvm-svn: 142881
2011-10-25 00:06:12 +00:00
Richard Smith 9ca5c42582 Update all tests other than Driver/std.cpp to use -std=c++11 rather than
-std=c++0x. Patch by Ahmed Charles!

llvm-svn: 141900
2011-10-13 22:29:44 +00:00
Ted Kremenek c85a47724d Add test case for __has_warning.
llvm-svn: 141806
2011-10-12 20:06:09 +00:00
Argyrios Kyrtzidis f37d0a61c0 Handle the case where preprocessor entities are not received in order,
fixes http://llvm.org/PR11120

llvm-svn: 141788
2011-10-12 17:36:33 +00:00