diff options
Diffstat (limited to 'include/clang/Sema/Initialization.h')
-rw-r--r-- | include/clang/Sema/Initialization.h | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/include/clang/Sema/Initialization.h b/include/clang/Sema/Initialization.h index 6e72ad3f4a..58781ac628 100644 --- a/include/clang/Sema/Initialization.h +++ b/include/clang/Sema/Initialization.h @@ -75,7 +75,10 @@ public: EK_ComplexElement, /// \brief The entity being initialized is the field that captures a /// variable in a lambda. - EK_LambdaCapture + EK_LambdaCapture, + /// \brief The entity being initialized is the initializer for a compound + /// literal. + EK_CompoundLiteralInit }; private: @@ -118,8 +121,8 @@ private: /// low bit indicating whether the parameter is "consumed". uintptr_t Parameter; - /// \brief When Kind == EK_Temporary, the type source information for - /// the temporary. + /// \brief When Kind == EK_Temporary or EK_CompoundLiteralInit, the type + /// source information for the temporary. TypeSourceInfo *TypeInfo; struct LN LocAndNRVO; @@ -287,7 +290,16 @@ public: SourceLocation Loc) { return InitializedEntity(Var, Field, Loc); } - + + /// \brief Create the entity for a compound literal initializer. + static InitializedEntity InitializeCompoundLiteralInit(TypeSourceInfo *TSI) { + InitializedEntity Result(EK_CompoundLiteralInit, SourceLocation(), + TSI->getType()); + Result.TypeInfo = TSI; + return Result; + } + + /// \brief Determine the kind of initialization. EntityKind getKind() const { return Kind; } @@ -302,7 +314,7 @@ public: /// \brief Retrieve complete type-source information for the object being /// constructed, if known. TypeSourceInfo *getTypeSourceInfo() const { - if (Kind == EK_Temporary) + if (Kind == EK_Temporary || Kind == EK_CompoundLiteralInit) return TypeInfo; return 0; |