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

1396 Коммитов

Автор SHA1 Сообщение Дата
Sebastian Redl a5a35e149d Fix missing %s in run string causing hang during tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58394 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 19:29:09 +00:00
Ted Kremenek 4f03fd61ee Fix crash reported in PR2923 where a function declared using typeof(another_function) would have FunctionDecl::getNumParams() return the number of parameters in the original function type and not the number of parameters in the actual FunctionDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58392 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 18:41:34 +00:00
Douglas Gregor 6fc17ff5bf Simplify and correct the check for function redefinitions. This does two things:
- Allows definitions of overloaded functions :)
  - Eliminates extraneous error messages when we have a definition of a 
    function that isn't an overload but doesn't have exactly the same type
    as the original.
  



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58382 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 15:10:40 +00:00
Douglas Gregor f70bdb9463 Implement overloading rules for reference binding
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58381 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 14:50:44 +00:00
Douglas Gregor 818ce488be Temporary disable the const-object-declaration-without-initializer check, because it depends on linkage-specifier semantics we don't yet have
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 13:50:18 +00:00
Douglas Gregor 15da57e66c Tweak Sema::CheckReferenceInit so that it (optionally) computes an
ImplicitConversionSequence and, when doing so, following the specific
rules of [over.best.ics]. 

The computation of the implicit conversion sequences implements C++
[over.ics.ref], but we do not (yet) have ranking for implicit
conversion sequences that use reference binding.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58357 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 02:00:59 +00:00
Douglas Gregor 27c8dc06f6 Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:

  - Try/Perform-ImplicitConversion now handles implicit conversions
    that don't involve references.
  - Try/Perform-CopyInitialization uses
    CheckSingleAssignmentConstraints for C. PerformCopyInitialization
    is now used for all argument passing and returning values from a
    function.
  - Diagnose errors with declaring references and const values without
    an initializer. (Uses a new Action callback, ActOnUninitializedDecl).
  
We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 00:13:59 +00:00
Daniel Dunbar af668b0e7d Add attribute always_inline support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58304 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-28 00:17:57 +00:00
Mike Stump 1a19c29965 Skip random pathname characters better. I had a 5 in mine.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58291 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 22:49:55 +00:00
Daniel Dunbar 1c90363e9c Add test case to exercise IRgen "unsupported" path (mostly cleanup).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 22:11:01 +00:00
Ted Kremenek c532f633a9 Add 'expected-warning' for braces around scalar initializer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 22:00:16 +00:00
Ted Kremenek 194aade5a0 Added compound literal test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58279 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 21:57:17 +00:00
Douglas Gregor 49badde06e Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
  - ImplicitCastExpr is (still) used for all explicit casts
  - ExplicitCastExpr is now the root of all *explicit* casts
  - ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
  - CXXFunctionalCastExpr inherits from ExplicitCastExpr
  - CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
    of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
  - Added classes CXXStaticCastExpr, CXXDynamicCastExpr, 
    CXXReinterpretCastExpr, and CXXConstCastExpr to 

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 19:41:14 +00:00
Sebastian Redl 8b3f6b5c52 Fix some invalid casts that are detected by Sema now or soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58252 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 16:34:21 +00:00
Douglas Gregor 3dda64ec0f When destroying a translation unit, deallocate its owned declarations in reverse order, because there may be dependencies among the declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58244 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 12:50:38 +00:00
Steve Naroff a5ad8631c9 Fix <rdar://problem/6315646> clang on xcode: error: invalid operands to binary expression ('id<NSTableViewDelegate>' and 'XCExtendedArrayController *').
There is still a bug here (as the FIXME in the test case indicates). Prior to this patch, the bug would generate an error. Now, we simply do nothing (which is less harmful until we can get it right). The complete bug fix will require changing ASTContext::mergeTypes(), which I'd like to defer for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 10:33:19 +00:00
Zhongxing Xu 92429ddd87 Add test for SCA region store.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58235 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 09:21:27 +00:00
Zhongxing Xu 234a7d2bf5 Add test for SCA region store.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58234 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-27 09:19:25 +00:00
Chris Lattner 0fc73f722f implement some more FIXMEs, by rejecting more bogus stuff in
objc mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:29:41 +00:00
Chris Lattner 79ed6b5902 add some simple designator testcases. Reject things like this:
struct foo Y[10] = {
  [4] .arr [2] 4  // expected-error {{expected '=' or another designator}}
};

because the "missing equals" extension only is valid if there 
is exactly one array designator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:22:23 +00:00
Ted Kremenek 5b2316a8b6 Do not crash when performing VisitLValue on union types.
This fixes PR 2948.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58148 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 20:09:21 +00:00
Zhongxing Xu 2e971208f4 Add StringLiteral test code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58136 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-25 14:11:23 +00:00
Argyrios Kyrtzidis a596209962 Unbreak the test by.. removing a space. (clang protested that -verify only works on single input files).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58123 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 22:25:11 +00:00
Argyrios Kyrtzidis 971c4fae60 -Add support for cv-qualifiers after function declarators.
-Add withConst/withVolatile/withRestrict methods to QualType class, that return the QualType plus the respective qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58120 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 21:46:40 +00:00
Ted Kremenek f4b3548ac5 This test no longer is marked XFAIL.
Enhance test to include a case where a tracked object escapes because it is stored to a local ivar through a method dispatch to 'self.'


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 20:33:56 +00:00
Douglas Gregor 6cbd3df095 PR2942: FunctionDecls by typedef crash the C++ front-end
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58100 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 18:09:54 +00:00
Douglas Gregor 2f639b9f3c Semantic analysis for C++ reinterpret_cast and const_cast. Patch by Sebastian Redl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 15:36:09 +00:00
Zhongxing Xu 72e1682bbd Add random array and struct test code for SCA.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 08:51:58 +00:00
Daniel Dunbar b451bc1942 Use #define trickery to de-XFAIL test/Coverage/codegen-gnu.m while
still getting coverage for non-IRgen cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 08:42:52 +00:00
Daniel Dunbar 8de8c36fad Use #define trickery to de-XFAIL test/Coverage/codegen-next.m while
still getting coverage for non-IRgen cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 08:39:46 +00:00
Daniel Dunbar ac620decb6 PR2919: __builtin_types_compatible_p strips CRV qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58079 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 08:07:57 +00:00
Douglas Gregor 94b1dd2368 First non-embarrassing cut at checking for ambiguous derived-to-base
conversions.

Added PerformImplicitConversion, which follows an implicit conversion sequence
computed by TryCopyInitialization and actually performs the implicit
conversions, including the extra check for ambiguity mentioned above.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58071 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-24 04:54:22 +00:00
Daniel Dunbar c6cb77f1e5 Fix regression in comparison of qualified id; == operator was being
created with LHS and RHS whose types didn't match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58049 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 23:30:52 +00:00
Ted Kremenek f74675b5bb Temporarily mark this test XFAIL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58024 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 01:57:31 +00:00
Douglas Gregor bc0805a6ca Add support for conversions from a pointer-to-derived to a
pointer-to-base. Also, add overload ranking for pointer conversions
(for both pointer-to-void and derived-to-base pointer conversions).

Note that we do not yet diagnose derived-to-base pointer conversion
errors that stem from ambiguous or inacessible base classes. These
aren't handled during overload resolution; rather, when the conversion
is actually used we go ahead and diagnose the error.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58017 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-23 00:40:37 +00:00
Ted Kremenek 3ad2cc89ab Warn about potentially leaked objects that are returned from methods whose names do not follow the Cocoa Memory Management guidelines.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 23:56:21 +00:00
Steve Naroff 8970feab05 Fix <rdar://problem/6311947> clang on xcode (regression): error: use of undeclared identifier 'expandedValue'.
Mea culpa: I introduced this regresson in the following 2 commits: r57529 (10/14), r57841 (10/20).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 22:40:28 +00:00
Ted Kremenek 64e859a366 Enhance reference-count checker to correctly identify CG "release" functions. This fixes <rdar://problem/6303488>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 20:54:52 +00:00
Steve Naroff 7692ed6109 Fix <rdar://problem/6257675> error: member reference base type ('NSUserDefaults *') is not a structure or union.
Teach Sema::ActOnMemberReferenceExpr() to look through local category implementations associated with the class.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57995 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 19:16:27 +00:00
Douglas Gregor f8268ae319 Add representation of base classes in the AST, and verify that we
don't have duplicated direct base classes.

Seriliazation of base class specifiers is not yet implemented.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57991 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 17:49:05 +00:00
Zhongxing Xu c498848ebc Add test case for FuncDecl and function pointer variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57979 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 14:39:20 +00:00
Douglas Gregor 5737326601 Implement ranking of standard conversion sequences by their qualification
conversions (e.g., comparing int* -> const int* against 
int* -> const volatile int*); see C++ 13.3.3.2p3 bullet 3.

Add Sema::UnwrapSimilarPointerTypes to simplify the control flow of
IsQualificationConversion and CompareQualificationConversion (and fix
the handling of the int* -> volatile int* conversion in the former).
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57978 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 14:17:15 +00:00
Douglas Gregor 9b6e2d209c Fix a thinko in the qualification-conversion check when the qualificaitons are disjoint, and add some overloading-based tests of qualification conversions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-22 00:38:21 +00:00
Douglas Gregor 98cd599ee8 Initial step toward supporting qualification conversions (C++ 4.4).
Changes:
  - Sema::IsQualificationConversion determines whether we have a qualification
    conversion.
  - Sema::CheckSingleAssignment constraints now follows the C++ rules in C++,
    performing an implicit conversion from the right-hand side to the type of
    the left-hand side rather than checking based on the C notion of 
    "compatibility". We now rely on the implicit-conversion code to
    determine whether the conversion can happen or
    not. Sema::TryCopyInitialization has an ugly reference-related
    hack to cope with the initialization of references, for now.
  - When building DeclRefExprs, strip away the reference type, since
    there are no expressions whose type is a reference. We'll need to
    do this throughout Sema.
  - Expr::isLvalue now permits functions to be lvalues in C++ (but not
  in C).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57935 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 23:43:52 +00:00
Daniel Dunbar bd589e047f Add coverage of part of getPrimaryDecl that was failing prior to
previous commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 21:32:38 +00:00
Steve Naroff 2bd03723e7 Fix <rdar://problem/6257645> clang static analyzer crashes when encountering blocks as objects
ASTContext::isObjCObjectPointerType() needs to consider blocks as objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57913 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 18:21:45 +00:00
Douglas Gregor 8e9bebdea6 Preliminary support for function overloading
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 16:13:35 +00:00
Steve Naroff d7333c294d Fix a crasher during error recovery in Parser::ParseObjCTypeName().
Found this while fixing another unrelated radar.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57904 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 14:15:04 +00:00
Gabor Greif 0fe7060407 Tweak an expected-error to match the output. IMHO it is better to diagnose 'int (void)' because it has the same meaning in C and C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57901 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 11:46:36 +00:00
Steve Naroff fe6b0dc94a Fix <rdar://problem/6261178> clang-on-xcode: [sema] multiple method warning is over enthusiastic.
Fix <rdar://problem/6265257> warnings for ambiguous message send swamp other warnings.

Reworked Sema::MatchTwoMethodDeclarations() to optionally match based on method size and alignment (the default in GCC). Changed Sema::LookupInstanceMethodInGlobalPool() to use this feature.

Added -Wno-struct-selector-match to driver, however didn't hook it up yet. Added a FIXME that says this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57898 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-21 10:37:50 +00:00
Ted Kremenek c13b6e251a Further improve path-sensitivity with divide-by-zero checking by assuming that a denominator cannot be zero even when the result of an '/' or '%' expression is unknown.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 23:40:25 +00:00
Ted Kremenek 9253b0f3d7 Added test case inspired by <rdar://6268365>: recover path-sensitivity after compound assignment when the result of the assignment is not known.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57852 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 23:14:31 +00:00
Steve Naroff 18bc164e64 Fix <rdar://problem/6268365> Parser rejects property (dot notation) access on id<protocol>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 22:53:06 +00:00
Steve Naroff 87f3b93423 Sema::CheckCompareOperands() and ASTContext::mergeTypes(): Change handling of ObjC qualified id types to be consistent with gcc. This changes a handful of test case errors into warnings (diff will tell you which cases have changed).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 18:19:10 +00:00
Chris Lattner cd9f4b31c4 More property attribute recovery improvements. Instead of this:
crash.m:8:12: error: type name requires a specifier or qualifier
@property (readonlyx, getter=isAwesome) int _awesome;
           ^
crash.m:8:29: error: expected ';' at end of declaration list
@property (readonlyx, getter=isAwesome) int _awesome;
                            ^
crash.m:8:39: error: expected identifier or '('
@property (readonlyx, getter=isAwesome) int _awesome;
                                      ^

we now get:

crash.m:8:12: error: unknown property attribute 'readonlyx'
@property (readonlyx, getter=isAwesome) int _awesome;
           ^

Also, we can eliminate isObjCPropertyAttribute now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57811 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 07:15:22 +00:00
Chris Lattner 91867641fd add testcase for the recovery improvements in my last patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57810 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 07:03:51 +00:00
Chris Lattner da3253d8a9 fix a crash on unnamed properties like:
@property (readonly) int : 4;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 06:33:53 +00:00
Chris Lattner bc662afa1c refactor a bunch of code:
Check for @end in ParseObjCInterfaceDeclList instead of in each caller
Handle @required and @optional with the same code

Add some fixmes about some apparently objc2 code that is being accepted
in objc1.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 06:10:06 +00:00
Chris Lattner 639e2d35d9 Fix rdar://6257721 by tightening up the block "snapshot" check, and
move it to its own predicate to make it more clear.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57796 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 05:16:36 +00:00
Chris Lattner aab740af64 Support attributes in *yet another* place. Is there any place you
can't stick an attributes?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 04:57:38 +00:00
Chris Lattner 7399ee0aa6 Fix a parser bug where we let attributes interfere with our disambiguation
of whether a '(' was a grouping paren or the start of a function declarator.
This is PR2796.

Now we eat the attribute before deciding whether the paren is grouping or
not, then apply it to the resultant decl or to the first argument as needed.

One somewhat surprising aspect of this is that attributes interact with
implicit int in cases like this:

void a(x, y) // k&r style function
void b(__attribute__(()) x, y); // function with two implicit int arguments
void c(x, __attribute__(()) y); // error, can't have attr in identifier list.

Fun stuff.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 02:05:46 +00:00
Daniel Dunbar d3f2c10f88 Improve attribute parsing & tests.
- Support noreturn on function-typed variables.

 - Extend isFunctionOrMethod to return true for K&R functions and
   provide hasFunctionProto to check if a decl has information about
   its arguments. This code needs some serious cleaning, but works.

 - Add/improve test cases for noreturn and unused.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57778 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-19 02:04:16 +00:00
Ted Kremenek 6dfe2f544a Add support in GRExprEngine for UnaryOperator::AlignOf. This fixes one crash report in PR 2796.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57777 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 22:20:20 +00:00
Ted Kremenek 5c456fe4d3 Use "VisitLValue" when processing the base for "x.f" field accesses, and "Visit" when processing the base for "x->f" field accesses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57754 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 03:28:48 +00:00
Mon P Wang e5582f08df Added vec_set intrinsics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57749 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-18 02:43:25 +00:00
Daniel Dunbar 63c3a5fcdd Add some uses of PredefinedExpr to language coverage includes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57744 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 23:04:32 +00:00
Ted Kremenek dacd67a377 This test now passes again.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57742 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 22:53:09 +00:00
Ted Kremenek 63ffb78cf4 Test now passes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57718 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 20:29:05 +00:00
Ted Kremenek b6b81d1047 "Implement" GRExprEngine::VisitLValue for ObjCPropertyRefExpr. This is only a bandid; we need to properly handle properties by using locv/nonloc objects and specially handling property assignments in the transfer function for BinaryOperator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 17:24:14 +00:00
Daniel Dunbar e5fd2d92cf Exercise #pragma pack(pop, <width>) in test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57683 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 16:05:47 +00:00
Zhongxing Xu ef8b28e945 Add test case for array and struct variable lvalue evaluation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 05:19:52 +00:00
Daniel Dunbar 5273f514a1 Quick patch for PR2784, assert genereting debug info for opaque
structure.
 - I'm not sure yet about the behavior, but this at least prevents the
   crash.

Add some asserts on RegionStack usage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57661 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 01:07:56 +00:00
Ted Kremenek 3397e467f5 Mark these tests XFAIL. We need to add back assumption logic when doing array and field accesses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57658 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-17 00:51:39 +00:00
Steve Naroff 4fa4ab67dd Fix <rdar://problem/6239726> Parser rejects: type of property 'list' does not match type of ivar
and
http://llvm.org/bugs/show_bug.cgi?id=2893


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 14:59:30 +00:00
Daniel Dunbar 5db4b3f3ed Teach tryEvaluate that fabs, copysign, and unary +/- are constants for
floats.
 - With testcase, which also has some other things GCC folds but we
   don't commented out in it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57624 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 03:51:50 +00:00
Daniel Dunbar 3b0db908eb Implement #pragma pack use in structure packing. The general approach
is to encode the state of the #pragma pack stack as an attribute when
the structure is declared. 

 - Extend PackedAttr to take an alignment (in bits), and reuse for
   both __attribute__((packed)) (which takes no argument, instead
   packing tightly (to "minimize the memory required") and for #pragma
   pack (which allows specification of the maximum alignment in
   bytes). __attribute__((packed)) is just encoded as Alignment=1.

   This conflates two related but different mechanisms, but it didn't
   seem worth another attribute.

 - I have attempted to follow the MSVC semantics as opposed to the gcc
   ones, since if I understand correctly #pragma pack originated with
   MSVC. The semantics are generally equivalent except when the stack
   is altered during the definition of a structure; its not clear if
   anyone does this in practice. See testcase if curious.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57623 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-16 02:34:03 +00:00
Argyrios Kyrtzidis 259b0d91f2 Issue a warning when there's an ambiguous function declarator (that could be a direct initializer for a variable defition).
Idea originated from here: http://thread.gmane.org/gmane.comp.gcc.devel/101524

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 23:21:32 +00:00
Argyrios Kyrtzidis d6caa9ef4c Fix this bug:
typedef int f();
struct S {
   f *x; // incorrectly assuming this is function decl, leading to failed assertions.
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 20:23:22 +00:00
Steve Naroff ca74360821 Tighten up blocks rewriter to handle casts and some other interesting cases.
This fixes <rdar://problem/6289007> clang block rewriter: ^ in cast is not rewritten.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 18:38:58 +00:00
Ted Kremenek 380277e46e Enhance dead store checker to not flag preincrements to dead variables where the preincrement is a subexpression, e.g. foo(++x); This can cause false negatives, but will remove a whole class of false positives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 05:23:41 +00:00
Daniel Dunbar 00231ee34c Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-15 00:26:06 +00:00
Steve Naroff 3957907725 Downgrade incompatibilities with objc qualified types (e.g. id <P>) to warnings.
Note: One day, we should consider moving the actual diags to ObjCQualifiedIdTypesAreCompatible(), since it has more information on the actual problem. GCC currently emits slightly more instructive errors for some cases involving protocols. I added a FIXME to the code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57529 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 22:18:38 +00:00
Daniel Dunbar b8b10e3fef Fix typo in testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 16:46:03 +00:00
Chris Lattner 94dcecba32 add a testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 06:32:07 +00:00
Daniel Dunbar 4cde927072 Add Sema implementation of #pragma pack stack.
- Follows the MSVC (original) implementation, including support of
   pack(show) (useful for testing).
 - Implements support for named pack records which gcc seems to
   ignore (or implements incorrectly).
 - Not currently wired to anything, only functionality change is the
   type checking of the pragma.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57476 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-14 05:35:18 +00:00
Chris Lattner c106c106c6 Add a new -dump-raw-tokens option, which allows us to see raw tokens.
Rename -dumptokens to -dump-tokens.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-12 05:03:36 +00:00
Seo Sanghyeon 8f0fd62d82 Tests for return statement checks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57341 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-10 07:20:06 +00:00
Argyrios Kyrtzidis de933f025e Fix a bug that crashed clang when parsing this:
class C {
  static const int number = 50;
  static int arr[number];
};

Here's how it worked:
-GetTypeForDeclarator was called from both Sema::ActOnCXXMemberDeclarator and Sema::ActOnDeclarator.
-VariableArrayTypes are not uniqued so two VariableArrayTypes were created with the same DeclRefExpr.
-On exit they both tried to destroy that one DeclRefExpr.

The fix is not to use GetTypeForDeclarator from the Sema::ActOnCXXMemberDeclarator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57313 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-08 22:20:31 +00:00
Argyrios Kyrtzidis 3f2a8a0de5 In ParseParenDeclarator match "D.setGroupingParens(true);" with another setGroupingParens call after the ')' is parsed.
Fixes this bug:
  int (x)(0); // error, expected function declarator where the '(0)' initializer is

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57241 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-07 10:21:57 +00:00
Argyrios Kyrtzidis 73a0d889ed Implement support for C++ direct initializers in declarations, e.g. "int x(1);".
This is how this kind of initializers appear in the AST:
-The Init expression of the VarDecl is a functional type construction (of the VarDecl's type).
-The new VarDecl::hasCXXDirectInitializer() returns true.

e.g, for "int x(1);":
-VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr).
-hasCXXDirectInitializer() of VarDecl 'x' returns true.

A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code.
Note that codegening works now for "int x(1);" without any changes to CodeGen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 17:10:33 +00:00
Chris Lattner 4bf203c91f fix incorrect rdar number.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57165 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 07:43:28 +00:00
Chris Lattner eb52b44caf __CONSTANT_CFSTRINGS__ should be defined even in C mode, otherwise the CFSTR
won't expand to the builtin.  This fixes rdar://6248329



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57164 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 07:43:09 +00:00
Chris Lattner 506ff88f44 Make sema and codegen allow __builtin___CFStringMakeConstantString as a valid
constant lvalue.  Implement this in codegen by moving the code out of CGBuiltin
into EmitConstantExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57163 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 07:26:43 +00:00
Chris Lattner 46cfefa8a4 "Enhance" CheckArithmeticConstantExpression to accept ?: with a constant
condition as a constant even if the unevaluated side is a not a constant.
We don't do this when extensions are off, and we emit a warning when this 
happens:

t.c:22:11: warning: expression is not a constant, but is accepted as one by GNU extensions
short t = __builtin_constant_p(5353) ? 42 : somefunc();
          ^                                 ~~~~~~~~~~

suggestions for improvement are welcome.  This is obviously horrible, but
is required for real-world code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57153 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 05:42:39 +00:00
Argyrios Kyrtzidis e25d270b4d Allow variadic arguments without named ones for C++, e.g. "void(...);"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 00:07:55 +00:00
Argyrios Kyrtzidis d3dbbb68b1 Add some text from the C++ standard and additional ambiguity resolution tests.
No funcitonality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57136 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 21:10:08 +00:00
Argyrios Kyrtzidis 78c8d80f19 Handle ambiguities between expressions and type-ids that occur inside parentheses, e.g.:
sizeof(int()) -> "int()" is type-id
sizeof(int()+1) -> "int()+1" is expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57131 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 19:56:22 +00:00
Argyrios Kyrtzidis b9f341916e Found a subtle bug caused by an implicit enum-to-bool conversion (of the TentativeParsingResult enum).
This was the motivation of the following changes:

-'TentativeParsingResult' enum is replaced by a 'TPResult' class that basically encapsulates the enum.
-TPR_true, TPR_false, TPR_ambiguous, and TPR_error enum constants are replaced by TPResult::True(), TPResult::False(), etc. calls that return a TPResult object.
-Also fixed the subtle bug in Parser::isCXXFunctionDeclarator (caught by the above changes as a compilation error).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57125 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 18:52:21 +00:00
Anders Carlsson 770918281c Add parsing of the sentinel attribute. Still need to create the attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57121 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 18:05:59 +00:00
Argyrios Kyrtzidis bbc70c019f Disambiguate between a declaration or an expression, in the 'for-init-statement' part of a 'for' statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57112 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 15:50:46 +00:00
Argyrios Kyrtzidis ca35baa788 Fix Parser::isCXXConditionDeclaration to properly resolve declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57111 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 15:19:49 +00:00
Argyrios Kyrtzidis a8a4598b6f Disambiguate between a declaration or expression for the 'condition' part of a if/switch/while/for statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 15:03:47 +00:00
Argyrios Kyrtzidis 1ee2c43bc0 Consider GNU attributes when doing ambiguity resolution.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57108 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 14:27:18 +00:00
Daniel Dunbar eb15425409 Add X86 builtin code generation test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 06:38:36 +00:00
Daniel Dunbar ea7a31fe21 Improve C language testing coverage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57103 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 06:36:33 +00:00
Daniel Dunbar 1768a6242a Add some builtins to codegen test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57101 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 06:34:45 +00:00
Daniel Dunbar 5186906067 Add -rewrite-macros test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 01:39:04 +00:00
Daniel Dunbar a6f6c71cf7 Coverage test for targets.
- This pushes us over 80% coverage of executable LOC.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57092 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 01:04:25 +00:00
Daniel Dunbar 075e3c1c38 Improve codegen coverage tests.
- Hit debug info generation.
 - Hit both ObjC runtimes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57088 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:31:54 +00:00
Argyrios Kyrtzidis 9173e91787 Append the test runs with '&&'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57085 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:08:56 +00:00
Argyrios Kyrtzidis 5404a156be Resolve ambiguous C++ statements (C++ 6.8p1).
'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-05 00:06:24 +00:00
Daniel Dunbar 417dd179b2 Add coverage tests of C and Obj-C language features.
- AST printing, dumping, serialization, codegen.
 - HTML printing.
 - Parser callbacks.

Several of these are XFAIL because they trigger unimplemented code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57081 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 23:47:28 +00:00
Daniel Dunbar b7219f8238 Desensitize env-include-paths.c to the directory it is running in.
- It would probably be better if TestRunner.sh canonicalized this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 21:05:04 +00:00
Daniel Dunbar bb95255e08 Bug fix, CPATH="" does not add '.' to search path.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57072 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 20:58:18 +00:00
Daniel Dunbar ae3c16cc54 Add test/Driver.
- env-include-paths.c is XFAIL as it exposed a bug.

Add test/Coverage.
 - For tests which achieve code coverage but don't validate anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57070 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 20:46:41 +00:00
Daniel Dunbar f7a726b5f2 De-XFAIL test/Parser/pragma-pack.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:45:56 +00:00
Chris Lattner 7499cb59f0 switch to using -verify
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57068 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:43:25 +00:00
Chris Lattner 4f2670d827 Move the expected-warning lines to a place that clang -verify will pick them
up.  Speculatularly hacktastic, but strangely beautiful?
Daniel, lines 20/21 are rejected, please investigate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:38:15 +00:00
Daniel Dunbar fcdd8fe26d Add Parser support for #pragma pack
- Uses Action::ActOnPragmaPack
 - Test case is XFAIL pending verifier fixes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:21:03 +00:00
Daniel Dunbar 7d076643e7 Merge postfix attributes on record decls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57019 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-03 17:33:35 +00:00
Daniel Dunbar ae3f4919e4 Add Builtins.def attribute for "can be a constant expression".
- Enabled for builtins which are always constant expressions
   (__builtin_huge_val*, __builtin_inf*, __builtin_constant_p,
   __builtin_classify_type, __builtin___CFStringMakeConstantString).

Added Builtin::Context::isConstantExpr.
 - Currently overly simply interface which only works for builtins
   whose constantexprness does not depend on their arguments.

CallExpr::isBuiltinConstantExpr now takes an ASTContext argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56983 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 23:30:31 +00:00
Daniel Dunbar de45428f92 Add support for format string checking of object-size checking
versions of sprintf and friends.
 - Added FIXME that this mechanism should be generalized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56962 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 18:44:07 +00:00
Steve Naroff 8af6a451ea Changed Sema::CheckForConstantInitializer to allow global block literals.
This commit also includes some name changes in the blocks rewriter (no functionality change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56955 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-02 17:12:56 +00:00
Ted Kremenek cc9ac41ac0 Enhance NSError** checking with analogous checking for CFErrorRef*.
Expand checking to include functions, not just methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 23:24:09 +00:00
Ted Kremenek 9f67edeff2 Added test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56915 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 05:05:46 +00:00
Daniel Dunbar ad2dc71a6f NeXT: Update to use CreateRuntimeFunction for the routines it imports.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56902 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-01 01:06:06 +00:00
Steve Naroff 037cda5282 Fix <rdar://problem/6191148> [sema] Objective-C method lookup (at global scope) fails to handle overloaded selectors properly.
Long standing bug in Sema::ActOnInstanceMessage(). We now warn when messaging an "id" with multiple method signatures in scope. The diags are a little verbose, however they can be streamlined if necessary. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 14:38:43 +00:00
Nuno Lopes 33e2c5f8b5 fix test for latest changes in llvm asm representation
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-30 14:37:33 +00:00
Chris Lattner f77d545fe9 Fix va_arg handling to do argument decaying at the correct place. This
fixes problems handling references of va_list, which happens on x86_64.
This fixes PR2841 and rdar://6252231


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56809 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 22:28:25 +00:00
Steve Naroff b440686eee Teach Sema::CheckAssignmentConstraints() to allow assignments between id and block pointer types (^{}).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56793 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 18:10:17 +00:00
Steve Naroff 6c4088e5fc Fix <rdar://problem/6251012> clang: Blocks are objects too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 16:51:41 +00:00
Steve Naroff 5e0a74fbf4 Fix <rdar://problem/6253149> property declaration doesn't declare getter and setter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56785 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-29 14:20:56 +00:00
Steve Naroff e84a864a78 Fix <rdar://problem/6252129> implementation of method in category doesn't effectively declare it for methods below.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56771 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 14:55:53 +00:00
Steve Naroff ae530cfaf6 Fix <rdar://problem/6252108> assigning to argument passed to block should not require __block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56770 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 14:02:55 +00:00
Chris Lattner 891ed9aa87 Fix rdar://6252231 - cannot call vsnprintf with va_list on x86_64,
by decaying __builtin_va_list's type when forming builtins.  On
x86-64 (and other targets) __builtin_va_list is a typedef for
an array.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 06:05:35 +00:00
Chris Lattner f7037b1c3b Fix rdar://6251437, references to enum constant decls in a block
don't need a BlockDeclRefExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56766 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 05:30:26 +00:00
Steve Naroff 59f5394648 Fix <rdar://problem/6252216> compare block to NULL.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 01:11:11 +00:00
Steve Naroff 538afe30e4 Fix <rdar://problem/6252226> parser thinks block argument is undefined identifier in NSServices.m
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56761 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-28 00:13:36 +00:00
Daniel Dunbar 0cb45f6ea7 Remove automagic substitution of %llvmgcc
- Is unused and somewhat unreliable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56737 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-27 00:47:03 +00:00
Daniel Dunbar ced4fcb233 Fix function-attributes test case to not rely on llvm-gcc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56734 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-27 00:44:01 +00:00
Daniel Dunbar d58139e1d4 Fix attributes test case to not run clang umpteen times.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56733 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-27 00:39:13 +00:00
Ted Kremenek d2025e2673 Add more control-flow to test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56707 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 23:05:47 +00:00
Ted Kremenek 610a09e409 Add CFG support for implicit-control flow for VLA size expressions within an SizeOfAlignOfTypeExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 22:58:57 +00:00
Chris Lattner 22e6dd79ec testcase for my previous patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 18:07:51 +00:00
Ted Kremenek 3527b59f24 Enter a new scope for a @try block.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 17:32:47 +00:00
Steve Naroff 4f6a7d7ead Tweak Expr::isModifiableLvalue() and Expr::isLvalue() to better deal with BlockDeclRef exprs.
This fixes <rdar://problem/6248392> clang: Error when using address of stack variable inside block.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56652 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 14:41:28 +00:00
Ted Kremenek 84fa6b90ab Examine VLA size expressions when computing liveness information.
Fixes <rdar://problem/6248086>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 05:52:45 +00:00
Daniel Dunbar 246e70f69c Parser support for prefix __attribute__ on @protocol.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56642 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 04:48:09 +00:00
Daniel Dunbar 3568249c2d Sema support for format and noreturn attributes on Objective-C methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56640 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 04:12:28 +00:00
Daniel Dunbar 085e8f7da3 Add support for CFString in format attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 03:32:58 +00:00
Ted Kremenek aefc36656d Have @finally introduce a new scope.
Fixes: <rdar://problem/6248119> @finally doesn't introduce a new scope


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 00:31:16 +00:00
Steve Naroff ba80c9abcc Downgrade incompatible block pointer error to a warning (to be consistent with incompatible pointer warnings in general).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56595 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 23:31:10 +00:00
Steve Naroff 16564420ff Fix <rdar://problem/6243788> clang: Incorrect return statement for Blocks?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56590 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 22:26:48 +00:00
Daniel Dunbar 739a36be30 Add more testing of Obj-C property synthesis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56564 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 18:00:13 +00:00
Ted Kremenek cafd9089a4 Updated test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56548 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-24 06:40:03 +00:00
Daniel Dunbar 95e61fb7cd Implement type checking of Objective-C property attributes.
- readonly and readwrite are mutually exclusive.
 - assign, copy, and retain are mutually exclusive.
 - copy and retain are invalid on non-object types.
 - Warn about using default 'assign' property on object types
   (attempting to follow gcc behavior).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56507 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 21:53:23 +00:00
Steve Naroff eab5f63207 Teach block rewriter to replace '^' with '*' in VarDecls.
Since we don't have DeclGroup's and location information for types, there is some fancy footwork to do this fairly reliably.

O.K...it's a kludge. One day, we can use this as motivation to do this more gracefully:-)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 19:24:41 +00:00
Ted Kremenek d1f5ff717d Added test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-23 18:05:01 +00:00
Daniel Dunbar e1226d24d2 Bug fix, result of isIntegerConstantExpr could be of incorrect width
for type.
  - PR2817


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 23:53:24 +00:00
Steve Naroff 4f9b9f1e68 Fix http://llvm.org/bugs/show_bug.cgi?id=2816.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-22 10:28:57 +00:00
Ted Kremenek fb8a7fd774 Test case for transfer function logic of const casts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56369 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 20:53:52 +00:00
Ted Kremenek 0a41e5a03a Fixed logic error in BasicConstraintManager pointed out by Zhongxing Xu.
For checking if a symbol >= value, we need to check if symbol == value || symbol
> value. When checking symbol > value and we know that symbol != value, the path
is infeasible only if value == maximum integer.

For checking if a symbol <= value, we need to check if symbol == value || symbol
< value. When checking symbol < value and we know that symbol != value, the path
is infeasible only if value == minimum integer.

Updated test case exercising this logic: we only prune paths if the values are
unsigned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56354 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 18:00:36 +00:00
Chris Lattner 69d349a874 Fix rdar://6222856: the receiver of a message expr is an
arbitrary expr, not just a assign expr.  The grammar comment
was right, the code was just wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 17:44:00 +00:00
Ted Kremenek 1cd920a1cb Added test case for PR 2600: proper use of NSError**
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56332 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 04:56:32 +00:00
Steve Naroff 9eae5761c0 Finish pushing blocks attribute through the clang attribute machinery.
Also added a couple simple tests from the "gcc.apple" test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56309 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 16:44:58 +00:00
Ted Kremenek 91985ae8c8 Added CFNumberCreate test case to illustrate a 32-bit/64-bit arch issue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56295 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-18 00:28:23 +00:00
Ted Kremenek f6e5ec4595 Add path-sensitivity test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56294 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 22:24:13 +00:00
Daniel Dunbar 4e6153b49b Another attempt to make test/Makefile return correct error code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56285 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 18:08:07 +00:00
Steve Naroff 094cefbcc4 Fix http://llvm.org/bugs/show_bug.cgi?id=2760.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-17 14:05:40 +00:00
Daniel Dunbar 799c6f6faf Ignore XFAIL tests when checking for make failure in test/
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 23:43:13 +00:00
Ted Kremenek e2b0083474 Fix copy-paste error in test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56261 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 23:25:28 +00:00
Ted Kremenek 8c3e7fbae6 Minor pass-sensitivity improvement:
if we know that 'len != 0' and know that 'i == 0' then we know that
  'i < len' must evaluate to true and cannot evaluate to false


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56260 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 23:24:45 +00:00
Steve Naroff 17dab4f616 Remove support for BlockExprExpr. For example...
^(expression) or ^(int arg1, float arg2)(expression)
...is no longer supported. 
All block literals now require a compound statement.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56257 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 23:11:46 +00:00
Steve Naroff c50a4a5f2e Sema::ActOnBlockReturnStmt(): Need to perform the UsualUnaryConversions on the return type.
Sema::CheckReturnStackAddr(): Make sure we skip over implicit casts.
Added some more test cases...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-16 22:25:10 +00:00
Douglas Gregor 77a52233f7 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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56137 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-12 00:47:35 +00:00
Daniel Dunbar 5e155f0c9b 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56135 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 23:12:46 +00:00
Argyrios Kyrtzidis 6314ff264c Do implicit conversion to bool for the condition in a do-while statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 05:16:22 +00:00
Argyrios Kyrtzidis 143db71d8d Fix do-while scoping in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56095 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 04:46:46 +00:00
Daniel Dunbar 91e19b2029 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56084 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-11 00:50:25 +00:00
Argyrios Kyrtzidis 4c0f56b999 In the 'condition.cpp' test case, make sure that condition declarations are local to the statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56077 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 23:34:50 +00:00
Daniel Dunbar 0b7a5c0a1e Add XFAIL test case for:
<rdar://problem/6211479> [sema] array type invalid for Obj-C property


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56075 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 23:11:23 +00:00
Steve Naroff 61f40a2b67 More semantic analysis for blocks...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56064 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 19:17:48 +00:00
Steve Naroff 1f3b0d5cca Sema::ActOnIdentifierExpr(): Lookup block arguments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 18:33:00 +00:00
Argyrios Kyrtzidis e3a09e6ad0 Implement CodeGen support for the 'CXXConditionDeclExpr' expression node, which represents a 'condition' declaration, e.g: "if (int x=0) {...}".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56045 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:36:38 +00:00
Argyrios Kyrtzidis 5921093cf1 Implement Sema support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56044 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-10 02:17:11 +00:00
Argyrios Kyrtzidis 8592b1d9a0 Fix test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 20:56:12 +00:00
Argyrios Kyrtzidis 71b914b999 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 20:38:47 +00:00
Daniel Dunbar 219df6644e 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55966 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-08 23:44:31 +00:00
Daniel Dunbar 3e98e513d6 Add missing RUN line
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55934 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-08 18:01:15 +00:00
Nuno Lopes 8bdd880d6c 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-06 16:42:14 +00:00
Steve Naroff dd972f20dc More type checking for blocks. Still incomplete (will hopefully finish up this weekend).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 22:11:13 +00:00
Argyrios Kyrtzidis 0f07203293 Support "typeof unary-expression" (GNU C++ extension).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 11:26:19 +00:00
Argyrios Kyrtzidis 02e7e7442c Line endings: CRLF -> LF
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55829 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 08:53:53 +00:00
Daniel Dunbar 5313ebce37 Test case for previous commit (Workaround gcc bug causing crash on our
preprocessed outputs)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55826 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 03:23:51 +00:00
Daniel Dunbar 3a9a3e112a Set sext/zext on function result.
- <rdar://problem/6156739>


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55815 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 00:57:45 +00:00
Daniel Dunbar ab49c0bb0f Fix unintended use of doxygen comment strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 21:54:53 +00:00
Ted Kremenek b497ebdce3 Added test case for the dead stores checker that was originally an FP reported in PR 2763.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55801 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 21:52:52 +00:00
Daniel Dunbar 7ad1b1fa07 Prevent invalid warnings about incomplete implementations for methods
which are inherited from base clases or protocols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 20:01:15 +00:00
Nuno Lopes f557fb749e 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)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55782 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 18:33:57 +00:00
Daniel Dunbar b21d6afce9 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!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55761 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 04:36:23 +00:00
Daniel Dunbar 80e62c29fe Implement codegen of aggregates as lvalues in binary expressions,
e.g. "(a = b).somefield".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55758 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 03:20:13 +00:00
Daniel Dunbar 607b17b736 Update TestRunner to not report failure for XFAIL tests
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55751 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-04 00:30:11 +00:00
Daniel Dunbar 33ad012026 Set register storage class correctly for function parameters.
- PR2730


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55739 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 21:54:21 +00:00
Ted Kremenek ea644d8440 Following gcc's behavior, only enable trigraphs if '-trigraphs' or '-ansi' is
specified, or -std is set to a conforming mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 21:22:16 +00:00
Daniel Dunbar d417d96037 Add two test cases for builtins (mostly related to object size
builtins).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55736 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 21:17:21 +00:00
Daniel Dunbar 40727a4b43 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55705 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 17:53:25 +00:00
Daniel Dunbar 2307d312f7 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55686 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-03 01:05:41 +00:00
Steve Naroff b4eaf9cf5f - Implement __block.
- Replace FIXME in Preprocessor::HandleIdentifier() with a check that avoids diagnosing extension tokens that originate from macro definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 18:50:17 +00:00
Steve Naroff c9a4eea592 Pull code from last commit. will put back soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 18:04:36 +00:00
Steve Naroff 042f955a20 Implement block pseudo-storage class modifiers (__block, __byref).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 15:20:19 +00:00
Nuno Lopes 67c8601677 add the other test case for completeness and to avoid regressions in the future
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55629 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 10:10:14 +00:00
Eli Friedman b529d830b3 Fix for PR2747: allow pointer->int casts with a null base; these are
offset-of-like expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55627 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 09:37:00 +00:00
Eli Friedman 6f7adbdcd0 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 05:29:22 +00:00
Eli Friedman bc88745b43 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55621 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 05:19:23 +00:00
Eli Friedman f1c7b48638 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 05:09:35 +00:00
Nuno Lopes 62b6a65f0b readd test as it passes correctly. nice, but weird
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55615 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-01 22:28:55 +00:00
Eli Friedman 6d4abe1eee 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55614 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-01 22:08:17 +00:00
Ted Kremenek 7fb43c17eb 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-01 19:57:52 +00:00
Nuno Lopes 73419bf6cb fix one more this-is-not-a-constant error. test included
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-01 18:42:41 +00:00
Nuno Lopes f7e37ce840 make CheckArithmeticConstantExpression() aware of &foo and pointers
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-01 14:47:06 +00:00
Daniel Dunbar 4bbef0f165 Temporarily disable some tests which due to dot-syntax
access of methods.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55569 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-30 16:22:34 +00:00
Daniel Dunbar 852119ea9b Allow 'make TESTDIRS=Sema' in test/ directory for only running a
subset of tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55513 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 23:28:16 +00:00
Steve Naroff 296e8d5fdc 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55495 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 19:20:44 +00:00
Daniel Dunbar aa1f9f1d50 Fix isIntegerConstantExpr eval of __builtin_offsetof to return result
with correct width.
 - PR2728.

Also, fix PR2727 test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55493 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 18:42:20 +00:00
Daniel Dunbar 9048891ff9 Fix double-free error with sizeof applied to VLA types.
- PR2727.

Also, fix warning in CodeGenTypes for new BlockPointer type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 18:02:04 +00:00
Steve Naroff 5618bd4a52 First wave of changes to support "blocks" (an extension to C).
This commit adds the declaration syntax (and associated type).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 16:04:49 +00:00
Daniel Dunbar 8a7267ef41 Update test case (we were missing a warning here)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 05:41:04 +00:00
Daniel Dunbar 394d33f1f6 Add ObjCPropertyDecl::isReadOnly.
Respect isReadOnly when generating synthesized method decls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 07:16:44 +00:00
Daniel Dunbar a56f7460ba In incompatible pointer-typed ?: expressions, add implicit conversion
of RHSs to id type instead of void* if either has Objective-C object
type.
 - This ensures the result can still be used in normal places an
   object can be used, like a message send.

Add implicit conversions for ?: applied to qualified id types to
ensure that the RHSs are compatible. 
 - This prevents a codegen crash (creating invalid PHI nodes).
 - Again, this relates to the fact that qualified id types have no
   canonical types.
 - Note that the implicit type casted to is incorrect, however this
   doesn't currently cause problems because of the flexibility of the
   id type.

Test cases for above.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55346 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-26 00:41:39 +00:00
Eli Friedman eb4b7051a5 Do typechecking and codegen for K&R-style function declarations
correctly.  Not a regression, but made more obvious by my recent fix 
which made function type compatibility checking a bit more strict.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55339 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 21:31:01 +00:00
Eli Friedman c3f07644a7 Fix for PR2720; be a little bit more permissive in initializers for
casting pointers to integers.

Eventually, we should check whether we can evaluate an expression 
using Expr::tryEvaluate, and this codepath should be tightened to only 
handle standard-compliant cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 20:46:57 +00:00
Daniel Dunbar 1e465df22f Add test case for function-pointer-cast-of-global as constant
expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 20:08:27 +00:00
Anders Carlsson 1fe379f0fa Objective-C foreach selector elements must be lvalues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-25 18:16:36 +00:00
Anders Carlsson 6e14a8f2ac Fix silly bug in objc_gc attribute parsing and add test case
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55286 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-24 16:33:25 +00:00
Anders Carlsson 4f3cc81896 Add carbon.cpp and cocoa.mm tests
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55262 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 22:21:00 +00:00
Anders Carlsson b88d45ea7e treat bool literals as constatnt expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55255 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 21:12:35 +00:00
Anders Carlsson 413ad8b6b5 Handle Objective-C++ tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55254 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 21:03:10 +00:00
Anders Carlsson ef048ef393 Reserved C++ words are valid selectors in Objective-C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 21:00:01 +00:00
Argyrios Kyrtzidis 7267f7832e Add CodeGen support for CXXZeroInitValueExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55249 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 19:35:47 +00:00
Argyrios Kyrtzidis 2fba1217dc Add a null pointer test in the type-convert-construct.cpp tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55247 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 19:24:45 +00:00
Chris Lattner e8904e992c Fix a FIXME by not creating an invalid AST on erroneous input. Also
make diagnostic output in some other malformed cases significantly
more useful.  This fixes PR2708


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-23 01:48:03 +00:00
Argyrios Kyrtzidis 4bd8217d94 Move the rest of the Sema C++ tests into the SemaCXX test directory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55178 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 15:43:49 +00:00
Argyrios Kyrtzidis 987a14bf58 Add support for C++'s "type-specifier ( expression-list )" expression:
-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
   -If the type is a class, it will treat it as a class constructor. [TODO]
   -If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
   -If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55177 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 15:38:55 +00:00
Nico Weber dfb99a968b make test fails if llvm is checked out to llvm-svn of if there is a dash somewhere else in the path. fix that.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55175 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 09:33:51 +00:00
Anders Carlsson c5eb731144 Initial sema support for C++ static initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55166 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-22 05:00:02 +00:00
Chris Lattner 2c15647dce add a simple check to warn people who type "=+" when they probably meant
"+=".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55131 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 18:04:13 +00:00
Daniel Dunbar 5323e23777 Use full path to count script, and don't treat files with missing RUN
lines as errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 04:43:28 +00:00
Daniel Dunbar 9562726a28 Missed a test case writing a .ll file.
Suppress count output from 'make test' on errors (used to generate
result code).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55107 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 04:30:23 +00:00
Daniel Dunbar 4565938ff6 Reorder the PATH used during testing so $(ToolDir) and the LLVM
scripts dir appear before the user path.
 - This is an attempt to pick up the right executables. We should
   probably be substituting the exact things we want for clang a la
   the LLVM test script.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55105 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 03:03:44 +00:00
Daniel Dunbar 2d6ca8d0f6 Update a number of CodeGen tests to not create .ll files in the test
directory.
 - Removed .ll from the svn:ignore lists to try and prevent this.
 - Added svn:ignore on test/Misc/Output


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55104 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-21 02:51:29 +00:00