Commit Graph

2576 Commits

Author SHA1 Message Date
Steve Naroff e50478e0b0 Tune the lookup logic in Sema::ActOnInstanceMessage() to handle private methods (declared within the implementation).
llvm-svn: 44041
2007-11-13 04:10:18 +00:00
Steve Naroff 9d0d4dc7bd Minor indenting changes and removed a level of casting in getClassInterface();
llvm-svn: 44039
2007-11-13 01:40:57 +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 4a158f37f9 Fix Sema::CheckAssignmentConstraints() to operate on the canonical, unqualified type.
llvm-svn: 44036
2007-11-13 00:31:42 +00:00
Ted Kremenek e9b83bbd68 Renamed all serialization "Materialize" methods to "Create" to conform with
the new serialization API.

llvm-svn: 44035
2007-11-13 00:25:37 +00:00
Ted Kremenek cd51750512 Restructured serialization code for decls to make it cleaner, easier to
understand, and batched the emission owned subobjects (using
BatchEmitOwnedPtr) to get a smaller output bitcode size.

llvm-svn: 44033
2007-11-13 00:15:39 +00:00
Fariborz Jahanian 21f54eeacf Patch to do statically typed ivar references.
llvm-svn: 44028
2007-11-12 22:29:28 +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
Fariborz Jahanian 2d0d3ba43e Minor twik for when there is no super class and 'super' is errornously used.
llvm-svn: 44026
2007-11-12 20:20:37 +00:00
Fariborz Jahanian d98a734bd6 'super' nailed.
llvm-svn: 44025
2007-11-12 20:13:27 +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 cd002f5a0e Add an error diagnostic to Parse::ParseObjCMessageExpression().
This now exposes the following bug...

******************** TEST 'Sema/message.m' FAILED! ********************
Command: 
 clang -fsyntax-only -verify Sema/message.m
Output:
Errors seen but not expected:
  Line 9: invalid receiver to message expression
******************** TEST 'Sema/message.m' FAILED! ********************

As far as I can tell, all messages to method agruments fail.

The method arguments are built by Sema::ObjcActOnStartOfMethodDef().

llvm-svn: 44022
2007-11-12 19:18:37 +00:00
Ted Kremenek 0035bf33c4 In Stmt serialization, renamed directEmit to EmitImpl and
directMaterialize to CreateImpl.

llvm-svn: 44020
2007-11-12 18:04:32 +00:00
Steve Naroff b342361c0d Now that we can refer to instance variables, make sure they are considered lvalues.
llvm-svn: 44017
2007-11-12 14:34:27 +00:00
Steve Naroff e46504b278 Implement instance variable references.
llvm-svn: 44016
2007-11-12 14:29:37 +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 8e5c112add Forgot this file from my last commit...
llvm-svn: 44009
2007-11-12 05:02:46 +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 bb87572d70 Replace 3 method definition functions (ObjcParseMethodDefinition, ParseObjCInstanceMethodDefinition, ParseObjCClassMethodDefinition) with 1 method definition function (ParseObjCMethodDefinition).
Less code/confusion.

llvm-svn: 43999
2007-11-11 19:54:21 +00:00
Steve Naroff 49effdefef Tweak Sema::ActOnInstanceMessage() to treat the built-in "Class" type the same as "id".
llvm-svn: 43996
2007-11-11 17:52:25 +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 5f9ae64f6e Make sure Sema::CheckIncrementDecrementOperand() removes typedefs when doing it's analysis.
Thanks to Seo Sanghyeon for his excellent (first) bug fix!

llvm-svn: 43994
2007-11-11 14:15:57 +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 16e3123071 pretty priting for method definitions.
llvm-svn: 43986
2007-11-10 20:59:13 +00:00
Steve Naroff 257b4a2467 Fix a basic bug (having to do with typedefs) in Sema::UsualArithmeticConversions().
This resuled in the following crash below.

Also modified the usual-float.c test case to capture this case.

[steve-naroffs-imac:clang/test/Sema] snaroff% ../../../../Debug/bin/clang usual-float.c
Assertion failed: (0 && "Sema::UsualArithmeticConversions(): illegal float comparison"), function UsualArithmeticConversions, file SemaExpr.cpp, line 960.
0   clang                               0x001ef9b9 _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8315PrintStackTraceEv + 45
1   clang                               0x001efd5f _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8313SignalHandlerEi + 323
2   libSystem.B.dylib                   0x90c6297b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libSystem.B.dylib                   0x90cdb782 raise + 26
5   libSystem.B.dylib                   0x90cead3f abort + 73
6   libSystem.B.dylib                   0x90cdc923 __assert_rtn + 101
7   clang                               0x00077316 _ZN5clang4Sema26UsualArithmeticConversionsERPNS_4ExprES3_b + 1004
8   clang                               0x000803cf _ZN5clang4Sema27CheckMultiplyDivideOperandsERPNS_4ExprES3_NS_14SourceLocationEb + 181
9   clang                               0x0007a8e8 _ZN5clang4Sema10ActOnBinOpENS_14SourceLocationENS_3tok9TokenKindEPvS4_ + 472
10  clang                               0x000cf058 _ZN5clang6Parser26ParseRHSOfBinaryExpressionENS_6Action12ActionResultILj0EEEj + 1286
11  clang                               0x000cf2de _ZN5clang6Parser25ParseAssignmentExpressionEv + 86

llvm-svn: 43985
2007-11-10 19:45:54 +00:00
Steve Naroff 68754c59bc Since we are all working on Leopard, change the built-in MacOS X version number (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) to target Leopard. This is only a short term solution, until the clang driver implements the "-mmacosx-version-min" flag (which will compute this value based on the target).
llvm-svn: 43981
2007-11-10 18:06:36 +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
Ted Kremenek 739156ab7c Changed the serialization of IdentifierTable to only serialize out entries
that are referenced in the ASTs. This assumes that we serialize out the
decls/stmts first, and use the pointer-tracking logic in the Serializer to
determine if an IdentifierInfo (or its string key) is ever referenced.

This is a significant space optimization for serialized ASTs.

Consider the following program:

void foo(int x,int y) {
  return x > y ? x : y+1;
}

Here are the sizes of the files for the serialized ASTs:

        Full IdentifierTable: 23676 bytes
 Only-referenced Identifiers:   304 bytes.

For this simple program, this is a 77% reduction in the file size of the
serialized ASTs.

llvm-svn: 43975
2007-11-10 02:11:55 +00:00
Ted Kremenek 11d700bfba Modifed the test serialization driver to...
(1) serialize out top-level decls BEFORE serializing out translation unit
structures like ASTContext.

(2) deserialize out translation unit structures like ASTContext before
top-level decls by first skipping the decls in the bitstream, deserializing
ASTContext and friends, and then jumping back to the bitstream block with the
decls and then deserializing them.

Change (1) allows us to utilize the pointer-tracking system in the Serializer
to only serialize out metadata that is actually referenced by the ASTS.

Change (2) allows us to deserialize the metadata first as before, which
signficantly reduces the amount of pointer backpatching the deserializer
would have to do if the decls were deserialized first.

llvm-svn: 43974
2007-11-10 02:07:12 +00:00
Chris Lattner ef067a2828 rename getInstantiationLoc to match the scheme of isPhysicalLoc.
llvm-svn: 43969
2007-11-09 23:59:17 +00:00
Chris Lattner 198b3e085d change source location to have two bits for macros, tracking
whether the location is the start and/or end of an expansion.
These are currently not set or used by anything.

llvm-svn: 43968
2007-11-09 23:52:16 +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
Hartmut Kaiser 03f4d47254 Updated VC++ build system
llvm-svn: 43958
2007-11-09 19:53:21 +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
Steve Naroff 2011338446 Rewrite global variable initializers.
llvm-svn: 43947
2007-11-09 15:20:18 +00:00
Steve Naroff 8570fdec1a Recognize ObjCStringLiteral as a constant expression.
llvm-svn: 43946
2007-11-09 15:00:03 +00:00
Steve Naroff 1b232132ad - add typedef guards.
- tweak scanForProtocolRefs heuristic.
- disable RewriteInclude() for now.

llvm-svn: 43942
2007-11-09 12:50:28 +00:00
Ted Kremenek 908f96a2cf Changed method call to reflect updated serialization API.
llvm-svn: 43917
2007-11-09 00:43:55 +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
Chris Lattner f546408406 remove some temporary code.
llvm-svn: 43906
2007-11-08 20:53:07 +00:00
Chris Lattner b74f6e82e4 add a getAtOffset() member to simplify some code.
llvm-svn: 43905
2007-11-08 20:51:02 +00:00
Ted Kremenek da4c6c183d Rewrote serialization of IdentifierInfo and IdentifierTable to use methods Emit
and Materialize/Read instead of using specializations of SerializeTrait<>. The
resulting code is much cleaner. We are also setting the stage so that only the
parts of the IdentifierTable that are ever referenced within the ASTs are
serialized, and not the whole table.

llvm-svn: 43904
2007-11-08 19:52:41 +00:00
Chris Lattner 34660fb75a add a fixme.
llvm-svn: 43902
2007-11-08 19:40:23 +00:00
Chris Lattner bedd411589 significantly simplify the implementation of RewriteRope by changing the
implementation to be list<RopePiece> instead of vector<RopePiece*>.

llvm-svn: 43901
2007-11-08 19:39:57 +00:00