Chris Lattner
9fcdc52243
Fix PR1820, an incredibly subtle macro expansion bug that Neil discovered.
...
Neil, please review this fix.
llvm-svn: 44285
2007-11-23 06:50:21 +00:00
Anders Carlsson
94ea8aab34
Store output and input operands as well as clobber information in the AsmStmt. Ted, could you please review the serialization/deserialization code?
...
llvm-svn: 44266
2007-11-22 01:36:19 +00:00
Anders Carlsson
091a059c55
GCC fails if there is a trailing colon but no clobbers.
...
llvm-svn: 44265
2007-11-21 23:27:34 +00:00
Anders Carlsson
81a5a69682
Store inline asm code in the AST.
...
llvm-svn: 44255
2007-11-20 19:21:03 +00:00
Anders Carlsson
4f8eb127e1
Add __builtin_abs
...
llvm-svn: 44254
2007-11-20 19:05:17 +00:00
Chris Lattner
5c3f1541a7
Improve function decl merging, patch by Oliver Hunt!
...
llvm-svn: 44253
2007-11-20 19:04:50 +00:00
Ted Kremenek
9e823c745d
Added another test case for the Dead Stores checker that tests that
...
block-level expressions are evaluated the same as regular expressions. Test
case provided by Nuno Lopes.
llvm-svn: 44247
2007-11-20 03:03:00 +00:00
Ted Kremenek
9d0acca967
Updated CFGStmtVisitor and CFGRecStmtVisitor to have a notion of
...
"block-expressions" when visiting arbitrary expressions (via calls to
"Visit()"). This results in a refactoring where a dataflow analysis no
longer needs to always special case when handling block-expressions versus
non-block expressions.
Updated LiveVariables and UninitializedValues to conform to the slightly
altered interface of these visitor classes.
Thanks to Nuno Lopes for providing a test case that illustrated some
fundamental problems in the current design of the CFGXXXStmtVisitor classes
and how they were used.
llvm-svn: 44246
2007-11-20 03:01:58 +00:00
Ted Kremenek
e866e7b6fc
Removed PersistentMap. It is now superseded in every way by the ImmutableMap
...
and ImmutableSet classes in the main LLVM libraries.
llvm-svn: 44237
2007-11-19 17:25:30 +00:00
Ted Kremenek
eb8471bfa1
Added test case for dead stores checker (live variables analysis) that tests
...
for correct propagation/update of liveness information within subexpressions
of Block-Level expressions. Test case provided by Nuno Lopes.
llvm-svn: 44225
2007-11-19 06:38:23 +00:00
Ted Kremenek
850f1155ad
Fixed bug where LiveVariables was not properly propagating updates to liveness
...
state that occurred in subexpressions of Block-Level expressions. Bug and fix
provided by Nuno Lopes.
llvm-svn: 44224
2007-11-19 06:36:49 +00:00
Anders Carlsson
9c1011c090
Put back the flags field in the constant CF string type.
...
llvm-svn: 44222
2007-11-19 00:25:30 +00:00
Ted Kremenek
094079c0dc
Added test case for dead-stores checker. Test case provided by Nuno Lopes.
...
llvm-svn: 44221
2007-11-18 20:06:35 +00:00
Ted Kremenek
7016e4d509
Fixed bug in WalkaST_VisitDeclSubExprs where we failed to properly check if
...
the StmtIterator referring to the initializers of a chain of Decls was equal
to the "end" iterator. The particular bug manifested when an iterator was
created on a chain of decls with no initializers.
Thanks to Nuno Lopes for reporting this bug and providing a patch.
llvm-svn: 44220
2007-11-18 20:06:01 +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
Ted Kremenek
f115550f6f
Added assertion in serialization of DeclRefExprs. DeclRefExprs can only
...
own the decl they reference if it is a FunctionDecl. Note that his
ownership property is still considered a hack, and should be fixed.
llvm-svn: 44192
2007-11-16 19:00:35 +00:00
Ted Kremenek
50d7f6f620
Fixed bug in the serialization of FunctionDecls. We would incorrectly
...
query for the number of parameters for FunctionDecls that had type
FunctionTypeNoProto.
llvm-svn: 44191
2007-11-16 18:11:10 +00:00
Chris Lattner
48d52848d7
Tighten up address-of checking, implementing test/Sema/expr-address-of.c.
...
This fixes a bug reported by Seo Sanghyeon.
This was meant to be committed yesterday, but the commit failed. doh.
llvm-svn: 44190
2007-11-16 17:46:48 +00:00
Chris Lattner
0640e3ef35
Fix transient failure on Lex/c90.c due to an uninit variable.
...
llvm-svn: 44180
2007-11-15 19:22:40 +00:00
Chris Lattner
4dcbc2090a
add header file I forgot to check in
...
llvm-svn: 44179
2007-11-15 19:22:18 +00:00
Chris Lattner
609d413363
fix a bug Steve noticed, where a #import of the main file itself would fail.
...
llvm-svn: 44178
2007-11-15 19:07:47 +00:00
Ted Kremenek
07941e21e9
Added hack when serializing DeclRefExprs. This should probably be fixed.
...
Some FunctionDecls do not appear at the top-level or are owned by a DeclStmt.
In calls to implicitly defined functions, a FunctionDecl is created, but only
the DeclRefExprs reference them. Since an implicitly defined function may be
called multiple times, there is no clear ownership model for such objects.
Temporary solution: when serializing out DeclRefExprs, emit an ownership bit
for the Decl. This bit is determined by querying the serializer to see if the
Decl has already been serialized. If it hasn't, emit the Decl as an owned
pointer.
I repeat: this is a hack. This should be fixed.
llvm-svn: 44176
2007-11-15 18:26:39 +00:00
Ted Kremenek
4791e1a7bd
Started separate section for method definitions for ObjC serialization.
...
Added missing deserialization case in Stmt::Create() switch statement.
llvm-svn: 44175
2007-11-15 18:10:29 +00:00
Steve Naroff
c8fcbe09d0
No need to forward declare definition of objc_super...
...
llvm-svn: 44173
2007-11-15 17:06:21 +00:00
Steve Naroff
e3ffc2f4a9
Finish up variadic methods/messages.
...
llvm-svn: 44172
2007-11-15 13:05:42 +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
05caa48fb4
Extend RewriteTest::RewriteObjCIvarRefExpr() to cope with static typing (when using -> on a type which corresponds to the implementation type).
...
llvm-svn: 44170
2007-11-15 11:33:00 +00:00
Steve Naroff
44864e48bd
Tweak funky cast to accommodate messaging 'super'. This removes any spurious warnings.
...
llvm-svn: 44169
2007-11-15 10:43:57 +00:00
Steve Naroff
7fa2f040f3
Rewrite for messaging 'super'.
...
The code gen. results in some spurious warnings...a cast is forthcoming.
llvm-svn: 44168
2007-11-15 10:28:18 +00:00
Nate Begeman
847bfbcaf0
Break out bool/true/false support into a LangOption
...
llvm-svn: 44164
2007-11-15 07:30:50 +00:00
Nate Begeman
4c18c23eb3
Implement codegen of CXX Bool
...
llvm-svn: 44160
2007-11-15 05:40:03 +00:00
Chris Lattner
bb31a42fef
Handle "bool" in all places that touch _Bool.
...
This fixes code like "if((bool)x) {}" for example.
Patch by Nate Begeman.
llvm-svn: 44159
2007-11-15 05:25:19 +00:00
Steve Naroff
f60782b8c9
- Implement ivar rewrite (patch by Fariborz).
...
- RewriteMessageExpr()...make implicit casts explicit with synthesizing call (removing warnings when calling objc_msgSend()).
llvm-svn: 44156
2007-11-15 02:58:25 +00:00
Steve Naroff
909d666681
Refinement to previous commit. Always cast the first argument to "id"...no need to special case self.
...
llvm-svn: 44149
2007-11-15 00:00:21 +00:00
Steve Naroff
e7f181986a
Cast implicit "self" argument to "id". This removes all warnings associated with implicit references to self. It doesn't yet deal withexplicit references to self...
...
llvm-svn: 44148
2007-11-14 23:54:14 +00:00
Ted Kremenek
cf7a20a6c4
Fixed bug in serialization of EnumConstantDecl where we improperly
...
"default constructed" an APSInt. Fixed another bug in the same method
where we did not allow the NextDeclarator to be NULL.
llvm-svn: 44147
2007-11-14 23:38:09 +00:00
Ted Kremenek
c77e5a126c
Fixed bug when serializing QualTypes where we were serializing in the
...
qualifiers as part of the pointer address.
llvm-svn: 44146
2007-11-14 23:35:01 +00:00
Steve Naroff
03f2767368
Always generate a typedef for @class . The typedef removal logic that I'm removing only made sense when we were operating on preprocess files without typedef guards. Now that we have guards, it is incorrect to ever remove one (since it may increase the likelihood that the rewritten header can't be included stand alone).
...
llvm-svn: 44145
2007-11-14 23:02:56 +00:00
Chris Lattner
174a825f01
Fix a rewriter bug that steve noticed. Don't skip arbitrary things
...
between an @ and a p, just skip whitespace.
llvm-svn: 44144
2007-11-14 22:57:51 +00:00
Ted Kremenek
83b75f5ee8
Added QualType::ReadBackpatch to allow QualType initialization with
...
backpatching. This original was available, but then we removed it. It is back
again to help with deserialization of FieldDecls. Because FieldDecls are
currently owned by RecordDecls, which are owned by a TagType, the type of the
FieldDecl may not be deserialized prior to deserializing the FieldDecl. Thus
backpatching solves the problem of constructing a FieldDecl that references a
type that has not yet been deserialized.
Simplified serialization of TagType to not require passing in the
SerializedPtrID. Registration of the materialized type object is done after
the CreateImpl method returns (as with other types).
llvm-svn: 44143
2007-11-14 22:51:02 +00:00
Fariborz Jahanian
c6225532c3
Patch to comment out use of protocol qualifiers when rewriting ivars.
...
llvm-svn: 44142
2007-11-14 22:26:25 +00:00
Ted Kremenek
e25b79ff84
Implemented serialization of InitListExpr.
...
llvm-svn: 44137
2007-11-14 21:31:46 +00:00
Ted Kremenek
3db07a7016
Implemented serialization of CompoundLiteralExpr.
...
llvm-svn: 44134
2007-11-14 21:18:36 +00:00
Ted Kremenek
fab0c76a25
Added serialization of Union decls.
...
llvm-svn: 44133
2007-11-14 21:15:42 +00:00
Ted Kremenek
00e0b40599
Removed assertion inserted only for temporary debugging.
...
llvm-svn: 44131
2007-11-14 19:36:11 +00:00
Ted Kremenek
ec56081f38
Added missing break statement.
...
Reordered serialization methods for FunctionTypeProto and FunctionTypeNoProto
to be alphabetical by serialized type name.
llvm-svn: 44130
2007-11-14 19:33:01 +00:00
Steve Naroff
dde78986fb
Fairly major surgery to RewriteTest::SynthesizeObjcInternalStruct().
...
This allows us to handle funky stuff like...
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
@interface NSLayoutManager : NSObject <NSCoding, NSGlyphStorage> {
#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
@interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
...which now rewrites to...
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
#ifndef _REWRITER_typedef_NSLayoutManager
#define _REWRITER_typedef_NSLayoutManager
typedef struct objc_object NSLayoutManager;
#endif
struct NSLayoutManager {
struct NSObject _NSObject;
#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
// @interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
llvm-svn: 44129
2007-11-14 19:25:57 +00:00
Ted Kremenek
26ba7973ea
Implemented serialization of EnumDecl and EnumConstantDecl.
...
llvm-svn: 44127
2007-11-14 18:12:19 +00:00
Ted Kremenek
8e93ca3de5
Implemented serialization of FieldDecls.
...
llvm-svn: 44126
2007-11-14 17:47:01 +00:00
Ted Kremenek
31ae973708
SourceManager, IdentifierTable, Selectors are now serialized in their own
...
block separate from ASTContext. This block is serialized out AFTER writing out
ASTContext, but deserialized BEFORE reading in ASTContext. This permits the
optimization of the serialization of the IdentifierTable where we only write
out identifiers that are used.
This was needed because TagDecls are owned by Types, and TagDecls contain
identifiers. Thus types need to be written out first to register with the
serializer any identifiers they refer to (and hence need to be serialized out
with IdentifierTable).
llvm-svn: 44125
2007-11-14 17:46:35 +00:00
Fariborz Jahanian
794793ec1c
Removed unused variabel.
...
llvm-svn: 44123
2007-11-14 17:35:46 +00:00
Chris Lattner
e6c7a858b0
Fix a bug handling hex floats in c90 mode, pointed out by Neil.
...
llvm-svn: 44120
2007-11-14 16:14:50 +00:00
Steve Naroff
a509f04034
Fix yesterday's regression with rewriting @optional/@required.
...
llvm-svn: 44119
2007-11-14 15:03:57 +00:00
Steve Naroff
58ed6c04f2
Rewrite methods that span multiple lines.
...
llvm-svn: 44118
2007-11-14 14:34:23 +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
Ted Kremenek
3c9c7b84fe
Implemented serialization of RecordDecls. Changed serialization of TagType to
...
have an owning pointer to the referred TagDecl. This should hopefully fix a
bug where TagDecls (including decls from structs, etc.) were not serialized.
llvm-svn: 44106
2007-11-14 08:06:37 +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
Steve Naroff
c17b056427
Comment out recent regression r44096.
...
llvm-svn: 44098
2007-11-14 03:37:28 +00:00
Fariborz Jahanian
fe38ba24af
Rewrite @optional/@required directives used inside protocol definitions.
...
llvm-svn: 44096
2007-11-14 01:37:46 +00:00
Fariborz Jahanian
da6165c3dc
Rewrite of forward protocol declaration.
...
llvm-svn: 44095
2007-11-14 00:42:16 +00:00
Ted Kremenek
164faf98f3
Implemented serialization of FunctionTypeNoProto.
...
llvm-svn: 44094
2007-11-14 00:38:50 +00:00
Ted Kremenek
7068cef079
Implemented serialization of VariableArrayTypes.
...
llvm-svn: 44093
2007-11-14 00:31:36 +00:00
Ted Kremenek
eef4a6296f
Implemented serialization of TypedefType.
...
llvm-svn: 44092
2007-11-14 00:27:46 +00:00
Ted Kremenek
ea27383d68
Implemented serialization of ConstantArrayType.
...
llvm-svn: 44091
2007-11-14 00:17:21 +00:00
Ted Kremenek
f35e589847
Implemented serialization of TagTypes.
...
llvm-svn: 44090
2007-11-14 00:03:56 +00:00
Ted Kremenek
919858a428
Modified ASTContext::getTagDeclType() to accept a NULL pointer for the passed
...
in TagDecl*. This allows the deserializer to use ASTContext to create the
TagTypes. Deserialize TagTypes then rely on pointer-backpatching to resolve
the decls.
This may not be the interface that we want, but as the implementation of
TagTypes will potentially change significantly in the future, I'm leaving this
for now. An appropriate FIXME is in place.
llvm-svn: 44089
2007-11-14 00:03:20 +00:00
Steve Naroff
971d2f1242
Fix regression with ObjC method definitions and -ast-print
...
llvm-svn: 44088
2007-11-13 23:48:03 +00:00
Fariborz Jahanian
bc92fd7542
Type encoding for structs.
...
llvm-svn: 44087
2007-11-13 23:21:38 +00:00
Steve Naroff
7b8fa4746a
Rewrite method definition bodies. Also renamed a method to distinguish between method declarations and definitions.
...
llvm-svn: 44080
2007-11-13 23:01:27 +00:00
Ted Kremenek
204a1d3976
Removed line with typo (declared friendship with ASTContext). Line was
...
not needed since friendship is declared elsewhere.
llvm-svn: 44079
2007-11-13 22:57:59 +00:00
Ted Kremenek
767e7507c2
Added pretty-printing of statements during serialization.
...
llvm-svn: 44078
2007-11-13 22:56:10 +00:00
Ted Kremenek
049059a7db
Implemented serialization of AsmStmt (or rather what is currently implemented
...
in AsmStmt).
llvm-svn: 44077
2007-11-13 22:55:51 +00:00
Ted Kremenek
d86dcfe8ca
Fixed bug in FunctionDecl serialization where we crashed when the
...
FunctionDecl had decls for its parameters but still had greater than 0
arguments.
llvm-svn: 44076
2007-11-13 22:51:08 +00:00
Ted Kremenek
da551c3b1e
Implemented serialization for SizeOfAlignOfTypeExpr.
...
llvm-svn: 44075
2007-11-13 22:30:29 +00:00
Ted Kremenek
b8f51d5512
Implemented serialization for MemberExpr.
...
llvm-svn: 44074
2007-11-13 22:16:23 +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
Fariborz Jahanian
989e03989b
Fixed a rewrite of metadata bug when category implementation has no matching interface.
...
llvm-svn: 44072
2007-11-13 22:09:49 +00:00
Ted Kremenek
24726c3fc9
Rewrote type serialization to used the same methodology as we do for Decls.
...
Removed tons of dead code in ASTContext concerning how types use to be
serialized.
Removed serialization methods from QualType that are no longer used.
llvm-svn: 44070
2007-11-13 22:02:55 +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
5633835d17
Populate metadata with adrress of method code.
...
llvm-svn: 44066
2007-11-13 21:02:00 +00:00
Chris Lattner
47791a4051
Parse "sizeof(arr)[0]" as a sizeof of an expr if arr
...
is an expression.
llvm-svn: 44065
2007-11-13 20:50:37 +00:00
Fariborz Jahanian
c54d8462fb
Rewrite of method definitions in categories.
...
llvm-svn: 44062
2007-11-13 20:04:28 +00:00
Fariborz Jahanian
98ba6cde3d
Order of methods are OK and generated .c file can be compiled.
...
llvm-svn: 44060
2007-11-13 19:21:13 +00:00
Ted Kremenek
794d8a6cde
Updated test case to flag about comparisons against constants. We may
...
invert this case (i.e., not flag a warning) in the future.
llvm-svn: 44059
2007-11-13 19:18:22 +00:00
Ted Kremenek
b83f182b59
Modified -Wfloat-equal logic to suppress warnings where floating point values
...
are compared against builtins such as __builtin_inf.
llvm-svn: 44058
2007-11-13 19:17:00 +00:00
Fariborz Jahanian
1e5f64e2ea
First patch in rewrie of method definitions. This is work in progress.
...
llvm-svn: 44055
2007-11-13 18:44:14 +00:00
Ted Kremenek
577437de8b
Updated diagnostic for -Wfloat-equal to underline the offending expressions.
...
llvm-svn: 44054
2007-11-13 18:40:33 +00:00
Ted Kremenek
2272f72723
Added -Wfloat-equal option to the driver. This makes warnings about
...
floating point comparisons using == or != an opt-in rather than a default
warning.
Updated test case to use -Wfloat-equal.
llvm-svn: 44053
2007-11-13 18:37:02 +00:00
Chris Lattner
034b49dca0
Clean up types, removing some casts. Patch contributed by
...
Cedric Venet.
llvm-svn: 44050
2007-11-13 18:16:41 +00:00
Chris Lattner
2f72c427cf
improve handling of address of global when checking for
...
constants and initializers. Patch by Sanghyeon Seo, thanks!
llvm-svn: 44049
2007-11-13 18:05:45 +00:00
Steve Naroff
b666625493
Teach Sema::CheckCompareOperands() about "void *" (C99 6.5.9p2)
...
llvm-svn: 44047
2007-11-13 14:57:38 +00:00
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
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
Devang Patel
ef2d838fef
Stay within 80 columns.
...
llvm-svn: 43843
2007-11-07 21:04:59 +00:00
Hartmut Kaiser
abcbb0493a
Updated VC++ build system
...
llvm-svn: 43838
2007-11-07 19:34:40 +00:00
Ted Kremenek
d68db575f3
Implemented serialization of StringLiteral.
...
llvm-svn: 43834
2007-11-07 19:08:19 +00:00
Ted Kremenek
f9062be688
Implemented serialization of ImaginaryLiteral.
...
llvm-svn: 43833
2007-11-07 18:53:02 +00:00
Ted Kremenek
569725f827
Implemented serialization of FloatingLiteral.
...
llvm-svn: 43832
2007-11-07 18:45:55 +00:00
Steve Naroff
1601858de5
Finishing touches on code generation for @try and friends.
...
- declare functions we use.
- cast arguments to objc_exception_match().
- don't take the & of _stack.buf.
llvm-svn: 43831
2007-11-07 18:43:40 +00:00
Fariborz Jahanian
1299a92327
Emit objective-c's meta-data at the end of rewriting to stdout.
...
llvm-svn: 43830
2007-11-07 18:40:28 +00:00
Steve Naroff
b7a032eb20
Remove old asserts from ASTContext::isObjcIdType() and isObjcClassType(). Instead, return false if the declarations aren't in scope. This was a hold over from when 'id' and 'Class' were initialized lazily.
...
llvm-svn: 43827
2007-11-07 18:07:59 +00:00
Fariborz Jahanian
8a348705a8
Fixed an array overflow bug.
...
llvm-svn: 43826
2007-11-07 17:43:16 +00:00
Fariborz Jahanian
e044087b56
Fixed typo.
...
llvm-svn: 43825
2007-11-07 17:29:15 +00:00
Ted Kremenek
c874c6a959
Implemented serialization of CharacterLiteral.
...
llvm-svn: 43824
2007-11-07 17:15:49 +00:00
Ted Kremenek
3c58662411
Implemented serialiation of PreDefinedExpr.
...
llvm-svn: 43823
2007-11-07 17:11:58 +00:00
Ted Kremenek
d47c8125a1
Implemented serialization of ContinueStmt.
...
llvm-svn: 43822
2007-11-07 17:05:07 +00:00
Ted Kremenek
3b4c08deae
Implemented serialization of IndirectGotoStmt.
...
Added "FIXME" regarding the lack of source location information for IndirectGotoStmt.
llvm-svn: 43821
2007-11-07 17:02:32 +00:00
Steve Naroff
a733c7ffe4
Implement rewrite for @throw.
...
llvm-svn: 43820
2007-11-07 15:32:26 +00:00
Ted Kremenek
5fd3040c57
Implemented serialization of GotoStmt.
...
llvm-svn: 43818
2007-11-07 08:07:46 +00:00
Ted Kremenek
35e20410aa
Implemented serialization for ForStmt.
...
llvm-svn: 43817
2007-11-07 08:02:55 +00:00
Ted Kremenek
83e96b8d5a
Implemented serialization of DoStmt.
...
llvm-svn: 43816
2007-11-07 07:53:55 +00:00
Ted Kremenek
f6d8ce1052
Implemented serialization for WhileStmt.
...
llvm-svn: 43815
2007-11-07 07:50:10 +00:00
Ted Kremenek
154c790538
Implemented serialization of IfStmt.
...
Fixed declarations of several "directEmit" methods of classes that subclass
Stmt that were missing a "virtual" keyword.
llvm-svn: 43814
2007-11-07 07:19:30 +00:00
Steve Naroff
4d7b367652
Teach ASTContext::tagTypesAreCompatible() about the built-in ObjC types (Class and id), removing a bogus warning.
...
llvm-svn: 43809
2007-11-07 06:03:51 +00:00
Ted Kremenek
acb9bcf22a
Implemented serialization of SwitchStmt, CaseStmt, BreakStmt, DefaultStmt,
...
and ParenExpr.
llvm-svn: 43806
2007-11-07 05:25:31 +00:00
Steve Naroff
bf478ece48
Rewrite ObjC @try/@catch/@finally. Some minor tweaks to the AST nodes...
...
Still need to rewrite @throw (and do more testing)...
llvm-svn: 43803
2007-11-07 04:08:17 +00:00
Fariborz Jahanian
adfbbc3330
AST for objective-c's @throw statement and its pretty-printing.
...
llvm-svn: 43802
2007-11-07 02:00:49 +00:00
Devang Patel
b1ecfc6e25
Start struct bit field laout work.
...
This is far from complete.
llvm-svn: 43801
2007-11-07 01:57:13 +00:00
Ted Kremenek
a8cdf31aa0
Implemented serialization of LabelStmts.
...
llvm-svn: 43800
2007-11-07 00:48:04 +00:00
Fariborz Jahanian
defbf9a86c
Fixed a pretty-printer bug whereby a @try statement with no @finally seg faulted.
...
llvm-svn: 43798
2007-11-07 00:46:42 +00:00
Ted Kremenek
ad1bc400d7
Added serialization/deserialization of NullStmts.
...
llvm-svn: 43797
2007-11-07 00:40:53 +00:00
Ted Kremenek
80fe8904e1
Added serialization/deserialization of DeclStmts.
...
Reordered stmt serialization method implementations to be in alphabetical order.
llvm-svn: 43796
2007-11-07 00:37:40 +00:00
Ted Kremenek
148aa5edbc
Overhauled serialization of statements. We no longer use specialized SerializeTrait<> classes,
...
but methods in Stmt (like other objects we are serializing). Full serialization of all statements
is not yet complete.
llvm-svn: 43793
2007-11-07 00:17:35 +00:00
Ted Kremenek
abcfe90802
Added static inline method "ReadVal" to QualType for more succinct
...
deserialization code of objects containing QualTypes.
llvm-svn: 43792
2007-11-07 00:13:45 +00:00
Fariborz Jahanian
e8a3016ac7
Rewrite for properties.
...
llvm-svn: 43791
2007-11-07 00:09:37 +00:00
Ted Kremenek
fa2bf434cc
Fixed typo in the name of "ReadPreamble".
...
llvm-svn: 43790
2007-11-06 23:52:19 +00:00
Fariborz Jahanian
bcce2f8d54
Fix an inverted conditional,
...
--chris
llvm-svn: 43789
2007-11-06 23:06:16 +00:00
Ted Kremenek
453ab7d126
Started work on new serialization approach within ASTContext to
...
serialize Type objects in the order they are serialized in the Types
vector. We also now rely on the methods within ASTContext to unique
Type objects and handle the actual creation of Type objects (these are
now called by the deserialization code). This approach solves some
hairy issues with ownership of objects and allows us to naturally
handle recursive types.
llvm-svn: 43787
2007-11-06 22:26:16 +00:00
Ted Kremenek
7c91ccae88
QualType deserialization now requires that the underlying pointer type
...
must be deserialized without requiring backpatching.
llvm-svn: 43786
2007-11-06 22:23:53 +00:00