 |
|
 |
|
| Files: |
1 |
|
Branches Taken: |
20.0% |
9 / 45 |
| Generated: |
2010-02-10 01:31 |
|
Branches Executed: |
28.9% |
13 / 45 |
| |
|
Line Coverage: |
79.4% |
154 / 194 |
| |
 |
|
 |
1 : //===--- ExprObjC.h - Classes for representing ObjC expressions -*- C++ -*-===//
2 : //
3 : // The LLVM Compiler Infrastructure
4 : //
5 : // This file is distributed under the University of Illinois Open Source
6 : // License. See LICENSE.TXT for details.
7 : //
8 : //===----------------------------------------------------------------------===//
9 : //
10 : // This file defines the ExprObjC interface and subclasses.
11 : //
12 : //===----------------------------------------------------------------------===//
13 :
14 : #ifndef LLVM_CLANG_AST_EXPROBJC_H
15 : #define LLVM_CLANG_AST_EXPROBJC_H
16 :
17 : #include "clang/AST/Expr.h"
18 : #include "clang/Basic/IdentifierTable.h"
19 :
20 : namespace clang {
21 : class IdentifierInfo;
22 : class ASTContext;
23 : class ObjCMethodDecl;
24 : class ObjCPropertyDecl;
25 :
26 : /// ObjCStringLiteral, used for Objective-C string literals
27 : /// i.e. @"foo".
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
28 0: class ObjCStringLiteral : public Expr {
29 : Stmt *String;
30 : SourceLocation AtLoc;
31 : public:
32 216: ObjCStringLiteral(StringLiteral *SL, QualType T, SourceLocation L)
33 216: : Expr(ObjCStringLiteralClass, T, false, false), String(SL), AtLoc(L) {}
34 1: explicit ObjCStringLiteral(EmptyShell Empty)
35 1: : Expr(ObjCStringLiteralClass, Empty) {}
36 :
37 37: StringLiteral *getString() { return cast<StringLiteral>(String); }
38 104: const StringLiteral *getString() const { return cast<StringLiteral>(String); }
39 1: void setString(StringLiteral *S) { String = S; }
40 :
41 1: SourceLocation getAtLoc() const { return AtLoc; }
42 1: void setAtLoc(SourceLocation L) { AtLoc = L; }
43 :
44 443: virtual SourceRange getSourceRange() const {
45 443: return SourceRange(AtLoc, String->getLocEnd());
46 : }
47 :
48 2047: static bool classof(const Stmt *T) {
49 2047: return T->getStmtClass() == ObjCStringLiteralClass;
50 : }
51 : static bool classof(const ObjCStringLiteral *) { return true; }
52 :
53 : // Iterators
54 : virtual child_iterator child_begin();
55 : virtual child_iterator child_end();
56 : };
57 :
58 : /// ObjCEncodeExpr, used for @encode in Objective-C. @encode has the same type
59 : /// and behavior as StringLiteral except that the string initializer is obtained
60 : /// from ASTContext with the encoding type as an argument.
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
61 0: class ObjCEncodeExpr : public Expr {
62 : QualType EncType;
63 : SourceLocation AtLoc, RParenLoc;
64 : public:
65 : ObjCEncodeExpr(QualType T, QualType ET,
66 32: SourceLocation at, SourceLocation rp)
67 : : Expr(ObjCEncodeExprClass, T, ET->isDependentType(),
68 32: ET->isDependentType()), EncType(ET), AtLoc(at), RParenLoc(rp) {}
69 :
70 1: explicit ObjCEncodeExpr(EmptyShell Empty) : Expr(ObjCEncodeExprClass, Empty){}
71 :
72 :
73 5: SourceLocation getAtLoc() const { return AtLoc; }
74 1: void setAtLoc(SourceLocation L) { AtLoc = L; }
75 3: SourceLocation getRParenLoc() const { return RParenLoc; }
76 1: void setRParenLoc(SourceLocation L) { RParenLoc = L; }
77 :
78 28: QualType getEncodedType() const { return EncType; }
79 1: void setEncodedType(QualType T) { EncType = T; }
80 :
81 :
82 43: virtual SourceRange getSourceRange() const {
83 43: return SourceRange(AtLoc, RParenLoc);
84 : }
85 :
86 5545: static bool classof(const Stmt *T) {
87 5545: return T->getStmtClass() == ObjCEncodeExprClass;
88 : }
89 : static bool classof(const ObjCEncodeExpr *) { return true; }
90 :
91 : // Iterators
92 : virtual child_iterator child_begin();
93 : virtual child_iterator child_end();
94 : };
95 :
96 : /// ObjCSelectorExpr used for @selector in Objective-C.
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
2: branch 6 taken
97 2: class ObjCSelectorExpr : public Expr {
98 : Selector SelName;
99 : SourceLocation AtLoc, RParenLoc;
100 : public:
101 : ObjCSelectorExpr(QualType T, Selector selInfo,
102 40: SourceLocation at, SourceLocation rp)
103 : : Expr(ObjCSelectorExprClass, T, false, false), SelName(selInfo), AtLoc(at),
104 40: RParenLoc(rp){}
105 3: explicit ObjCSelectorExpr(EmptyShell Empty)
106 3: : Expr(ObjCSelectorExprClass, Empty) {}
107 :
108 6: Selector getSelector() const { return SelName; }
109 3: void setSelector(Selector S) { SelName = S; }
110 :
111 3: SourceLocation getAtLoc() const { return AtLoc; }
112 3: SourceLocation getRParenLoc() const { return RParenLoc; }
113 3: void setAtLoc(SourceLocation L) { AtLoc = L; }
114 3: void setRParenLoc(SourceLocation L) { RParenLoc = L; }
115 :
116 47: virtual SourceRange getSourceRange() const {
117 47: return SourceRange(AtLoc, RParenLoc);
118 : }
119 :
120 : /// getNumArgs - Return the number of actual arguments to this call.
121 : unsigned getNumArgs() const { return SelName.getNumArgs(); }
122 :
123 2725: static bool classof(const Stmt *T) {
124 2725: return T->getStmtClass() == ObjCSelectorExprClass;
125 : }
126 : static bool classof(const ObjCSelectorExpr *) { return true; }
127 :
128 : // Iterators
129 : virtual child_iterator child_begin();
130 : virtual child_iterator child_end();
131 : };
132 :
133 : /// ObjCProtocolExpr used for protocol expression in Objective-C. This is used
134 : /// as: @protocol(foo), as in:
135 : /// obj conformsToProtocol:@protocol(foo)]
136 : /// The return type is "Protocol*".
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
137 0: class ObjCProtocolExpr : public Expr {
138 : ObjCProtocolDecl *TheProtocol;
139 : SourceLocation AtLoc, RParenLoc;
140 : public:
141 : ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol,
142 20: SourceLocation at, SourceLocation rp)
143 : : Expr(ObjCProtocolExprClass, T, false, false), TheProtocol(protocol),
144 20: AtLoc(at), RParenLoc(rp) {}
145 1: explicit ObjCProtocolExpr(EmptyShell Empty)
146 1: : Expr(ObjCProtocolExprClass, Empty) {}
147 :
148 19: ObjCProtocolDecl *getProtocol() const { return TheProtocol; }
149 1: void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; }
150 :
151 1: SourceLocation getAtLoc() const { return AtLoc; }
152 1: SourceLocation getRParenLoc() const { return RParenLoc; }
153 1: void setAtLoc(SourceLocation L) { AtLoc = L; }
154 1: void setRParenLoc(SourceLocation L) { RParenLoc = L; }
155 :
156 20: virtual SourceRange getSourceRange() const {
157 20: return SourceRange(AtLoc, RParenLoc);
158 : }
159 :
160 982: static bool classof(const Stmt *T) {
161 982: return T->getStmtClass() == ObjCProtocolExprClass;
162 : }
163 : static bool classof(const ObjCProtocolExpr *) { return true; }
164 :
165 : // Iterators
166 : virtual child_iterator child_begin();
167 : virtual child_iterator child_end();
168 : };
169 :
170 : /// ObjCIvarRefExpr - A reference to an ObjC instance variable.
0: branch 1 not taken
51: branch 2 taken
0: branch 5 not taken
0: branch 6 not taken
171 51: class ObjCIvarRefExpr : public Expr {
172 : class ObjCIvarDecl *D;
173 : SourceLocation Loc;
174 : Stmt *Base;
175 : bool IsArrow:1; // True if this is "X->F", false if this is "X.F".
176 : bool IsFreeIvar:1; // True if ivar reference has no base (self assumed).
177 :
178 : public:
179 : ObjCIvarRefExpr(ObjCIvarDecl *d,
180 : QualType t, SourceLocation l, Expr *base=0,
181 584: bool arrow = false, bool freeIvar = false) :
182 : Expr(ObjCIvarRefExprClass, t, false, false), D(d),
183 : Loc(l), Base(base), IsArrow(arrow),
184 584: IsFreeIvar(freeIvar) {}
185 :
186 0: explicit ObjCIvarRefExpr(EmptyShell Empty)
187 0: : Expr(ObjCIvarRefExprClass, Empty) {}
188 :
189 268: ObjCIvarDecl *getDecl() { return D; }
190 248: const ObjCIvarDecl *getDecl() const { return D; }
191 0: void setDecl(ObjCIvarDecl *d) { D = d; }
192 :
193 438: const Expr *getBase() const { return cast<Expr>(Base); }
194 523: Expr *getBase() { return cast<Expr>(Base); }
195 15: void setBase(Expr * base) { Base = base; }
196 :
197 251: bool isArrow() const { return IsArrow; }
198 1162: bool isFreeIvar() const { return IsFreeIvar; }
199 0: void setIsArrow(bool A) { IsArrow = A; }
200 0: void setIsFreeIvar(bool A) { IsFreeIvar = A; }
201 :
202 13: SourceLocation getLocation() const { return Loc; }
203 0: void setLocation(SourceLocation L) { Loc = L; }
204 :
205 1134: virtual SourceRange getSourceRange() const {
206 : return isFreeIvar() ? SourceRange(Loc)
938: branch 1 taken
196: branch 2 taken
207 1134: : SourceRange(getBase()->getLocStart(), Loc);
208 : }
209 :
210 4052: static bool classof(const Stmt *T) {
211 4052: return T->getStmtClass() == ObjCIvarRefExprClass;
212 : }
213 : static bool classof(const ObjCIvarRefExpr *) { return true; }
214 :
215 : // Iterators
216 : virtual child_iterator child_begin();
217 : virtual child_iterator child_end();
218 : };
219 :
220 : /// ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC
221 : /// property.
222 : ///
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
2: branch 6 taken
223 2: class ObjCPropertyRefExpr : public Expr {
224 : private:
225 : ObjCPropertyDecl *AsProperty;
226 : SourceLocation IdLoc;
227 : Stmt *Base;
228 : public:
229 : ObjCPropertyRefExpr(ObjCPropertyDecl *PD, QualType t,
230 156: SourceLocation l, Expr *base)
231 : : Expr(ObjCPropertyRefExprClass, t, false, false), AsProperty(PD),
232 156: IdLoc(l), Base(base) {
233 156: }
234 :
235 0: explicit ObjCPropertyRefExpr(EmptyShell Empty)
236 0: : Expr(ObjCPropertyRefExprClass, Empty) {}
237 :
238 188: ObjCPropertyDecl *getProperty() const { return AsProperty; }
239 0: void setProperty(ObjCPropertyDecl *D) { AsProperty = D; }
240 :
241 369: const Expr *getBase() const { return cast<Expr>(Base); }
242 18: Expr *getBase() { return cast<Expr>(Base); }
243 0: void setBase(Expr *base) { Base = base; }
244 :
245 0: SourceLocation getLocation() const { return IdLoc; }
246 0: void setLocation(SourceLocation L) { IdLoc = L; }
247 :
248 141: virtual SourceRange getSourceRange() const {
249 141: return SourceRange(getBase()->getLocStart(), IdLoc);
250 : }
251 :
252 3003: static bool classof(const Stmt *T) {
253 3003: return T->getStmtClass() == ObjCPropertyRefExprClass;
254 : }
255 : static bool classof(const ObjCPropertyRefExpr *) { return true; }
256 :
257 : // Iterators
258 : virtual child_iterator child_begin();
259 : virtual child_iterator child_end();
260 : };
261 :
262 : /// ObjCImplicitSetterGetterRefExpr - A dot-syntax expression to access two
263 : /// methods; one to set a value to an 'ivar' (Setter) and the other to access
264 : /// an 'ivar' (Setter).
265 : /// An example for use of this AST is:
266 : /// @code
267 : /// @interface Test { }
268 : /// - (Test *)crash;
269 : /// - (void)setCrash: (Test*)value;
270 : /// @end
271 : /// void foo(Test *p1, Test *p2)
272 : /// {
273 : /// p2.crash = p1.crash; // Uses ObjCImplicitSetterGetterRefExpr AST
274 : /// }
275 : /// @endcode
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
276 0: class ObjCImplicitSetterGetterRefExpr : public Expr {
277 : /// Setter - Setter method user declared for setting its 'ivar' to a value
278 : ObjCMethodDecl *Setter;
279 : /// Getter - Getter method user declared for accessing 'ivar' it controls.
280 : ObjCMethodDecl *Getter;
281 : /// Location of the member in the dot syntax notation. This is location
282 : /// of the getter method.
283 : SourceLocation MemberLoc;
284 : // FIXME: Swizzle these into a single pointer.
285 : Stmt *Base;
286 : ObjCInterfaceDecl *InterfaceDecl;
287 : /// Location of the receiver class in the dot syntax notation
288 : /// used to call a class method setter/getter.
289 : SourceLocation ClassLoc;
290 :
291 : public:
292 : ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter,
293 : QualType t,
294 : ObjCMethodDecl *setter,
295 62: SourceLocation l, Expr *base)
296 : : Expr(ObjCImplicitSetterGetterRefExprClass, t, false, false),
297 : Setter(setter), Getter(getter), MemberLoc(l), Base(base),
298 62: InterfaceDecl(0), ClassLoc(SourceLocation()) {
299 62: }
300 : ObjCImplicitSetterGetterRefExpr(ObjCMethodDecl *getter,
301 : QualType t,
302 : ObjCMethodDecl *setter,
303 16: SourceLocation l, ObjCInterfaceDecl *C, SourceLocation CL)
304 : : Expr(ObjCImplicitSetterGetterRefExprClass, t, false, false),
305 : Setter(setter), Getter(getter), MemberLoc(l), Base(0), InterfaceDecl(C),
306 16: ClassLoc(CL) {
307 16: }
308 0: explicit ObjCImplicitSetterGetterRefExpr(EmptyShell Empty)
309 0: : Expr(ObjCImplicitSetterGetterRefExprClass, Empty){}
310 :
311 10: ObjCMethodDecl *getGetterMethod() const { return Getter; }
312 28: ObjCMethodDecl *getSetterMethod() const { return Setter; }
313 30: ObjCInterfaceDecl *getInterfaceDecl() const { return InterfaceDecl; }
314 0: void setGetterMethod(ObjCMethodDecl *D) { Getter = D; }
315 0: void setSetterMethod(ObjCMethodDecl *D) { Setter = D; }
316 0: void setInterfaceDecl(ObjCInterfaceDecl *D) { InterfaceDecl = D; }
317 :
318 217: virtual SourceRange getSourceRange() const {
211: branch 0 taken
6: branch 1 taken
319 217: if (Base)
320 211: return SourceRange(getBase()->getLocStart(), MemberLoc);
321 6: return SourceRange(ClassLoc, MemberLoc);
322 : }
323 235: const Expr *getBase() const { return cast_or_null<Expr>(Base); }
324 0: Expr *getBase() { return cast_or_null<Expr>(Base); }
325 0: void setBase(Expr *base) { Base = base; }
326 :
327 0: SourceLocation getLocation() const { return MemberLoc; }
328 0: void setLocation(SourceLocation L) { MemberLoc = L; }
329 0: SourceLocation getClassLoc() const { return ClassLoc; }
330 0: void setClassLoc(SourceLocation L) { ClassLoc = L; }
331 :
332 8508: static bool classof(const Stmt *T) {
333 8508: return T->getStmtClass() == ObjCImplicitSetterGetterRefExprClass;
334 : }
335 : static bool classof(const ObjCImplicitSetterGetterRefExpr *) { return true; }
336 :
337 : // Iterators
338 : virtual child_iterator child_begin();
339 : virtual child_iterator child_end();
340 : };
341 :
342 : class ObjCMessageExpr : public Expr {
343 : // SubExprs - The receiver and arguments of the message expression.
344 : Stmt **SubExprs;
345 :
346 : // NumArgs - The number of arguments (not including the receiver) to the
347 : // message expression.
348 : unsigned NumArgs;
349 :
350 : // A unigue name for this message.
351 : Selector SelName;
352 :
353 : // A method prototype for this message (optional).
354 : // FIXME: Since method decls contain the selector, and most messages have a
355 : // prototype, consider devising a scheme for unifying SelName/MethodProto.
356 : ObjCMethodDecl *MethodProto;
357 :
358 : SourceLocation LBracloc, RBracloc;
359 :
360 : // Constants for indexing into SubExprs.
361 : enum { RECEIVER=0, ARGS_START=1 };
362 :
363 : // Bit-swizzling flags.
364 : enum { IsInstMeth=0, IsClsMethDeclUnknown, IsClsMethDeclKnown, Flags=0x3 };
365 : unsigned getFlag() const { return (uintptr_t) SubExprs[RECEIVER] & Flags; }
366 :
367 : public:
368 : /// This constructor is used to represent class messages where the
369 : /// ObjCInterfaceDecl* of the receiver is not known.
370 : ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo,
371 : QualType retType, ObjCMethodDecl *methDecl,
372 : SourceLocation LBrac, SourceLocation RBrac,
373 : Expr **ArgExprs, unsigned NumArgs);
374 :
375 : /// This constructor is used to represent class messages where the
376 : /// ObjCInterfaceDecl* of the receiver is known.
377 : // FIXME: clsName should be typed to ObjCInterfaceType
378 : ObjCMessageExpr(ObjCInterfaceDecl *cls, Selector selInfo,
379 : QualType retType, ObjCMethodDecl *methDecl,
380 : SourceLocation LBrac, SourceLocation RBrac,
381 : Expr **ArgExprs, unsigned NumArgs);
382 :
383 : // constructor for instance messages.
384 : ObjCMessageExpr(Expr *receiver, Selector selInfo,
385 : QualType retType, ObjCMethodDecl *methDecl,
386 : SourceLocation LBrac, SourceLocation RBrac,
387 : Expr **ArgExprs, unsigned NumArgs);
388 :
389 10: explicit ObjCMessageExpr(EmptyShell Empty)
390 10: : Expr(ObjCMessageExprClass, Empty), SubExprs(0), NumArgs(0) {}
391 :
392 0: ~ObjCMessageExpr() {
0: branch 0 not taken
0: branch 1 not taken
0: branch 3 not taken
0: branch 4 not taken
393 0: delete [] SubExprs;
0: branch 1 not taken
0: branch 2 not taken
0: branch 5 not taken
0: branch 6 not taken
394 0: }
395 :
396 : /// getReceiver - Returns the receiver of the message expression.
397 : /// This can be NULL if the message is for class methods. For
398 : /// class methods, use getClassName.
399 : /// FIXME: need to handle/detect 'super' usage within a class method.
400 17546: Expr *getReceiver() {
401 17546: uintptr_t x = (uintptr_t) SubExprs[RECEIVER];
12818: branch 0 taken
4728: branch 1 taken
402 17546: return (x & Flags) == IsInstMeth ? (Expr*) x : 0;
403 : }
404 4010: const Expr *getReceiver() const {
405 4010: return const_cast<ObjCMessageExpr*>(this)->getReceiver();
406 : }
407 : // FIXME: need setters for different receiver types.
408 10: void setReceiver(Expr *rec) { SubExprs[RECEIVER] = rec; }
409 3283: Selector getSelector() const { return SelName; }
410 10: void setSelector(Selector S) { SelName = S; }
411 :
412 3025: const ObjCMethodDecl *getMethodDecl() const { return MethodProto; }
413 241: ObjCMethodDecl *getMethodDecl() { return MethodProto; }
414 10: void setMethodDecl(ObjCMethodDecl *MD) { MethodProto = MD; }
415 :
416 : typedef std::pair<ObjCInterfaceDecl*, IdentifierInfo*> ClassInfo;
417 :
418 : /// getClassInfo - For class methods, this returns both the ObjCInterfaceDecl*
419 : /// and IdentifierInfo* of the invoked class. Both can be NULL if this
420 : /// is an instance message, and the ObjCInterfaceDecl* can be NULL if none
421 : /// was available when this ObjCMessageExpr object was constructed.
422 : ClassInfo getClassInfo() const;
423 : void setClassInfo(const ClassInfo &C);
424 :
425 : /// getClassName - For class methods, this returns the invoked class,
426 : /// and returns NULL otherwise. For instance methods, use getReceiver.
427 2895: IdentifierInfo *getClassName() const {
428 2895: return getClassInfo().second;
429 : }
430 :
431 : /// getNumArgs - Return the number of actual arguments to this call.
432 8537: unsigned getNumArgs() const { return NumArgs; }
433 10: void setNumArgs(unsigned nArgs) {
434 10: NumArgs = nArgs;
435 : // FIXME: should always allocate SubExprs via the ASTContext's
436 : // allocator.
437 10: if (!SubExprs)
438 10: SubExprs = new Stmt* [NumArgs + 1];
439 10: }
440 :
441 : /// getArg - Return the specified argument.
442 33: Expr *getArg(unsigned Arg) {
0: branch 0 not taken
0: branch 1 not taken
443 33: assert(Arg < NumArgs && "Arg access out of range!");
444 33: return cast<Expr>(SubExprs[Arg+ARGS_START]);
445 : }
446 48: const Expr *getArg(unsigned Arg) const {
0: branch 0 not taken
447 48: assert(Arg < NumArgs && "Arg access out of range!");
448 48: return cast<Expr>(SubExprs[Arg+ARGS_START]);
449 : }
450 : /// setArg - Set the specified argument.
451 2: void setArg(unsigned Arg, Expr *ArgExpr) {
452 2: assert(Arg < NumArgs && "Arg access out of range!");
453 2: SubExprs[Arg+ARGS_START] = ArgExpr;
454 2: }
455 :
456 20: SourceLocation getLeftLoc() const { return LBracloc; }
457 10: SourceLocation getRightLoc() const { return RBracloc; }
458 :
459 10: void setLeftLoc(SourceLocation L) { LBracloc = L; }
460 10: void setRightLoc(SourceLocation L) { RBracloc = L; }
461 :
462 : void setSourceRange(SourceRange R) {
463 : LBracloc = R.getBegin();
464 : RBracloc = R.getEnd();
465 : }
466 7159: virtual SourceRange getSourceRange() const {
467 7159: return SourceRange(LBracloc, RBracloc);
468 : }
469 :
470 6748: static bool classof(const Stmt *T) {
471 6748: return T->getStmtClass() == ObjCMessageExprClass;
472 : }
473 : static bool classof(const ObjCMessageExpr *) { return true; }
474 :
475 : // Iterators
476 : virtual child_iterator child_begin();
477 : virtual child_iterator child_end();
478 :
479 : typedef ExprIterator arg_iterator;
480 : typedef ConstExprIterator const_arg_iterator;
481 :
482 2492: arg_iterator arg_begin() { return &SubExprs[ARGS_START]; }
483 2492: arg_iterator arg_end() { return &SubExprs[ARGS_START] + NumArgs; }
484 1405: const_arg_iterator arg_begin() const { return &SubExprs[ARGS_START]; }
485 1405: const_arg_iterator arg_end() const { return &SubExprs[ARGS_START] + NumArgs; }
486 : };
487 :
488 : /// ObjCSuperExpr - Represents the "super" expression in Objective-C,
489 : /// which refers to the object on which the current method is executing.
490 8: class ObjCSuperExpr : public Expr {
491 : SourceLocation Loc;
492 : public:
493 90: ObjCSuperExpr(SourceLocation L, QualType Type)
494 90: : Expr(ObjCSuperExprClass, Type, false, false), Loc(L) { }
495 0: explicit ObjCSuperExpr(EmptyShell Empty) : Expr(ObjCSuperExprClass, Empty) {}
496 :
497 0: SourceLocation getLoc() const { return Loc; }
498 0: void setLoc(SourceLocation L) { Loc = L; }
499 :
500 47: virtual SourceRange getSourceRange() const { return SourceRange(Loc); }
501 :
502 2188: static bool classof(const Stmt *T) {
503 2188: return T->getStmtClass() == ObjCSuperExprClass;
504 : }
505 : static bool classof(const ObjCSuperExpr *) { return true; }
506 :
507 : // Iterators
508 : virtual child_iterator child_begin();
509 : virtual child_iterator child_end();
510 : };
511 :
512 : /// ObjCIsaExpr - Represent X->isa and X.isa when X is an ObjC 'id' type.
513 : /// (similiar in spirit to MemberExpr).
514 0: class ObjCIsaExpr : public Expr {
515 : /// Base - the expression for the base object pointer.
516 : Stmt *Base;
517 :
518 : /// IsaMemberLoc - This is the location of the 'isa'.
519 : SourceLocation IsaMemberLoc;
520 :
521 : /// IsArrow - True if this is "X->F", false if this is "X.F".
522 : bool IsArrow;
523 : public:
524 13: ObjCIsaExpr(Expr *base, bool isarrow, SourceLocation l, QualType ty)
525 : : Expr(ObjCIsaExprClass, ty, false, false),
526 13: Base(base), IsaMemberLoc(l), IsArrow(isarrow) {}
527 :
528 : /// \brief Build an empty expression.
529 0: explicit ObjCIsaExpr(EmptyShell Empty) : Expr(ObjCIsaExprClass, Empty) { }
530 :
531 0: void setBase(Expr *E) { Base = E; }
532 17: Expr *getBase() const { return cast<Expr>(Base); }
533 :
534 7: bool isArrow() const { return IsArrow; }
535 0: void setArrow(bool A) { IsArrow = A; }
536 :
537 : /// getMemberLoc - Return the location of the "member", in X->F, it is the
538 : /// location of 'F'.
539 0: SourceLocation getIsaMemberLoc() const { return IsaMemberLoc; }
540 0: void setIsaMemberLoc(SourceLocation L) { IsaMemberLoc = L; }
541 :
542 6: virtual SourceRange getSourceRange() const {
543 6: return SourceRange(getBase()->getLocStart(), IsaMemberLoc);
544 : }
545 :
546 0: virtual SourceLocation getExprLoc() const { return IsaMemberLoc; }
547 :
548 2: static bool classof(const Stmt *T) {
549 2: return T->getStmtClass() == ObjCIsaExprClass;
550 : }
551 : static bool classof(const ObjCIsaExpr *) { return true; }
552 :
553 : // Iterators
554 : virtual child_iterator child_begin();
555 : virtual child_iterator child_end();
556 : };
557 :
558 : } // end namespace clang
559 :
560 : #endif
Generated: 2010-02-10 01:31 by zcov