diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-10-20 21:14:49 +0000 |
commit | 36981b17ed939300f6f8fc2355a255f711fcef71 (patch) | |
tree | ee2483e98b09cac943dc93a6969d83ca737ff139 /include/clang/AST/ExprCXX.h | |
parent | 180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff) | |
download | src-36981b17ed939300f6f8fc2355a255f711fcef71.tar.gz src-36981b17ed939300f6f8fc2355a255f711fcef71.zip |
Vendor import of clang release_30 branch r142614:vendor/clang/clang-r142614
Notes
Notes:
svn path=/vendor/clang/dist/; revision=226586
svn path=/vendor/clang/clang-r142614/; revision=226587; tag=vendor/clang/clang-r142614
Diffstat (limited to 'include/clang/AST/ExprCXX.h')
-rw-r--r-- | include/clang/AST/ExprCXX.h | 79 |
1 files changed, 49 insertions, 30 deletions
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h index 19117040ef96..3cc09cdf5e45 100644 --- a/include/clang/AST/ExprCXX.h +++ b/include/clang/AST/ExprCXX.h @@ -807,37 +807,41 @@ private: SourceLocation Loc; SourceRange ParenRange; + unsigned NumArgs : 16; bool Elidable : 1; + bool HadMultipleCandidates : 1; bool ZeroInitialization : 1; unsigned ConstructKind : 2; Stmt **Args; - unsigned NumArgs; protected: CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T, SourceLocation Loc, CXXConstructorDecl *d, bool elidable, Expr **args, unsigned numargs, + bool HadMultipleCandidates, bool ZeroInitialization = false, ConstructionKind ConstructKind = CK_Complete, SourceRange ParenRange = SourceRange()); /// \brief Construct an empty C++ construction expression. CXXConstructExpr(StmtClass SC, EmptyShell Empty) - : Expr(SC, Empty), Constructor(0), Elidable(0), ZeroInitialization(0), - ConstructKind(0), Args(0), NumArgs(0) { } + : Expr(SC, Empty), Constructor(0), NumArgs(0), Elidable(0), + HadMultipleCandidates(false), ZeroInitialization(0), + ConstructKind(0), Args(0) { } public: /// \brief Construct an empty C++ construction expression. explicit CXXConstructExpr(EmptyShell Empty) : Expr(CXXConstructExprClass, Empty), Constructor(0), - Elidable(0), ZeroInitialization(0), - ConstructKind(0), Args(0), NumArgs(0) { } + NumArgs(0), Elidable(0), HadMultipleCandidates(false), + ZeroInitialization(0), ConstructKind(0), Args(0) { } static CXXConstructExpr *Create(ASTContext &C, QualType T, SourceLocation Loc, CXXConstructorDecl *D, bool Elidable, Expr **Args, unsigned NumArgs, + bool HadMultipleCandidates, bool ZeroInitialization = false, ConstructionKind ConstructKind = CK_Complete, SourceRange ParenRange = SourceRange()); @@ -852,7 +856,12 @@ public: /// \brief Whether this construction is elidable. bool isElidable() const { return Elidable; } void setElidable(bool E) { Elidable = E; } - + + /// \brief Whether the referred constructor was resolved from + /// an overloaded set having size greater than 1. + bool hadMultipleCandidates() const { return HadMultipleCandidates; } + void setHadMultipleCandidates(bool V) { HadMultipleCandidates = V; } + /// \brief Whether this construction first requires /// zero-initialization before the initializer is called. bool requiresZeroInitialization() const { return ZeroInitialization; } @@ -980,6 +989,7 @@ public: TypeSourceInfo *Type, Expr **Args,unsigned NumArgs, SourceRange parenRange, + bool HadMultipleCandidates, bool ZeroInitialization = false); explicit CXXTemporaryObjectExpr(EmptyShell Empty) : CXXConstructExpr(CXXTemporaryObjectExprClass, Empty), Type() { } @@ -1049,8 +1059,11 @@ class CXXNewExpr : public Expr { // If this is an array allocation, does the usual deallocation // function for the allocated type want to know the allocated size? bool UsualArrayDeleteWantsSize : 1; + // Whether the referred constructor (if any) was resolved from an + // overload set having size greater than 1. + bool HadMultipleCandidates : 1; // The number of placement new arguments. - unsigned NumPlacementArgs : 14; + unsigned NumPlacementArgs : 13; // The number of constructor arguments. This may be 1 even for non-class // types; use the pseudo copy constructor. unsigned NumConstructorArgs : 14; @@ -1086,6 +1099,7 @@ public: SourceRange TypeIdParens, Expr *arraySize, CXXConstructorDecl *constructor, bool initializer, Expr **constructorArgs, unsigned numConsArgs, + bool HadMultipleCandidates, FunctionDecl *operatorDelete, bool usualArrayDeleteWantsSize, QualType ty, TypeSourceInfo *AllocatedTypeInfo, SourceLocation startLoc, SourceLocation endLoc, @@ -1174,6 +1188,11 @@ public: return cast<Expr>(SubExprs[Array + NumPlacementArgs + i]); } + /// \brief Whether the new expression refers a constructor that was + /// resolved from an overloaded set having size greater than 1. + bool hadMultipleCandidates() const { return HadMultipleCandidates; } + void setHadMultipleCandidates(bool V) { HadMultipleCandidates = V; } + typedef ExprIterator arg_iterator; typedef ConstExprIterator const_arg_iterator; @@ -1842,16 +1861,16 @@ public: /// template argument list, e.g. f<int>. bool hasExplicitTemplateArgs() const { return HasExplicitTemplateArgs; } - ExplicitTemplateArgumentList &getExplicitTemplateArgs(); // defined far below + ASTTemplateArgumentListInfo &getExplicitTemplateArgs(); // defined far below - const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const { + const ASTTemplateArgumentListInfo &getExplicitTemplateArgs() const { return const_cast<OverloadExpr*>(this)->getExplicitTemplateArgs(); } /// \brief Retrieves the optional explicit template arguments. /// This points to the same data as getExplicitTemplateArgs(), but /// returns null if there are no explicit template arguments. - const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() { + const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() { if (!hasExplicitTemplateArgs()) return 0; return &getExplicitTemplateArgs(); } @@ -1969,21 +1988,21 @@ public: // nodes, users are *forbidden* from calling these methods on objects // without explicit template arguments. - ExplicitTemplateArgumentList &getExplicitTemplateArgs() { + ASTTemplateArgumentListInfo &getExplicitTemplateArgs() { assert(hasExplicitTemplateArgs()); - return *reinterpret_cast<ExplicitTemplateArgumentList*>(this + 1); + return *reinterpret_cast<ASTTemplateArgumentListInfo*>(this + 1); } /// Gets a reference to the explicit template argument list. - const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const { + const ASTTemplateArgumentListInfo &getExplicitTemplateArgs() const { assert(hasExplicitTemplateArgs()); - return *reinterpret_cast<const ExplicitTemplateArgumentList*>(this + 1); + return *reinterpret_cast<const ASTTemplateArgumentListInfo*>(this + 1); } /// \brief Retrieves the optional explicit template arguments. /// This points to the same data as getExplicitTemplateArgs(), but /// returns null if there are no explicit template arguments. - const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() { + const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() { if (!hasExplicitTemplateArgs()) return 0; return &getExplicitTemplateArgs(); } @@ -2094,21 +2113,21 @@ public: // nodes, users are *forbidden* from calling these methods on objects // without explicit template arguments. - ExplicitTemplateArgumentList &getExplicitTemplateArgs() { + ASTTemplateArgumentListInfo &getExplicitTemplateArgs() { assert(hasExplicitTemplateArgs()); - return *reinterpret_cast<ExplicitTemplateArgumentList*>(this + 1); + return *reinterpret_cast<ASTTemplateArgumentListInfo*>(this + 1); } /// Gets a reference to the explicit template argument list. - const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const { + const ASTTemplateArgumentListInfo &getExplicitTemplateArgs() const { assert(hasExplicitTemplateArgs()); - return *reinterpret_cast<const ExplicitTemplateArgumentList*>(this + 1); + return *reinterpret_cast<const ASTTemplateArgumentListInfo*>(this + 1); } /// \brief Retrieves the optional explicit template arguments. /// This points to the same data as getExplicitTemplateArgs(), but /// returns null if there are no explicit template arguments. - const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() { + const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() { if (!hasExplicitTemplateArgs()) return 0; return &getExplicitTemplateArgs(); } @@ -2470,14 +2489,14 @@ public: /// \brief Retrieve the explicit template argument list that followed the /// member template name, if any. - ExplicitTemplateArgumentList &getExplicitTemplateArgs() { + ASTTemplateArgumentListInfo &getExplicitTemplateArgs() { assert(HasExplicitTemplateArgs); - return *reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1); + return *reinterpret_cast<ASTTemplateArgumentListInfo *>(this + 1); } /// \brief Retrieve the explicit template argument list that followed the /// member template name, if any. - const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const { + const ASTTemplateArgumentListInfo &getExplicitTemplateArgs() const { return const_cast<CXXDependentScopeMemberExpr *>(this) ->getExplicitTemplateArgs(); } @@ -2485,7 +2504,7 @@ public: /// \brief Retrieves the optional explicit template arguments. /// This points to the same data as getExplicitTemplateArgs(), but /// returns null if there are no explicit template arguments. - const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() { + const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() { if (!hasExplicitTemplateArgs()) return 0; return &getExplicitTemplateArgs(); } @@ -2663,22 +2682,22 @@ public: /// \brief Retrieve the explicit template argument list that followed the /// member template name. - ExplicitTemplateArgumentList &getExplicitTemplateArgs() { + ASTTemplateArgumentListInfo &getExplicitTemplateArgs() { assert(hasExplicitTemplateArgs()); - return *reinterpret_cast<ExplicitTemplateArgumentList *>(this + 1); + return *reinterpret_cast<ASTTemplateArgumentListInfo *>(this + 1); } /// \brief Retrieve the explicit template argument list that followed the /// member template name, if any. - const ExplicitTemplateArgumentList &getExplicitTemplateArgs() const { + const ASTTemplateArgumentListInfo &getExplicitTemplateArgs() const { assert(hasExplicitTemplateArgs()); - return *reinterpret_cast<const ExplicitTemplateArgumentList *>(this + 1); + return *reinterpret_cast<const ASTTemplateArgumentListInfo *>(this + 1); } /// \brief Retrieves the optional explicit template arguments. /// This points to the same data as getExplicitTemplateArgs(), but /// returns null if there are no explicit template arguments. - const ExplicitTemplateArgumentList *getOptionalExplicitTemplateArgs() { + const ASTTemplateArgumentListInfo *getOptionalExplicitTemplateArgs() { if (!hasExplicitTemplateArgs()) return 0; return &getExplicitTemplateArgs(); } @@ -2856,7 +2875,7 @@ public: } }; -inline ExplicitTemplateArgumentList &OverloadExpr::getExplicitTemplateArgs() { +inline ASTTemplateArgumentListInfo &OverloadExpr::getExplicitTemplateArgs() { if (isa<UnresolvedLookupExpr>(this)) return cast<UnresolvedLookupExpr>(this)->getExplicitTemplateArgs(); else |