Chris Lattner
1a6bb70ad0
Set loc earlier in CheckSingleInitializer to avoid emitting a
...
diagnostic without a location. This produces:
simpleTest.c:2:18: error: initializer element is not constant
int *myPointer = &(myArray[2]);
^~~~~~~~~~~~~
instead of:
error: initializer element is not constant
llvm-svn: 44375
2007-11-27 21:21:35 +00:00
Steve Naroff
0ee0b0ab8c
Move the null pointer constant check from Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible.
...
Thanks to Seo Sanghyeon for the bug, follow-through, and patch!
llvm-svn: 44366
2007-11-27 17:58:44 +00:00
Chris Lattner
db3467f8d4
handle __vector_size__ like vector_size
...
llvm-svn: 44358
2007-11-27 07:28:18 +00:00
Chris Lattner
5c3f1541a7
Improve function decl merging, patch by Oliver Hunt!
...
llvm-svn: 44253
2007-11-20 19:04:50 +00:00
Steve Naroff
14f5f79bb6
Now that we are passing back "free standing decls", make sure -ast-dump works like -ast-print.
...
Also added a cast to be safe...
llvm-svn: 44209
2007-11-17 21:37:36 +00:00
Steve Naroff
c1e6d60b14
Make sure Sema::ParsedFreeStandingDeclSpec() returns a decl representing the type.
...
Adding basic printing to StmtPrinter::PrintRawDecl().
llvm-svn: 44208
2007-11-17 21:21:01 +00:00
Steve Naroff
d8ea1ac576
Implement support for variadic methods (work in progress).
...
llvm-svn: 44171
2007-11-15 12:35:21 +00:00
Steve Naroff
9e0887cff4
Allow properties within a protocol. The case below was asserting...now it works fine.
...
@protocol CAMediaTiming
@property int beginTime;
@end
Comments in the code tell the rest of the story...
llvm-svn: 44117
2007-11-14 14:15:31 +00:00
Chris Lattner
07b201d9c0
implement test/Sema/typedef-prototype.c, allowing code
...
to declare a function with a typedef:
typedef int unary_int_func(int arg);
unary_int_func add_one;
This patch contributed by Seo Sanghyeon!
llvm-svn: 44100
2007-11-14 06:34:38 +00:00
Nate Begeman
a0f78974a6
Give AST-walk passes a way to access DeclSpec attributes on functions and
...
variables.
llvm-svn: 44073
2007-11-13 22:14:47 +00:00
Nate Begeman
313f8ca67b
Rename Sema method to follow class naming convention
...
llvm-svn: 44069
2007-11-13 21:49:48 +00:00
Fariborz Jahanian
3a9fe93286
Patch to set context (interface, category, etc.) in which method is declared.
...
llvm-svn: 44038
2007-11-13 01:10:08 +00:00
Steve Naroff
fedb49771d
Add category method definitions incrementally, removing a FIXME (like we do for class implementations).
...
llvm-svn: 44027
2007-11-12 22:05:31 +00:00
Steve Naroff
040f696bfc
Fix regression to Sema::ObjcActOnStartOfMethodDef()...need to initialize InvalidType field to false.
...
llvm-svn: 44023
2007-11-12 19:48:27 +00:00
Steve Naroff
e3d1ab29da
- Minor cleanup to yesterday's changes to Sema::ObjcActOnStartOfMethodDef();
...
- Add Sema::CurMethodDecl, in preparation for adding ObjcIvarRefExpr.
- Add ObjcInterfaceDecl::lookupInstanceVariable(), in prep for adding ivars.
- A couple renames in ObjcInterfaceDecl, while I was in the vicinity:-)
llvm-svn: 44015
2007-11-12 13:56:41 +00:00
Steve Naroff
ff4dbff4f4
Remove Action::ObjcActOnMethodDefinition(). Rationale:
...
- It is not an "action" - it is never called by the parser.
- It was only used by one method, Sema::ObjcActOnStartOfMethodDef().
As a result, the logic it embodied is now directly implemented in Sema::ObjcActOnStartOfMethodDef().
llvm-svn: 44008
2007-11-12 04:59:00 +00:00
Steve Naroff
3434bebec9
Make sure @property is allowed within a category.
...
Bug submitted by Keith Bauer.
CookieJar:Desktop keith$ cat test.m
#import <WebKit/WebKit.h>
llvm-svn: 44007
2007-11-12 04:22:52 +00:00
Steve Naroff
d0bf516e70
Remove Sema::ObjcBuildMethodParameter().
...
Modify Sema::ParseParamDeclarator() to work for both ActOnStartOfFunctionDef() and ObjcActOnStartOfMethodDef().
llvm-svn: 44006
2007-11-12 03:44:46 +00:00
Steve Naroff
b313fc3203
Replace 2 method definition actions (ActOnFunctionDefBody, ActOnMethodDefBody) with 1 method definition action (ActOnFinishFunctionBody). I can't think of any reason that we would need two action hooks.
...
llvm-svn: 44000
2007-11-11 23:20:51 +00:00
Steve Naroff
cac26f4f5f
This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() about private methods (r43989).
...
While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end).
Other details...
- Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments.
- Removed Parser::AllImplMethods (a nice cleanup).
- Added location info to ObjcImplementationDecl (since we will need it very soon:-)
- Modified message.m test to no longer allow the bogus diagnostic.
llvm-svn: 43995
2007-11-11 17:19:15 +00:00
Steve Naroff
22e078e013
Teach Sema::ActOnInstanceMessage() about private methods. That is, methods declared in an implementation (but not listed in the interface).
...
This commit is only 95% of the bug fix. The last piece to this puzzle is to add the method decls to the implementation incrementally (as we encounter them). At the moment, the methods aren't added until we see an @end (which is too late).
I will complete this later...
llvm-svn: 43989
2007-11-11 00:10:47 +00:00
Fariborz Jahanian
0bd56b7727
Fixed a bug which exposed the internally built type to user code.
...
llvm-svn: 43987
2007-11-10 22:00:55 +00:00
Fariborz Jahanian
6aafd4130b
Minor code clean up in method def area.
...
llvm-svn: 43980
2007-11-10 17:40:57 +00:00
Fariborz Jahanian
85e1d0d807
Represent method definitions as separate AST nodes. Pretty print will come next.
...
llvm-svn: 43979
2007-11-10 16:31:34 +00:00
Fariborz Jahanian
7a017215eb
Some code clean up in the form of name changes for functions which
...
process method definitions.
llvm-svn: 43967
2007-11-09 22:27:59 +00:00
Fariborz Jahanian
b5605179c4
Added class context to method declarations. Provide "interface *" type
...
to 'self' method of instance methods.
llvm-svn: 43957
2007-11-09 19:52:12 +00:00
Fariborz Jahanian
19d4dbd217
Insert invisble arguments to method definition header.
...
llvm-svn: 43948
2007-11-09 17:18:29 +00:00
Fariborz Jahanian
56ff146ec4
First patch toward rewriting of method definitions. This is work in progress.
...
llvm-svn: 43915
2007-11-08 23:49:49 +00:00
Fariborz Jahanian
f76f2b0c1c
Patch for objc2's property ASTs, as well as pretty-priting the ASTs.
...
llvm-svn: 43778
2007-11-06 22:01:00 +00:00
Chris Lattner
45d561ad99
improve decl merging logic to be more correct with
...
functions. Patch contributed by Nuno Lopes, thanks!
llvm-svn: 43757
2007-11-06 06:07:26 +00:00
Chris Lattner
3209725c68
Add better validation for array types when merging decls. Patch
...
contributed by Oliver Hunt, thanks!
llvm-svn: 43750
2007-11-06 04:28:31 +00:00
Fariborz Jahanian
ac73ff8868
Remaining work to collect objective-c's type qualifiers and use them to encode
...
method types.
llvm-svn: 43617
2007-11-01 17:18:37 +00:00
Devang Patel
32714064b1
Propagate bitfield info.
...
llvm-svn: 43613
2007-11-01 16:29:56 +00:00
Fariborz Jahanian
7a9c47480d
1) More additions for objective-c's qualifier type.
...
2) Fixed a test failure (which should have failed all along!).
llvm-svn: 43589
2007-10-31 23:53:01 +00:00
Fariborz Jahanian
95b6076c77
Fixed problem with rewriting stand-alone @implementation (with no matching @interface).
...
A new test case added.
llvm-svn: 43568
2007-10-31 18:48:14 +00:00
Steve Naroff
6d40db0dde
Implement a more sensible strategy for ObjC built-in types (addressing a long standing FIXME in Sema::GetObjcIdType()).
...
This removes several gross hacks to work around the previous "lazy" behavior.
Two notes:
- MinimalActions still needs to be taught about the built-in types (This breaks one of the -noop test cases). I started this, then added a FIXME.
- I didn't convert Sema::GetObjcProtoType() yet.
llvm-svn: 43567
2007-10-31 18:42:27 +00:00
Fariborz Jahanian
d728e949bb
After Anders check-in, we can now encode 'Class' type.
...
llvm-svn: 43556
2007-10-31 16:00:13 +00:00
Fariborz Jahanian
ca5338196f
Added new type and bitfield fields in some decl types in preparation for objective-c's type qualifiers.
...
Added initialization of Class/SEMA types.
llvm-svn: 43534
2007-10-31 00:12:35 +00:00
Chris Lattner
0b11172e8c
minor tweaks
...
llvm-svn: 43515
2007-10-30 20:57:56 +00:00
Fariborz Jahanian
18d7b30241
Revisited my last patch to be able to do encoding of ivar types with 'id'.
...
llvm-svn: 43507
2007-10-30 18:27:03 +00:00
Fariborz Jahanian
509d8d6fc6
Added type encoding for 'id' type.
...
llvm-svn: 43504
2007-10-30 17:06:23 +00:00
Steve Naroff
5448cf6d61
- Add location info to category/protocol AST's
...
- Rewrite categories.
llvm-svn: 43501
2007-10-30 13:30:57 +00:00
Steve Naroff
4cd61acc33
Remove a couple FIXME's for rewriting ObjC interfaces (which are now being rewritten properly).
...
llvm-svn: 43494
2007-10-30 03:43:13 +00:00
Steve Naroff
c54840433f
More support for rewriting ObjC intefaces. Still some edge cases to handle...
...
llvm-svn: 43493
2007-10-30 02:23:23 +00:00
Steve Naroff
33a1e80dd1
This commit contains lot's of small tweaks to how we pass around and store SourceLocation's for interfaces/protocols/categories/implementations.
...
llvm-svn: 43475
2007-10-29 21:38:07 +00:00
Steve Naroff
161a92b976
Start rewriting ObjC interfaces. As a start, we comment out all the methods. This involved refining how the parser/AST passes/manages SourceLocations for ObjcMethodDecl's.
...
llvm-svn: 43404
2007-10-26 20:53:56 +00:00
Fariborz Jahanian
3339d0d14e
This patch allows synthesis generation of ivar offset for legacy objective-c @implementation
...
decl without an @interface decl.
llvm-svn: 43403
2007-10-26 20:50:24 +00:00
Chris Lattner
8beb9dee0e
Fix a crash on test/Sema/invalid-decl.c
...
llvm-svn: 43188
2007-10-19 20:10:30 +00:00
Steve Naroff
eee59ebb15
Add a FIXME to an assert.
...
Change a dyn_cast_or_null back to cast (which is more efficient).
llvm-svn: 43152
2007-10-18 22:17:45 +00:00
Fariborz Jahanian
c34409c281
Patch to rewrite ivar tables metadata for classes defined.
...
llvm-svn: 43151
2007-10-18 22:09:03 +00:00