diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-08-15 20:02:54 +0000 |
commit | 56d91b49b13fe55c918afbda19f6165b5fbff87a (patch) | |
tree | 9abb1a658a297776086f4e0dfa6ca533de02104e /include/clang/AST/ExprObjC.h | |
parent | 41e20f564abdb05101d6b2b29c59459a966c22cc (diff) | |
download | src-test2-56d91b49b13fe55c918afbda19f6165b5fbff87a.tar.gz src-test2-56d91b49b13fe55c918afbda19f6165b5fbff87a.zip |
Notes
Diffstat (limited to 'include/clang/AST/ExprObjC.h')
-rw-r--r-- | include/clang/AST/ExprObjC.h | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/include/clang/AST/ExprObjC.h b/include/clang/AST/ExprObjC.h index 4bfd12c06930..93a5ada27915 100644 --- a/include/clang/AST/ExprObjC.h +++ b/include/clang/AST/ExprObjC.h @@ -87,43 +87,45 @@ public: child_range children() { return child_range(); } }; -/// ObjCNumericLiteral - used for objective-c numeric literals; -/// as in: @42 or @true (c++/objc++) or @__yes (c/objc) -class ObjCNumericLiteral : public Expr { - /// Number - expression AST node for the numeric literal - Stmt *Number; - ObjCMethodDecl *ObjCNumericLiteralMethod; - SourceLocation AtLoc; +/// ObjCBoxedExpr - used for generalized expression boxing. +/// as in: @(strdup("hello world")) or @(random()) +/// Also used for boxing non-parenthesized numeric literals; +/// as in: @42 or \@true (c++/objc++) or \@__yes (c/objc). +class ObjCBoxedExpr : public Expr { + Stmt *SubExpr; + ObjCMethodDecl *BoxingMethod; + SourceRange Range; public: - ObjCNumericLiteral(Stmt *NL, QualType T, ObjCMethodDecl *method, - SourceLocation L) - : Expr(ObjCNumericLiteralClass, T, VK_RValue, OK_Ordinary, - false, false, false, false), Number(NL), - ObjCNumericLiteralMethod(method), AtLoc(L) {} - explicit ObjCNumericLiteral(EmptyShell Empty) - : Expr(ObjCNumericLiteralClass, Empty) {} + ObjCBoxedExpr(Expr *E, QualType T, ObjCMethodDecl *method, + SourceRange R) + : Expr(ObjCBoxedExprClass, T, VK_RValue, OK_Ordinary, + E->isTypeDependent(), E->isValueDependent(), + E->isInstantiationDependent(), E->containsUnexpandedParameterPack()), + SubExpr(E), BoxingMethod(method), Range(R) {} + explicit ObjCBoxedExpr(EmptyShell Empty) + : Expr(ObjCBoxedExprClass, Empty) {} - Expr *getNumber() { return cast<Expr>(Number); } - const Expr *getNumber() const { return cast<Expr>(Number); } + Expr *getSubExpr() { return cast<Expr>(SubExpr); } + const Expr *getSubExpr() const { return cast<Expr>(SubExpr); } - ObjCMethodDecl *getObjCNumericLiteralMethod() const { - return ObjCNumericLiteralMethod; + ObjCMethodDecl *getBoxingMethod() const { + return BoxingMethod; } - - SourceLocation getAtLoc() const { return AtLoc; } + + SourceLocation getAtLoc() const { return Range.getBegin(); } SourceRange getSourceRange() const LLVM_READONLY { - return SourceRange(AtLoc, Number->getSourceRange().getEnd()); + return Range; } - + static bool classof(const Stmt *T) { - return T->getStmtClass() == ObjCNumericLiteralClass; + return T->getStmtClass() == ObjCBoxedExprClass; } - static bool classof(const ObjCNumericLiteral *) { return true; } + static bool classof(const ObjCBoxedExpr *) { return true; } // Iterators - child_range children() { return child_range(&Number, &Number+1); } - + child_range children() { return child_range(&SubExpr, &SubExpr+1); } + friend class ASTStmtReader; }; @@ -332,9 +334,9 @@ public: }; -/// ObjCEncodeExpr, used for @encode in Objective-C. @encode has the same type -/// and behavior as StringLiteral except that the string initializer is obtained -/// from ASTContext with the encoding type as an argument. +/// ObjCEncodeExpr, used for \@encode in Objective-C. \@encode has the same +/// type and behavior as StringLiteral except that the string initializer is +/// obtained from ASTContext with the encoding type as an argument. class ObjCEncodeExpr : public Expr { TypeSourceInfo *EncodedType; SourceLocation AtLoc, RParenLoc; @@ -376,7 +378,7 @@ public: child_range children() { return child_range(); } }; -/// ObjCSelectorExpr used for @selector in Objective-C. +/// ObjCSelectorExpr used for \@selector in Objective-C. class ObjCSelectorExpr : public Expr { Selector SelName; SourceLocation AtLoc, RParenLoc; @@ -419,19 +421,20 @@ public: /// The return type is "Protocol*". class ObjCProtocolExpr : public Expr { ObjCProtocolDecl *TheProtocol; - SourceLocation AtLoc, RParenLoc; + SourceLocation AtLoc, ProtoLoc, RParenLoc; public: ObjCProtocolExpr(QualType T, ObjCProtocolDecl *protocol, - SourceLocation at, SourceLocation rp) + SourceLocation at, SourceLocation protoLoc, SourceLocation rp) : Expr(ObjCProtocolExprClass, T, VK_RValue, OK_Ordinary, false, false, false, false), - TheProtocol(protocol), AtLoc(at), RParenLoc(rp) {} + TheProtocol(protocol), AtLoc(at), ProtoLoc(protoLoc), RParenLoc(rp) {} explicit ObjCProtocolExpr(EmptyShell Empty) : Expr(ObjCProtocolExprClass, Empty) {} ObjCProtocolDecl *getProtocol() const { return TheProtocol; } void setProtocol(ObjCProtocolDecl *P) { TheProtocol = P; } + SourceLocation getProtocolIdLoc() const { return ProtoLoc; } SourceLocation getAtLoc() const { return AtLoc; } SourceLocation getRParenLoc() const { return RParenLoc; } void setAtLoc(SourceLocation L) { AtLoc = L; } @@ -448,6 +451,9 @@ public: // Iterators child_range children() { return child_range(); } + + friend class ASTStmtReader; + friend class ASTStmtWriter; }; /// ObjCIvarRefExpr - A reference to an ObjC instance variable. @@ -1019,7 +1025,7 @@ public: /// a l-value or r-value reference will be an l-value or x-value, /// respectively. /// - /// \param LBrac The location of the open square bracket '['. + /// \param LBracLoc The location of the open square bracket '['. /// /// \param SuperLoc The location of the "super" keyword. /// @@ -1033,8 +1039,6 @@ public: /// /// \param Args The message send arguments. /// - /// \param NumArgs The number of arguments. - /// /// \param RBracLoc The location of the closing square bracket ']'. static ObjCMessageExpr *Create(ASTContext &Context, QualType T, ExprValueKind VK, @@ -1059,7 +1063,7 @@ public: /// a l-value or r-value reference will be an l-value or x-value, /// respectively. /// - /// \param LBrac The location of the open square bracket '['. + /// \param LBracLoc The location of the open square bracket '['. /// /// \param Receiver The type of the receiver, including /// source-location information. @@ -1071,8 +1075,6 @@ public: /// /// \param Args The message send arguments. /// - /// \param NumArgs The number of arguments. - /// /// \param RBracLoc The location of the closing square bracket ']'. static ObjCMessageExpr *Create(ASTContext &Context, QualType T, ExprValueKind VK, @@ -1095,7 +1097,7 @@ public: /// a l-value or r-value reference will be an l-value or x-value, /// respectively. /// - /// \param LBrac The location of the open square bracket '['. + /// \param LBracLoc The location of the open square bracket '['. /// /// \param Receiver The expression used to produce the object that /// will receive this message. @@ -1107,8 +1109,6 @@ public: /// /// \param Args The message send arguments. /// - /// \param NumArgs The number of arguments. - /// /// \param RBracLoc The location of the closing square bracket ']'. static ObjCMessageExpr *Create(ASTContext &Context, QualType T, ExprValueKind VK, |