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

1164 Коммитов

Автор SHA1 Сообщение Дата
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