ExprCXX.h revision 99a2e600f9e2e51d3ce10fb6f27191677ac65b2a
1//===--- ExprCXX.h - Classes for representing 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 Expr interface and subclasses for C++ expressions. 11// 12//===----------------------------------------------------------------------===// 13 14#ifndef LLVM_CLANG_AST_EXPRCXX_H 15#define LLVM_CLANG_AST_EXPRCXX_H 16 17#include "clang/Basic/TypeTraits.h" 18#include "clang/AST/Expr.h" 19#include "clang/AST/Decl.h" 20#include "clang/AST/TemplateBase.h" 21 22namespace clang { 23 24 class CXXConstructorDecl; 25 class CXXDestructorDecl; 26 class CXXMethodDecl; 27 class CXXTemporary; 28 class TemplateArgumentListInfo; 29 30//===--------------------------------------------------------------------===// 31// C++ Expressions. 32//===--------------------------------------------------------------------===// 33 34/// \brief A call to an overloaded operator written using operator 35/// syntax. 36/// 37/// Represents a call to an overloaded operator written using operator 38/// syntax, e.g., "x + y" or "*p". While semantically equivalent to a 39/// normal call, this AST node provides better information about the 40/// syntactic representation of the call. 41/// 42/// In a C++ template, this expression node kind will be used whenever 43/// any of the arguments are type-dependent. In this case, the 44/// function itself will be a (possibly empty) set of functions and 45/// function templates that were found by name lookup at template 46/// definition time. 47class CXXOperatorCallExpr : public CallExpr { 48 /// \brief The overloaded operator. 49 OverloadedOperatorKind Operator; 50 51public: 52 CXXOperatorCallExpr(ASTContext& C, OverloadedOperatorKind Op, Expr *fn, 53 Expr **args, unsigned numargs, QualType t, 54 SourceLocation operatorloc) 55 : CallExpr(C, CXXOperatorCallExprClass, fn, args, numargs, t, operatorloc), 56 Operator(Op) {} 57 explicit CXXOperatorCallExpr(ASTContext& C, EmptyShell Empty) : 58 CallExpr(C, CXXOperatorCallExprClass, Empty) { } 59 60 61 /// getOperator - Returns the kind of overloaded operator that this 62 /// expression refers to. 63 OverloadedOperatorKind getOperator() const { return Operator; } 64 void setOperator(OverloadedOperatorKind Kind) { Operator = Kind; } 65 66 /// getOperatorLoc - Returns the location of the operator symbol in 67 /// the expression. When @c getOperator()==OO_Call, this is the 68 /// location of the right parentheses; when @c 69 /// getOperator()==OO_Subscript, this is the location of the right 70 /// bracket. 71 SourceLocation getOperatorLoc() const { return getRParenLoc(); } 72 73 virtual SourceRange getSourceRange() const; 74 75 static bool classof(const Stmt *T) { 76 return T->getStmtClass() == CXXOperatorCallExprClass; 77 } 78 static bool classof(const CXXOperatorCallExpr *) { return true; } 79}; 80 81/// CXXMemberCallExpr - Represents a call to a member function that 82/// may be written either with member call syntax (e.g., "obj.func()" 83/// or "objptr->func()") or with normal function-call syntax 84/// ("func()") within a member function that ends up calling a member 85/// function. The callee in either case is a MemberExpr that contains 86/// both the object argument and the member function, while the 87/// arguments are the arguments within the parentheses (not including 88/// the object argument). 89class CXXMemberCallExpr : public CallExpr { 90public: 91 CXXMemberCallExpr(ASTContext& C, Expr *fn, Expr **args, unsigned numargs, 92 QualType t, SourceLocation rparenloc) 93 : CallExpr(C, CXXMemberCallExprClass, fn, args, numargs, t, rparenloc) {} 94 95 /// getImplicitObjectArgument - Retrieves the implicit object 96 /// argument for the member call. For example, in "x.f(5)", this 97 /// operation would return "x". 98 Expr *getImplicitObjectArgument(); 99 100 virtual SourceRange getSourceRange() const; 101 102 static bool classof(const Stmt *T) { 103 return T->getStmtClass() == CXXMemberCallExprClass; 104 } 105 static bool classof(const CXXMemberCallExpr *) { return true; } 106}; 107 108/// CXXNamedCastExpr - Abstract class common to all of the C++ "named" 109/// casts, @c static_cast, @c dynamic_cast, @c reinterpret_cast, or @c 110/// const_cast. 111/// 112/// This abstract class is inherited by all of the classes 113/// representing "named" casts, e.g., CXXStaticCastExpr, 114/// CXXDynamicCastExpr, CXXReinterpretCastExpr, and CXXConstCastExpr. 115class CXXNamedCastExpr : public ExplicitCastExpr { 116private: 117 SourceLocation Loc; // the location of the casting op 118 119protected: 120 CXXNamedCastExpr(StmtClass SC, QualType ty, CastKind kind, Expr *op, 121 QualType writtenTy, SourceLocation l) 122 : ExplicitCastExpr(SC, ty, kind, op, writtenTy), Loc(l) {} 123 124public: 125 const char *getCastName() const; 126 127 /// \brief Retrieve the location of the cast operator keyword, e.g., 128 /// "static_cast". 129 SourceLocation getOperatorLoc() const { return Loc; } 130 void setOperatorLoc(SourceLocation L) { Loc = L; } 131 132 virtual SourceRange getSourceRange() const { 133 return SourceRange(Loc, getSubExpr()->getSourceRange().getEnd()); 134 } 135 static bool classof(const Stmt *T) { 136 switch (T->getStmtClass()) { 137 case CXXNamedCastExprClass: 138 case CXXStaticCastExprClass: 139 case CXXDynamicCastExprClass: 140 case CXXReinterpretCastExprClass: 141 case CXXConstCastExprClass: 142 return true; 143 default: 144 return false; 145 } 146 } 147 static bool classof(const CXXNamedCastExpr *) { return true; } 148}; 149 150/// CXXStaticCastExpr - A C++ @c static_cast expression (C++ [expr.static.cast]). 151/// 152/// This expression node represents a C++ static cast, e.g., 153/// @c static_cast<int>(1.0). 154class CXXStaticCastExpr : public CXXNamedCastExpr { 155public: 156 CXXStaticCastExpr(QualType ty, CastKind kind, Expr *op, 157 QualType writtenTy, SourceLocation l) 158 : CXXNamedCastExpr(CXXStaticCastExprClass, ty, kind, op, writtenTy, l) {} 159 160 static bool classof(const Stmt *T) { 161 return T->getStmtClass() == CXXStaticCastExprClass; 162 } 163 static bool classof(const CXXStaticCastExpr *) { return true; } 164}; 165 166/// CXXDynamicCastExpr - A C++ @c dynamic_cast expression 167/// (C++ [expr.dynamic.cast]), which may perform a run-time check to 168/// determine how to perform the type cast. 169/// 170/// This expression node represents a dynamic cast, e.g., 171/// @c dynamic_cast<Derived*>(BasePtr). 172class CXXDynamicCastExpr : public CXXNamedCastExpr { 173public: 174 CXXDynamicCastExpr(QualType ty, CastKind kind, Expr *op, QualType writtenTy, 175 SourceLocation l) 176 : CXXNamedCastExpr(CXXDynamicCastExprClass, ty, kind, op, writtenTy, l) {} 177 178 static bool classof(const Stmt *T) { 179 return T->getStmtClass() == CXXDynamicCastExprClass; 180 } 181 static bool classof(const CXXDynamicCastExpr *) { return true; } 182}; 183 184/// CXXReinterpretCastExpr - A C++ @c reinterpret_cast expression (C++ 185/// [expr.reinterpret.cast]), which provides a differently-typed view 186/// of a value but performs no actual work at run time. 187/// 188/// This expression node represents a reinterpret cast, e.g., 189/// @c reinterpret_cast<int>(VoidPtr). 190class CXXReinterpretCastExpr : public CXXNamedCastExpr { 191public: 192 CXXReinterpretCastExpr(QualType ty, CastKind kind, Expr *op, 193 QualType writtenTy, SourceLocation l) 194 : CXXNamedCastExpr(CXXReinterpretCastExprClass, ty, kind, op, 195 writtenTy, l) {} 196 197 static bool classof(const Stmt *T) { 198 return T->getStmtClass() == CXXReinterpretCastExprClass; 199 } 200 static bool classof(const CXXReinterpretCastExpr *) { return true; } 201}; 202 203/// CXXConstCastExpr - A C++ @c const_cast expression (C++ [expr.const.cast]), 204/// which can remove type qualifiers but does not change the underlying value. 205/// 206/// This expression node represents a const cast, e.g., 207/// @c const_cast<char*>(PtrToConstChar). 208class CXXConstCastExpr : public CXXNamedCastExpr { 209public: 210 CXXConstCastExpr(QualType ty, Expr *op, QualType writtenTy, 211 SourceLocation l) 212 : CXXNamedCastExpr(CXXConstCastExprClass, ty, CK_NoOp, op, writtenTy, l) {} 213 214 static bool classof(const Stmt *T) { 215 return T->getStmtClass() == CXXConstCastExprClass; 216 } 217 static bool classof(const CXXConstCastExpr *) { return true; } 218}; 219 220/// CXXBoolLiteralExpr - [C++ 2.13.5] C++ Boolean Literal. 221/// 222class CXXBoolLiteralExpr : public Expr { 223 bool Value; 224 SourceLocation Loc; 225public: 226 CXXBoolLiteralExpr(bool val, QualType Ty, SourceLocation l) : 227 Expr(CXXBoolLiteralExprClass, Ty), Value(val), Loc(l) {} 228 229 bool getValue() const { return Value; } 230 231 virtual SourceRange getSourceRange() const { return SourceRange(Loc); } 232 233 static bool classof(const Stmt *T) { 234 return T->getStmtClass() == CXXBoolLiteralExprClass; 235 } 236 static bool classof(const CXXBoolLiteralExpr *) { return true; } 237 238 // Iterators 239 virtual child_iterator child_begin(); 240 virtual child_iterator child_end(); 241}; 242 243/// CXXNullPtrLiteralExpr - [C++0x 2.14.7] C++ Pointer Literal 244class CXXNullPtrLiteralExpr : public Expr { 245 SourceLocation Loc; 246public: 247 CXXNullPtrLiteralExpr(QualType Ty, SourceLocation l) : 248 Expr(CXXNullPtrLiteralExprClass, Ty), Loc(l) {} 249 250 virtual SourceRange getSourceRange() const { return SourceRange(Loc); } 251 252 static bool classof(const Stmt *T) { 253 return T->getStmtClass() == CXXNullPtrLiteralExprClass; 254 } 255 static bool classof(const CXXNullPtrLiteralExpr *) { return true; } 256 257 virtual child_iterator child_begin(); 258 virtual child_iterator child_end(); 259}; 260 261/// CXXTypeidExpr - A C++ @c typeid expression (C++ [expr.typeid]), which gets 262/// the type_info that corresponds to the supplied type, or the (possibly 263/// dynamic) type of the supplied expression. 264/// 265/// This represents code like @c typeid(int) or @c typeid(*objPtr) 266class CXXTypeidExpr : public Expr { 267private: 268 bool isTypeOp : 1; 269 union { 270 void *Ty; 271 Stmt *Ex; 272 } Operand; 273 SourceRange Range; 274 275public: 276 CXXTypeidExpr(bool isTypeOp, void *op, QualType Ty, const SourceRange r) : 277 Expr(CXXTypeidExprClass, Ty, 278 // typeid is never type-dependent (C++ [temp.dep.expr]p4) 279 false, 280 // typeid is value-dependent if the type or expression are dependent 281 (isTypeOp ? QualType::getFromOpaquePtr(op)->isDependentType() 282 : static_cast<Expr*>(op)->isValueDependent())), 283 isTypeOp(isTypeOp), Range(r) { 284 if (isTypeOp) 285 Operand.Ty = op; 286 else 287 // op was an Expr*, so cast it back to that to be safe 288 Operand.Ex = static_cast<Expr*>(op); 289 } 290 291 bool isTypeOperand() const { return isTypeOp; } 292 QualType getTypeOperand() const { 293 assert(isTypeOperand() && "Cannot call getTypeOperand for typeid(expr)"); 294 return QualType::getFromOpaquePtr(Operand.Ty); 295 } 296 Expr* getExprOperand() const { 297 assert(!isTypeOperand() && "Cannot call getExprOperand for typeid(type)"); 298 return static_cast<Expr*>(Operand.Ex); 299 } 300 301 virtual SourceRange getSourceRange() const { 302 return Range; 303 } 304 static bool classof(const Stmt *T) { 305 return T->getStmtClass() == CXXTypeidExprClass; 306 } 307 static bool classof(const CXXTypeidExpr *) { return true; } 308 309 // Iterators 310 virtual child_iterator child_begin(); 311 virtual child_iterator child_end(); 312}; 313 314/// CXXThisExpr - Represents the "this" expression in C++, which is a 315/// pointer to the object on which the current member function is 316/// executing (C++ [expr.prim]p3). Example: 317/// 318/// @code 319/// class Foo { 320/// public: 321/// void bar(); 322/// void test() { this->bar(); } 323/// }; 324/// @endcode 325class CXXThisExpr : public Expr { 326 SourceLocation Loc; 327 328public: 329 CXXThisExpr(SourceLocation L, QualType Type) 330 : Expr(CXXThisExprClass, Type, 331 // 'this' is type-dependent if the class type of the enclosing 332 // member function is dependent (C++ [temp.dep.expr]p2) 333 Type->isDependentType(), Type->isDependentType()), 334 Loc(L) { } 335 336 virtual SourceRange getSourceRange() const { return SourceRange(Loc); } 337 338 static bool classof(const Stmt *T) { 339 return T->getStmtClass() == CXXThisExprClass; 340 } 341 static bool classof(const CXXThisExpr *) { return true; } 342 343 // Iterators 344 virtual child_iterator child_begin(); 345 virtual child_iterator child_end(); 346}; 347 348/// CXXThrowExpr - [C++ 15] C++ Throw Expression. This handles 349/// 'throw' and 'throw' assignment-expression. When 350/// assignment-expression isn't present, Op will be null. 351/// 352class CXXThrowExpr : public Expr { 353 Stmt *Op; 354 SourceLocation ThrowLoc; 355public: 356 // Ty is the void type which is used as the result type of the 357 // exepression. The l is the location of the throw keyword. expr 358 // can by null, if the optional expression to throw isn't present. 359 CXXThrowExpr(Expr *expr, QualType Ty, SourceLocation l) : 360 Expr(CXXThrowExprClass, Ty, false, false), Op(expr), ThrowLoc(l) {} 361 const Expr *getSubExpr() const { return cast_or_null<Expr>(Op); } 362 Expr *getSubExpr() { return cast_or_null<Expr>(Op); } 363 void setSubExpr(Expr *E) { Op = E; } 364 365 SourceLocation getThrowLoc() const { return ThrowLoc; } 366 void setThrowLoc(SourceLocation L) { ThrowLoc = L; } 367 368 virtual SourceRange getSourceRange() const { 369 if (getSubExpr() == 0) 370 return SourceRange(ThrowLoc, ThrowLoc); 371 return SourceRange(ThrowLoc, getSubExpr()->getSourceRange().getEnd()); 372 } 373 374 static bool classof(const Stmt *T) { 375 return T->getStmtClass() == CXXThrowExprClass; 376 } 377 static bool classof(const CXXThrowExpr *) { return true; } 378 379 // Iterators 380 virtual child_iterator child_begin(); 381 virtual child_iterator child_end(); 382}; 383 384/// CXXDefaultArgExpr - C++ [dcl.fct.default]. This wraps up a 385/// function call argument that was created from the corresponding 386/// parameter's default argument, when the call did not explicitly 387/// supply arguments for all of the parameters. 388class CXXDefaultArgExpr : public Expr { 389 ParmVarDecl *Param; 390 391protected: 392 CXXDefaultArgExpr(StmtClass SC, ParmVarDecl *param) 393 : Expr(SC, param->hasUnparsedDefaultArg() ? 394 param->getType().getNonReferenceType() 395 : param->getDefaultArg()->getType()), 396 Param(param) { } 397 398public: 399 // Param is the parameter whose default argument is used by this 400 // expression. 401 static CXXDefaultArgExpr *Create(ASTContext &C, ParmVarDecl *Param) { 402 return new (C) CXXDefaultArgExpr(CXXDefaultArgExprClass, Param); 403 } 404 405 // Retrieve the parameter that the argument was created from. 406 const ParmVarDecl *getParam() const { return Param; } 407 ParmVarDecl *getParam() { return Param; } 408 409 // Retrieve the actual argument to the function call. 410 const Expr *getExpr() const { return Param->getDefaultArg(); } 411 Expr *getExpr() { return Param->getDefaultArg(); } 412 413 virtual SourceRange getSourceRange() const { 414 // Default argument expressions have no representation in the 415 // source, so they have an empty source range. 416 return SourceRange(); 417 } 418 419 static bool classof(const Stmt *T) { 420 return T->getStmtClass() == CXXDefaultArgExprClass; 421 } 422 static bool classof(const CXXDefaultArgExpr *) { return true; } 423 424 // Iterators 425 virtual child_iterator child_begin(); 426 virtual child_iterator child_end(); 427}; 428 429/// CXXTemporary - Represents a C++ temporary. 430class CXXTemporary { 431 /// Destructor - The destructor that needs to be called. 432 const CXXDestructorDecl *Destructor; 433 434 CXXTemporary(const CXXDestructorDecl *destructor) 435 : Destructor(destructor) { } 436 ~CXXTemporary() { } 437 438public: 439 static CXXTemporary *Create(ASTContext &C, 440 const CXXDestructorDecl *Destructor); 441 442 void Destroy(ASTContext &Ctx); 443 444 const CXXDestructorDecl *getDestructor() const { return Destructor; } 445}; 446 447/// CXXBindTemporaryExpr - Represents binding an expression to a temporary, 448/// so its destructor can be called later. 449class CXXBindTemporaryExpr : public Expr { 450 CXXTemporary *Temp; 451 452 Stmt *SubExpr; 453 454 CXXBindTemporaryExpr(CXXTemporary *temp, Expr* subexpr) 455 : Expr(CXXBindTemporaryExprClass, 456 subexpr->getType()), Temp(temp), SubExpr(subexpr) { } 457 ~CXXBindTemporaryExpr() { } 458 459protected: 460 virtual void DoDestroy(ASTContext &C); 461 462public: 463 static CXXBindTemporaryExpr *Create(ASTContext &C, CXXTemporary *Temp, 464 Expr* SubExpr); 465 466 CXXTemporary *getTemporary() { return Temp; } 467 const CXXTemporary *getTemporary() const { return Temp; } 468 469 const Expr *getSubExpr() const { return cast<Expr>(SubExpr); } 470 Expr *getSubExpr() { return cast<Expr>(SubExpr); } 471 void setSubExpr(Expr *E) { SubExpr = E; } 472 473 virtual SourceRange getSourceRange() const { 474 return SubExpr->getSourceRange(); 475 } 476 477 // Implement isa/cast/dyncast/etc. 478 static bool classof(const Stmt *T) { 479 return T->getStmtClass() == CXXBindTemporaryExprClass; 480 } 481 static bool classof(const CXXBindTemporaryExpr *) { return true; } 482 483 // Iterators 484 virtual child_iterator child_begin(); 485 virtual child_iterator child_end(); 486}; 487 488/// CXXConstructExpr - Represents a call to a C++ constructor. 489class CXXConstructExpr : public Expr { 490 CXXConstructorDecl *Constructor; 491 492 SourceLocation Loc; 493 bool Elidable; 494 495 Stmt **Args; 496 unsigned NumArgs; 497 498protected: 499 CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T, 500 SourceLocation Loc, 501 CXXConstructorDecl *d, bool elidable, 502 Expr **args, unsigned numargs); 503 ~CXXConstructExpr() { } 504 505 virtual void DoDestroy(ASTContext &C); 506 507public: 508 /// \brief Construct an empty C++ construction expression that will store 509 /// \p numargs arguments. 510 CXXConstructExpr(EmptyShell Empty, ASTContext &C, unsigned numargs); 511 512 static CXXConstructExpr *Create(ASTContext &C, QualType T, 513 SourceLocation Loc, 514 CXXConstructorDecl *D, bool Elidable, 515 Expr **Args, unsigned NumArgs); 516 517 518 CXXConstructorDecl* getConstructor() const { return Constructor; } 519 void setConstructor(CXXConstructorDecl *C) { Constructor = C; } 520 521 SourceLocation getLocation() const { return Loc; } 522 void setLocation(SourceLocation Loc) { this->Loc = Loc; } 523 524 /// \brief Whether this construction is elidable. 525 bool isElidable() const { return Elidable; } 526 void setElidable(bool E) { Elidable = E; } 527 528 typedef ExprIterator arg_iterator; 529 typedef ConstExprIterator const_arg_iterator; 530 531 arg_iterator arg_begin() { return Args; } 532 arg_iterator arg_end() { return Args + NumArgs; } 533 const_arg_iterator arg_begin() const { return Args; } 534 const_arg_iterator arg_end() const { return Args + NumArgs; } 535 536 Expr **getArgs() const { return reinterpret_cast<Expr **>(Args); } 537 unsigned getNumArgs() const { return NumArgs; } 538 539 /// getArg - Return the specified argument. 540 Expr *getArg(unsigned Arg) { 541 assert(Arg < NumArgs && "Arg access out of range!"); 542 return cast<Expr>(Args[Arg]); 543 } 544 const Expr *getArg(unsigned Arg) const { 545 assert(Arg < NumArgs && "Arg access out of range!"); 546 return cast<Expr>(Args[Arg]); 547 } 548 549 /// setArg - Set the specified argument. 550 void setArg(unsigned Arg, Expr *ArgExpr) { 551 assert(Arg < NumArgs && "Arg access out of range!"); 552 Args[Arg] = ArgExpr; 553 } 554 555 virtual SourceRange getSourceRange() const { 556 // FIXME: Should we know where the parentheses are, if there are any? 557 if (NumArgs == 0) 558 return SourceRange(Loc); 559 560 return SourceRange(Loc, Args[NumArgs - 1]->getLocEnd()); 561 } 562 563 static bool classof(const Stmt *T) { 564 return T->getStmtClass() == CXXConstructExprClass || 565 T->getStmtClass() == CXXTemporaryObjectExprClass; 566 } 567 static bool classof(const CXXConstructExpr *) { return true; } 568 569 // Iterators 570 virtual child_iterator child_begin(); 571 virtual child_iterator child_end(); 572}; 573 574/// CXXFunctionalCastExpr - Represents an explicit C++ type conversion 575/// that uses "functional" notion (C++ [expr.type.conv]). Example: @c 576/// x = int(0.5); 577class CXXFunctionalCastExpr : public ExplicitCastExpr { 578 SourceLocation TyBeginLoc; 579 SourceLocation RParenLoc; 580public: 581 CXXFunctionalCastExpr(QualType ty, QualType writtenTy, 582 SourceLocation tyBeginLoc, CastKind kind, 583 Expr *castExpr, SourceLocation rParenLoc) 584 : ExplicitCastExpr(CXXFunctionalCastExprClass, ty, kind, castExpr, 585 writtenTy), 586 TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {} 587 588 SourceLocation getTypeBeginLoc() const { return TyBeginLoc; } 589 SourceLocation getRParenLoc() const { return RParenLoc; } 590 591 virtual SourceRange getSourceRange() const { 592 return SourceRange(TyBeginLoc, RParenLoc); 593 } 594 static bool classof(const Stmt *T) { 595 return T->getStmtClass() == CXXFunctionalCastExprClass; 596 } 597 static bool classof(const CXXFunctionalCastExpr *) { return true; } 598}; 599 600/// @brief Represents a C++ functional cast expression that builds a 601/// temporary object. 602/// 603/// This expression type represents a C++ "functional" cast 604/// (C++[expr.type.conv]) with N != 1 arguments that invokes a 605/// constructor to build a temporary object. If N == 0 but no 606/// constructor will be called (because the functional cast is 607/// performing a value-initialized an object whose class type has no 608/// user-declared constructors), CXXZeroInitValueExpr will represent 609/// the functional cast. Finally, with N == 1 arguments the functional 610/// cast expression will be represented by CXXFunctionalCastExpr. 611/// Example: 612/// @code 613/// struct X { X(int, float); } 614/// 615/// X create_X() { 616/// return X(1, 3.14f); // creates a CXXTemporaryObjectExpr 617/// }; 618/// @endcode 619class CXXTemporaryObjectExpr : public CXXConstructExpr { 620 SourceLocation TyBeginLoc; 621 SourceLocation RParenLoc; 622 623public: 624 CXXTemporaryObjectExpr(ASTContext &C, CXXConstructorDecl *Cons, 625 QualType writtenTy, SourceLocation tyBeginLoc, 626 Expr **Args,unsigned NumArgs, 627 SourceLocation rParenLoc); 628 629 ~CXXTemporaryObjectExpr() { } 630 631 SourceLocation getTypeBeginLoc() const { return TyBeginLoc; } 632 SourceLocation getRParenLoc() const { return RParenLoc; } 633 634 virtual SourceRange getSourceRange() const { 635 return SourceRange(TyBeginLoc, RParenLoc); 636 } 637 static bool classof(const Stmt *T) { 638 return T->getStmtClass() == CXXTemporaryObjectExprClass; 639 } 640 static bool classof(const CXXTemporaryObjectExpr *) { return true; } 641}; 642 643/// CXXZeroInitValueExpr - [C++ 5.2.3p2] 644/// Expression "T()" which creates a value-initialized rvalue of type 645/// T, which is either a non-class type or a class type without any 646/// user-defined constructors. 647/// 648class CXXZeroInitValueExpr : public Expr { 649 SourceLocation TyBeginLoc; 650 SourceLocation RParenLoc; 651 652public: 653 CXXZeroInitValueExpr(QualType ty, SourceLocation tyBeginLoc, 654 SourceLocation rParenLoc ) : 655 Expr(CXXZeroInitValueExprClass, ty, false, false), 656 TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {} 657 658 SourceLocation getTypeBeginLoc() const { return TyBeginLoc; } 659 SourceLocation getRParenLoc() const { return RParenLoc; } 660 661 /// @brief Whether this initialization expression was 662 /// implicitly-generated. 663 bool isImplicit() const { 664 return TyBeginLoc.isInvalid() && RParenLoc.isInvalid(); 665 } 666 667 virtual SourceRange getSourceRange() const { 668 return SourceRange(TyBeginLoc, RParenLoc); 669 } 670 671 static bool classof(const Stmt *T) { 672 return T->getStmtClass() == CXXZeroInitValueExprClass; 673 } 674 static bool classof(const CXXZeroInitValueExpr *) { return true; } 675 676 // Iterators 677 virtual child_iterator child_begin(); 678 virtual child_iterator child_end(); 679}; 680 681/// CXXNewExpr - A new expression for memory allocation and constructor calls, 682/// e.g: "new CXXNewExpr(foo)". 683class CXXNewExpr : public Expr { 684 // Was the usage ::new, i.e. is the global new to be used? 685 bool GlobalNew : 1; 686 // Was the form (type-id) used? Otherwise, it was new-type-id. 687 bool ParenTypeId : 1; 688 // Is there an initializer? If not, built-ins are uninitialized, else they're 689 // value-initialized. 690 bool Initializer : 1; 691 // Do we allocate an array? If so, the first SubExpr is the size expression. 692 bool Array : 1; 693 // The number of placement new arguments. 694 unsigned NumPlacementArgs : 14; 695 // The number of constructor arguments. This may be 1 even for non-class 696 // types; use the pseudo copy constructor. 697 unsigned NumConstructorArgs : 14; 698 // Contains an optional array size expression, any number of optional 699 // placement arguments, and any number of optional constructor arguments, 700 // in that order. 701 Stmt **SubExprs; 702 // Points to the allocation function used. 703 FunctionDecl *OperatorNew; 704 // Points to the deallocation function used in case of error. May be null. 705 FunctionDecl *OperatorDelete; 706 // Points to the constructor used. Cannot be null if AllocType is a record; 707 // it would still point at the default constructor (even an implicit one). 708 // Must be null for all other types. 709 CXXConstructorDecl *Constructor; 710 711 SourceLocation StartLoc; 712 SourceLocation EndLoc; 713 714public: 715 CXXNewExpr(bool globalNew, FunctionDecl *operatorNew, Expr **placementArgs, 716 unsigned numPlaceArgs, bool ParenTypeId, Expr *arraySize, 717 CXXConstructorDecl *constructor, bool initializer, 718 Expr **constructorArgs, unsigned numConsArgs, 719 FunctionDecl *operatorDelete, QualType ty, 720 SourceLocation startLoc, SourceLocation endLoc); 721 ~CXXNewExpr() { 722 delete[] SubExprs; 723 } 724 725 QualType getAllocatedType() const { 726 assert(getType()->isPointerType()); 727 return getType()->getAs<PointerType>()->getPointeeType(); 728 } 729 730 FunctionDecl *getOperatorNew() const { return OperatorNew; } 731 FunctionDecl *getOperatorDelete() const { return OperatorDelete; } 732 CXXConstructorDecl *getConstructor() const { return Constructor; } 733 734 bool isArray() const { return Array; } 735 Expr *getArraySize() { 736 return Array ? cast<Expr>(SubExprs[0]) : 0; 737 } 738 const Expr *getArraySize() const { 739 return Array ? cast<Expr>(SubExprs[0]) : 0; 740 } 741 742 unsigned getNumPlacementArgs() const { return NumPlacementArgs; } 743 Expr *getPlacementArg(unsigned i) { 744 assert(i < NumPlacementArgs && "Index out of range"); 745 return cast<Expr>(SubExprs[Array + i]); 746 } 747 const Expr *getPlacementArg(unsigned i) const { 748 assert(i < NumPlacementArgs && "Index out of range"); 749 return cast<Expr>(SubExprs[Array + i]); 750 } 751 752 bool isGlobalNew() const { return GlobalNew; } 753 bool isParenTypeId() const { return ParenTypeId; } 754 bool hasInitializer() const { return Initializer; } 755 756 unsigned getNumConstructorArgs() const { return NumConstructorArgs; } 757 Expr *getConstructorArg(unsigned i) { 758 assert(i < NumConstructorArgs && "Index out of range"); 759 return cast<Expr>(SubExprs[Array + NumPlacementArgs + i]); 760 } 761 const Expr *getConstructorArg(unsigned i) const { 762 assert(i < NumConstructorArgs && "Index out of range"); 763 return cast<Expr>(SubExprs[Array + NumPlacementArgs + i]); 764 } 765 766 typedef ExprIterator arg_iterator; 767 typedef ConstExprIterator const_arg_iterator; 768 769 arg_iterator placement_arg_begin() { 770 return SubExprs + Array; 771 } 772 arg_iterator placement_arg_end() { 773 return SubExprs + Array + getNumPlacementArgs(); 774 } 775 const_arg_iterator placement_arg_begin() const { 776 return SubExprs + Array; 777 } 778 const_arg_iterator placement_arg_end() const { 779 return SubExprs + Array + getNumPlacementArgs(); 780 } 781 782 arg_iterator constructor_arg_begin() { 783 return SubExprs + Array + getNumPlacementArgs(); 784 } 785 arg_iterator constructor_arg_end() { 786 return SubExprs + Array + getNumPlacementArgs() + getNumConstructorArgs(); 787 } 788 const_arg_iterator constructor_arg_begin() const { 789 return SubExprs + Array + getNumPlacementArgs(); 790 } 791 const_arg_iterator constructor_arg_end() const { 792 return SubExprs + Array + getNumPlacementArgs() + getNumConstructorArgs(); 793 } 794 795 virtual SourceRange getSourceRange() const { 796 return SourceRange(StartLoc, EndLoc); 797 } 798 799 static bool classof(const Stmt *T) { 800 return T->getStmtClass() == CXXNewExprClass; 801 } 802 static bool classof(const CXXNewExpr *) { return true; } 803 804 // Iterators 805 virtual child_iterator child_begin(); 806 virtual child_iterator child_end(); 807}; 808 809/// CXXDeleteExpr - A delete expression for memory deallocation and destructor 810/// calls, e.g. "delete[] pArray". 811class CXXDeleteExpr : public Expr { 812 // Is this a forced global delete, i.e. "::delete"? 813 bool GlobalDelete : 1; 814 // Is this the array form of delete, i.e. "delete[]"? 815 bool ArrayForm : 1; 816 // Points to the operator delete overload that is used. Could be a member. 817 FunctionDecl *OperatorDelete; 818 // The pointer expression to be deleted. 819 Stmt *Argument; 820 // Location of the expression. 821 SourceLocation Loc; 822public: 823 CXXDeleteExpr(QualType ty, bool globalDelete, bool arrayForm, 824 FunctionDecl *operatorDelete, Expr *arg, SourceLocation loc) 825 : Expr(CXXDeleteExprClass, ty, false, false), GlobalDelete(globalDelete), 826 ArrayForm(arrayForm), OperatorDelete(operatorDelete), Argument(arg), 827 Loc(loc) { } 828 829 bool isGlobalDelete() const { return GlobalDelete; } 830 bool isArrayForm() const { return ArrayForm; } 831 832 FunctionDecl *getOperatorDelete() const { return OperatorDelete; } 833 834 Expr *getArgument() { return cast<Expr>(Argument); } 835 const Expr *getArgument() const { return cast<Expr>(Argument); } 836 837 virtual SourceRange getSourceRange() const { 838 return SourceRange(Loc, Argument->getLocEnd()); 839 } 840 841 static bool classof(const Stmt *T) { 842 return T->getStmtClass() == CXXDeleteExprClass; 843 } 844 static bool classof(const CXXDeleteExpr *) { return true; } 845 846 // Iterators 847 virtual child_iterator child_begin(); 848 virtual child_iterator child_end(); 849}; 850 851/// \brief Represents a C++ pseudo-destructor (C++ [expr.pseudo]). 852/// 853/// Example: 854/// 855/// \code 856/// template<typename T> 857/// void destroy(T* ptr) { 858/// ptr->~T(); 859/// } 860/// \endcode 861/// 862/// When the template is parsed, the expression \c ptr->~T will be stored as 863/// a member reference expression. If it then instantiated with a scalar type 864/// as a template argument for T, the resulting expression will be a 865/// pseudo-destructor expression. 866class CXXPseudoDestructorExpr : public Expr { 867 /// \brief The base expression (that is being destroyed). 868 Stmt *Base; 869 870 /// \brief Whether the operator was an arrow ('->'); otherwise, it was a 871 /// period ('.'). 872 bool IsArrow : 1; 873 874 /// \brief The location of the '.' or '->' operator. 875 SourceLocation OperatorLoc; 876 877 /// \brief The nested-name-specifier that follows the operator, if present. 878 NestedNameSpecifier *Qualifier; 879 880 /// \brief The source range that covers the nested-name-specifier, if 881 /// present. 882 SourceRange QualifierRange; 883 884 /// \brief The type being destroyed. 885 QualType DestroyedType; 886 887 /// \brief The location of the type after the '~'. 888 SourceLocation DestroyedTypeLoc; 889 890public: 891 CXXPseudoDestructorExpr(ASTContext &Context, 892 Expr *Base, bool isArrow, SourceLocation OperatorLoc, 893 NestedNameSpecifier *Qualifier, 894 SourceRange QualifierRange, 895 QualType DestroyedType, 896 SourceLocation DestroyedTypeLoc) 897 : Expr(CXXPseudoDestructorExprClass, 898 Context.getPointerType(Context.getFunctionType(Context.VoidTy, 0, 0, 899 false, 0)), 900 /*isTypeDependent=*/false, 901 /*isValueDependent=*/Base->isValueDependent()), 902 Base(static_cast<Stmt *>(Base)), IsArrow(isArrow), 903 OperatorLoc(OperatorLoc), Qualifier(Qualifier), 904 QualifierRange(QualifierRange), DestroyedType(DestroyedType), 905 DestroyedTypeLoc(DestroyedTypeLoc) { } 906 907 void setBase(Expr *E) { Base = E; } 908 Expr *getBase() const { return cast<Expr>(Base); } 909 910 /// \brief Determines whether this member expression actually had 911 /// a C++ nested-name-specifier prior to the name of the member, e.g., 912 /// x->Base::foo. 913 bool hasQualifier() const { return Qualifier != 0; } 914 915 /// \brief If the member name was qualified, retrieves the source range of 916 /// the nested-name-specifier that precedes the member name. Otherwise, 917 /// returns an empty source range. 918 SourceRange getQualifierRange() const { return QualifierRange; } 919 920 /// \brief If the member name was qualified, retrieves the 921 /// nested-name-specifier that precedes the member name. Otherwise, returns 922 /// NULL. 923 NestedNameSpecifier *getQualifier() const { return Qualifier; } 924 925 /// \brief Determine whether this pseudo-destructor expression was written 926 /// using an '->' (otherwise, it used a '.'). 927 bool isArrow() const { return IsArrow; } 928 void setArrow(bool A) { IsArrow = A; } 929 930 /// \brief Retrieve the location of the '.' or '->' operator. 931 SourceLocation getOperatorLoc() const { return OperatorLoc; } 932 933 /// \brief Retrieve the type that is being destroyed. 934 QualType getDestroyedType() const { return DestroyedType; } 935 936 /// \brief Retrieve the location of the type being destroyed. 937 SourceLocation getDestroyedTypeLoc() const { return DestroyedTypeLoc; } 938 939 virtual SourceRange getSourceRange() const { 940 return SourceRange(Base->getLocStart(), DestroyedTypeLoc); 941 } 942 943 static bool classof(const Stmt *T) { 944 return T->getStmtClass() == CXXPseudoDestructorExprClass; 945 } 946 static bool classof(const CXXPseudoDestructorExpr *) { return true; } 947 948 // Iterators 949 virtual child_iterator child_begin(); 950 virtual child_iterator child_end(); 951}; 952 953/// UnaryTypeTraitExpr - A GCC or MS unary type trait, as used in the 954/// implementation of TR1/C++0x type trait templates. 955/// Example: 956/// __is_pod(int) == true 957/// __is_enum(std::string) == false 958class UnaryTypeTraitExpr : public Expr { 959 /// UTT - The trait. 960 UnaryTypeTrait UTT; 961 962 /// Loc - The location of the type trait keyword. 963 SourceLocation Loc; 964 965 /// RParen - The location of the closing paren. 966 SourceLocation RParen; 967 968 /// QueriedType - The type we're testing. 969 QualType QueriedType; 970 971public: 972 UnaryTypeTraitExpr(SourceLocation loc, UnaryTypeTrait utt, QualType queried, 973 SourceLocation rparen, QualType ty) 974 : Expr(UnaryTypeTraitExprClass, ty, false, queried->isDependentType()), 975 UTT(utt), Loc(loc), RParen(rparen), QueriedType(queried) { } 976 977 virtual SourceRange getSourceRange() const { return SourceRange(Loc, RParen);} 978 979 UnaryTypeTrait getTrait() const { return UTT; } 980 981 QualType getQueriedType() const { return QueriedType; } 982 983 bool EvaluateTrait(ASTContext&) const; 984 985 static bool classof(const Stmt *T) { 986 return T->getStmtClass() == UnaryTypeTraitExprClass; 987 } 988 static bool classof(const UnaryTypeTraitExpr *) { return true; } 989 990 // Iterators 991 virtual child_iterator child_begin(); 992 virtual child_iterator child_end(); 993}; 994 995/// \brief A reference to a name which we were able to look up during 996/// parsing but could not resolve to a specific declaration. This 997/// arises in several ways: 998/// * we might be waiting for argument-dependent lookup 999/// * the name might resolve to an overloaded function 1000/// and eventually: 1001/// * the lookup might have included a function template 1002/// These never include UnresolvedUsingValueDecls, which are always 1003/// class members and therefore appear only in 1004/// UnresolvedMemberLookupExprs. 1005class UnresolvedLookupExpr : public Expr { 1006 /// The results. These are undesugared, which is to say, they may 1007 /// include UsingShadowDecls. 1008 UnresolvedSet Results; 1009 1010 /// The name declared. 1011 DeclarationName Name; 1012 1013 /// The qualifier given, if any. 1014 NestedNameSpecifier *Qualifier; 1015 1016 /// The source range of the nested name specifier. 1017 SourceRange QualifierRange; 1018 1019 /// The location of the name. 1020 SourceLocation NameLoc; 1021 1022 /// True if these lookup results should be extended by 1023 /// argument-dependent lookup if this is the operand of a function 1024 /// call. 1025 bool RequiresADL; 1026 1027 /// True if these lookup results are overloaded. This is pretty 1028 /// trivially rederivable if we urgently need to kill this field. 1029 bool Overloaded; 1030 1031 /// True if the name looked up had explicit template arguments. 1032 /// This requires all the results to be function templates. 1033 bool HasExplicitTemplateArgs; 1034 1035 UnresolvedLookupExpr(QualType T, bool Dependent, 1036 NestedNameSpecifier *Qualifier, SourceRange QRange, 1037 DeclarationName Name, SourceLocation NameLoc, 1038 bool RequiresADL, bool Overloaded, bool HasTemplateArgs) 1039 : Expr(UnresolvedLookupExprClass, T, Dependent, Dependent), 1040 Name(Name), Qualifier(Qualifier), QualifierRange(QRange), 1041 NameLoc(NameLoc), RequiresADL(RequiresADL), Overloaded(Overloaded), 1042 HasExplicitTemplateArgs(HasTemplateArgs) 1043 {} 1044 1045public: 1046 static UnresolvedLookupExpr *Create(ASTContext &C, 1047 bool Dependent, 1048 NestedNameSpecifier *Qualifier, 1049 SourceRange QualifierRange, 1050 DeclarationName Name, 1051 SourceLocation NameLoc, 1052 bool ADL, bool Overloaded) { 1053 return new(C) UnresolvedLookupExpr(Dependent ? C.DependentTy : C.OverloadTy, 1054 Dependent, Qualifier, QualifierRange, 1055 Name, NameLoc, ADL, Overloaded, false); 1056 } 1057 1058 static UnresolvedLookupExpr *Create(ASTContext &C, 1059 bool Dependent, 1060 NestedNameSpecifier *Qualifier, 1061 SourceRange QualifierRange, 1062 DeclarationName Name, 1063 SourceLocation NameLoc, 1064 bool ADL, 1065 const TemplateArgumentListInfo &Args); 1066 1067 /// Computes whether an unresolved lookup on the given declarations 1068 /// and optional template arguments is type- and value-dependent. 1069 static bool ComputeDependence(NamedDecl * const *Begin, 1070 NamedDecl * const *End, 1071 const TemplateArgumentListInfo *Args); 1072 1073 void addDecl(NamedDecl *Decl) { 1074 Results.addDecl(Decl); 1075 } 1076 1077 typedef UnresolvedSet::iterator decls_iterator; 1078 decls_iterator decls_begin() const { return Results.begin(); } 1079 decls_iterator decls_end() const { return Results.end(); } 1080 1081 /// True if this declaration should be extended by 1082 /// argument-dependent lookup. 1083 bool requiresADL() const { return RequiresADL; } 1084 1085 /// True if this lookup is overloaded. 1086 bool isOverloaded() const { return Overloaded; } 1087 1088 /// Fetches the name looked up. 1089 DeclarationName getName() const { return Name; } 1090 1091 /// Gets the location of the name. 1092 SourceLocation getNameLoc() const { return NameLoc; } 1093 1094 /// Fetches the nested-name qualifier, if one was given. 1095 NestedNameSpecifier *getQualifier() const { return Qualifier; } 1096 1097 /// Fetches the range of the nested-name qualifier. 1098 SourceRange getQualifierRange() const { return QualifierRange; } 1099 1100 /// Determines whether this lookup had explicit template arguments. 1101 bool hasExplicitTemplateArgs() const { return HasExplicitTemplateArgs; } 1102 1103 // Note that, inconsistently with the explicit-template-argument AST 1104 // nodes, users are *forbidden* from calling these methods on objects 1105 // without explicit template arguments. 1106 1107 /// Gets a reference to the explicit template argument list. 1108 const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const { 1109 assert(hasExplicitTemplateArgs()); 1110 return *reinterpret_cast<const ExplicitTemplateArgumentList*>(this + 1); 1111 } 1112 1113 /// \brief Copies the template arguments (if present) into the given 1114 /// structure. 1115 void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { 1116 getExplicitTemplateArgs().copyInto(List); 1117 } 1118 1119 SourceLocation getLAngleLoc() const { 1120 return getExplicitTemplateArgs().LAngleLoc; 1121 } 1122 1123 SourceLocation getRAngleLoc() const { 1124 return getExplicitTemplateArgs().RAngleLoc; 1125 } 1126 1127 TemplateArgumentLoc const *getTemplateArgs() const { 1128 return getExplicitTemplateArgs().getTemplateArgs(); 1129 } 1130 1131 unsigned getNumTemplateArgs() const { 1132 return getExplicitTemplateArgs().NumTemplateArgs; 1133 } 1134 1135 virtual SourceRange getSourceRange() const { 1136 SourceRange Range(NameLoc); 1137 if (Qualifier) Range.setBegin(QualifierRange.getBegin()); 1138 if (hasExplicitTemplateArgs()) Range.setEnd(getRAngleLoc()); 1139 return Range; 1140 } 1141 1142 virtual StmtIterator child_begin(); 1143 virtual StmtIterator child_end(); 1144 1145 static bool classof(const Stmt *T) { 1146 return T->getStmtClass() == UnresolvedLookupExprClass; 1147 } 1148 static bool classof(const UnresolvedLookupExpr *) { return true; } 1149}; 1150 1151/// \brief A qualified reference to a name whose declaration cannot 1152/// yet be resolved. 1153/// 1154/// DependentScopeDeclRefExpr is similar to DeclRefExpr in that 1155/// it expresses a reference to a declaration such as 1156/// X<T>::value. The difference, however, is that an 1157/// DependentScopeDeclRefExpr node is used only within C++ templates when 1158/// the qualification (e.g., X<T>::) refers to a dependent type. In 1159/// this case, X<T>::value cannot resolve to a declaration because the 1160/// declaration will differ from on instantiation of X<T> to the 1161/// next. Therefore, DependentScopeDeclRefExpr keeps track of the 1162/// qualifier (X<T>::) and the name of the entity being referenced 1163/// ("value"). Such expressions will instantiate to a DeclRefExpr once the 1164/// declaration can be found. 1165class DependentScopeDeclRefExpr : public Expr { 1166 /// The name of the entity we will be referencing. 1167 DeclarationName Name; 1168 1169 /// Location of the name of the declaration we're referencing. 1170 SourceLocation Loc; 1171 1172 /// QualifierRange - The source range that covers the 1173 /// nested-name-specifier. 1174 SourceRange QualifierRange; 1175 1176 /// \brief The nested-name-specifier that qualifies this unresolved 1177 /// declaration name. 1178 NestedNameSpecifier *Qualifier; 1179 1180 /// \brief Whether the name includes explicit template arguments. 1181 bool HasExplicitTemplateArgs; 1182 1183 DependentScopeDeclRefExpr(QualType T, 1184 NestedNameSpecifier *Qualifier, 1185 SourceRange QualifierRange, 1186 DeclarationName Name, 1187 SourceLocation NameLoc, 1188 bool HasExplicitTemplateArgs) 1189 : Expr(DependentScopeDeclRefExprClass, T, true, true), 1190 Name(Name), Loc(NameLoc), 1191 QualifierRange(QualifierRange), Qualifier(Qualifier), 1192 HasExplicitTemplateArgs(HasExplicitTemplateArgs) 1193 {} 1194 1195public: 1196 static DependentScopeDeclRefExpr *Create(ASTContext &C, 1197 NestedNameSpecifier *Qualifier, 1198 SourceRange QualifierRange, 1199 DeclarationName Name, 1200 SourceLocation NameLoc, 1201 const TemplateArgumentListInfo *TemplateArgs = 0); 1202 1203 /// \brief Retrieve the name that this expression refers to. 1204 DeclarationName getDeclName() const { return Name; } 1205 1206 /// \brief Retrieve the location of the name within the expression. 1207 SourceLocation getLocation() const { return Loc; } 1208 1209 /// \brief Retrieve the source range of the nested-name-specifier. 1210 SourceRange getQualifierRange() const { return QualifierRange; } 1211 1212 /// \brief Retrieve the nested-name-specifier that qualifies this 1213 /// declaration. 1214 NestedNameSpecifier *getQualifier() const { return Qualifier; } 1215 1216 /// Determines whether this lookup had explicit template arguments. 1217 bool hasExplicitTemplateArgs() const { return HasExplicitTemplateArgs; } 1218 1219 // Note that, inconsistently with the explicit-template-argument AST 1220 // nodes, users are *forbidden* from calling these methods on objects 1221 // without explicit template arguments. 1222 1223 /// Gets a reference to the explicit template argument list. 1224 const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const { 1225 assert(hasExplicitTemplateArgs()); 1226 return *reinterpret_cast<const ExplicitTemplateArgumentList*>(this + 1); 1227 } 1228 1229 /// \brief Copies the template arguments (if present) into the given 1230 /// structure. 1231 void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { 1232 getExplicitTemplateArgs().copyInto(List); 1233 } 1234 1235 SourceLocation getLAngleLoc() const { 1236 return getExplicitTemplateArgs().LAngleLoc; 1237 } 1238 1239 SourceLocation getRAngleLoc() const { 1240 return getExplicitTemplateArgs().RAngleLoc; 1241 } 1242 1243 TemplateArgumentLoc const *getTemplateArgs() const { 1244 return getExplicitTemplateArgs().getTemplateArgs(); 1245 } 1246 1247 unsigned getNumTemplateArgs() const { 1248 return getExplicitTemplateArgs().NumTemplateArgs; 1249 } 1250 1251 virtual SourceRange getSourceRange() const { 1252 SourceRange Range(QualifierRange.getBegin(), getLocation()); 1253 if (hasExplicitTemplateArgs()) 1254 Range.setEnd(getRAngleLoc()); 1255 return Range; 1256 } 1257 1258 static bool classof(const Stmt *T) { 1259 return T->getStmtClass() == DependentScopeDeclRefExprClass; 1260 } 1261 static bool classof(const DependentScopeDeclRefExpr *) { return true; } 1262 1263 virtual StmtIterator child_begin(); 1264 virtual StmtIterator child_end(); 1265}; 1266 1267class CXXExprWithTemporaries : public Expr { 1268 Stmt *SubExpr; 1269 1270 CXXTemporary **Temps; 1271 unsigned NumTemps; 1272 1273 CXXExprWithTemporaries(Expr *SubExpr, CXXTemporary **Temps, 1274 unsigned NumTemps); 1275 ~CXXExprWithTemporaries(); 1276 1277protected: 1278 virtual void DoDestroy(ASTContext &C); 1279 1280public: 1281 static CXXExprWithTemporaries *Create(ASTContext &C, Expr *SubExpr, 1282 CXXTemporary **Temps, 1283 unsigned NumTemps); 1284 1285 unsigned getNumTemporaries() const { return NumTemps; } 1286 CXXTemporary *getTemporary(unsigned i) { 1287 assert(i < NumTemps && "Index out of range"); 1288 return Temps[i]; 1289 } 1290 const CXXTemporary *getTemporary(unsigned i) const { 1291 return const_cast<CXXExprWithTemporaries*>(this)->getTemporary(i); 1292 } 1293 1294 Expr *getSubExpr() { return cast<Expr>(SubExpr); } 1295 const Expr *getSubExpr() const { return cast<Expr>(SubExpr); } 1296 void setSubExpr(Expr *E) { SubExpr = E; } 1297 1298 virtual SourceRange getSourceRange() const { 1299 return SubExpr->getSourceRange(); 1300 } 1301 1302 // Implement isa/cast/dyncast/etc. 1303 static bool classof(const Stmt *T) { 1304 return T->getStmtClass() == CXXExprWithTemporariesClass; 1305 } 1306 static bool classof(const CXXExprWithTemporaries *) { return true; } 1307 1308 // Iterators 1309 virtual child_iterator child_begin(); 1310 virtual child_iterator child_end(); 1311}; 1312 1313/// \brief Describes an explicit type conversion that uses functional 1314/// notion but could not be resolved because one or more arguments are 1315/// type-dependent. 1316/// 1317/// The explicit type conversions expressed by 1318/// CXXUnresolvedConstructExpr have the form \c T(a1, a2, ..., aN), 1319/// where \c T is some type and \c a1, a2, ..., aN are values, and 1320/// either \C T is a dependent type or one or more of the \c a's is 1321/// type-dependent. For example, this would occur in a template such 1322/// as: 1323/// 1324/// \code 1325/// template<typename T, typename A1> 1326/// inline T make_a(const A1& a1) { 1327/// return T(a1); 1328/// } 1329/// \endcode 1330/// 1331/// When the returned expression is instantiated, it may resolve to a 1332/// constructor call, conversion function call, or some kind of type 1333/// conversion. 1334class CXXUnresolvedConstructExpr : public Expr { 1335 /// \brief The starting location of the type 1336 SourceLocation TyBeginLoc; 1337 1338 /// \brief The type being constructed. 1339 QualType Type; 1340 1341 /// \brief The location of the left parentheses ('('). 1342 SourceLocation LParenLoc; 1343 1344 /// \brief The location of the right parentheses (')'). 1345 SourceLocation RParenLoc; 1346 1347 /// \brief The number of arguments used to construct the type. 1348 unsigned NumArgs; 1349 1350 CXXUnresolvedConstructExpr(SourceLocation TyBegin, 1351 QualType T, 1352 SourceLocation LParenLoc, 1353 Expr **Args, 1354 unsigned NumArgs, 1355 SourceLocation RParenLoc); 1356 1357public: 1358 static CXXUnresolvedConstructExpr *Create(ASTContext &C, 1359 SourceLocation TyBegin, 1360 QualType T, 1361 SourceLocation LParenLoc, 1362 Expr **Args, 1363 unsigned NumArgs, 1364 SourceLocation RParenLoc); 1365 1366 /// \brief Retrieve the source location where the type begins. 1367 SourceLocation getTypeBeginLoc() const { return TyBeginLoc; } 1368 void setTypeBeginLoc(SourceLocation L) { TyBeginLoc = L; } 1369 1370 /// \brief Retrieve the type that is being constructed, as specified 1371 /// in the source code. 1372 QualType getTypeAsWritten() const { return Type; } 1373 void setTypeAsWritten(QualType T) { Type = T; } 1374 1375 /// \brief Retrieve the location of the left parentheses ('(') that 1376 /// precedes the argument list. 1377 SourceLocation getLParenLoc() const { return LParenLoc; } 1378 void setLParenLoc(SourceLocation L) { LParenLoc = L; } 1379 1380 /// \brief Retrieve the location of the right parentheses (')') that 1381 /// follows the argument list. 1382 SourceLocation getRParenLoc() const { return RParenLoc; } 1383 void setRParenLoc(SourceLocation L) { RParenLoc = L; } 1384 1385 /// \brief Retrieve the number of arguments. 1386 unsigned arg_size() const { return NumArgs; } 1387 1388 typedef Expr** arg_iterator; 1389 arg_iterator arg_begin() { return reinterpret_cast<Expr**>(this + 1); } 1390 arg_iterator arg_end() { return arg_begin() + NumArgs; } 1391 1392 Expr *getArg(unsigned I) { 1393 assert(I < NumArgs && "Argument index out-of-range"); 1394 return *(arg_begin() + I); 1395 } 1396 1397 virtual SourceRange getSourceRange() const { 1398 return SourceRange(TyBeginLoc, RParenLoc); 1399 } 1400 static bool classof(const Stmt *T) { 1401 return T->getStmtClass() == CXXUnresolvedConstructExprClass; 1402 } 1403 static bool classof(const CXXUnresolvedConstructExpr *) { return true; } 1404 1405 // Iterators 1406 virtual child_iterator child_begin(); 1407 virtual child_iterator child_end(); 1408}; 1409 1410/// \brief Represents a C++ member access expression where the actual 1411/// member referenced could not be resolved because the base 1412/// expression or the member name was dependent. 1413/// 1414/// Like UnresolvedMemberExprs, these can be either implicit or 1415/// explicit accesses. It is only possible to get one of these with 1416/// an implicit access if a qualifier is provided. 1417class CXXDependentScopeMemberExpr : public Expr { 1418 /// \brief The expression for the base pointer or class reference, 1419 /// e.g., the \c x in x.f. Can be null in implicit accesses. 1420 Stmt *Base; 1421 1422 /// \brief The type of the base expression. Never null, even for 1423 /// implicit accesses. 1424 QualType BaseType; 1425 1426 /// \brief Whether this member expression used the '->' operator or 1427 /// the '.' operator. 1428 bool IsArrow : 1; 1429 1430 /// \brief Whether this member expression has explicitly-specified template 1431 /// arguments. 1432 bool HasExplicitTemplateArgs : 1; 1433 1434 /// \brief The location of the '->' or '.' operator. 1435 SourceLocation OperatorLoc; 1436 1437 /// \brief The nested-name-specifier that precedes the member name, if any. 1438 NestedNameSpecifier *Qualifier; 1439 1440 /// \brief The source range covering the nested name specifier. 1441 SourceRange QualifierRange; 1442 1443 /// \brief In a qualified member access expression such as t->Base::f, this 1444 /// member stores the resolves of name lookup in the context of the member 1445 /// access expression, to be used at instantiation time. 1446 /// 1447 /// FIXME: This member, along with the Qualifier and QualifierRange, could 1448 /// be stuck into a structure that is optionally allocated at the end of 1449 /// the CXXDependentScopeMemberExpr, to save space in the common case. 1450 NamedDecl *FirstQualifierFoundInScope; 1451 1452 /// \brief The member to which this member expression refers, which 1453 /// can be name, overloaded operator, or destructor. 1454 /// FIXME: could also be a template-id 1455 DeclarationName Member; 1456 1457 /// \brief The location of the member name. 1458 SourceLocation MemberLoc; 1459 1460 /// \brief Retrieve the explicit template argument list that followed the 1461 /// member template name, if any. 1462 ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() { 1463 assert(HasExplicitTemplateArgs); 1464 return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1); 1465 } 1466 1467 /// \brief Retrieve the explicit template argument list that followed the 1468 /// member template name, if any. 1469 const ExplicitTemplateArgumentList *getExplicitTemplateArgumentList() const { 1470 return const_cast<CXXDependentScopeMemberExpr *>(this) 1471 ->getExplicitTemplateArgumentList(); 1472 } 1473 1474 CXXDependentScopeMemberExpr(ASTContext &C, 1475 Expr *Base, QualType BaseType, bool IsArrow, 1476 SourceLocation OperatorLoc, 1477 NestedNameSpecifier *Qualifier, 1478 SourceRange QualifierRange, 1479 NamedDecl *FirstQualifierFoundInScope, 1480 DeclarationName Member, 1481 SourceLocation MemberLoc, 1482 const TemplateArgumentListInfo *TemplateArgs); 1483 1484public: 1485 CXXDependentScopeMemberExpr(ASTContext &C, 1486 Expr *Base, QualType BaseType, 1487 bool IsArrow, 1488 SourceLocation OperatorLoc, 1489 NestedNameSpecifier *Qualifier, 1490 SourceRange QualifierRange, 1491 NamedDecl *FirstQualifierFoundInScope, 1492 DeclarationName Member, 1493 SourceLocation MemberLoc) 1494 : Expr(CXXDependentScopeMemberExprClass, C.DependentTy, true, true), 1495 Base(Base), BaseType(BaseType), IsArrow(IsArrow), 1496 HasExplicitTemplateArgs(false), OperatorLoc(OperatorLoc), 1497 Qualifier(Qualifier), QualifierRange(QualifierRange), 1498 FirstQualifierFoundInScope(FirstQualifierFoundInScope), 1499 Member(Member), MemberLoc(MemberLoc) { } 1500 1501 static CXXDependentScopeMemberExpr * 1502 Create(ASTContext &C, 1503 Expr *Base, QualType BaseType, bool IsArrow, 1504 SourceLocation OperatorLoc, 1505 NestedNameSpecifier *Qualifier, 1506 SourceRange QualifierRange, 1507 NamedDecl *FirstQualifierFoundInScope, 1508 DeclarationName Member, 1509 SourceLocation MemberLoc, 1510 const TemplateArgumentListInfo *TemplateArgs); 1511 1512 /// \brief True if this is an implicit access, i.e. one in which the 1513 /// member being accessed was not written in the source. The source 1514 /// location of the operator is invalid in this case. 1515 bool isImplicitAccess() const { return Base == 0; } 1516 1517 /// \brief Retrieve the base object of this member expressions, 1518 /// e.g., the \c x in \c x.m. 1519 Expr *getBase() const { 1520 assert(!isImplicitAccess()); 1521 return cast<Expr>(Base); 1522 } 1523 void setBase(Expr *E) { Base = E; } 1524 1525 QualType getBaseType() const { return BaseType; } 1526 1527 /// \brief Determine whether this member expression used the '->' 1528 /// operator; otherwise, it used the '.' operator. 1529 bool isArrow() const { return IsArrow; } 1530 void setArrow(bool A) { IsArrow = A; } 1531 1532 /// \brief Retrieve the location of the '->' or '.' operator. 1533 SourceLocation getOperatorLoc() const { return OperatorLoc; } 1534 void setOperatorLoc(SourceLocation L) { OperatorLoc = L; } 1535 1536 /// \brief Retrieve the nested-name-specifier that qualifies the member 1537 /// name. 1538 NestedNameSpecifier *getQualifier() const { return Qualifier; } 1539 1540 /// \brief Retrieve the source range covering the nested-name-specifier 1541 /// that qualifies the member name. 1542 SourceRange getQualifierRange() const { return QualifierRange; } 1543 1544 /// \brief Retrieve the first part of the nested-name-specifier that was 1545 /// found in the scope of the member access expression when the member access 1546 /// was initially parsed. 1547 /// 1548 /// This function only returns a useful result when member access expression 1549 /// uses a qualified member name, e.g., "x.Base::f". Here, the declaration 1550 /// returned by this function describes what was found by unqualified name 1551 /// lookup for the identifier "Base" within the scope of the member access 1552 /// expression itself. At template instantiation time, this information is 1553 /// combined with the results of name lookup into the type of the object 1554 /// expression itself (the class type of x). 1555 NamedDecl *getFirstQualifierFoundInScope() const { 1556 return FirstQualifierFoundInScope; 1557 } 1558 1559 /// \brief Retrieve the name of the member that this expression 1560 /// refers to. 1561 DeclarationName getMember() const { return Member; } 1562 void setMember(DeclarationName N) { Member = N; } 1563 1564 // \brief Retrieve the location of the name of the member that this 1565 // expression refers to. 1566 SourceLocation getMemberLoc() const { return MemberLoc; } 1567 void setMemberLoc(SourceLocation L) { MemberLoc = L; } 1568 1569 /// \brief Determines whether this member expression actually had a C++ 1570 /// template argument list explicitly specified, e.g., x.f<int>. 1571 bool hasExplicitTemplateArgs() const { 1572 return HasExplicitTemplateArgs; 1573 } 1574 1575 /// \brief Copies the template arguments (if present) into the given 1576 /// structure. 1577 void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { 1578 assert(HasExplicitTemplateArgs); 1579 getExplicitTemplateArgumentList()->copyInto(List); 1580 } 1581 1582 /// \brief Retrieve the location of the left angle bracket following the 1583 /// member name ('<'), if any. 1584 SourceLocation getLAngleLoc() const { 1585 assert(HasExplicitTemplateArgs); 1586 return getExplicitTemplateArgumentList()->LAngleLoc; 1587 } 1588 1589 /// \brief Retrieve the template arguments provided as part of this 1590 /// template-id. 1591 const TemplateArgumentLoc *getTemplateArgs() const { 1592 assert(HasExplicitTemplateArgs); 1593 return getExplicitTemplateArgumentList()->getTemplateArgs(); 1594 } 1595 1596 /// \brief Retrieve the number of template arguments provided as part of this 1597 /// template-id. 1598 unsigned getNumTemplateArgs() const { 1599 assert(HasExplicitTemplateArgs); 1600 return getExplicitTemplateArgumentList()->NumTemplateArgs; 1601 } 1602 1603 /// \brief Retrieve the location of the right angle bracket following the 1604 /// template arguments ('>'). 1605 SourceLocation getRAngleLoc() const { 1606 assert(HasExplicitTemplateArgs); 1607 return getExplicitTemplateArgumentList()->RAngleLoc; 1608 } 1609 1610 virtual SourceRange getSourceRange() const { 1611 SourceRange Range; 1612 if (!isImplicitAccess()) 1613 Range.setBegin(Base->getSourceRange().getBegin()); 1614 else if (getQualifier()) 1615 Range.setBegin(getQualifierRange().getBegin()); 1616 else 1617 Range.setBegin(MemberLoc); 1618 1619 if (hasExplicitTemplateArgs()) 1620 Range.setEnd(getRAngleLoc()); 1621 else 1622 Range.setEnd(MemberLoc); 1623 return Range; 1624 } 1625 1626 static bool classof(const Stmt *T) { 1627 return T->getStmtClass() == CXXDependentScopeMemberExprClass; 1628 } 1629 static bool classof(const CXXDependentScopeMemberExpr *) { return true; } 1630 1631 // Iterators 1632 virtual child_iterator child_begin(); 1633 virtual child_iterator child_end(); 1634}; 1635 1636/// \brief Represents a C++ member access expression for which lookup 1637/// produced a set of overloaded functions. 1638/// 1639/// The member access may be explicit or implicit: 1640/// struct A { 1641/// int a, b; 1642/// int explicitAccess() { return this->a + this->A::b; } 1643/// int implicitAccess() { return a + A::b; } 1644/// }; 1645/// 1646/// In the final AST, an explicit access always becomes a MemberExpr. 1647/// An implicit access may become either a MemberExpr or a 1648/// DeclRefExpr, depending on whether the member is static. 1649class UnresolvedMemberExpr : public Expr { 1650 /// The results. These are undesugared, which is to say, they may 1651 /// include UsingShadowDecls. 1652 UnresolvedSet Results; 1653 1654 /// \brief The expression for the base pointer or class reference, 1655 /// e.g., the \c x in x.f. This can be null if this is an 'unbased' 1656 /// member expression 1657 Stmt *Base; 1658 1659 /// \brief The type of the base expression; never null. 1660 QualType BaseType; 1661 1662 /// \brief Whether this member expression used the '->' operator or 1663 /// the '.' operator. 1664 bool IsArrow : 1; 1665 1666 /// \brief Whether the lookup results contain an unresolved using 1667 /// declaration. 1668 bool HasUnresolvedUsing : 1; 1669 1670 /// \brief Whether this member expression has explicitly-specified template 1671 /// arguments. 1672 bool HasExplicitTemplateArgs : 1; 1673 1674 /// \brief The location of the '->' or '.' operator. 1675 SourceLocation OperatorLoc; 1676 1677 /// \brief The nested-name-specifier that precedes the member name, if any. 1678 NestedNameSpecifier *Qualifier; 1679 1680 /// \brief The source range covering the nested name specifier. 1681 SourceRange QualifierRange; 1682 1683 /// \brief The member to which this member expression refers, which 1684 /// can be a name or an overloaded operator. 1685 DeclarationName MemberName; 1686 1687 /// \brief The location of the member name. 1688 SourceLocation MemberLoc; 1689 1690 /// \brief Retrieve the explicit template argument list that followed the 1691 /// member template name. 1692 ExplicitTemplateArgumentList *getExplicitTemplateArgs() { 1693 assert(HasExplicitTemplateArgs); 1694 return reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1); 1695 } 1696 1697 /// \brief Retrieve the explicit template argument list that followed the 1698 /// member template name, if any. 1699 const ExplicitTemplateArgumentList *getExplicitTemplateArgs() const { 1700 return const_cast<UnresolvedMemberExpr*>(this)->getExplicitTemplateArgs(); 1701 } 1702 1703 UnresolvedMemberExpr(QualType T, bool Dependent, 1704 bool HasUnresolvedUsing, 1705 Expr *Base, QualType BaseType, bool IsArrow, 1706 SourceLocation OperatorLoc, 1707 NestedNameSpecifier *Qualifier, 1708 SourceRange QualifierRange, 1709 DeclarationName Member, 1710 SourceLocation MemberLoc, 1711 const TemplateArgumentListInfo *TemplateArgs); 1712 1713public: 1714 static UnresolvedMemberExpr * 1715 Create(ASTContext &C, bool Dependent, bool HasUnresolvedUsing, 1716 Expr *Base, QualType BaseType, bool IsArrow, 1717 SourceLocation OperatorLoc, 1718 NestedNameSpecifier *Qualifier, 1719 SourceRange QualifierRange, 1720 DeclarationName Member, 1721 SourceLocation MemberLoc, 1722 const TemplateArgumentListInfo *TemplateArgs); 1723 1724 /// Adds a declaration to the unresolved set. By assumption, all of 1725 /// these happen at initialization time and properties like 1726 /// 'Dependent' and 'HasUnresolvedUsing' take them into account. 1727 void addDecl(NamedDecl *Decl) { 1728 Results.addDecl(Decl); 1729 } 1730 1731 typedef UnresolvedSet::iterator decls_iterator; 1732 decls_iterator decls_begin() const { return Results.begin(); } 1733 decls_iterator decls_end() const { return Results.end(); } 1734 1735 unsigned getNumDecls() const { return Results.size(); } 1736 1737 /// \brief True if this is an implicit access, i.e. one in which the 1738 /// member being accessed was not written in the source. The source 1739 /// location of the operator is invalid in this case. 1740 bool isImplicitAccess() const { return Base == 0; } 1741 1742 /// \brief Retrieve the base object of this member expressions, 1743 /// e.g., the \c x in \c x.m. 1744 Expr *getBase() { 1745 assert(!isImplicitAccess()); 1746 return cast<Expr>(Base); 1747 } 1748 void setBase(Expr *E) { Base = E; } 1749 1750 QualType getBaseType() const { return BaseType; } 1751 1752 /// \brief Determine whether this member expression used the '->' 1753 /// operator; otherwise, it used the '.' operator. 1754 bool isArrow() const { return IsArrow; } 1755 void setArrow(bool A) { IsArrow = A; } 1756 1757 /// \brief Retrieve the location of the '->' or '.' operator. 1758 SourceLocation getOperatorLoc() const { return OperatorLoc; } 1759 void setOperatorLoc(SourceLocation L) { OperatorLoc = L; } 1760 1761 /// \brief Retrieve the nested-name-specifier that qualifies the member 1762 /// name. 1763 NestedNameSpecifier *getQualifier() const { return Qualifier; } 1764 1765 /// \brief Retrieve the source range covering the nested-name-specifier 1766 /// that qualifies the member name. 1767 SourceRange getQualifierRange() const { return QualifierRange; } 1768 1769 /// \brief Retrieve the name of the member that this expression 1770 /// refers to. 1771 DeclarationName getMemberName() const { return MemberName; } 1772 void setMemberName(DeclarationName N) { MemberName = N; } 1773 1774 // \brief Retrieve the location of the name of the member that this 1775 // expression refers to. 1776 SourceLocation getMemberLoc() const { return MemberLoc; } 1777 void setMemberLoc(SourceLocation L) { MemberLoc = L; } 1778 1779 /// \brief Determines whether this member expression actually had a C++ 1780 /// template argument list explicitly specified, e.g., x.f<int>. 1781 bool hasExplicitTemplateArgs() const { 1782 return HasExplicitTemplateArgs; 1783 } 1784 1785 /// \brief Copies the template arguments into the given structure. 1786 void copyTemplateArgumentsInto(TemplateArgumentListInfo &List) const { 1787 getExplicitTemplateArgs()->copyInto(List); 1788 } 1789 1790 /// \brief Retrieve the location of the left angle bracket following 1791 /// the member name ('<'). 1792 SourceLocation getLAngleLoc() const { 1793 return getExplicitTemplateArgs()->LAngleLoc; 1794 } 1795 1796 /// \brief Retrieve the template arguments provided as part of this 1797 /// template-id. 1798 const TemplateArgumentLoc *getTemplateArgs() const { 1799 return getExplicitTemplateArgs()->getTemplateArgs(); 1800 } 1801 1802 /// \brief Retrieve the number of template arguments provided as 1803 /// part of this template-id. 1804 unsigned getNumTemplateArgs() const { 1805 return getExplicitTemplateArgs()->NumTemplateArgs; 1806 } 1807 1808 /// \brief Retrieve the location of the right angle bracket 1809 /// following the template arguments ('>'). 1810 SourceLocation getRAngleLoc() const { 1811 return getExplicitTemplateArgs()->RAngleLoc; 1812 } 1813 1814 virtual SourceRange getSourceRange() const { 1815 SourceRange Range; 1816 if (!isImplicitAccess()) 1817 Range.setBegin(Base->getSourceRange().getBegin()); 1818 else if (getQualifier()) 1819 Range.setBegin(getQualifierRange().getBegin()); 1820 else 1821 Range.setBegin(MemberLoc); 1822 1823 if (hasExplicitTemplateArgs()) 1824 Range.setEnd(getRAngleLoc()); 1825 else 1826 Range.setEnd(MemberLoc); 1827 return Range; 1828 } 1829 1830 static bool classof(const Stmt *T) { 1831 return T->getStmtClass() == UnresolvedMemberExprClass; 1832 } 1833 static bool classof(const UnresolvedMemberExpr *) { return true; } 1834 1835 // Iterators 1836 virtual child_iterator child_begin(); 1837 virtual child_iterator child_end(); 1838}; 1839 1840} // end namespace clang 1841 1842#endif 1843