Commit Graph

911 Commits

Author SHA1 Message Date
Douglas Gregor a71cc15361 Implement promotion for enumeration types.
WHAT!?!

It turns out that Type::isPromotableIntegerType() was not considering
enumeration types to be promotable, so we would never do the
promotion despite having properly computed the promotion type when the
enum was defined. Various operations on values of enum type just
"worked" because we could still compute the integer rank of an enum
type; the oddity, however, is that operations such as "add an enum and
an unsigned" would often have an enum result type (!). The bug
actually showed up as a spurious -Wformat diagnostic
(<rdar://problem/7595366>), but in theory it could cause miscompiles.

In this commit:
  - Enum types with a promotion type of "int" or "unsigned int" are
  promotable.
  - Tweaked the computation of promotable types for enums
  - For all of the ABIs, treat enum types the same way as their
  underlying types (*not* their promotion types) for argument passing
  and return values
  - Extend the ABI tester with support for enumeration types

llvm-svn: 95117
2010-02-02 20:10:50 +00:00
Daniel Dunbar 96ebba5770 ARM/APCS: Fix classification of small complex integer types as "integer like".
llvm-svn: 95030
2010-02-01 23:31:26 +00:00
Daniel Dunbar eedf151cb1 ARM/APCS: Pass Complex types following llvm-gcc.
llvm-svn: 95029
2010-02-01 23:31:19 +00:00
Chris Lattner 5b5d2db3f6 Don't explicitly force utf strings into the __TEXT,__ustring
by setting the section of the generated global.  This is an
optimization done by the code generator, and the code being
removed didn't handle the case when the string contained an
embedded nul (which the code generator does correctly 
handle).  This is rdar://7589850

llvm-svn: 95003
2010-02-01 20:59:08 +00:00
Devang Patel 156b11368a New test case.
llvm-svn: 94821
2010-01-29 18:32:33 +00:00
Daniel Dunbar 45c7ff1d79 ARM/APCS ABI: Fix some problems with bit-fields in structures. After rereading
the ABI spec, this turns out to simplify the code. We still have some annoying
code which mismatches the spec with regard to empty structures.

llvm-svn: 94796
2010-01-29 03:22:29 +00:00
Anders Carlsson b1ef991097 Fix an incorrect union layout assert. Fixes PR6164.
llvm-svn: 94754
2010-01-28 18:22:03 +00:00
Benjamin Kramer b2abc13f28 Adjust testcase for recent DWARF printer changes.
llvm-svn: 94306
2010-01-23 10:14:58 +00:00
Mike Stump 92d487712e Fix for Release-Asserts.
llvm-svn: 93340
2010-01-13 19:40:37 +00:00
Dan Gohman d1e76b957b Use -fno-math-errno by default, and remove the IsMathErrnoDefault
targethook, which is no longer being used. This fixes PR5971.

llvm-svn: 92987
2010-01-08 02:20:44 +00:00
Benjamin Kramer 0128f668a9 __builtin_object_size(ptr, type) returns -1 for type = {0,1} if there are any side-effects.
llvm-svn: 92453
2010-01-03 18:18:37 +00:00
Eli Friedman 906be1b580 Add test for annotate attribute for coverage.
llvm-svn: 92435
2010-01-03 00:51:58 +00:00
Eli Friedman 090adddf15 Fix minor oversight for increment/decrement of complex int. Add tests for
coverage.

llvm-svn: 92433
2010-01-03 00:20:48 +00:00
Eli Friedman bb333722c1 Add a couple more tests for coverage.
llvm-svn: 92430
2010-01-02 23:21:40 +00:00
Eli Friedman e14b1997db Don't look through casts when looking for the underlying decl for a function
call; the standard doesn't expect us to, and the program could be doing
something crazy.  Fixes PR5882.

llvm-svn: 92166
2009-12-26 03:35:45 +00:00
Chris Lattner 9ac2b586c7 fix typo
llvm-svn: 92065
2009-12-23 22:06:12 +00:00
Chris Lattner 4e1a323b85 fix opencl extvector element extraction on rvalues. We previously
error_unsupported on test10 and crashed on test11.

llvm-svn: 92056
2009-12-23 21:31:11 +00:00
Eric Christopher c87915629b Update for the intrinsic changes in llvm: the object size intrinsic
only takes a boolean second argument now. Update tests accordingly.
Currently the builtin still accepts the full range for compatibility.

llvm-svn: 91983
2009-12-23 03:49:37 +00:00
Daniel Dunbar a7d0231b66 clang -cc1: Rename -mcpu to -target-cpu to match other target options and not alias driver/backend option.
llvm-svn: 91671
2009-12-18 06:30:12 +00:00
Daniel Dunbar 5618e98f33 Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

llvm-svn: 91460
2009-12-15 22:01:24 +00:00
Daniel Dunbar 8fbe78f6fc Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
   which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
   can be useful to redefine what gets run as 'clang -cc1' (for example, to set
   a default target).

llvm-svn: 91446
2009-12-15 20:14:24 +00:00
Fariborz Jahanian a01b67d7b0 Make tests use the new clang -cc1 flag.
llvm-svn: 91303
2009-12-14 18:00:56 +00:00
Nate Begeman 67dfd4236a Revert mmx palignr to use an intrinsic, since mmx shuffle patterns are missing.
llvm-svn: 91269
2009-12-14 05:15:02 +00:00
Nate Begeman 72ec6bc6f4 Support x86's PALIGNR instruction without the use of a palignr intrinsic.
llvm-svn: 91264
2009-12-14 04:57:03 +00:00
Eli Friedman 4f678f3de1 Fix for PR5709: use the computed type of the declaration instead of the
type of the builtin when generating the function declaration for a builtin
library call.

llvm-svn: 90936
2009-12-09 03:05:59 +00:00
Daniel Dunbar f51087656d Remove include of system header.
llvm-svn: 90883
2009-12-08 21:52:24 +00:00
Daniel Dunbar 888a89ccf2 Use clang-cc in this test.
llvm-svn: 90872
2009-12-08 19:49:40 +00:00
Mike Stump b2a568d9e5 Switch over to checking .ll files instead of .s files.
llvm-svn: 90786
2009-12-07 19:22:29 +00:00
Chris Lattner 0f3a228e73 add 'F' to a bunch of libm builtins so that codegen doesn't die on them,
pointed out by Charles Davis.

llvm-svn: 90736
2009-12-07 02:09:14 +00:00
Chris Lattner 2da786f794 fix comment.
llvm-svn: 90660
2009-12-05 08:33:21 +00:00
Chris Lattner ded98d4172 consolidate some tests.
llvm-svn: 90659
2009-12-05 08:30:04 +00:00
Chris Lattner e99c110d06 implement rdar://7346691 by codegen'ing struct/array initializers
to a memset or a memcpy from a global when possible.

llvm-svn: 90658
2009-12-05 08:22:11 +00:00
Chris Lattner ffcd06ea7c simplify a condition and add a testcase.
llvm-svn: 90652
2009-12-05 06:49:57 +00:00
Daniel Dunbar e97582406b Use '-FOO' 'BAR' instead of '-FOO=BAR' for FOO in -stack-protector, -fvisibility, and -fconstant-string-class.
llvm-svn: 90072
2009-11-29 09:33:20 +00:00
Daniel Dunbar 4e7596cc3a Normalize options to use '-FOO' instead of '--FOO'.
llvm-svn: 90071
2009-11-29 09:33:10 +00:00
Anders Carlsson 1299f36af1 Update a test to FileCheck.
llvm-svn: 89610
2009-11-22 18:56:40 +00:00
Ken Dyck 65da2db736 Use intptr_t from stdint.h (in freestanding mode) instead of redefining it here
with __INTPTR_TYPE__.

llvm-svn: 89609
2009-11-22 18:29:06 +00:00
Daniel Dunbar c2588c3bd9 Convert test to FileCheck.
llvm-svn: 89514
2009-11-20 23:46:56 +00:00
Daniel Dunbar 32164f4bdb Driver: Use '-target-abi' 'FOO' instead of '-target-abi=FOO'.
llvm-svn: 89501
2009-11-20 22:32:30 +00:00
Daniel Dunbar 4274685b63 Pass '-mcpu' 'FOO' instead of '-mcpu=FOO'.
llvm-svn: 89498
2009-11-20 22:21:52 +00:00
Daniel Dunbar 9c7efbb996 Fix some codegen tests to include positive checks.
llvm-svn: 89465
2009-11-20 17:23:39 +00:00
Daniel Dunbar 484afa2d3b Switch -f{builtin,math-errno,rtti} and -analyzer-purge-dead to -...no... variants instead of using llvm:🆑:init(true) arguments.
llvm-svn: 89315
2009-11-19 04:55:23 +00:00
Daniel Dunbar ba0c9e8685 Remove unnecessary &&s.
llvm-svn: 89153
2009-11-17 22:25:07 +00:00
David Chisnall 950a9518b1 Added block type introspection support.
As per Fariborz's suggestion, committed now but can be reverted later if the used flag is problematic for Apple.

llvm-svn: 89134
2009-11-17 19:33:30 +00:00
Daniel Dunbar feedba68b5 Don't #include <stdio.h> when tests don't need it, or use clang instead of clang-cc when they do.
llvm-svn: 89070
2009-11-17 08:57:36 +00:00
Daniel Dunbar f85fabec35 Remove some redundant tests.
llvm-svn: 89069
2009-11-17 08:57:06 +00:00
Daniel Dunbar 4930e3357b Add -fblocks, -stack-protector, and -fobjc-nonfragile-abi defaulting to driver,
instead of using getDefaultLangOptions.
 - Remove unused -fobjc-tight-layout while at it.

llvm-svn: 89065
2009-11-17 08:07:36 +00:00
Jakob Stoklund Olesen 4359796e52 Fix tests after enabling -split-phi-edges.
object-size.c aws simply too fragile.

constructor-default-arg.cpp triggers an issue when LiveVariables is run before RALocal.

llvm-svn: 89025
2009-11-17 01:47:01 +00:00
Eli Friedman b0bc559b19 PR5526: Make sure to set the right cast kinds for the inserted implicit casts.
llvm-svn: 89023
2009-11-17 01:22:05 +00:00
Eli Friedman b210fc598f Make __func__ and friends work correctly within the initializer for a static
local variable.

llvm-svn: 88766
2009-11-14 08:37:13 +00:00
Eli Friedman 6f04b1e605 Obvious fix for PR5474.
llvm-svn: 88696
2009-11-13 21:23:46 +00:00
Daniel Dunbar 775f18520c And now a test fix in +Asserts mode, which I broke.
llvm-svn: 86801
2009-11-11 03:48:34 +00:00
Daniel Dunbar 568e302a7f Fix some tests in -Asserts mode.
- FileCheck is a *huuuuge* improvement here.

 - Still feels like we could use a better tool for this though, either teach
   llvm-dis to spit out the FileCheck syntax, or provide another tool to turn a
   .ll into a "matchable" input.

 - Also on my Christmas list is better FileCheck diagnostics with missing
   variables or mismatches.

llvm-svn: 86800
2009-11-11 03:48:26 +00:00
Mike Stump 68ec7ee0e8 Enable the use of the new llvm objectsize intrinsic.
llvm-svn: 86607
2009-11-09 22:40:09 +00:00
Daniel Dunbar 34546ce43d Remove RUN: true lines.
llvm-svn: 86432
2009-11-08 01:47:25 +00:00
Daniel Dunbar 8b57697954 Eliminate &&s in tests.
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.

llvm-svn: 86430
2009-11-08 01:45:36 +00:00
Chris Lattner 3f5124815d commit test update
llvm-svn: 86396
2009-11-07 18:59:51 +00:00
Devang Patel 22053c0f46 MIPS linkage name confuses gdb here. Generate and test DW_AT_name here.
llvm-svn: 86318
2009-11-07 00:41:37 +00:00
Mike Stump 6de15a8881 Test case for recent checkin.
llvm-svn: 85972
2009-11-03 23:32:42 +00:00
Daniel Dunbar a530841b4f Switch XFAIL format to match LLVM.
llvm-svn: 85880
2009-11-03 07:25:45 +00:00
Benjamin Kramer 170a56f135 Add missing colons for FileCheck.
llvm-svn: 85683
2009-10-31 20:42:26 +00:00
Mike Stump f3eb5ec2c0 Fix one more bug with __builtin_object_size.
llvm-svn: 85538
2009-10-29 23:34:20 +00:00
Mike Stump dc28a8b997 Add yet more testcases.
llvm-svn: 85535
2009-10-29 23:29:54 +00:00
Mike Stump eb5c92b399 Add some more testcases.
llvm-svn: 85534
2009-10-29 23:22:14 +00:00
Nuno Lopes 09bd8656c3 make clang emit undefs for padding of structs and unions instead of zeros. this enables constant compaction optimizations.
llvm-svn: 85504
2009-10-29 11:27:06 +00:00
Chris Lattner 08bb9ef7f7 make this interpretable.
llvm-svn: 85487
2009-10-29 05:25:27 +00:00
Chris Lattner 29fb551a36 make this more interesting, test the static const array.
llvm-svn: 85464
2009-10-29 01:20:34 +00:00
Douglas Gregor 05925031f7 Mangle based on the declaration we're given, not the canonical
declaration, since attributes that affect mangling may have been added
to subsequent declarations. However, to determine the linkage of the
declaration, we need to look at the canonical declaration. Fixes PR4412.

llvm-svn: 85400
2009-10-28 16:31:34 +00:00
Daniel Dunbar c369d73405 Set OptimizeForSize LLVM function attribute with -Os.
llvm-svn: 85278
2009-10-27 19:48:08 +00:00
Daniel Dunbar 59ca7f1a1e Convert test to FileCheck.
llvm-svn: 85277
2009-10-27 19:48:00 +00:00
Benjamin Kramer 59b7cf6a6d Make test independent of darwin system headers.
llvm-svn: 85232
2009-10-27 12:19:13 +00:00
Mike Stump 5183a14bfb __builtin_object_size refinements. Also handle stack based objects. WIP.
llvm-svn: 85174
2009-10-26 23:05:19 +00:00
Mike Stump 10bd7e1c5b __builtin_object_size refinements. When we run out of object, be sure
to clamp at 0 bytes left.  WIP.

llvm-svn: 85157
2009-10-26 21:38:39 +00:00
Edward O'Callaghan 72af806797 Convert a few tests to FileCheck for PR5307.
llvm-svn: 85154
2009-10-26 20:49:20 +00:00
Mike Stump 722cedfb0d __builtin_object_size refinements. WIP.
llvm-svn: 85136
2009-10-26 18:35:08 +00:00
Mike Stump 9bb0059449 Add radar number.
llvm-svn: 84923
2009-10-23 02:13:20 +00:00
Mike Stump ae2559a221 Fixup the return type of functions.
llvm-svn: 84922
2009-10-23 01:52:13 +00:00
Benjamin Kramer 53b4041151 Force triple; this test was failing on non-darwin platforms due to different
asm comment styles (## vs #).

llvm-svn: 84777
2009-10-21 19:59:43 +00:00
Devang Patel e4f2b2a8ac Encode global variable name in debug info.
llvm-svn: 84653
2009-10-20 18:26:30 +00:00
Nate Begeman 72eabcb5b1 Add test for OpenCL vector initializer codegen
llvm-svn: 84445
2009-10-18 21:04:35 +00:00
Chris Lattner 9b24e8aba6 daniel really wants this in the testsuite.
llvm-svn: 84354
2009-10-17 20:37:18 +00:00
John Thompson 146b025c39 Sorry! Accidentally checked in experimental change.
llvm-svn: 84183
2009-10-15 14:34:41 +00:00
Mike Stump bf186694b0 Make this at least compile.
llvm-svn: 84167
2009-10-15 02:10:57 +00:00
John Thompson 3254182bfa Removed math.h include, as Windows math.h has a compile error.
llvm-svn: 84160
2009-10-15 00:39:58 +00:00
Chris Lattner 4f8a2e22c0 fix some cfstring related issues:
1) -fwritable-string does affect the non-utf16 version of cfstrings
   just not the utf16 ones.
2) utf16 strings should always be marked constant, as the __TEXT segment
   is readonly.
3) The name of the global doesn't matter, remove it from TargetInfo.
4) Trust the asmprinter to drop cstrings into the right section, like llvmgcc does now.

This fixes rdar://7115750

llvm-svn: 84077
2009-10-14 05:55:45 +00:00
Chris Lattner 3eb172a02b Teach sema and codegen about the difference between address of labels,
which is a common idiom to improve PIC'ness of code using the addr of
label extension.  This implementation is a gross hack, but the only other
alternative would be to teach evalutate about this horrid combination.
While GCC allows things like "&&foo - &&bar + 1", people don't use this
in practice.  This implements PR5131.

llvm-svn: 83957
2009-10-13 07:14:16 +00:00
Chris Lattner 9842a4dcb1 merge an indirect goto test into statements, add another
hairier (but nonsensical) example.

llvm-svn: 83951
2009-10-13 06:52:43 +00:00
Chris Lattner f315471e24 fix PR4938 by recognizing % as a modifier on outputs,
previously we only recognized it on inputs.

llvm-svn: 83939
2009-10-13 04:32:07 +00:00
Devang Patel 232f278fc1 Disable tests that check debug info intrinsic. This does not work if debug info intrinsics are not used to encode debug info.
llvm-svn: 83929
2009-10-12 23:46:58 +00:00
Mike Stump f8c1f0d1f0 Speed up testing by avoiding stdio.h, also helps testing on windows.
Patch by John Thompson.

llvm-svn: 83593
2009-10-08 23:05:06 +00:00
Mike Stump 03686660b1 In VC++, the *printf functions put an extra "0" in the exponent part
of a floating point number.  This add regular expressions to account
for this.  Patch by John Thompson.

llvm-svn: 83581
2009-10-08 21:57:41 +00:00
Mike Stump c2eeac617d Convert some tests to FileCheck to be more portable. Patch by John Thompson.
llvm-svn: 83578
2009-10-08 21:52:07 +00:00
Mike Stump da6822f584 Add codegen for __builtin_abort. Convert to FileCheck.
llvm-svn: 83427
2009-10-06 22:58:45 +00:00
Chris Lattner 78a2e6356b remove this test, grepping for define isn't really testing anything.
llvm-svn: 83325
2009-10-05 21:16:22 +00:00
Benjamin Kramer 80401b96c2 FileCheckize test case.
llvm-svn: 83244
2009-10-02 10:32:51 +00:00
Anders Carlsson 8a744ad8a6 Don't update the struct alignment when adding fields to a packed struct. Fixes PR5118.
llvm-svn: 83235
2009-10-02 04:52:12 +00:00
Anders Carlsson 39e3eb12ae When building constant structs, check if the resulting LLVM struct will be bigger than the record layout size and use a packed struct if that's the case. Fixes PR5108.
llvm-svn: 83230
2009-10-02 02:15:20 +00:00
Douglas Gregor 3dc959f88b Tweak CHECK lines to eliminate a failure on i686-apple-darwin10
llvm-svn: 83173
2009-09-30 21:39:51 +00:00
Chris Lattner 24440102aa Convert from nonportable grep to filecheck, patch by John Thompson
llvm-svn: 83158
2009-09-30 19:55:07 +00:00
Anders Carlsson e33eed5c1e Set alignment on static function level decls and VLAs. Fixes PR5060.
llvm-svn: 82868
2009-09-26 18:16:06 +00:00
Daniel Dunbar b3b1e53d33 Darwin/x86-32: Enumerated types and block pointer types in structures were not
handled correctly.
 - <rdar://problem/7247671> Function arguments incorrect when function returns a
   struct on i386 w/ llvm-g++ and clang

llvm-svn: 82681
2009-09-24 05:12:36 +00:00
Daniel Dunbar 1da76c4e58 Add ARM register names and aliases.
- Patch by Shantonu Sen!

<rdar://problem/6922650> clang doesn't know about ARM registers for inline asm clobber lists

llvm-svn: 82132
2009-09-17 07:03:19 +00:00
Daniel Dunbar 09d3362bf5 ARM/[A]APCS: Ignore empty records passed as arguments.
llvm-svn: 81798
2009-09-14 21:54:03 +00:00
Daniel Dunbar ff0553ec61 Fix subtle bug in generating LLVM function declarations for builtin functions.
The decl wasn't being passed down, which meant that function attributes were not
being set correctly. This is particularly important for ARM, since it wants to
override the calling convention. Instead we would emit the builtin with the
wrong calling convention, and instcombine would come along and merrily shred all
the calls to it. :)

llvm-svn: 81756
2009-09-14 04:33:21 +00:00
Daniel Dunbar d53bac7fa4 ARM/APCS: Don't treat structs w/ floating point types as "integer like".
llvm-svn: 81748
2009-09-14 02:20:34 +00:00
Daniel Dunbar 1ce7251a0a Some minor clang/ARM/AAPCS tweaks.
llvm-svn: 81737
2009-09-14 00:56:55 +00:00
Daniel Dunbar b4091a9c6a Add TargetInfo::getABI(), and base ARM APCS vs AAPCS choice on that.
llvm-svn: 81735
2009-09-14 00:35:03 +00:00
Anders Carlsson ccbabc9645 Fix another byref bug. This should hopefully get QuickLookPlugins building successfully.
llvm-svn: 81681
2009-09-13 17:55:13 +00:00
Daniel Dunbar 626f1d8c3a ARM/APCS: Only "integer like" aggregates should be returned in r0 (following
gcc's interpretation of APCS' somewhat loose specification).

llvm-svn: 81671
2009-09-13 08:03:58 +00:00
Douglas Gregor 299d76e901 Rework the way we determine whether an externally visible symbol is
generated for an inline function definition, taking into account C99
and GNU inline/extern inline semantics. This solution is simpler,
cleaner, and fixes PR4536.

llvm-svn: 81670
2009-09-13 07:46:26 +00:00
Daniel Dunbar 0482cfd790 Don't use the PredefinedExpr string as the global variable name, these don't
make very nice symbols, just use the function name.

llvm-svn: 81653
2009-09-12 23:06:21 +00:00
Anders Carlsson f8e94f2008 Add support for __block variables with alignment greater than __alignof(void *).
llvm-svn: 81602
2009-09-12 02:44:18 +00:00
Daniel Dunbar 020daa9476 Stub out room for ARM APCS ABI implementation (and AAPCS_VFP, although you can't
hit this via command line options yet).

llvm-svn: 81595
2009-09-12 01:00:39 +00:00
Dan Gohman 0533ffa2a6 Update this test to expect the "inbounds" keyword, which LLVM's constant
folder is now automatically adding.

llvm-svn: 81491
2009-09-11 00:27:06 +00:00
Anders Carlsson 10f2c10b83 Make the forwarding member of block byref structs be a pointer to the block byref struct itself.
llvm-svn: 81423
2009-09-10 01:32:12 +00:00
Mike Stump 11289f4280 Remove tabs, and whitespace cleanups.
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Chris Lattner 6426345b8f convert this to filecheck, hopefully it will fix PR4888. If nothing
else it will make tests run faster and make 4888 easier to diagnose.

llvm-svn: 81238
2009-09-08 18:43:45 +00:00
Anders Carlsson 2fb0824197 Vastly improve PredefinedExpr output, both in Sema and CodeGen. Patch by Sam Weinig!
llvm-svn: 81237
2009-09-08 18:24:21 +00:00
Anders Carlsson 0e91275ab4 If the alignment of the chosen field in a union is greater than the alignment of the union, we need to use a packed LLVM struct. Fixes <rdar://problem/7184250>.
llvm-svn: 80964
2009-09-03 22:56:02 +00:00
Anders Carlsson 09a3774cd3 Packed unions should be packed. Fixes an assert Daniel reported.
llvm-svn: 80808
2009-09-02 17:51:33 +00:00
Eli Friedman 1c277d0fe8 PR4836, part 2: CodeGen for __builtin_isnan.
llvm-svn: 80655
2009-09-01 04:19:44 +00:00
Chris Lattner 7ef882dca0 convert to filecheck and force a triple so that this passes on big
endian hosts.  Fixes PR4792

llvm-svn: 80301
2009-08-27 23:22:19 +00:00
Eli Friedman 95f896380f Make address-space qualification work correctly for compound literals.
Issue reported on cfe-dev.

Also fixed the code to use isConstant to determine whether to generate a 
constant global, to be consistent with CodeGenModule.  This probably 
needs to be refactored to deal with C++, though.

llvm-svn: 80131
2009-08-26 20:01:39 +00:00
Dan Gohman a98e0e73de Update clang for raw_fd_ostream no longer requiring F_Force.
llvm-svn: 79991
2009-08-25 15:36:09 +00:00
Daniel Dunbar 87db734400 Fix a few tests to be -Asserts agnostic.
- Ugh.

llvm-svn: 79860
2009-08-23 19:28:59 +00:00
Daniel Dunbar 2a4061929f Fix some made up triples.
llvm-svn: 79316
2009-08-18 05:30:27 +00:00
Eli Friedman c0f6d44ef6 Make test a bit more precise.
llvm-svn: 79073
2009-08-15 03:35:55 +00:00
Eli Friedman 04fddf0d1f Fix for PR4721: adjust CodeGen and ASTContext so that we have a
consistent model for handling size expressions for VLAs.

The model is essentially as follows: VLA types own their associated
expression.  In some cases, we need to create multiple VLA types to 
represent a given VLA (for canonical types, or qualifiers on array types,
or type merging).  If we need to create multiple types based off of 
the same VLA declaration, we use the new refcounting functionality so they can 
all own the expression. The VLASizeMap in CodeGenFunction then uses the size
expression to identify the group of VLA types based off of the same original
declaration.

I'm not particularly attached to the VLA types owning the expression, 
but we're stuck with at least until someone comes up with a way 
to walk the VLA expressions for a declaration.

I did the parallel fix in ASTContext for DependentSizedArrayType, but I 
haven't really looked closely at it, so there might still be issues 
there.

I'll clean up the code duplication in ASTContext in a followup commit.

llvm-svn: 79071
2009-08-15 02:50:32 +00:00
Daniel Dunbar e5515289fa Update test
llvm-svn: 78877
2009-08-13 01:27:45 +00:00
Daniel Dunbar d362857f4c Update test case.
llvm-svn: 78699
2009-08-11 18:37:40 +00:00
Chris Lattner 2375952a47 these tests include section specifiers that aren't valid on the
mac, use an explicit triple.

llvm-svn: 78583
2009-08-10 18:56:44 +00:00
Anders Carlsson e139f868b7 Add tests.
llvm-svn: 78491
2009-08-08 19:43:14 +00:00
Chris Lattner f49573d1ee weak globals that are const should get weak_odr linkage.
add a fixme about C++ const.

llvm-svn: 78159
2009-08-05 05:20:29 +00:00
Chris Lattner c0693bc2ea rdar://7119244 - globals with an explicit section specified don't get
common linkage.

llvm-svn: 78158
2009-08-05 04:56:58 +00:00
Anders Carlsson 5638895b2a Revert the fix for PR3800, it broke things.
llvm-svn: 78084
2009-08-04 18:18:36 +00:00
Daniel Dunbar e9863976b3 Fix test case for Darwin10 (which sets ssp), and move to CodeGen/
llvm-svn: 78049
2009-08-04 04:38:31 +00:00
Daniel Dunbar 4d93a4f9d4 Make sure UTF-16 strings end with a 16-bit null (as opposed to 8-bit).
llvm-svn: 78001
2009-08-03 21:47:08 +00:00
Anders Carlsson 7df966e040 Don't evaluate inout constraints twice. Fixes PR3800.
llvm-svn: 77854
2009-08-02 03:40:19 +00:00
Eli Friedman 62561fe9b0 Fix a minor issue with unions in the new struct building code.
llvm-svn: 77829
2009-08-01 23:11:24 +00:00
Devang Patel fe6bbd1145 New test case for rev. 77694.
llvm-svn: 77698
2009-07-31 18:24:12 +00:00
Anders Carlsson 72fb384a65 Enable the new struct type builder now that the constant struct builder works. (The old code will still be there until we know that everything works well.
llvm-svn: 77190
2009-07-27 15:31:55 +00:00
Anders Carlsson b7130ed888 Enable the new constant struct builder by default. The old code is still in place but will be removed shortly. The new struct builder works on big endian systems.
llvm-svn: 77185
2009-07-27 05:54:15 +00:00
Mike Stump 8c5d7996e8 Add noreturn as a type attribute, handle printing for them and handle
calls to noreturn function pointers when CFG building.

llvm-svn: 77089
2009-07-25 21:26:53 +00:00
Daniel Dunbar 6d8adef9a0 Remove empty tests, left over from an svn revert.
llvm-svn: 77068
2009-07-25 12:41:25 +00:00
Daniel Dunbar 97ea867690 MultiTestRunner: Validate '&&' at the end of RUN lines.
- This is just to normalize, these will go away soon hopefully.

Added all the missing '&&'s that have crept in. :)

llvm-svn: 77062
2009-07-25 11:27:37 +00:00
John McCall 02dee0a46a Semantic checking for main().
Fix some invalid main() methods in the test suite that were nicely
exposed by the new checks.

llvm-svn: 77047
2009-07-25 04:36:53 +00:00
Mike Stump 8e79f99b16 Implement new warning for functions declared 'noreturn' when they fall off the end.
llvm-svn: 76932
2009-07-24 02:49:01 +00:00
Daniel Dunbar 91ade14197 Output UTF-16 string literals independent of host byte order.
- Steve, can you take a look at this? It seems like this code should live
   elsewhere, and there is a FIXME about having Sema validates the UTF-8 to
   UTF-16 conversion.

llvm-svn: 76915
2009-07-23 23:41:22 +00:00
Anders Carlsson 516e5e7835 Correct a thinko in bitfield layout code. Fixes PR4611.
llvm-svn: 76898
2009-07-23 21:16:33 +00:00
Anders Carlsson d78fc89fcb We don't need to keep track of the packed alignment, just whether the struct is packed or not. Fixes PR4610.
llvm-svn: 76884
2009-07-23 17:24:40 +00:00
Anders Carlsson 718a89a501 Use arrays as union padding. Also, since the resulting struct will always contain a single element and either a single i8 element or an array of i8s, there's no reason to use a packed struct.
llvm-svn: 76854
2009-07-23 04:50:01 +00:00
Eli Friedman 5ac69057c0 Make vectorized floating-point comparisons work without crashing.
llvm-svn: 76726
2009-07-22 06:07:16 +00:00
Mon P Wang acedf7768f Preserve address space information through member accesses, e.g.,
__attribute__((address_space(1))) struct {int arr[ 3 ]; }  *p1;
   ... = p1->arr[2];  // load from address space 1

llvm-svn: 76717
2009-07-22 03:08:17 +00:00
Mike Stump 5c1acd1f33 Revert this, was a bug in my new warning code, not the test case.
llvm-svn: 76690
2009-07-21 23:50:15 +00:00
Mike Stump 5e7869f63e Prep for new warning.
llvm-svn: 76638
2009-07-21 20:52:43 +00:00
Daniel Dunbar c3ab4c6c98 Detect when the current generation point is unreachable after emitting
expressions.
 - This generally catches the important case of noreturn functions.

 - With the last two changes, we are down to 152 unreachable blocks emitted on
   403.gcc, vs the 1805 we started with.

llvm-svn: 76364
2009-07-19 08:23:12 +00:00
Daniel Dunbar b6adc43f6e Avoid generation of dead code in a few more situations.
- Emit variable declarations as "simple", we want to avoid forcing the creation
   of a dummy basic block, but still need to make the variable available for
   later use.

 - With that, we can now skip IRgen for other unreachable statements (which
   don't define a label).

 - Anders, I added two fixmes on calls to EmitVLASize, can you check them?

llvm-svn: 76361
2009-07-19 06:58:07 +00:00
Chris Lattner 3afa3e1d91 codegen string literals using private linkage now like llvm-gcc, eliminating
some target hooks.

llvm-svn: 75895
2009-07-16 05:03:48 +00:00
Chris Lattner 2a7deb64c0 reimplement vector comparisons as [fi]cmp+sext instead of using v[if]cmp.
Also, enable them in sema so that they are tested, and now that the x86 backend
has stablized.

llvm-svn: 74983
2009-07-08 01:08:03 +00:00
Chris Lattner 877a48e67a make these tests pass with the stack canary stuff even on targets where they default to on.
llvm-svn: 74412
2009-06-28 19:49:49 +00:00
Bill Wendling d63bbadbef Add stack protector support to clang. This generates the 'ssp' and 'sspreq'
function attributes. There are predefined macros that are defined when stack
protectors are used: __SSP__=1 with -fstack-protector and __SSP_ALL__=2 with
-fstack-protector-all.

llvm-svn: 74405
2009-06-28 07:36:13 +00:00
Devang Patel 0d425350b2 Revrt PR4228 fix for now.
llvm-svn: 74304
2009-06-26 18:32:22 +00:00
Chris Lattner 4c8da96ea9 fix PR4423.
llvm-svn: 73938
2009-06-23 01:38:41 +00:00
Eli Friedman c619d6fab5 Add a target triple to a couple of tests which depend on it. Reported
by Mark Cianciosa on cfe-dev.

llvm-svn: 73672
2009-06-18 02:04:19 +00:00
Devang Patel 9fc4341eec It is possible that main input file does not have any symbol with debug info. To handle this edge case, always create main compile unit first.
This fixes PR 4228.

llvm-svn: 73520
2009-06-16 18:02:02 +00:00
Chris Lattner 943658f00b testcase for r72869, it turns out that it happens in Ruby.
llvm-svn: 73514
2009-06-16 17:39:02 +00:00
Eli Friedman 6282b3cff8 PR4390: Make sure to handle anonymous unions correctly while building
static intializers for structs.

llvm-svn: 73349
2009-06-14 21:41:37 +00:00
Eli Friedman 3192cc8526 Fix the calling convention for structs/unions containing SSE vectors on
x86-32.  This is slightly messy, but I think it's consistent with gcc.

llvm-svn: 73306
2009-06-13 21:37:10 +00:00
Chris Lattner 4ca97c3b9e Fix PR4372, another case where non-prototyped functions can prevent
always_inline from working.

llvm-svn: 73273
2009-06-13 00:26:38 +00:00
Daniel Dunbar fd262b4a62 Fix test, which could miss failures, and also avoid leaving temporary .i file in
source directory.

llvm-svn: 73094
2009-06-08 22:44:26 +00:00
Daniel Dunbar eed62b7c4b Add stack alignment to x86_64 target data.
- <rdar://problem/6948443> WARNING: Linking two modules of different data
   layouts!

llvm-svn: 73093
2009-06-08 22:39:13 +00:00
Eli Friedman e9ff191459 Remove a few more vector builtins.
llvm-svn: 73022
2009-06-07 09:32:56 +00:00
Eli Friedman 5a996fc0fc Now that LLVM CodeGen can handle the generic variations a bit better,
get rid of a few more clang vector builtins.

llvm-svn: 73015
2009-06-07 07:12:56 +00:00
Eli Friedman 07bbeca406 PR4339: make sure to properly extend/trunc the index of a vector element
insert/extract; the relevant instructions are defined to take only an 
i32.

llvm-svn: 73005
2009-06-06 19:09:26 +00:00
Eli Friedman 5f75ff84b7 Test changes to account for removed builtins.
llvm-svn: 73004
2009-06-06 18:15:42 +00:00
Daniel Dunbar feeeda70e2 weak_import should not make definitions have weak linkage.
- <rdar://problem/6948703> clang treats weak_import like weak

llvm-svn: 72967
2009-06-05 22:58:34 +00:00
Daniel Dunbar 4be99ff767 ABI handling: Fix nasty thinko where IRgen could generate an out-of-bounds read
when generating a coercion for ABI handling purposes.
 - This may only manifest itself when building at -O0, but the practical effect
   is that other arguments may get clobbered.

 - <rdar://problem/6930451> [irgen] ABI coercion clobbers other arguments

llvm-svn: 72932
2009-06-05 07:58:54 +00:00
Eli Friedman dd27484888 PR4316: Fix IRGen for cast-to-union extension.
llvm-svn: 72803
2009-06-03 20:45:06 +00:00
Daniel Dunbar 877b30f83c Driver: Support -mllvm; this just forwards options to clang-cc.
llvm-svn: 72780
2009-06-03 16:16:27 +00:00
Daniel Dunbar 4b665ebb01 Add clang-cc support for -disable-llvm-optzns.
- Avoids running any LLVM optimizations, even at -O2, etc., while still keeping
   any language changes these optimizations imply.

llvm-svn: 72742
2009-06-02 22:07:45 +00:00
Eli Friedman cb9d07caeb Add support for __builtin_unwind_init.
Also, committing an #if 0'ed __builtin_setjmp and __builtin_longjmp 
implementation I've had sitting in my tree for a while.  I haven't 
enabled it because the LLVM backend support isn't complete yet.

llvm-svn: 72727
2009-06-02 09:37:50 +00:00
Eli Friedman e32c02114f PR4289: Make sure "&func" has the right LLVM type when "func" is a
K&R-style definition.

llvm-svn: 72690
2009-06-01 10:04:20 +00:00
Eli Friedman 202a68a917 Simplify run line.
llvm-svn: 72687
2009-06-01 08:55:08 +00:00
Mike Stump 2346cd2a10 Improve __builtin_nanf support; we now can deal with them as constants.
llvm-svn: 72607
2009-05-30 03:56:50 +00:00
Eli Friedman 9444638e4e Re-add a slightly more general version of the check from r72578; it is
actually necessary in some obscure cases.

llvm-svn: 72585
2009-05-29 19:23:46 +00:00
Mike Stump de83126b80 We don't want to validate bad code,
llvm-svn: 72574
2009-05-29 16:24:13 +00:00
Mike Stump f9f89a3fee Note another case that doesn't work yet.
llvm-svn: 72573
2009-05-29 16:12:36 +00:00
Mike Stump df0fe27b66 Fixup the rest of the trivial cases of the codegen of volatile. If
any body can spot codegen bugs with volatile, or knows of any in the
bug database, let me know.

llvm-svn: 72572
2009-05-29 15:46:01 +00:00
Eli Friedman 2a69547f38 PR4281: Fix bogus CodeGen assertion. The issue is that
getUnqualifiedType() doesn't strip off all qualifiers for non-canonical 
types.

llvm-svn: 72552
2009-05-28 23:04:00 +00:00
Daniel Dunbar 16f422ec86 Fix a use-of-undefined, IRgen expects the RValue for "void" to be a scalar RValue.
llvm-svn: 72504
2009-05-27 23:45:33 +00:00
Mike Stump de79ea2f51 Update comment.
llvm-svn: 72444
2009-05-26 23:35:31 +00:00
Mike Stump 6adbd62790 And an additional testcase that also works.
llvm-svn: 72441
2009-05-26 23:10:55 +00:00
Mike Stump ec3cbfe8c6 Fixup codegen for volatile structs in the trivial cases (a a=a and a=a=a).
llvm-svn: 72439
2009-05-26 22:03:21 +00:00
Daniel Dunbar 1518b64ddc When trying to pass an argument on the stack, assume LLVM will do the right
thing for non-aggregate types.
 - Otherwise we unnecessarily pin values to the stack and currently end up
   triggering a backend bug in one case.

 - This loose cooperation with LLVM to implement the ABI is pretty ugly.

 - <rdar://problem/6918722> [irgen] clang miscompile of many pointer varargs on
   x86-64

llvm-svn: 72419
2009-05-26 16:37:37 +00:00
Eli Friedman 895771aa4b Handle the edge case of a weak function with incomplete type correctly.
Found by code inspection; I haven't seen this in real-world code.

llvm-svn: 72408
2009-05-26 01:22:57 +00:00
Mike Stump c63428b192 Fixup codegen for __block int i; i += rhs();. Should also slightly
improve codegen in some cases.

llvm-svn: 72273
2009-05-22 19:07:20 +00:00
Daniel Dunbar 499f3f9c5d x86_64 ABI: Account for sret parameters consuming an integer register.
- PR4242.

llvm-svn: 72268
2009-05-22 17:33:44 +00:00
Torok Edwin 5b34933b90 Set correct calling convention even if there is a bitcast in the way.
This attempts to fix PR4239.

llvm-svn: 72251
2009-05-22 07:25:06 +00:00
Mike Stump aed08f9929 Fixup blocks codegen for { __block i; i = rhs(); }, we want the rhs
evaluated first.  This can also improve codegen just a bit as we might
have another register to play with for the evaluation of the rhs.

llvm-svn: 72226
2009-05-21 21:05:15 +00:00
Daniel Dunbar 018958d94d Update test
llvm-svn: 72110
2009-05-19 16:09:59 +00:00
Eli Friedman 45966b4671 Remove the -arch option from clang-cc: for all practical purposes, it's
redundant with -triple.

llvm-svn: 72108
2009-05-19 11:12:40 +00:00
Anders Carlsson 8dd2947696 Remove an unused builtin.
llvm-svn: 72033
2009-05-18 19:25:54 +00:00
Anders Carlsson 2081200b8c Add 'cmp' SSE builtins and get rid of a bunch of other builtins.
llvm-svn: 72032
2009-05-18 19:16:46 +00:00
Daniel Dunbar 2daacd1f08 Avoid generating temp in source directory
llvm-svn: 71776
2009-05-14 17:00:11 +00:00
Daniel Dunbar ffdb8439d7 ABI handling: Fix invalid assertion, it is possible for a valid
coercion to be specified which truncates padding bits. It would be
nice to still have the assert, but we don't have any API call for the
unpadding size of a type yet.

llvm-svn: 71695
2009-05-13 18:54:26 +00:00
Chris Lattner afde259240 implement __sync_synchronize and __sync_lock_release,
rdar://6880573

llvm-svn: 71637
2009-05-13 04:46:13 +00:00
Chris Lattner e541ea3a61 implement l-value codegen of comma expr
llvm-svn: 71595
2009-05-12 21:28:12 +00:00
Daniel Dunbar bbfd054746 Darwin x86-32 ABI: Now that structure passing is farther along, we
don't need special treatment for unions.

llvm-svn: 71559
2009-05-12 17:00:20 +00:00
Daniel Dunbar 203e2e8dd8 x86-64 ABI: clang incorrectly passes union { long double, float } in
register.
 - Merge algorithm was returning MEMORY as it should.

llvm-svn: 71556
2009-05-12 15:22:40 +00:00
Daniel Dunbar 097353cbb5 Darwin x86-32: Multi-dimensional arrays were not handled correctly,
spotted by Eli!

llvm-svn: 71490
2009-05-11 23:01:34 +00:00
Daniel Dunbar e92449e4cc Make cleanup-stack.c test stronger, and work in release-asserts mode.
llvm-svn: 71484
2009-05-11 22:30:29 +00:00
Daniel Dunbar 2ce6b3f91c Darwin x86_32: Treat records with unnamed bit-fields as "empty".
llvm-svn: 71461
2009-05-11 18:58:49 +00:00
Chris Lattner da38fda583 force a target triple so that the right greppable output happens.
llvm-svn: 71361
2009-05-09 17:36:58 +00:00
Daniel Dunbar b997f3bcc3 x86_64 ABI: Ignore padding bit-fields during classification.
- {return-types,single-args}-{32,64} pass the first 1k ABI tests with
   bit-fields enabled.

llvm-svn: 71272
2009-05-08 22:26:44 +00:00
Daniel Dunbar 4752783057 Darwin x86_32: When coercing a "single element" structure, make sure
to use a wide enough type. This might be wider than the "single
element"'s type in the presence of padding bit-fields.
 - Darwin x86_32 now passes the first 1k ABI tests with bit-field
   generation enabled.

llvm-svn: 71270
2009-05-08 21:30:11 +00:00
Daniel Dunbar fdda3501a0 Darwin x86_32: Ignore padding bit-fields when looking for "single
element" structures.

llvm-svn: 71266
2009-05-08 21:04:47 +00:00
Daniel Dunbar 4861346c44 Darwin x86_32: Improve bit-field handling for returning records.
- This turns out to be a no-op now that most of the handling for
   everything else is in place.

llvm-svn: 71261
2009-05-08 20:55:49 +00:00
Daniel Dunbar 85f4028f2e Darwin x86_32: Ignore arrays of empty structures inside records.
- This eliminates 5/1000 failures on return-types-32, on the current
   ABITest config.

llvm-svn: 71250
2009-05-08 20:21:04 +00:00
Chris Lattner 5b9241b2a6 Fix the atomics sema code to convert operands to the argument types
of the underlying _N builtin, not the the type of the pointee of the
actual type.  This ensures that atomics involving pointers end up
using the correct integer type when they are resolved, avoiding
aborts in codegen.

llvm-svn: 71218
2009-05-08 15:36:58 +00:00
Chris Lattner dc04654697 reimplement __sync_* builtins to be variadic and to follow the same
semantic rules that gcc and icc use.  This implements the variadic
and concrete versions as builtins and has sema do the 
disambiguation.  There are probably a bunch of details to finish up
but this seems like a large monotonic step forward :)

llvm-svn: 71212
2009-05-08 06:58:22 +00:00
Eli Friedman 7ce29a18e1 Fix crash with constant initialization of bit-fields in unions.
llvm-svn: 71194
2009-05-07 23:42:42 +00:00
Daniel Dunbar 4dbaaa6f43 Improve handling of (X86) target features.
- This is a WIP...

 - This adds -march= handling to the driver, and fixes the defaulting
   of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
 -target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.

llvm-svn: 71061
2009-05-06 03:16:41 +00:00
Chris Lattner 36797ab251 When defining a function whose type has no prototype, make an effort
to go back and clean up existing uses of the bitcasted function.  This
is not just an optimization: it is required for correctness to get
always inline functions to work, see testcases in function-attributes.c.

llvm-svn: 70971
2009-05-05 06:16:31 +00:00
Eli Friedman 2ad7e17096 PR4143: don't crash generating debug info for incomplete enum types.
llvm-svn: 70825
2009-05-04 04:39:55 +00:00
Eli Friedman 5b73b5e197 PR4134: Implement __builtin_extract_return_addr.
llvm-svn: 70794
2009-05-03 19:23:23 +00:00
Eli Friedman c0042d804c PR4133: fix always_inline implementation to be consistent with gcc.
llvm-svn: 70786
2009-05-03 18:13:43 +00:00
Chris Lattner 61af27860d look at the right operand when increasing the size of an asm output,
this fixes http://llvm.org/bugs/show_bug.cgi?id=3373#c20

llvm-svn: 70685
2009-05-03 09:05:53 +00:00
Chris Lattner cc1cde9c57 allow references to the larger value in a tied constraint
from the asm string, but reject references to the smaller one.

llvm-svn: 70679
2009-05-03 08:32:32 +00:00
Chris Lattner 59c3a9cd54 add support for tying asm operands where the result is smaller than
the input.  This is part of PR3373.

llvm-svn: 70677
2009-05-03 08:21:20 +00:00
Daniel Dunbar c7121faa71 Remove typo
llvm-svn: 70676
2009-05-03 08:00:14 +00:00
Chris Lattner 10f221f321 implement support for asm outputs targetting non-simple lvalue destinations
like bitfields.  incidentally llvm-gcc crashes on this sort of thing also. :)

llvm-svn: 70675
2009-05-03 07:53:25 +00:00
Chris Lattner b65933eaa2 handle codegen of asms where a small input is tied to a large output.
llvm-svn: 70672
2009-05-03 07:27:51 +00:00
Douglas Gregor 8d9c509975 Implement bit-field promotion rules for C99. Fixes PR3500.
llvm-svn: 70571
2009-05-01 20:41:21 +00:00
Douglas Gregor 72a57b89aa Add testcase that illustrates the problem from r69699 regarding tentative definitions of statics
llvm-svn: 70543
2009-05-01 15:45:53 +00:00
Mike Stump d898026e8a Don't assert when we think we need copy/dispose, but don't need them.
Radar 6838889

llvm-svn: 70525
2009-05-01 01:31:57 +00:00
Anders Carlsson b4e463287e Don't use indirect memory destinations for inline asm. Fixes 6841383.
llvm-svn: 70523
2009-05-01 00:16:04 +00:00
Eli Friedman 902fddd1cf Fix for PR4108: be a bit looser with the casts that we accept in
constant initializers.

llvm-svn: 70483
2009-04-30 07:03:22 +00:00
Chris Lattner 7d4f5c47ce only support int128_t on 64-bit and larger targets. 32-bit targets don't
have support for __divti3 and friends.

llvm-svn: 70480
2009-04-30 06:18:40 +00:00
Chris Lattner f122cef4df initial support for __[u]int128_t, which should be basically
compatible with VC++ and GCC.  The codegen/mangling angle hasn't
been fully ironed out yet.  Note that we accept int128_t even in
32-bit mode, unlike gcc.

llvm-svn: 70464
2009-04-30 02:43:43 +00:00
Douglas Gregor 76fe50c654 Improve compatibility with GCC regarding inline semantics in GNU89
mode and in the presence of __gnu_inline__ attributes. This should fix
both PR3989 and PR4069.

As part of this, we now keep track of all of the attributes attached
to each declaration even after we've performed declaration
merging. This fixes PR3264.

llvm-svn: 70292
2009-04-28 06:37:30 +00:00
Eli Friedman 2b680b43e9 Simplify the scheme used for keywords, and change the classification
scheme to be more useful.

The new scheme introduces a set of categories that should be more 
readable, and also reflects what we want to consider as an extension 
more accurately.  Specifically, it makes the "what is a keyword" 
determination accurately reflect whether the keyword is a GNU or 
Microsoft extension.

I also introduced separate flags for keyword aliases; this is useful 
because the classification of the aliases is mostly unrelated to the 
classification of the original keyword.

This patch treats anything that's in the implementation 
namespace (prefixed with "__", or "_X" where "X" is any upper-case 
letter) as a keyword without marking it as an extension.  This is 
consistent with the standards in that an implementation is allowed to define 
arbitrary extensions in the implementation namespace without violating 
the standard. This gets rid of all the nasty "extension used" warnings 
for stuff like __attribute__ in -pedantic mode.  We still warn for 
extensions outside of the the implementation namespace, like typeof.
If someone wants to implement -Wextensions or something like that, we 
could add additional information to the keyword table.

This also removes processing for the unused "Boolean" language option; 
such an extension isn't supported on any other C implementation, so I 
don't see any point to adding it.

The changes to test/CodeGen/inline.c are required because previously, we 
weren't actually disabling the "inline" keyword in -std=c89 mode.

I'll remove Boolean and NoExtensions from LangOptions in a follow-up 
commit.

llvm-svn: 70281
2009-04-28 03:13:54 +00:00
Daniel Dunbar 01910a50c4 x86-32 ABI: Fix crash on return of structure with flexible array
member.

Also, spell bitfield more consistently as bit-field.

llvm-svn: 70220
2009-04-27 18:31:32 +00:00
Anders Carlsson 6f5c15688d When calling the cleanup function specified by __attribute__((cleanup)), make sure to bitcast the argument so it has the same type as the first argument of the cleanup function. Fixes <rdar://problem/6827047>.
llvm-svn: 70098
2009-04-26 00:34:20 +00:00
Chris Lattner a4185c543e fix PR4067: [Linux kernel] cannot aggregate codegen stmtexpr as lvalue
llvm-svn: 70067
2009-04-25 19:35:26 +00:00
Douglas Gregor 89c8e000cf Fix handling of C99 "extern inline" semantics when dealing with
multiple declarations of the function. Should fix PR3989 and
<rdar://problem/6818429>.

llvm-svn: 69905
2009-04-23 18:22:55 +00:00
Devang Patel a6acb390e7 Handle corner case where clang-cc is invoked directly to compile preprocessed source file without -main-file-name. In this case, CDDebugInfo is not able identify correct main source file becase SM.isFromMainFile() returns true for locations from header files as well as locations from main source file.
This patch takes conservative approach by not emitting more then one compile unit with isMain bit set.

llvm-svn: 69902
2009-04-23 18:09:16 +00:00
Chris Lattner f8dc07369a Fix some mishandling of the attr(gnu_inline) mode when used with
extern.  Previously we would warn about it and ignore the attribute.
This is incorrect, it should be handled as a c89 "extern inline" 
function.  Many thanks to Matthieu Castet for pointing this out and
beating me over the head until I got it.

PR3988: extern inline function are not externally visible
llvm-svn: 69756
2009-04-22 00:03:30 +00:00
Chris Lattner 2f343dd5c8 fix PR4026: Clang can't codegen __func__ without implicit cast
llvm-svn: 69747
2009-04-21 23:00:09 +00:00
Chris Lattner a9aeea9f27 use of predefined identifiers like __func__ at global scope warn in sema,
but crashed codegen.  Fix this to report the name of the llvm function.
This fixes rdar://6808051

llvm-svn: 69658
2009-04-21 04:41:23 +00:00
Chris Lattner ddf6ca0355 the __gnuc_inline__ attribute is actually named __gnu_inline__,
PR4023

llvm-svn: 69618
2009-04-20 19:12:28 +00:00