Граф коммитов

701 Коммитов

Автор SHA1 Сообщение Дата
Steve Naroff e39bfd0c52 A much better fix for http://llvm.org/bugs/show_bug.cgi?id=1987.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47103 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 02:58:32 +00:00
Eli Friedman 4b3f9b367c 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-13 17:29:58 +00:00
Eli Friedman bab9696888 Make typechecking for enum+int compatibility stricter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 08:46:17 +00:00
Eli Friedman 4c721d381f Fix type compatibility between constant and variable arrays.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47003 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 08:23:06 +00:00
Steve Naroff 9532414c45 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46984 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-12 04:08:59 +00:00
Anders Carlsson 88cf226cae Get rid of bogus warnings when the second argument in va_start is either an implicit cast expr or a paren expr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46950 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 04:20:54 +00:00
Steve Naroff 3a15485c28 Tweak test...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46946 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 02:16:41 +00:00
Steve Naroff b43eaa5fa6 Fix http://llvm.org/bugs/show_bug.cgi?id=1988.
Sema::CheckInitializerListTypes() needs to ignore invalid structures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 00:06:17 +00:00
Chris Lattner a7ad98ff09 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.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46941 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-11 00:02:17 +00:00
Eli Friedman 68f624e9eb Basic codegen test for conditional with void*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46940 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 23:18:23 +00:00
Eli Friedman f76f5ed050 Add a couple of sema tests for qualifiers with conditionals containing
void*.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 23:14:16 +00:00
Chris Lattner 99d724f6a3 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 23:08:00 +00:00
Steve Naroff acb818a4f7 Refine bug fix to Expr::isLvalue (commit r46917).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46919 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 01:39:04 +00:00
Steve Naroff 75ceedf377 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 00:30:18 +00:00
Anders Carlsson 8bd36fcb44 Behave correctly if a constraint expression is invalid.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46910 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 19:57:29 +00:00
Steve Naroff 336ed0b79b Fix <rdar://problem/5733511> clang doesn't emit error for const array.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46905 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 16:59:44 +00:00
Steve Naroff efe7f36f4d 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). 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46897 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 22:06:17 +00:00
Lauro Ramos Venancio c0959fc20d Fix a bitfield regression. Reported by Anders Carlsson.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 19:46:46 +00:00
Steve Naroff 3628097517 Use getLogicalLineNumber() in FuzzyParseMicrosoftAsmStatement(), it's more general and simplifies the code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46885 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 18:01:27 +00:00
Steve Naroff 03d6bc6734 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 03:36:19 +00:00
Eli Friedman a312ce2bda Improve diagnostic for illegal array initialization.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-08 00:48:24 +00:00
Lauro Ramos Venancio d957aa0933 Simplify bitfield codegen.
Fix codegen of struct { short a[3]; int b:15; }.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46859 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 19:29:53 +00:00
Lauro Ramos Venancio 8432f4b4cd Fix codegen of
struct {
  char a[3];
  unsigned char b:1;
};

Fix PR1990.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 18:18:58 +00:00
Chris Lattner 3f1cc838f9 Implement support for the extremely atrocious MS /##/ extension,
which pastes together a comment.  This is only enabled with 
-fms-extensions of course.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-07 06:03:59 +00:00
Eli Friedman 510190777c Make sure to propagate qualifiers through the member operator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46830 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 22:48:16 +00:00
Chris Lattner c8edf6bd5f explicitly document that return statement argument does not necessarily follow the result type of the function. Add testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46823 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 21:20:34 +00:00
Eli Friedman 75afb58549 Fix the codegen of structs with flexible array members.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 05:33:51 +00:00
Eli Friedman 4e92acf3b7 Be a bit stricter about array type compatibility.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 04:53:22 +00:00
Chris Lattner 9eee0f8593 Finish off the refactoring of type handling stuff. Now we recompile every
tag decl after it has been completed


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46798 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 04:51:19 +00:00
Chris Lattner e66b65c3a3 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 01:42:25 +00:00
Steve Naroff 64515f3185 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 21:27:35 +00:00
Chris Lattner d86e6bc7ab rewrite some of the type refinement code to eliminate dangling pointers
simplify the code and generally make it more robust.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46745 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 08:06:13 +00:00
Chris Lattner c4b23a530b Relax an assertion, fixing PR1968
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 06:37:34 +00:00
Devang Patel eae1560d4f Cleanup InitListExpr code generation code.
Handle padding fields while initializing struct (fix PR 1962)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46736 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 02:39:50 +00:00
Christopher Lamb b41a7d2002 Add ending newline to test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46692 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 02:35:11 +00:00
Christopher Lamb ebb97e98c0 Add experimental support for address space qualified types. Address space
qualifiers use the __attribute__((address_space(id))) syntax.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-04 02:31:56 +00:00
Chris Lattner 35080844d3 Implement support for __extension__ which silences extwarnings in its
scope.  This is part of the fix for PR1966


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46669 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 20:20:10 +00:00
Anders Carlsson 4f45b465b0 Add RUN line.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46663 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 04:49:12 +00:00
Chris Lattner 3ea740e5ee testcase for previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46662 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-02 04:45:42 +00:00
Anders Carlsson 2cec15fc2f Add trailing newline.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 23:27:51 +00:00
Anders Carlsson 79b67f351f Only OCU vectors can be splatted.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 23:17:55 +00:00
Steve Naroff e12e69223e 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46644 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 20:02:07 +00:00
Ted Kremenek 5f0ad3f34c Moved "Rewriter" tests from test/Sema to test/Rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 17:05:54 +00:00
Anders Carlsson 369dee454f 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46634 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 07:15:58 +00:00
Chris Lattner 6e10a08fe0 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__; });



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46633 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 06:57:39 +00:00
Ted Kremenek 77250c8034 Added back 'CodeGen' to test suite (accidentally removed in my last patch).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46631 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 06:37:46 +00:00
Ted Kremenek a6e4d21dc4 Implemented casts for ConcreteInt and ConcreteIntLValue.
Implemented '==' and '!=' for ConcreteIntLValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46630 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-01 06:36:40 +00:00
Chris Lattner e0e713b661 Fix PR1965: missing diagnostics for parameters that are missing
type specifiers.  This required updating some (buggy) tests, and the
testcase was previously accidentally committed.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 06:10:07 +00:00
Chris Lattner 868d08f9e9 Fix a bogus test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 06:06:29 +00:00
Chris Lattner 338d1e2ced 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 05:10:40 +00:00
Chris Lattner 6860f3cef7 Fix PR1921 by promoting negative indices to intptrty.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 04:12:50 +00:00
Steve Naroff 890d93eec4 Fix test case and add a FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46577 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 21:50:43 +00:00
Lauro Ramos Venancio 5bfe18c32f getLLVMFieldNo can't be called before emitting the base value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46576 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 21:23:20 +00:00
Lauro Ramos Venancio 8df106e161 A pointer to an opaque type is an "opaque type definition".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 21:21:08 +00:00
Eli Friedman b1284ace14 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46557 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 17:02:03 +00:00
Chris Lattner 01e3c9e06d fix a problem reported by Eli, caused by not keeping bool as i1
when in a register.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46552 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 07:01:17 +00:00
Chris Lattner e0c5414f05 make this pass by adding an expected error, add some tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46551 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 06:46:30 +00:00
Steve Naroff b7b032ecb2 Many refinements to Sema::MergeVarDecl(). This routine still needs some re-work to fully handle tentative decls.
This includes a fix to bz1908.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-30 00:44:01 +00:00
Devang Patel 47fb697750 Handle incomplete struct initializer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46534 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 23:23:18 +00:00
Fariborz Jahanian a0f5579240 Rewriting of @synchronized. This has one FIXME in it. But this should allow @sychronized to be rewritten.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46533 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 22:59:37 +00:00
Steve Naroff 2565eeff7b 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...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46522 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 18:58:14 +00:00
Eli Friedman 356916ec84 Fix a bug where CodeGen would attempt to erase an instruction that was
already used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46519 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 18:13:51 +00:00
Anders Carlsson 5a1deb8d9c Implement __builtin_offsetof.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 15:56:48 +00:00
Chris Lattner 71a3a8d506 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 07:54:23 +00:00
Anders Carlsson ce6237edf6 Handle binary or in constant expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 01:33:32 +00:00
Anders Carlsson a3881fc62a Correctly handle constants that refer to enums.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46481 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 01:28:48 +00:00
Anders Carlsson f6884ac7cf Correctly handle scalars in braces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46480 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 01:15:48 +00:00
Steve Naroff ba03eda159 Fix bz1950. ASTContext::functionTypesAreCompatible() needs to operate on the unqualified parameter types (per C99 6.7.5.3p15).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-29 00:15:50 +00:00
Steve Naroff 578edc6614 Fix a bug with struct initializers (in Sema::CheckInitializerListTypes()).
Test case included from bz1948 (thanks Neil!).
Also fixed an 80 column violation...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-28 02:00:41 +00:00
Chris Lattner 5c749428a9 Add support for dispatching an objc message to a variable
in an initializer list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46367 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 19:43:26 +00:00
Chris Lattner da46f3b5da First half of a fix for the "objc message send in initializer" bug. This only
handles message sends with typenames to start with.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46366 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 19:37:24 +00:00
Fariborz Jahanian 1dad5b2f0e Diagnose bad receiver type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46358 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 17:43:39 +00:00
Nate Begeman d47d4f518e Support checking and codegen of constant vector globals
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46343 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 05:34:48 +00:00
Steve Naroff a99603333f Replace Sema::CheckVariableInitList, CheckConstantInitList, and CheckForCharArrayInitializer with CheckInitializerListTypes. The new routine now supports struct/union initializers.
This is a modified version of a patch by Eli Friedman. This version passes all of the clang tests and supports vectors:-)

Note that Eli and I are still unsatisfied the implementation of CheckInitializerListTypes(). We'd like to find a more elegant implementation. Nevertheless, this is a complex part of the standard (and may be hard to simplify). Since the complexity is localized to this routine, we can iterate without too much disruption:-)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 00:51:06 +00:00
Chris Lattner 0cbc215ccd Fix a bug recovering from broken code with a goto that Eli reported.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46336 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-25 00:01:10 +00:00
Fariborz Jahanian 7da8d94cb7 Fixed a nasty bug which took a while to come up with a test case,
diagnose, and took even longer to fix. It has to do with rewriting of a message
receiver which is an 'ivar' reference. Fix, however, is to remove a code which
was not doing the right thing and no longer needed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-23 20:34:40 +00:00
Chris Lattner 116a4b148e add support for -Wundef.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46274 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-23 17:19:46 +00:00
Fariborz Jahanian 7d6b46d9a9 Problem with ObjC's type-encoding of nested structs causing infinit recursion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46260 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 22:44:46 +00:00
Lauro Ramos Venancio a0c5d0eace Implement bitfield write.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46258 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 22:36:45 +00:00
Lauro Ramos Venancio 3b8c22d93d Implement bitfield read.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 20:17:04 +00:00
Chris Lattner c21d9e4766 Fix PR1936, a crash on malformed #if. Thanks to Neil for
noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-22 19:34:51 +00:00
Steve Naroff ca107309ff Sema::CheckInitializerTypes(). Start simpliying and cleaning up...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 23:53:58 +00:00
Fariborz Jahanian 2338d58a90 Elimate bogus warning when va_start is correctly used in
a method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46232 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 22:59:53 +00:00
Lauro Ramos Venancio 2c46ce8de9 Simplify the bitfield codegen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46230 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 22:54:57 +00:00
Fariborz Jahanian 7c39ff7eb3 Synthesize methods with va-arg list correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46212 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-21 20:14:23 +00:00
Steve Naroff 20ebf8f15d Fix two bugs with an @throw that doesn't have a statement.
- ObjCAtThrowStmt::getSourceRange() needs to check if it has a statement (and not go "boom":-)
- RewriteTest::RewriteObjCThrowStmt() needs to generate refer to the current exception. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46184 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-19 00:42:38 +00:00
Steve Naroff 9a75f8ae17 Sema::FinalizeDeclaratorGroup(): Tighten up the tentative definition rule when dealing with arrays.
Bug submitted by Eli.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46179 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 20:40:52 +00:00
Anders Carlsson a46b759d55 Assert that the type of the cast is equal to the _unqualified_ type of the subexpression. Fixes a problem spotted by Nuno Lopes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46158 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 02:25:57 +00:00
Steve Naroff d3cd1e56d1 Sema::FinalizeDeclaratorGroup()...make sure we emit an diagnostic for tentative definitions with incomplete types. Touch up all test cases that are effected.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46152 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 00:39:39 +00:00
Fariborz Jahanian 7c453b3ded Don't ICE on missing interface declaration when declaring one of its protocols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46141 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 20:33:24 +00:00
Steve Naroff 1b4a6227f3 Declarator::clear(): Null out variable after it's been deleted.
This avoids a double free (which is good:-)

Bug submitted by Eli.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-17 00:36:28 +00:00
Steve Naroff 67c49e892b Type::isArithmeticType(): disallow incomplete enum decls.
Bug submitted by Eli.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46102 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 23:54:22 +00:00
Chris Lattner 1e0a390124 Move promoteExprToType from being a static method in SemaExpr.cpp to being
a method named ImpCastExprToType in Sema.

Use this method to insert implicit casts for case statements from their 
operand type to the condition type of the switch.  This fixes a crash on
test/CodeGen/statements.c, reported by Eli Friedman.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46083 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 19:17:22 +00:00
Steve Naroff 837618c094 Sema::MergeFunctionDecl()...make sure diagnostic is accurate (wrt function declarations/definitions). Patch by Carl Lewis!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-16 15:01:34 +00:00
Fariborz Jahanian e8d1c05794 Added support for rewriting of continue/break statements inside ObjC2's foreach-stmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46037 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 23:58:23 +00:00
Steve Naroff dfb9bbbb7c Finish up handling all permutations of "complex int" (in Sema::UsualArithmeticConversions()).
A FIXME remains to verify the conversion rules are consistent with GCC.

Thanks to Eli for the new/improved test case...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46022 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 22:21:49 +00:00
Steve Naroff 02f62a9fed - Change Type::isComplexType() to exlude GCC's complex integer extension. In general, we will keep the lowest level Type predicates "pure" (i.e. true to the C99 spec).
- Modify Sema::UsualArithmeticConversions() to work with the new definition of Type::isComplexType().

This is a nice cleanup and also fixes a bug submitted by Eli (which I've added to the test suite).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 19:36:10 +00:00
Chris Lattner b1a17ae9d3 avoid pasting L + "foo" into L"foo".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46000 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 05:22:14 +00:00
Steve Naroff 4cdec1c3ca Rework commit r45976, which was incorrect.
- Add Type::isComplexIntegerType(), Type::getAsComplexIntegerType().
- Don't inlude complex types with Type::isIntegerType(), which is too general.
- Use the new predicates in Sema::UsualArithmeticConversions() to recognize/convert the types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45992 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-15 01:41:59 +00:00
Steve Naroff 14f3f1b80e Make sure Sema::GetTypeForDeclarator() deals with abstract declarators when diagnosing incorrect code.
Bug submitted by Eli.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 23:33:18 +00:00
Steve Naroff 3f0c5adc2f Teach Type::isIntegerType() about GCC's __complex__ integer extensions...
Bug submitted by Eli.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45976 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 21:38:57 +00:00
Steve Naroff adbbd0c625 Fix crasher when redefining functions. Not 100% pleased with this solution, but it is clearly an improvement. Will discuss with Chris later.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45975 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 20:51:29 +00:00
Steve Naroff e9b12198c4 Record if a compound literal expression is @ file scope. This allows us to implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable.
Bug/patch by Eli Friedman!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45966 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 18:19:28 +00:00
Steve Naroff aa58f00ebb Revert r45951, Chris says it violates the C99 spec.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45961 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 16:10:57 +00:00
Anders Carlsson e4707ff0bb Add codegen upport for implicit casts to aggregate exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45954 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 06:28:57 +00:00
Chris Lattner 1adb88370b Fix ASTContext::typesAreCompatible when analyzing a function type with
proto and function type without proto.  It would never call 
'functionTypesAreCompatible' because they have different type classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45952 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 05:45:46 +00:00
Steve Naroff aaffbf7c79 Rewrite Expr::isNullPointerConstant() to deal with multiple levels of explicit casts.
Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0"



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 02:53:34 +00:00
Steve Naroff 08f1967167 Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.
Remove diagnostics from Sema::CheckIndirectionOperand(). C89/C99 allow dereferencing an incomplete type. clang appears to be emulating some incorrect gcc behavior (see below).

void
foo (void)
{
 struct b;
 struct b* x = 0;
 struct b* y = &*x; // gcc produces an error ("dereferencing pointer to incomplete type")
}

With this patch, the above is now allowed.

Bug/Patch by Eli Friedman!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-13 17:10:08 +00:00
Chris Lattner 1423ea4146 Tighten up handling of __func__ and friends: it should be an array
of const char, and it should error if it occurs outside a function.

Is it valid in an objc method?  If so we should handle that too.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45910 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 18:39:25 +00:00
Chris Lattner fa28b30d5a Fix the type of predefined identifiers like __func__. Patch by
Eli Friedman!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45906 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-12 08:14:25 +00:00
Fariborz Jahanian 20552d2842 Recover from user typo not having proper @interface decl and a bad foreach decl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45839 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 20:33:58 +00:00
Fariborz Jahanian a12a75faa6 Remove non-ascii chaaracter from diagnostic
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45836 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 18:10:31 +00:00
Fariborz Jahanian 94cdb25a49 Warn (as gcc does) when @end does not close anything.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45834 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 17:58:07 +00:00
Fariborz Jahanian d577b5e4a5 Pass rewritten output to 'clang' for verification.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45794 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 00:30:24 +00:00
Fariborz Jahanian 7571228ec9 Allow messaging expression as foreach's collection expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-10 00:24:29 +00:00
Steve Naroff ffce4d572d Fix Sema::ActOnDeclarator() to call MergeFunctionDecl for function decls that aren't in scope. Since C functions are in a flat namespace, we need to give them special treatment (when compared with variables and typedefs).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45789 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 23:34:55 +00:00
Steve Naroff 4a74678ed6 Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 6.7.2.2p4).
Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45784 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 22:43:08 +00:00
Steve Naroff 58d1821279 Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45782 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 20:58:06 +00:00
Chris Lattner 19009e6fe7 implement proper support for _Bool in memory, which is usually i8, not i1.
This fixes a crash reported by Seo Sanghyeon


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 18:47:25 +00:00
Fariborz Jahanian 88f50f31d8 Type-cast RHS of assignment to prevent warning compiling rewritten foreach code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 18:15:42 +00:00
Fariborz Jahanian 3f76f2aa6e Fixed a bug whereby a parethesized collection expression was not being rewritten correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45776 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 17:50:00 +00:00
Fariborz Jahanian 7f93ce9e30 Another test case for testing rewriteing of nested foreach-statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45769 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 00:47:02 +00:00
Fariborz Jahanian 388601228d Remove dependency on objc.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 00:33:05 +00:00
Steve Naroff b8f13a8baf Teach Expr::isConstantExpr() about CompoundLiterals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-09 00:05:37 +00:00
Fariborz Jahanian 33b9c4e4c6 Patch to rewrite ObjC2's foreach-stmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 22:06:28 +00:00
Steve Naroff b6d54e56a5 Fix Sema::CheckConditionalOperands(). The null pointer constant checks need to precede the check for two pointer operands.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45732 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 01:11:38 +00:00
Chris Lattner 4d73046173 Fix a nasty corner case that Neil noticed in PR1900, where we would
incorrectly apply the multiple include optimization to files with 
guards like:

#if !defined(x) MACRO

where MACRO could expand to different things in different contexts.
Thanks Neil!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 19:50:27 +00:00
Fariborz Jahanian 540fc539b9 Limit type of foreach's element and collection to be a pointer to
objc object type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 18:14:04 +00:00
Fariborz Jahanian 8ce5da3064 Issue diagnostics if more than one declaration in objectove-c's foreach-stmt header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 17:52:35 +00:00
Chris Lattner b7b6115932 add comments for the various AssignConvertType's, and split int->pointer from pointer->int.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 18:22:42 +00:00
Chris Lattner 5cf216b7fa Merge all the 'assignment' diagnostic code into one routine, decloning
it from several places.  This merges the diagnostics, making them more
uniform and fewer in number. This also simplifies and cleans up the code.

Some highlights:
1. This removes a bunch of very-similar diagnostics.
2. This renames AssignmentCheckResult -> AssignConvertType
3. This merges PointerFromInt + IntFromPointer which were always treated the same.
4. This updates a bunch of test cases that have minor changes to the produced diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45589 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 18:04:52 +00:00
Fariborz Jahanian 1f990d67c2 Patch to add semantics check for ObjC2's foreacn statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 00:27:46 +00:00
Chris Lattner 4667ac39be generalize some of the conversion warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 23:38:43 +00:00
Chris Lattner c992b4aff5 update for changes in diagnostic strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 23:36:08 +00:00
Chris Lattner bfe639e4d3 give better diagnostics for converting between function pointer and void*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 22:56:36 +00:00
Fariborz Jahanian 9d3185e840 Fixed a bug reported by Chris, involving assiging 0 to a qualified object type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45542 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 18:46:52 +00:00
Chris Lattner 8f925280ab Fix a crash reported by Seo Sanghyeon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45530 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 06:36:51 +00:00
Chris Lattner 529bd02aff When promoting array to pointer for argument, don't lose type qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 22:50:48 +00:00
Chris Lattner efdd1574e3 Fix PR1895: a crash on an ugly gcc extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45505 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 21:54:09 +00:00
Fariborz Jahanian 0de2ae28c6 Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45491 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 19:17:38 +00:00
Fariborz Jahanian 0ba0aa1460 Prevent crash on incorrect objc messaging expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 18:09:46 +00:00
Nate Begeman 4119d1aeca Allow implicit casts during arithmetic for OCUVector operations
Add codegen support and test for said casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 02:59:45 +00:00
Nate Begeman aabbb12dcb Rename stats to print-stats to avoid conflicting with llvm's
stats statistic when clang is built as a dylib.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45441 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-30 01:38:50 +00:00
Christopher Lamb 22c940ee58 Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45395 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 05:02:41 +00:00
Chris Lattner 1e571444b9 add a file I forgot to svn add.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45374 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 21:46:27 +00:00
Chris Lattner cda459ec79 use -emit-llvm-bc
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45372 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 20:35:58 +00:00
Chris Lattner 6d0747d6be no need to verify this, no errors/warnings are expected.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45371 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 20:31:56 +00:00
Chris Lattner 516bd467c2 Fix a crash on a top-level objc string, patch by Nico Weber
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45370 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 20:29:42 +00:00
Chris Lattner cb53b361bc - Use Tok.isObjCAtKeyword instead of Tok.getIdentifierInfo()->getObjCKeywordID().
The later fails if the token is not an identifier.
 - Replace tabs with spaces.
 - Various other cleanups.

Patch by Nico Weber!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45368 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 19:57:00 +00:00
Seo Sanghyeon 9bb947adc5 Remove broken assert from CodeGen. Better check is done in Sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45358 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-26 05:21:37 +00:00
Seo Sanghyeon ad6ebd6efc String literal in aggregate expression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45330 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-23 03:11:58 +00:00
Fariborz Jahanian dc5c01b219 Another test case, testing a variety of objective-c type comparisons.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45302 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-22 00:17:49 +00:00
Fariborz Jahanian 7b5e1b839e Another test for objective-c's type comparison.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45301 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 23:48:59 +00:00
Fariborz Jahanian 4c71f1a58e This patch implements some of the more obscure type-checking involving
'id' quallified with protocols and static types which have categories and
inheritance which implement these protocols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45294 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 22:22:33 +00:00
Devang Patel 3c40085b37 Convert opaque type when struct definition is seen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45287 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 19:35:28 +00:00
Fariborz Jahanian b145e7dede Patch to compare to objective-c static types where one or the other
(but not both) may be a protocol qualified static type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45283 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 17:34:43 +00:00
Fariborz Jahanian 88d752103b Test case for my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45277 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 00:35:35 +00:00
Fariborz Jahanian cfc8738b8a Another test for objective-c type comparison.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45271 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 22:53:29 +00:00
Fariborz Jahanian 0f01debd47 More objective-c type checking. This time comparing objective-c known objects.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45269 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 22:37:58 +00:00
Fariborz Jahanian c395bda57a Patch to do type-checking for objctive-c's object types.
More is yet to come.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45263 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 19:24:10 +00:00
Chris Lattner 1b9a079395 implement semantic analysis for __builtin_islessequal and friends.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45239 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-20 00:26:33 +00:00
Chris Lattner 2243449253 Add support for #pragma mark, which shouldn't warn about bogus tokens.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45212 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 19:38:36 +00:00
Fariborz Jahanian cf5f931a5b Minor test twik.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45208 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 19:07:24 +00:00
Chris Lattner 68cfd49ea3 reenable this code, fix the testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45205 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 18:01:43 +00:00
Fariborz Jahanian 411f373abf This patch concludes implementation of dynamic objective-c type qualified by
protocol list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45203 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 17:45:58 +00:00
Chris Lattner cd8812948b Implement C99 6.7.5.3p1
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45188 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 05:31:29 +00:00
Fariborz Jahanian d58fabf7ed Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45174 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 21:33:44 +00:00
Chris Lattner 2b9d2ca4ce local static vars are globals also. This fixes a testcase
reported by Seo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45156 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 08:16:44 +00:00
Chris Lattner 65383479cb Fix the location we emit the "not a constant" error for this:
int foo() {
  typedef int x[foo()];
  static int y = sizeof(x);
}

previously we'd emit it on the typedef, which made not sense at all.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45154 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 07:15:40 +00:00
Chris Lattner d7d860d97a Fix an nice and subtle parser bug reported by Nico Weber.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45149 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 06:06:23 +00:00
Steve Naroff b99a4a3630 Fixe bogus error for variable argument methods. Sema::ObjcGetTypeForMethodDefinition() wasn't preserving the isVariadic boolean. Another fix is to avoid synthsizing the function decl entirely, however this is a separate issue that I don't want to deal with now. Also added a FIXME to Sema::CheckFunctionCall(), which is currently emitting a bogus warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45146 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 03:41:15 +00:00
Steve Naroff a56f616744 Improve how we find private method decls. This involved:
- Changed Sema::ObjcActOnStartOfMethodDef() to register the methods with the global pools.
- Changed Sema::ActOnInstanceMessage() to look in global pools (should be much less error prone).
- Added a test case to message.m (for lookup that was broken).

Misc changes while I was investigating this...

- Changed Sema::ActOnAtEnd() to call AddFactoryMethodToGlobalPool (this looked like a cut/paste error).
- Added a comment and tweaked another where I was using the first person.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45142 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 01:30:32 +00:00
Fariborz Jahanian c569249ca0 Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45121 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 21:03:50 +00:00
Ted Kremenek 4a33646560 Modified format-string checking to not emit a warning when all of the
following hold:

(1) A vprintf-like function is called that takes the argument list via a
    via_list argument.

(2) The format string is a non-literal that is the parameter value of
    the enclosing function, e.g:
    
    void logmessage(const char *fmt,...) { 
      va_list ap;
      va_start(ap,fmt);
      fprintf(fmt,ap);  // Do not emit a warning.
    }
    
In the future this special case will be enhanced to consult the "format"
attribute attached to a function declaration instead of just allowing a blank
check for all function parameters to be used as format strings to vprintf-like
functions. This will happen when more support for attributes becomes
available.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45114 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 19:03:13 +00:00
Steve Naroff 3cc4af8018 Sema::ActOnMemberReferenceExpr() needs to perform the default conversions.
Bug and test case provided by Carl Lewis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45078 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-16 21:42:28 +00:00
Seo Sanghyeon 9b73b39f6f Array subscription in aggregate expression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 02:04:12 +00:00
Seo Sanghyeon 7777bb263f Implement dereference operator in aggregate expression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45020 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-14 01:09:11 +00:00
Chris Lattner 1dcf2c8c3b Don't do integer promotions of LHS for compound shift assignment. The LHS has to be a modifiable lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44993 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13 07:28:16 +00:00
Fariborz Jahanian 4319b8437d Fixed test to match the new diagnostic text.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44966 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-13 00:16:34 +00:00
Fariborz Jahanian 79a99f2c06 Concatenation of objc strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44964 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 23:55:49 +00:00
Chris Lattner beb663677a Unbreak -stats on cocoa.h
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44919 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 06:43:05 +00:00
Chris Lattner a027b86f70 add run lines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44918 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 06:22:14 +00:00
Chris Lattner 4c88d3a71f add run line
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44917 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 06:20:40 +00:00
Chris Lattner 5113613c5b add runline, make this test real.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44916 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 06:20:18 +00:00
Chris Lattner 32a3999c62 verify that tests contain RUN lines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44915 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 06:19:22 +00:00
Chris Lattner a9e6372208 Fix a codegen crash on test/CodeGen/cast.c, reported by Keith.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44908 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 04:13:20 +00:00
Chris Lattner 4619366f8e fix expected errors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44901 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 01:15:04 +00:00
Fariborz Jahanian 2d6410dc91 Add -pedantic so test passes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44900 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 01:06:09 +00:00
Chris Lattner b3a99cd5bc Add ObjC parser support for concatenated ObjC strings. Note that
this is passed to sema and ignored there, so the second part of the
string will not make it into the AST.  Passing to Fariborz to finish
Sema + AST construction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44898 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 01:04:12 +00:00
Fariborz Jahanian 4ffc54111f Implemented type checking for pointer of objects of protocol-qualified types.
Note that incompatible-protocol-qualified-types.m is currently failing. This is
unrelated to this patch and Steve is looking at the general problem of not reporting
incompitible pointer types in return stetement..


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44897 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 01:00:23 +00:00
Fariborz Jahanian 61477f7a4c Implemented rewriting of protocol-qualified global variable types.
Re-implemented some of rewriting of protocol-qualified function 
argument types to support it in its generality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44886 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 22:50:14 +00:00
Devang Patel fe2419aac4 Match union field type when member expression is u->x
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44879 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 21:33:16 +00:00
Fariborz Jahanian 0105556097 For @optional unimplemented methods do not issue the warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44872 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 19:10:26 +00:00
Fariborz Jahanian f366b4c844 Fixed a parsing bug whereby @optional/@required keyword is not followed by
a method declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44870 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 18:34:51 +00:00
Steve Naroff a924e7c06d - Tweak several tests to be compatible with my last commit.
- Add a test to message.m for an unusual case for GCC compat (as suggested by Chris).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44842 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 03:34:41 +00:00
Chris Lattner df5eb710ce Reimplement support for strings that initialize global inits now that
the types are right in sema.  Thanks Steve.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44834 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 01:38:45 +00:00
Devang Patel 6e8df73693 Add support to share llvm fields for bit-fields.
For example, struct { char a; short b:2; };


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44830 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 00:49:18 +00:00
Steve Naroff 32150f3247 Explicitly set the string literal type from "char *" to "constant array of char".
At this point, I am fairly certain the front-end is correct. Unfortunately, the back-end is still unhappy.

That said, I've commented out the two lines in globalinit.c that are causing problems.

Chris, please have a look...thanks!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44823 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-11 00:00:01 +00:00
Steve Naroff 2fdc374909 Add support for initializing char arrays from string literals.
Adapted from a patch by Anders Carlsson.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44816 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 22:44:33 +00:00
Chris Lattner 4fd46bc651 add support for implicit cast from array to pointer that is not the element
type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44809 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 19:50:32 +00:00
Chris Lattner 53ea781156 disable case that makes this fail.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44807 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 19:44:50 +00:00
Devang Patel 14c7500b8c Use getABITypeSizeInBits() instead of getTypeSizeInBits() during struct layout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44798 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 18:25:34 +00:00
Chris Lattner 5ccc7011e6 extend or truncate the initializer for a string initializer to match its type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44751 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-10 00:00:56 +00:00
Chris Lattner a44cf73c74 Implement codegen support for:
char text[8] = "string";

Big fixme remains.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44750 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 23:49:42 +00:00
Chris Lattner 6e4ab61300 Implement correct semantic analysis of subtractions, implementing
C99 6.5.6.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44746 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 21:53:25 +00:00
Chris Lattner 5f1803210b The flags on tokens indicate whether they are the start of a *physical* line,
not the start of a logical line.  Be careful about this distinction, which 
affects when newlines are printed and when paste-avoidance happens, etc.  
This fixes PR1848, thanks to Neil for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44743 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 21:11:08 +00:00
Chris Lattner 2ea81a84e2 implement support for functions that initialize globals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 00:36:01 +00:00
Fariborz Jahanian c92942c5fe Test case for my last patch for implementation of static protocoled type
used as reciver type of a message expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44693 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-08 01:00:55 +00:00
Fariborz Jahanian 36ee2cb324 Patch for rewriting of @protocol.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44681 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 18:47:10 +00:00
Fariborz Jahanian 66c5dfc193 Patch to implement "Protocol" as a built-in type declared as
"@class Protocol;"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44670 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-07 00:18:54 +00:00
Devang Patel 37884b3b3a More struct bitfields layout work. Now handle,
struct STestB1 {char a; char b:2; } stb1;
struct STestB2 {char a; char b:5; char c:4} stb2;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44664 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 19:16:05 +00:00
Fariborz Jahanian d20f1768ac test case for my very last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44662 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 17:43:04 +00:00
Chris Lattner ec584d6f64 Fix a bug handling typedefs of functions, patch by Nuno Lopes!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44661 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-06 17:20:20 +00:00
Fariborz Jahanian 5ef404f08b Patch to prevent crash on use of objc2 syntax.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44617 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 18:16:33 +00:00
Fariborz Jahanian 7127431a1d Changed type-cast of "struct objc_super"'s 2nd initializer to match definition of
"struct objc_super".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44616 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 17:29:46 +00:00
Steve Naroff e638639467 Recognize CompoundLiteralExpr's as valid lvalue's.
Also updated a FIXME in Sema::CheckInitializer()...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44602 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 04:00:10 +00:00
Fariborz Jahanian e2c4cd8998 Test case for my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44581 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 21:48:54 +00:00
Fariborz Jahanian 87ce5d1cb9 Fixed a bug exposed by referencing an ivar field using component reference syntax.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44553 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 22:25:42 +00:00
Ted Kremenek ae3607684c Implemented initial support for "-triple" option to the clang driver. This
replaces the functionality previously provided by just "-arch" (which is still
supported but has different semantics).

The new behavior is as follows:

(1) If the user does not specify -triple:

   (a) If no -arch options are specified, the target triple used is the host
   triple (in llvm/Config/config.h).
   
   (b) If one or more -arch's are specified (and no -triple), then there is
       one triple for each -arch, where the specified arch is substituted
       for the arch in the host triple.  Example:
          host triple = i686-apple-darwin9
          command: clang  -arch ppc -arch ppc64 ...
          triples used: ppc-apple-darwin9  ppc64-apple-darwin9
          
(2) The user does specify a -triple (only one allowed):

  (a) If no -arch options are specified, the triple specified by -triple
      is used.  E.g clang -triple i686-apple-darwin9
      
  (b) If one or more -arch options are specified, then the triple specified
      by -triple is used as the primary target, and the arch's specified
      by -arch are used to create secondary targets.  For example:
      
      clang -triple i686-apple-darwin9 -arch ppc -arch ppc64
      
      has the following targets:
         i686-apple-darwin9  (primary target)
         ppc-apple-darwin9
         ppc64-apple-darwin9


Other changes related to the changes to the driver:

- TargetInfoImpl now includes the triple string.

- TargetInfo::getTargetTriple returns the triple for its primary target.

- test case test/Parser/portability.c has been updated because "-arch linux" is
  no longer valid ("linux" is an OS, not an arch); instead we use a bogus
  architecture "bogusW16W16" where WCharWidth=16 and WCharAlign=16.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44551 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 22:06:55 +00:00
Chris Lattner 0d6ca11db0 Fix an ast-print/ast-dump bug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44550 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 21:43:25 +00:00
Bill Wendling 43d69750e7 Fix for testcase that assigns a dereferenced reference to a pointer. The
standard says that we should adjust the "reference to T" type to "T"
before analysis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44530 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 07:33:35 +00:00
Seo Sanghyeon ec86b97c34 Ignore typedefs in pointer arithmetic codegen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44529 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-03 06:23:43 +00:00
Seo Sanghyeon 2de3b3a4ac Fix isStructureType and isUnionType to ignore typedefs, as stated
in the header. Patch by Cédric Venet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44519 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 16:57:27 +00:00
Christopher Lamb ce39faa836 Treat discarding array initializer elements as an extwarn (so -pedantic-errors flags it). Allow CodeGen to truncate the initializer if needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44518 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 08:49:54 +00:00
Chris Lattner d411e04db1 all filevar's have static storage. Previously a global with
extern storage class was returning false from hasStaticStorage.
Ted, please review this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44515 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 07:47:49 +00:00
Christopher Lamb e86e9ce200 Commit test for CL 44440.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44514 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 07:47:19 +00:00
Chris Lattner e6e25a5458 Fix buggy test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44513 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 07:46:00 +00:00
Chris Lattner 9615bf855a add codegen support for global inits that require array decay.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44511 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 07:30:13 +00:00
Chris Lattner 9cd4fe4af6 Handle global variable definitions which change the type of a definition, such as:
extern int x[];
void foo() { x[0] = 1; }
int x[10];
void bar() { x[0] = 1; }



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44509 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 07:09:19 +00:00
Chris Lattner 58c3f9ec11 implement codegen for functions whose function body type don't match
their prototype.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44506 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 06:27:33 +00:00
Oliver Hunt 2824723d6d Support initalisers for more than just int-typed static variables.
We now use the CodeGenModule logic for generating the constant 
initialiser expression, so happily further initialiser fixes should 
automatically work for statics as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44495 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-02 00:11:25 +00:00
Chris Lattner 1438b4918a fix a couple switch codegen problems Oliver reported.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44484 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 05:27:33 +00:00
Anders Carlsson 3907323dd6 GCC has an extension where the left hand side of the ? : operator can be omitted. Handle this in a few more places.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44462 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 19:04:31 +00:00
Chris Lattner 3e47be5c90 fix a bug handling typedefs in member expr codegen. Patch
by Seo Sanghyeon


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44455 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 18:02:19 +00:00
Chris Lattner 2202bce80f Fix a codegen crash on void ?: reported by Oliver
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44454 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 17:56:23 +00:00
Chris Lattner c69a5810f4 Support fully general case expressions, patch by Sanghyeon Seo!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44453 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 17:44:57 +00:00
Christopher Lamb fbd91735c8 Doh! Check in this long overdue test fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44450 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 06:35:48 +00:00
Anders Carlsson 695dbb697d Support lax vector conversions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44449 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 04:21:22 +00:00
Ted Kremenek 502654085f Added "complex.c" (a copy of test/Codegen/complex.) to the serialization
test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44439 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 19:05:51 +00:00
Christopher Lamb 016765e345 Support floating point literals of the form "1e-16f" which specify an exponent but no decimal point.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44431 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 06:06:27 +00:00
Ted Kremenek b594a40589 Fixed test case to not expect a warning when one should not be emitted.
Removed redundant test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44426 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 01:03:21 +00:00
Ted Kremenek 9e7f0ecab9 Added test cases for -Wfloat-equal to test comparisons against literals that can be
represented exactly and inexactly by APFloats. For the former, we do not emit a
warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44425 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-29 01:00:11 +00:00
Ted Kremenek 251f7325b3 Inlined test case to make it independent of the stmt_exprs test case in test/Sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44416 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 21:29:54 +00:00
Ted Kremenek efb71539a7 Added the "Serialization" test directory to the set of tests executed.
Introduced a few line breaks to make the Makefile easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44413 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 19:24:15 +00:00
Ted Kremenek f387aeb136 Added initial test case for testing serialization of ASTs. This test
case simply performs --test-pickling on the code found in Sema/stmt_exprs.c.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44412 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 19:23:15 +00:00
Ted Kremenek 6a18c7689b Changed TestRunner.sh to dump the output and generated script files in
subdirectories mirroring where the test case file is located

For example, for the test case "Sema/stmt_exprs.c", instead of the files
"Output/stmt_exprs.c.out" and "Output/stmt_exprs.c.out.script" being created, the
files "Output/Sema/stmt_exprs.c.out" and "Output/Sema/stmt_exprs.c.out.script" are
created. This prevents any collisions from different test directories that have the
same file name for a test case, and also makes it clear where the test case was
drawn from.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 19:16:54 +00:00
Ted Kremenek 83c903f1ab Added missing "RUN:" to comment for test case file. This fixed a bug where the test
case testing the frontend's support of statement expressions was not being
executed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44409 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 19:05:11 +00:00
Chris Lattner b751c28a1a Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
Bug pointed out by Michael Zolda, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 18:51:29 +00:00
Oliver Hunt 0d3b50ec86 Fix typo in writable string test
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44398 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 06:52:03 +00:00
Oliver Hunt 01acb91aff Adding code gen tests for writable and shared string literals.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44397 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 06:27:12 +00:00