diff options
Diffstat (limited to 'contrib/llvm/tools/clang/include/clang/Sema/Initialization.h')
-rw-r--r-- | contrib/llvm/tools/clang/include/clang/Sema/Initialization.h | 58 |
1 files changed, 39 insertions, 19 deletions
diff --git a/contrib/llvm/tools/clang/include/clang/Sema/Initialization.h b/contrib/llvm/tools/clang/include/clang/Sema/Initialization.h index df6138c7f039..e69bebd56cff 100644 --- a/contrib/llvm/tools/clang/include/clang/Sema/Initialization.h +++ b/contrib/llvm/tools/clang/include/clang/Sema/Initialization.h @@ -22,10 +22,6 @@ #include "llvm/ADT/SmallVector.h" #include <cassert> -namespace llvm { - class raw_ostream; -} - namespace clang { class CXXBaseSpecifier; @@ -71,7 +67,10 @@ public: EK_VectorElement, /// \brief The entity being initialized is a field of block descriptor for /// the copied-in c++ object. - EK_BlockElement + EK_BlockElement, + /// \brief The entity being initialized is the real or imaginary part of a + /// complex number. + EK_ComplexElement }; private: @@ -115,8 +114,9 @@ private: /// virtual base. uintptr_t Base; - /// \brief When Kind == EK_ArrayElement or EK_VectorElement, the - /// index of the array or vector element being initialized. + /// \brief When Kind == EK_ArrayElement, EK_VectorElement, or + /// EK_ComplexElement, the index of the array or vector element being + /// initialized. unsigned Index; }; @@ -313,7 +313,8 @@ public: /// \brief If this is already the initializer for an array or vector /// element, sets the element index. void setElementIndex(unsigned Index) { - assert(getKind() == EK_ArrayElement || getKind() == EK_VectorElement); + assert(getKind() == EK_ArrayElement || getKind() == EK_VectorElement || + EK_ComplexElement); this->Index = Index; } }; @@ -525,8 +526,10 @@ public: SK_QualificationConversionLValue, /// \brief Perform an implicit conversion sequence. SK_ConversionSequence, - /// \brief Perform list-initialization + /// \brief Perform list-initialization without a constructor SK_ListInitialization, + /// \brief Perform list-initialization with a constructor. + SK_ListConstructorCall, /// \brief Perform initialization via a constructor. SK_ConstructorInitialization, /// \brief Zero-initialize the object @@ -562,20 +565,24 @@ public: /// \brief When Kind == SK_ResolvedOverloadedFunction or Kind == /// SK_UserConversion, the function that the expression should be /// resolved to or the conversion function to call, respectively. + /// When Kind == SK_ConstructorInitialization or SK_ListConstruction, + /// the constructor to be called. /// - /// Always a FunctionDecl. + /// Always a FunctionDecl, plus a Boolean flag telling if it was + /// selected from an overloaded set having size greater than 1. /// For conversion decls, the naming class is the source type. /// For construct decls, the naming class is the target type. struct { + bool HadMultipleCandidates; FunctionDecl *Function; DeclAccessPair FoundDecl; } Function; - + /// \brief When Kind = SK_ConversionSequence, the implicit conversion /// sequence ImplicitConversionSequence *ICS; }; - + void Destroy(); }; @@ -584,7 +591,7 @@ private: enum SequenceKind SequenceKind; /// \brief Steps taken by this initialization. - llvm::SmallVector<Step, 4> Steps; + SmallVector<Step, 4> Steps; public: /// \brief Describes why initialization failed. @@ -633,11 +640,13 @@ public: /// \brief Default-initialization of a 'const' object. FK_DefaultInitOfConst, /// \brief Initialization of an incomplete type. - FK_Incomplete + FK_Incomplete, + /// \brief List initialization failed at some point. + FK_ListInitializationFailed }; private: - /// \brief The reason why initialization failued. + /// \brief The reason why initialization failed. FailureKind Failure; /// \brief The failed result of overload resolution. @@ -722,7 +731,7 @@ public: /// \brief Determine whether the initialization sequence is invalid. bool Failed() const { return SequenceKind == FailedSequence; } - typedef llvm::SmallVector<Step, 4>::const_iterator step_iterator; + typedef SmallVector<Step, 4>::const_iterator step_iterator; step_iterator step_begin() const { return Steps.begin(); } step_iterator step_end() const { return Steps.end(); } @@ -736,7 +745,18 @@ public: /// \brief Determine whether this initialization is direct call to a /// constructor. bool isConstructorInitialization() const; - + + /// \brief Returns whether the last step in this initialization sequence is a + /// narrowing conversion, defined by C++0x [dcl.init.list]p7. + /// + /// If this function returns true, *isInitializerConstant will be set to + /// describe whether *Initializer was a constant expression. If + /// *isInitializerConstant is set to true, *ConstantValue will be set to the + /// evaluated value of *Initializer. + bool endsWithNarrowing(ASTContext &Ctx, const Expr *Initializer, + bool *isInitializerConstant, + APValue *ConstantValue) const; + /// \brief Add a new step in the initialization that resolves the address /// of an overloaded function to a specific function declaration. /// @@ -792,7 +812,7 @@ public: void AddConversionSequenceStep(const ImplicitConversionSequence &ICS, QualType T); - /// \brief Add a list-initialiation step + /// \brief Add a list-initialiation step. void AddListInitializationStep(QualType T); /// \brief Add a constructor-initialization step. @@ -857,7 +877,7 @@ public: /// \brief Dump a representation of this initialization sequence to /// the given stream, for debugging purposes. - void dump(llvm::raw_ostream &OS) const; + void dump(raw_ostream &OS) const; /// \brief Dump a representation of this initialization sequence to /// standard error, for debugging purposes. |