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
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
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
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
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
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
Ted Kremenek
577437de8b
Updated diagnostic for -Wfloat-equal to underline the offending expressions.
...
llvm-svn: 44054
2007-11-13 18:40:33 +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
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
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
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
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
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
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
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
adfbbc3330
AST for objective-c's @throw statement and its pretty-printing.
...
llvm-svn: 43802
2007-11-07 02:00: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
Steve Naroff
96d20616c4
Sema::ActOnClassMessage()...if a class method isn't found, lookup an instance method. Since all classes are also instances, this is appropriate.
...
llvm-svn: 43708
2007-11-05 15:27:52 +00:00
Steve Naroff
66697aa72f
Add a method prototype slot/getter to the ObjCMessageExpr AST.
...
llvm-svn: 43666
2007-11-03 16:37:59 +00:00
Steve Naroff
a397efd915
Implement rewrite rules for ObjC string constants.
...
llvm-svn: 43665
2007-11-03 11:27:19 +00:00
Chris Lattner
376cdaf50b
Fix ownership model of ParseAST to allow the dtor of
...
ASTConsumer to process the AST before it is destroyed.
This allows elimination of HandleObjcMetaDataEmission.
llvm-svn: 43659
2007-11-03 06:24:16 +00:00
Fariborz Jahanian
f859ef293c
AST for @try statement.
...
llvm-svn: 43640
2007-11-02 15:39:31 +00:00
Fariborz Jahanian
71234d8a9e
AST for @finally statement.
...
llvm-svn: 43629
2007-11-02 00:18:53 +00:00
Fariborz Jahanian
9e63b98de7
AST build for @catch clause (this is work in progress).
...
llvm-svn: 43628
2007-11-01 23:59:59 +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
Anders Carlsson
f56a7aee2f
Encode Class, SEL and Objective-C objects.
...
llvm-svn: 43540
2007-10-31 02:53:19 +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
Steve Naroff
5cdcd9b61c
Stop pre-defining objc_msgSend/objc_getClass in the preprocessor. Instead, I generate these declaration on the fly when rewriting a message expression.
...
llvm-svn: 43529
2007-10-30 23:14:51 +00:00
Ted Kremenek
78036cdd5c
Tightened IgnoreParen.
...
llvm-svn: 43517
2007-10-30 21:03:09 +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
Ted Kremenek
e2763b0948
Added some comments.
...
Moved a dependent predicate in an if statement to be an assertion
within the if statement body.
llvm-svn: 43453
2007-10-29 17:13:39 +00:00
Ted Kremenek
e451eae8d7
For non-floating point types, added check for expressions of the form
...
"x == x" and "x != x". We emit a warning for these since they always evaluate
to a constant value and often indicate a logical error.
Added test case for this check.
llvm-svn: 43450
2007-10-29 16:58:49 +00:00
Ted Kremenek
fa907b8168
For floating point equality check, we now ignore parentheses. e.g.:
...
(x) == x is the treated the same as x == x.
llvm-svn: 43448
2007-10-29 16:45:23 +00:00
Ted Kremenek
d4ecc6da67
For checking for floating point comparison using == or !=, we now suppress
...
errors for cases such as "x == x".
Added test case to test this feature.
llvm-svn: 43447
2007-10-29 16:40:01 +00:00
Chris Lattner
b104d31bd9
when checking for type equality, ignore typedefs.
...
llvm-svn: 43441
2007-10-29 05:15:40 +00:00
Chris Lattner
3bc4d20862
casting to void is ok for structs (C99 6.5.4p2), this fixes
...
one bogus error on PR1750.
llvm-svn: 43436
2007-10-29 04:26:44 +00:00
Chris Lattner
73c56c0735
Implement *skeletal* support for representing GNU inline asm stmts in the AST,
...
resolving a crash on a .i file in PR1750. We now generate 49 errors on the
.i file in that bug.
llvm-svn: 43433
2007-10-29 04:04:16 +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
Fariborz Jahanian
99e96b0f11
Patch to synthesize computation of Ivar offset in rewritten c file.
...
Thanks to Steve N. to point out using of offsetof for this.
llvm-svn: 43391
2007-10-26 19:46:17 +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
684dc4107f
Fix the previous (short lived:-) FIXME.
...
I didn't realize that GCC considers this a hard error (I thought it was built-in).
Since it's not, we should simply emit an error.
[dylan:~/llvm/tools/clang] admin% cc -c trivial.m
trivial.m:6: error: cannot find interface declaration for 'NSConstantString'
[administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang trivial.m
trivial.m:6:16: error: cannot find interface declaration for 'NSConstantString'
NSString *s = @"123";
^
1 diagnostic generated.
llvm-svn: 43157
2007-10-18 23:53:51 +00:00
Fariborz Jahanian
e183a8259d
Check for Nullness of value built in GetObjcProtoType.
...
llvm-svn: 43155
2007-10-18 22:59:23 +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
Steve Naroff
1bb21df47f
Tweak a recent fix to UsualArithmeticConversions (made by Chris - r43113). The benefit of this tweak is it guarantees the entire routine operates on unqualified types (which I believe is a bit clearer).
...
llvm-svn: 43142
2007-10-18 18:55:53 +00:00
Steve Naroff
a78c464c9e
Fix a bug in Sema::CheckConditionalOperands(). When mixing pointers and null pointer constants, we need to promote the null pointer constant (which is an integer) to the pointer type. Test case is self explanatory.
...
This surfaced yesterday, when compiling test/Sema/cocoa.m on Leopard. Since this has nothing to do with ObjC, it's kind of bizarre this hasn't shown up before. I imagine Cocoa.h on Leopard may have changed recently?
Thanks to Ted for localizing the bug and giving me a useful AST dump...
llvm-svn: 43114
2007-10-18 05:13:08 +00:00
Chris Lattner
fac7ac4130
UsualArithmeticConversions is crashing with an assert
...
when comparing "float" and "const float". This "fixes" the
issue, but may not be the right fix. Steve, please review.
Testcase here: test/Sema/usual-float.c
llvm-svn: 43113
2007-10-18 03:50:33 +00:00
Steve Naroff
8569d77349
Fix the following bug...
...
unsigned char asso_values[] = { 34 };
int legal2() {
return asso_values[0];
}
The code that creates the new constant array type was operating on the original type.
As a result, the constant type being generated was "unsigned char [1][]" (which is wrong).
The fix is to operate on the element type - in this case, the correct type is "unsigned char [1]"
I added this case to array-init.c, which clearly didn't catch this bogosity...
llvm-svn: 43112
2007-10-18 03:27:23 +00:00
Fariborz Jahanian
a32aaefadc
Implementation of AST for @protocol expression.
...
llvm-svn: 43075
2007-10-17 16:58:11 +00:00
Anders Carlsson
f94cd1ffe6
Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.
...
llvm-svn: 43058
2007-10-17 00:52:43 +00:00
Fariborz Jahanian
6bd1d612ac
Fix location processing of @selector: the range should include the @ sign.
...
llvm-svn: 43051
2007-10-16 23:21:02 +00:00
Steve Naroff
077c83bddb
Add Sema::CheckMessageArgumentTypes()...
...
llvm-svn: 43050
2007-10-16 23:12:48 +00:00
Chris Lattner
37390bed4d
Fix location processing of @encode: the range should include the @ sign.
...
@selector probably gets this wrong also.
llvm-svn: 43048
2007-10-16 22:51:17 +00:00
Chris Lattner
a7c19feca2
Add a new Rewriter::getRangeSize method.
...
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for
consistency with other code.
Start building the rewriter towards handling @encode.
llvm-svn: 43047
2007-10-16 22:36:42 +00:00
Fariborz Jahanian
ebac2cb235
Patch to diagnose duplicate method implementations.
...
llvm-svn: 43046
2007-10-16 21:52:23 +00:00
Steve Naroff
d275426449
Remove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't used/needed.
...
Change ObjcMethodDecl::getMethodType to getResultType, to match FunctionDecl.
llvm-svn: 43045
2007-10-16 21:36:54 +00:00
Fariborz Jahanian
4bef462a3e
Patch to implement AST generation for objective-c's @selector expression.
...
llvm-svn: 43038
2007-10-16 20:40:23 +00:00
Steve Naroff
55f52da24c
Emit diagnostics for methods not found.
...
llvm-svn: 43037
2007-10-16 20:39:36 +00:00
Chris Lattner
e6dcd505d0
initialization of references should not do default fn/array promotions.
...
This fixes a bug Anders noticed.
llvm-svn: 43024
2007-10-16 02:55:40 +00:00
Steve Naroff
698495522d
Bad cast...need to use dyn_cast_or_null. Also changed Sema::InitBuiltinVaListType (which had the same bug).
...
llvm-svn: 43023
2007-10-16 00:00:18 +00:00
Steve Naroff
f73b784a5e
Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".
...
This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.
I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).
llvm-svn: 43021
2007-10-15 23:35:17 +00:00
Steve Naroff
32e44c0032
Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).
...
This allowed me to fix the following hack from this weekend...
// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
if (const RecordType *RT = getAsStructureType())
return !strcmp(RT->getDecl()->getName(), "objc_object");
return false;
}
...which is now...
bool isObjcIdType(QualType T) const {
return T->getAsStructureType() == IdStructType;
}
Side notes:
- I had to remove a convenience function from the TypesCompatibleExpr class.
int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}
Which required a couple clients get a little more verbose...
- Result = TCE->typesAreCompatible();
+ Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());
Overall, I think this change also makes sense for a couple reasons...
1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).
llvm-svn: 43009
2007-10-15 20:41:53 +00:00
Anders Carlsson
7e13ab88a2
Add code generation and sema checking for __builtin_va_arg.
...
llvm-svn: 43006
2007-10-15 20:28:48 +00:00