Commit Graph

2554 Commits

Author SHA1 Message Date
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
Fariborz Jahanian 8e632940fc Refactored parsing of main function body for reuse by objective-c methods.
llvm-svn: 43898
2007-11-08 19:01:26 +00:00
Chris Lattner 3eb670721f improve MakeRopeString to avoid doing a malloc for every 2-character string
that gets inserted.  This speeds up the rewriter another 10%.

llvm-svn: 43896
2007-11-08 18:32:01 +00:00
Chris Lattner 9a00d3ec90 Simplify interface to MakeRopeString.
llvm-svn: 43895
2007-11-08 17:59:48 +00:00
Chris Lattner 3a21bd50e7 Fix backwards assert.
llvm-svn: 43894
2007-11-08 17:56:40 +00:00
Ted Kremenek f2d68452c6 Implemented serialization of AddrLabelExpr.
Implemented serialization of ConditionalOperator.
Implemented serialization of StmtExpr.
Fixed bug in serialization of IndirectGoto (did not properly serialize subexpression).

llvm-svn: 43891
2007-11-08 16:32:00 +00:00
Steve Naroff 265a6b9693 Rewrite RewriteObjCStringLiteral(). This version is simpler (and unlike the previous one, works:-)
llvm-svn: 43890
2007-11-08 14:30:50 +00:00
Chris Lattner e90ce8def3 Add a new RewriteRope data structure which is a smarter way to represent the text
backing a rewrite buffer than using an std::vector<char>.  This class was hacked
together very quickly and needs to be cleaned up, but it seems to work.  It speeds
up rewriting a a 7M file from 6.43s to 0.24s on my machine.  The impl could also
be made to be a lot more algorithmically sound.

This produces identical output to using vector on this testcase, if it causes a
problems or bugs are encountered, it can be disabled by changing the 
RewriteBuffer::Buffer typedef back.

llvm-svn: 43884
2007-11-08 07:35:14 +00:00
Chris Lattner 7a7da75916 abstract out buffer type a bit better
llvm-svn: 43883
2007-11-08 05:42:25 +00:00
Chris Lattner dc0cfc9fe3 use insert instead of replacing 0 bytes with text :)
llvm-svn: 43882
2007-11-08 04:41:51 +00:00
Chris Lattner edebdb5b29 minor cleanups
llvm-svn: 43881
2007-11-08 04:41:04 +00:00
Chris Lattner 9fd5890e52 use std::copy instead of memcpy for abstraction.
Disable rewrite-tabs.  This speeds up processing of the commentified huge
crazy testcase steve gave me from 20s to 6.6s in a release build.

llvm-svn: 43880
2007-11-08 04:27:23 +00:00
Chris Lattner 4573cc708a Fix a rewriter bug that fariborz hit, when an @interface was the very very very
first thing in the file.

The trick is that text replacement should go after the insert point, 
not before it, because it will be replacing text after the point, not before 
it.

llvm-svn: 43879
2007-11-08 04:09:59 +00:00
Ted Kremenek a34b057762 Revised serialization of CaseStmt to emit all of the owned pointers (its
subexpressions) all together in one block at the end.

llvm-svn: 43862
2007-11-08 00:56:26 +00:00
Ted Kremenek c1cddef7c9 Implemented serialization of CompoundAssignOperator.
llvm-svn: 43860
2007-11-08 00:41:37 +00:00
Devang Patel ec51171319 Add assert for the case that is not handled.
struct { char a; short b:2; };

llvm-svn: 43859
2007-11-08 00:32:12 +00:00
Ted Kremenek 2419ac8792 Implemented serialization of UnaryOperator.
llvm-svn: 43858
2007-11-08 00:26:24 +00:00
Devang Patel 7c7a07d949 Keep track of beginning offset for the bit field that does not start at byte boundry.
llvm-svn: 43857
2007-11-08 00:17:59 +00:00
Ted Kremenek 766fc8c14a Implemented serialization of CallExpr.
llvm-svn: 43854
2007-11-07 23:32:20 +00:00
Ted Kremenek 2c325386b8 Implemented serialization of ArraySubscriptExpr.
Added "using ..." for "Serializer" and "Deserializer" to reduce amount
of typing for serialization methods.

llvm-svn: 43849
2007-11-07 22:53:01 +00:00
Ted Kremenek e87ceeeb4a Implemented serialization of CastExpr.
llvm-svn: 43848
2007-11-07 22:42:34 +00:00
Ted Kremenek b2b5e73f89 Implemented serialization of ImplicitCastExpr.
llvm-svn: 43847
2007-11-07 22:39:17 +00:00
Ted Kremenek 9d2bf704de Modified serialization of BinaryOperator and CaseStmt to use the new
BatchEmitOwnedPtrs() and BatchReadOwnedPtrs() methods.

Modified serialization of all Stmts to start their own record in the bitstream.

llvm-svn: 43846
2007-11-07 22:32:23 +00:00