Commit Graph

1143 Commits

Author SHA1 Message Date
Douglas Gregor aa1e21dcbd Give string literals const element typesin C++, and cope with the deprecated C++ conversion from a string literal to a pointer-to-non-const-character
llvm-svn: 56137
2008-09-12 00:47:35 +00:00
Daniel Dunbar 484603be40 Iterate on sema for :? in Objective-C:
- Follow C99 behavior of using other operand type when one of
   operands is a null pointer constant.
 - Fix overenthusiastic devolving of any Objective-C types to id:
   o If either operand has an Objective-C object type then:
     - If both operands are interfaces and either operand can be
       assigned to the other, use that type as the composite type.
     - Otherwise, if either type is id, use id as the composite type.
     - Otherwise, warn about incompatible types and use id as the
       composite type.
 - Return handling of qualified idea to separate test following
   general pointer type checking.
   o Upgraded from old code to allow devolving to id (without warning,
     which matches GCC).
 - <rdar://problem/6212771>

Add test case for issues fixed above, XFAIL though because it exposed
a new issue in property handling.

llvm-svn: 56135
2008-09-11 23:12:46 +00:00
Argyrios Kyrtzidis 176edb5490 Do implicit conversion to bool for the condition in a do-while statement.
llvm-svn: 56096
2008-09-11 05:16:22 +00:00
Argyrios Kyrtzidis fea38016a9 Fix do-while scoping in C++.
llvm-svn: 56095
2008-09-11 04:46:46 +00:00
Daniel Dunbar ce05c8eb49 Fix two bugs exposed by array passing assert:
(1) Additional arguments to variadic methods should have default
promotions applied.

(2) Additional arguments to non-variadic methods were allowed.

llvm-svn: 56084
2008-09-11 00:50:25 +00:00
Argyrios Kyrtzidis 996677e12d In the 'condition.cpp' test case, make sure that condition declarations are local to the statement.
llvm-svn: 56077
2008-09-10 23:34:50 +00:00
Daniel Dunbar b034bc71d4 Add XFAIL test case for:
<rdar://problem/6211479> [sema] array type invalid for Obj-C property

llvm-svn: 56075
2008-09-10 23:11:23 +00:00
Steve Naroff 2752a17a00 More semantic analysis for blocks...
llvm-svn: 56064
2008-09-10 19:17:48 +00:00
Steve Naroff 3ef15b5c2a Sema::ActOnIdentifierExpr(): Lookup block arguments.
llvm-svn: 56063
2008-09-10 18:33:00 +00:00
Argyrios Kyrtzidis 07052350f0 Implement CodeGen support for the 'CXXConditionDeclExpr' expression node, which represents a 'condition' declaration, e.g: "if (int x=0) {...}".
llvm-svn: 56045
2008-09-10 02:36:38 +00:00
Argyrios Kyrtzidis 7620ee4550 Implement Sema support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
llvm-svn: 56044
2008-09-10 02:17:11 +00:00
Argyrios Kyrtzidis f602e427e9 Fix test case.
llvm-svn: 56012
2008-09-09 20:56:12 +00:00
Argyrios Kyrtzidis 2b4072fe55 Implement parser support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
Add new 'ActOnCXXConditionDeclarationExpr' action, called when the 'condition' is a declaration instead of an expression.

llvm-svn: 56007
2008-09-09 20:38:47 +00:00
Daniel Dunbar 0beedc1684 Fix a number of issues w.r.t. emission of global for functions and
aliases.
 - Attributes specific to a definition are only set when the
   definition is seen.
 - Alias generation is delayed until the end of the module; necessary
   since the alias may reference forward.
 - Fixes: PR2743, <rdr://6140807&6094512>
 - Improves: <rdr://6095112> (added XFAIL)

Also, print module on verification failures.

llvm-svn: 55966
2008-09-08 23:44:31 +00:00
Daniel Dunbar 47be094138 Add missing RUN line
llvm-svn: 55934
2008-09-08 18:01:15 +00:00
Nuno Lopes fc8c680b89 skip test if llvm-gcc is requires but not found on the path.
someone with llvm-gcc installed please test if the Codegen/function-attributes.c test isn't skip in your system. thanks.

llvm-svn: 55871
2008-09-06 16:42:14 +00:00
Steve Naroff 8de9c3affe More type checking for blocks. Still incomplete (will hopefully finish up this weekend).
llvm-svn: 55862
2008-09-05 22:11:13 +00:00
Argyrios Kyrtzidis 2545aeb710 Support "typeof unary-expression" (GNU C++ extension).
llvm-svn: 55833
2008-09-05 11:26:19 +00:00
Argyrios Kyrtzidis 91c3f526dc Line endings: CRLF -> LF
llvm-svn: 55829
2008-09-05 08:53:53 +00:00
Daniel Dunbar 0335024c4a Test case for previous commit (Workaround gcc bug causing crash on our
preprocessed outputs)

llvm-svn: 55826
2008-09-05 03:23:51 +00:00
Daniel Dunbar 2ffee610da Set sext/zext on function result.
- <rdar://problem/6156739>

llvm-svn: 55815
2008-09-05 00:57:45 +00:00
Daniel Dunbar 98982ef954 Fix unintended use of doxygen comment strings.
llvm-svn: 55805
2008-09-04 21:54:53 +00:00
Ted Kremenek 72c06446bb Added test case for the dead stores checker that was originally an FP reported in PR 2763.
llvm-svn: 55801
2008-09-04 21:52:52 +00:00
Daniel Dunbar c7dfbfd544 Prevent invalid warnings about incomplete implementations for methods
which are inherited from base clases or protocols.

llvm-svn: 55790
2008-09-04 20:01:15 +00:00
Nuno Lopes 92c4bc8873 fix running tests with valgrind (there were a lot of bogus failures and warnings)
currently clang passes all tests under valgrind with the leak checker disabled :P (and fails most otherwise)

llvm-svn: 55782
2008-09-04 18:33:57 +00:00
Daniel Dunbar c01f56c8de Add some Objective-C code generation tests.
- Note that these don't really test anything other than that code
   generation doesn't fail or crash. Better than nothing though!

llvm-svn: 55761
2008-09-04 04:36:23 +00:00
Daniel Dunbar 8cde00a510 Implement codegen of aggregates as lvalues in binary expressions,
e.g. "(a = b).somefield".

llvm-svn: 55758
2008-09-04 03:20:13 +00:00
Daniel Dunbar 0f99912868 Update TestRunner to not report failure for XFAIL tests
llvm-svn: 55751
2008-09-04 00:30:11 +00:00
Daniel Dunbar 0ff4192f3a Set register storage class correctly for function parameters.
- PR2730

llvm-svn: 55739
2008-09-03 21:54:21 +00:00
Ted Kremenek b44763456c Following gcc's behavior, only enable trigraphs if '-trigraphs' or '-ansi' is
specified, or -std is set to a conforming mode.

llvm-svn: 55738
2008-09-03 21:22:16 +00:00
Daniel Dunbar 20e5db77a3 Add two test cases for builtins (mostly related to object size
builtins).

llvm-svn: 55736
2008-09-03 21:17:21 +00:00
Daniel Dunbar de1ec9cdcd Improve type-checking of ?: for Objective-C types.
- Allow any Objective-C object types to devolve to type id in a ?:
   expression. This matches gcc behavior more closely.

llvm-svn: 55705
2008-09-03 17:53:25 +00:00
Daniel Dunbar ef89086c12 Restore Objective-C dot-syntax access of methods.
- Now also searches for correct setter method.
 - There are still some issues regarding validation of the setter
   method and access of read-only properties.

llvm-svn: 55686
2008-09-03 01:05:41 +00:00
Steve Naroff c84e8b779e - Implement __block.
- Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions.

llvm-svn: 55639
2008-09-02 18:50:17 +00:00
Steve Naroff d450bffcf1 Pull code from last commit. will put back soon.
llvm-svn: 55637
2008-09-02 18:04:36 +00:00
Steve Naroff 95bffc74da Implement block pseudo-storage class modifiers (__block, __byref).
llvm-svn: 55635
2008-09-02 15:20:19 +00:00
Nuno Lopes dd30e2c677 add the other test case for completeness and to avoid regressions in the future
llvm-svn: 55629
2008-09-02 10:10:14 +00:00
Eli Friedman de09ce03c4 Fix for PR2747: allow pointer->int casts with a null base; these are
offset-of-like expressions.

llvm-svn: 55627
2008-09-02 09:37:00 +00:00
Eli Friedman ee29c9c2fc Fix for PR2750; don't check for an 'e' in the trash after the token.
Note that this isn't really a complete fix; I think there are other 
potential overrun situations.  I don't really know what the best 
systematic fix is, though.

llvm-svn: 55622
2008-09-02 05:29:22 +00:00
Eli Friedman 7c9ba6a1e3 An extremely hacky version of transparent_union support; it isn't
anywhere near correct in terms of missing cases and missing 
diagnostics, but it's good enough to handle the uses in the 
Linux system headers, which are currently a constant pain for compiling 
applications on Linux.

llvm-svn: 55621
2008-09-02 05:19:23 +00:00
Eli Friedman e7175d83dc Make sure to take the unqualified versions of the canonical types for
type-checking pointer subtraction; if the canonical types aren't used,
the qualifiers won't always get stripped off correctly.

llvm-svn: 55620
2008-09-02 05:09:35 +00:00
Nuno Lopes 4e630967fc readd test as it passes correctly. nice, but weird
llvm-svn: 55615
2008-09-01 22:28:55 +00:00
Eli Friedman 4c55e2c4ed Backing out r55607 due to logic errors and test regression.
I'll try to come up with a correct fix for the testcase sometime soon.

llvm-svn: 55614
2008-09-01 22:08:17 +00:00
Ted Kremenek c4f6d90ba1 Tidy up sema processing of attribute "nonull":
- warn about nonnull being applied to functions with no pointer arguments
- continue processing argument list in the attribute when we encounter a non-pointer parameter being marked as nonnull
- when no argument list is specified, only mark pointers as nonnull.  This fixes PR 2732 and radar 6188814.

llvm-svn: 55610
2008-09-01 19:57:52 +00:00
Nuno Lopes 2c5208c59f fix one more this-is-not-a-constant error. test included
llvm-svn: 55609
2008-09-01 18:42:41 +00:00
Nuno Lopes feac637074 make CheckArithmeticConstantExpression() aware of &foo and pointers
llvm-svn: 55607
2008-09-01 14:47:06 +00:00
Daniel Dunbar e0a09432cc Temporarily disable some tests which due to dot-syntax
access of methods.

llvm-svn: 55569
2008-08-30 16:22:34 +00:00
Daniel Dunbar 5888e603c3 Allow 'make TESTDIRS=Sema' in test/ directory for only running a
subset of tests.

llvm-svn: 55513
2008-08-28 23:28:16 +00:00
Steve Naroff 0ac012835f Add parser/action support for block literal expressions.
Parser support for blocks is almost complete...just need to add support for the __block() storage class qualifier.

llvm-svn: 55495
2008-08-28 19:20:44 +00:00
Daniel Dunbar 8c8616377d Fix isIntegerConstantExpr eval of __builtin_offsetof to return result
with correct width.
 - PR2728.

Also, fix PR2727 test case.

llvm-svn: 55493
2008-08-28 18:42:20 +00:00