Commit Graph

702 Commits

Author SHA1 Message Date
Chris Lattner 65079bd9be fix codegen support for functions that are nothrow and noreturn.
llvm-svn: 47838
2008-03-03 03:45:26 +00:00
Chris Lattner 8496639787 Add a bunch of attributes, patch by Nuno Lopes.
llvm-svn: 47837
2008-03-03 03:28:21 +00:00
Steve Naroff b96e4ab649 Fix http://llvm.org/bugs/show_bug.cgi?id=2103.
llvm-svn: 47775
2008-02-29 23:30:25 +00:00
Steve Naroff 83777fef1a Fix http://llvm.org/bugs/show_bug.cgi?id=2106.
llvm-svn: 47768
2008-02-29 21:48:07 +00:00
Chris Lattner f4c1aa67bd testcase for attr deprecated, by Nuno Lopes.
llvm-svn: 47757
2008-02-29 18:11:31 +00:00
Lauro Ramos Venancio 01a72ff5d3 Implement codegen for the following static var init.
void g() {
  static char a[10];
  static char *b = a;
}

Now we can compile wget!

llvm-svn: 47627
2008-02-26 21:41:45 +00:00
Lauro Ramos Venancio 8af648ac55 Fix a bug in ConvertAsmString function.
llvm-svn: 47618
2008-02-26 19:19:58 +00:00
Lauro Ramos Venancio c9fbd7301a Convert x86 target specific inline asm constraints to LLVM.
llvm-svn: 47609
2008-02-26 18:33:46 +00:00
Lauro Ramos Venancio 8983891531 Fix PR2086.
llvm-svn: 47551
2008-02-25 19:03:15 +00:00
Chris Lattner 5329e7e5ed Fix PR2090, a typo in digraph processing.
llvm-svn: 47540
2008-02-24 19:05:57 +00:00
Nate Begeman b16d53ea31 add a test case
llvm-svn: 47455
2008-02-21 19:44:16 +00:00
Eli Friedman c62dd9d345 Some const initializer tests for stuff I just committed.
llvm-svn: 47442
2008-02-21 18:07:36 +00:00
Chris Lattner 3b418d8446 implement codegen support for sizeof(void), fixing PR2080.
llvm-svn: 47429
2008-02-21 05:45:29 +00:00
Chris Lattner a2417c9d8b add some semantic checks for address spaces.
llvm-svn: 47423
2008-02-21 01:42:41 +00:00
Lauro Ramos Venancio e2162c6549 Simplify aggregate initilizer implementation. Use the CodeGenModule::EmitConstantExpr method when
possible.
Fix mediabench/mpeg2/mpeg2dec test.

llvm-svn: 47336
2008-02-19 19:27:31 +00:00
Chris Lattner d2a02fe840 fix the second half of PR2041: __restrict is ok in c90 mode, even if
restrict isn't.

llvm-svn: 47316
2008-02-19 06:46:10 +00:00
Lauro Ramos Venancio c58fc4052e A global without initializer must be emitted as weak.
Fix Olden/bh test.

llvm-svn: 47292
2008-02-19 00:04:15 +00:00
Lauro Ramos Venancio dec89733a7 Implement multi-dimension array initalizer.
Fix McCat/08-main test.

llvm-svn: 47286
2008-02-18 22:44:02 +00:00
Steve Naroff f631ae2cf8 Tweak fix for http://llvm.org/bugs/show_bug.cgi?id=2000 to work across typedefs.
llvm-svn: 47269
2008-02-18 15:14:59 +00:00
Chris Lattner b080ed504e Fix PR2042. One remaining issue: we don't currently diagnose
int foobar(int);
 int foobar() {}

which requires ifdef'ing out a testcase in predefined-function.c.

llvm-svn: 47236
2008-02-17 19:31:09 +00:00
Eli Friedman f7e92acaba Implemnt isVariablyModifiedType correctly.
llvm-svn: 47233
2008-02-17 00:59:11 +00:00
Chris Lattner df53e20f2d implement codegen support for aggregates casted to void.
llvm-svn: 47226
2008-02-16 23:55:16 +00:00
Lauro Ramos Venancio bada8d4b5b Implement extern block var.
llvm-svn: 47223
2008-02-16 22:30:38 +00:00
Anders Carlsson f13b1efa75 Add more tests
llvm-svn: 47217
2008-02-16 19:51:36 +00:00
Chris Lattner 27055194b7 Fix CheckEndOfDirective to diagnose lines that contain macros that expand to
zero tokens.  This fixes PR2045, thanks to Neil for finding another 
incredibly subtle corner case :)

llvm-svn: 47203
2008-02-16 01:20:36 +00:00
Anders Carlsson 3ea23a45d9 Make sizeof and __alignof work correctly with packed structs.
llvm-svn: 47202
2008-02-16 01:20:23 +00:00
Chris Lattner 287c734075 Fix PR2041: restrict is not a keyword in c90.
llvm-svn: 47160
2008-02-15 18:02:59 +00:00
Eli Friedman 78e47634b2 Get rid of outdated code that masks type errors. Fixes PR2036.
llvm-svn: 47154
2008-02-15 06:56:02 +00:00
Eli Friedman e9d0954c06 Nevermind, these tests work... I messed up my testing.
llvm-svn: 47153
2008-02-15 06:29:53 +00:00
Eli Friedman a01cfa75eb Partial fix for struct compatibility; there's still something messy
going on with mixing scopes, though.

llvm-svn: 47152
2008-02-15 06:03:44 +00:00
Steve Naroff f631997cb5 A much better fix for http://llvm.org/bugs/show_bug.cgi?id=1987.
llvm-svn: 47103
2008-02-14 02:58:32 +00:00
Eli Friedman 2be9af9556 Fix a minor bug in isNullPointerConstant triggered by the linux
tgmath.h.

Note that there is another issue with tgmath.h, so mandel.c still 
doesn't work.

llvm-svn: 47069
2008-02-13 17:29:58 +00:00
Eli Friedman a7bf7ed476 Make typechecking for enum+int compatibility stricter.
llvm-svn: 47005
2008-02-12 08:46:17 +00:00
Eli Friedman 16f909670e Fix type compatibility between constant and variable arrays.
llvm-svn: 47003
2008-02-12 08:23:06 +00:00
Steve Naroff ab468cb14b Allow the parser to detect invalid DeclSpec's. This fixes http://llvm.org/bugs/show_bug.cgi?id=1987.
This commit only "guards" the call to ParseDeclarationSpecifiers() in ParseDeclarationOrFunctionDefinition(). 

We could consider guarding all calls, however this is a bit radical (since it effectively stops parsing the declaration once we have a bad declspec). Will discuss with Chris tomorrow.

llvm-svn: 46984
2008-02-12 04:08:59 +00:00
Anders Carlsson 6a8350b4f1 Get rid of bogus warnings when the second argument in va_start is either an implicit cast expr or a paren expr.
llvm-svn: 46950
2008-02-11 04:20:54 +00:00
Steve Naroff e78e2af754 Tweak test...
llvm-svn: 46946
2008-02-11 02:16:41 +00:00
Steve Naroff 326389b8ce Fix http://llvm.org/bugs/show_bug.cgi?id=1988.
Sema::CheckInitializerListTypes() needs to ignore invalid structures.

llvm-svn: 46942
2008-02-11 00:06:17 +00:00
Chris Lattner 36fc8790b7 Fix PR1992 by computing the right type for string literals, which
is an array type not a pointer type.  This requires updating some
diags that change and updating the code generator to handle the
proper form of strings.

llvm-svn: 46941
2008-02-11 00:02:17 +00:00
Eli Friedman de4496bb9e Basic codegen test for conditional with void*.
llvm-svn: 46940
2008-02-10 23:18:23 +00:00
Eli Friedman fadc8462be Add a couple of sema tests for qualifiers with conditionals containing
void*.

llvm-svn: 46939
2008-02-10 23:14:16 +00:00
Chris Lattner 7b8134f5c6 Fix PR1999, by emitting a hard error only if an argument declarator is completely
missing.  Otherwise, it is an implicit int case, which is valid in c90 and invalid 
elsewhere, but accepted as an extension.

llvm-svn: 46938
2008-02-10 23:08:00 +00:00
Steve Naroff 1018ea35b7 Refine bug fix to Expr::isLvalue (commit r46917).
llvm-svn: 46919
2008-02-10 01:39:04 +00:00
Steve Naroff 43c50866f1 Change Expr::isLvalue() to allow the "void" type. This fixes bz2000 submitted by Neil Booth.
Neil, can you point me to the place in the C99 spec that says this is allowed? I thought Expr::isLvalue() conformed to the spec, which says "C99 6.3.2.1: an lvalue is an expression with an object type or an incomplete type other than void.". Please advise.

llvm-svn: 46917
2008-02-10 00:30:18 +00:00
Anders Carlsson 2e64d1a50f Behave correctly if a constraint expression is invalid.
llvm-svn: 46910
2008-02-09 19:57:29 +00:00
Steve Naroff 45173e0ac0 Fix <rdar://problem/5733511> clang doesn't emit error for const array.
llvm-svn: 46905
2008-02-09 16:59:44 +00:00
Steve Naroff a369922449 A bunch-o changes to fix <rdar://problem/5716046> incomplete implementation of ObjC class warning is incomplete
As part of this fix, I made a low-level change to the text diagnostics machinery (to basically avoid printing duplicate source lines/carets when you have multiple diagnostics that refer to the same exact place). For now, this only happens with we don't have a source range (could be extended to support source ranges as well). 

llvm-svn: 46897
2008-02-08 22:06:17 +00:00
Lauro Ramos Venancio d74057fa87 Fix a bitfield regression. Reported by Anders Carlsson.
llvm-svn: 46889
2008-02-08 19:46:46 +00:00
Steve Naroff 8c099c3f03 Use getLogicalLineNumber() in FuzzyParseMicrosoftAsmStatement(), it's more general and simplifies the code.
llvm-svn: 46885
2008-02-08 18:01:27 +00:00
Steve Naroff db5f7d7699 Support fuzzy parsing MS line-oriented __asm's that originate from a macro (a case where we can't obtain source line info). As the test case indicates, we don't currently support line-oriented asm statements that mix file/macro body tokens.
llvm-svn: 46878
2008-02-08 03:36:19 +00:00
Eli Friedman 4297826cac Improve diagnostic for illegal array initialization.
llvm-svn: 46869
2008-02-08 00:48:24 +00:00
Lauro Ramos Venancio 9eff02d9f8 Simplify bitfield codegen.
Fix codegen of struct { short a[3]; int b:15; }.

llvm-svn: 46859
2008-02-07 19:29:53 +00:00
Lauro Ramos Venancio 0f166de892 Fix codegen of
struct {
  char a[3];
  unsigned char b:1;
};

Fix PR1990.

llvm-svn: 46856
2008-02-07 18:18:58 +00:00
Chris Lattner 3b5054dda0 Implement support for the extremely atrocious MS /##/ extension,
which pastes together a comment.  This is only enabled with 
-fms-extensions of course.

llvm-svn: 46845
2008-02-07 06:03:59 +00:00
Eli Friedman 1242fff6ec Make sure to propagate qualifiers through the member operator.
llvm-svn: 46830
2008-02-06 22:48:16 +00:00
Chris Lattner 871e0ceffb explicitly document that return statement argument does not necessarily follow the result type of the function. Add testcase.
llvm-svn: 46823
2008-02-06 21:20:34 +00:00
Eli Friedman 220ee41011 Fix the codegen of structs with flexible array members.
llvm-svn: 46806
2008-02-06 05:33:51 +00:00
Eli Friedman d49a720d52 Be a bit stricter about array type compatibility.
llvm-svn: 46799
2008-02-06 04:53:22 +00:00
Chris Lattner a5e4d30942 Finish off the refactoring of type handling stuff. Now we recompile every
tag decl after it has been completed

llvm-svn: 46798
2008-02-06 04:51:19 +00:00
Chris Lattner b5eda6253b pull .ll and .bc writing out of the ASTConsumer destructors into some top
level code in clang.  This is a cleanup, but does implement "-o" for 
-emit-llvm.  One effect of this is that "clang foo.c -emit-llvm" will now
emit into foo.ll instead of stdout.  Use "clang foo.c -emit-llvm -o -" or 
"clang < foo.c -emit-llvm" to get the old behavior.

llvm-svn: 46791
2008-02-06 01:42:25 +00:00
Steve Naroff e6016798bf Fix Parser::ParseObjCTryStmt() to allow for trailing @-keyword statements/expressions.
This bug fix is the result of not having 2-token lookahead to recognize specific @-keywords.

llvm-svn: 46768
2008-02-05 21:27:35 +00:00
Chris Lattner b1537ebdd4 rewrite some of the type refinement code to eliminate dangling pointers
simplify the code and generally make it more robust.

llvm-svn: 46745
2008-02-05 08:06:13 +00:00
Chris Lattner b977b6a59b Relax an assertion, fixing PR1968
llvm-svn: 46742
2008-02-05 06:37:34 +00:00
Devang Patel a703a67384 Cleanup InitListExpr code generation code.
Handle padding fields while initializing struct (fix PR 1962)

llvm-svn: 46736
2008-02-05 02:39:50 +00:00
Christopher Lamb da8e5d979e Add ending newline to test.
llvm-svn: 46692
2008-02-04 02:35:11 +00:00
Christopher Lamb 025b5fb883 Add experimental support for address space qualified types. Address space
qualifiers use the __attribute__((address_space(id))) syntax.

llvm-svn: 46691
2008-02-04 02:31:56 +00:00
Chris Lattner c43926fe67 Implement support for __extension__ which silences extwarnings in its
scope.  This is part of the fix for PR1966

llvm-svn: 46669
2008-02-02 20:20:10 +00:00
Anders Carlsson 6fa0813186 Add RUN line.
llvm-svn: 46663
2008-02-02 04:49:12 +00:00
Chris Lattner bfc2d8acd9 testcase for previous patch.
llvm-svn: 46662
2008-02-02 04:45:42 +00:00
Anders Carlsson 53fef5d9d6 Add trailing newline.
llvm-svn: 46652
2008-02-01 23:27:51 +00:00
Anders Carlsson 0b05d041f2 Only OCU vectors can be splatted.
llvm-svn: 46651
2008-02-01 23:17:55 +00:00
Steve Naroff edb5bc6f09 Fix two rewriter bugs with @catch.
- Support @catch(...), rather than crash:-)
- Make sure all catch bodies get rewritten. This "fix" is really a workaround until the iterator for the "try" AST is fixed. Will fix this in a separate commit.

llvm-svn: 46644
2008-02-01 20:02:07 +00:00
Ted Kremenek e9a709a0c5 Moved "Rewriter" tests from test/Sema to test/Rewriter.
llvm-svn: 46640
2008-02-01 17:05:54 +00:00
Anders Carlsson 806700f973 It is allowed to get the address of an array subscript, even if the array has the register qualifier, if the array is really a pointer.
llvm-svn: 46634
2008-02-01 07:15:58 +00:00
Chris Lattner a347834869 make some diagnostics more terse, update testcases.
Fix Sema::ActOnInstanceMessage to correctly do things in terms of canonical 
types, fixing bogus errors like:

NSDistantObject.m:10383:120: error: bad receiver type 'typeof((id<NSMutableCopying>)self)'
    id mess = ({ id __inv__ = ((void *)0); id __mb__ = _NSMessageBuilder((id <NSMutableCopying>)self, &__inv__); (void)[(__typeof__((id <NSMutableCopying>)self))__mb__ mutableCopyWithZone:((void *)0)]; if (!objc_collecting_enabled()) object_dispose(__mb__); __inv__; });

llvm-svn: 46633
2008-02-01 06:57:39 +00:00
Ted Kremenek 81f0550cdd Added back 'CodeGen' to test suite (accidentally removed in my last patch).
llvm-svn: 46631
2008-02-01 06:37:46 +00:00
Ted Kremenek effdafa62a Implemented casts for ConcreteInt and ConcreteIntLValue.
Implemented '==' and '!=' for ConcreteIntLValue.

llvm-svn: 46630
2008-02-01 06:36:40 +00:00
Chris Lattner 7f024fe0c6 Fix PR1965: missing diagnostics for parameters that are missing
type specifiers.  This required updating some (buggy) tests, and the
testcase was previously accidentally committed.

llvm-svn: 46603
2008-01-31 06:10:07 +00:00
Chris Lattner 4973fb9273 Fix a bogus test
llvm-svn: 46602
2008-01-31 06:06:29 +00:00
Chris Lattner a779d69029 Fix a rewriter crash when the whole body of a foreach is itself
rewritten, as in Sema/rewrite-foreach-6.m.  Fariborz/Steve,
please review this to see if it is sane.

llvm-svn: 46600
2008-01-31 05:10:40 +00:00
Chris Lattner a94035bbb8 Fix PR1921 by promoting negative indices to intptrty.
llvm-svn: 46599
2008-01-31 04:12:50 +00:00
Steve Naroff 2a2c5b98ee Fix test case and add a FIXME.
llvm-svn: 46577
2008-01-30 21:50:43 +00:00
Lauro Ramos Venancio 86b99c1b79 getLLVMFieldNo can't be called before emitting the base value.
llvm-svn: 46576
2008-01-30 21:23:20 +00:00
Lauro Ramos Venancio f5291d2871 A pointer to an opaque type is an "opaque type definition".
llvm-svn: 46575
2008-01-30 21:21:08 +00:00
Eli Friedman 1bc0fed9a5 Fix codegen for conditionals with incommpatible pointer types. Code
that causes this isn't really correct, but if we're going to accept 
this, it should come up with a consistent AST.

llvm-svn: 46557
2008-01-30 17:02:03 +00:00
Chris Lattner 05ba4cbe17 fix a problem reported by Eli, caused by not keeping bool as i1
when in a register.

llvm-svn: 46552
2008-01-30 07:01:17 +00:00
Chris Lattner e850fa2452 make this pass by adding an expected error, add some tests.
llvm-svn: 46551
2008-01-30 06:46:30 +00:00
Steve Naroff 1e7873642b Many refinements to Sema::MergeVarDecl(). This routine still needs some re-work to fully handle tentative decls.
This includes a fix to bz1908.

llvm-svn: 46540
2008-01-30 00:44:01 +00:00
Devang Patel 45a65d2ee1 Handle incomplete struct initializer.
llvm-svn: 46534
2008-01-29 23:23:18 +00:00
Fariborz Jahanian 284011b462 Rewriting of @synchronized. This has one FIXME in it. But this should allow @sychronized to be rewritten.
llvm-svn: 46533
2008-01-29 22:59:37 +00:00
Steve Naroff ddb1dd8c5f Tighten up ASTContext::typesAreCompatible()...it needs to make sure the qualifiers match. The comment and C99 citation for this routine were correct...the code needed to conform to the comment/spec. This fixes the test added below.
Tightening up this routine forced tweaks to Sema::CheckSubtractionOperands() and Sema::CheckCompareOperands(). For example, they both need to operate on the unqualified pointee...

llvm-svn: 46522
2008-01-29 18:58:14 +00:00
Eli Friedman 7031d734ed Fix a bug where CodeGen would attempt to erase an instruction that was
already used.

llvm-svn: 46519
2008-01-29 18:13:51 +00:00
Anders Carlsson a8dc3e6b52 Implement __builtin_offsetof.
llvm-svn: 46515
2008-01-29 15:56:48 +00:00
Chris Lattner 0c8a1edb8b Fix a bug where we would incorrectly emit a "cannot paste" error
message when handling the GNU ", ## __VA_ARGS__" extension.  While
I'm at it, flag uses of this as extensions.

llvm-svn: 46503
2008-01-29 07:54:23 +00:00
Anders Carlsson ce0740e1f5 Handle binary or in constant expressions.
llvm-svn: 46482
2008-01-29 01:33:32 +00:00
Anders Carlsson 0674a7417f Correctly handle constants that refer to enums.
llvm-svn: 46481
2008-01-29 01:28:48 +00:00
Anders Carlsson 6f2a10e8c9 Correctly handle scalars in braces.
llvm-svn: 46480
2008-01-29 01:15:48 +00:00
Steve Naroff f06b5ba047 Fix bz1950. ASTContext::functionTypesAreCompatible() needs to operate on the unqualified parameter types (per C99 6.7.5.3p15).
llvm-svn: 46472
2008-01-29 00:15:50 +00:00
Steve Naroff aeb6b30f64 Fix a bug with struct initializers (in Sema::CheckInitializerListTypes()).
Test case included from bz1948 (thanks Neil!).
Also fixed an 80 column violation...

llvm-svn: 46430
2008-01-28 02:00:41 +00:00
Chris Lattner 77927cc33c Add support for dispatching an objc message to a variable
in an initializer list.

llvm-svn: 46367
2008-01-25 19:43:26 +00:00