aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/Sema/Initialization.h
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/Sema/Initialization.h')
-rw-r--r--contrib/llvm-project/clang/include/clang/Sema/Initialization.h61
1 files changed, 37 insertions, 24 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Sema/Initialization.h b/contrib/llvm-project/clang/include/clang/Sema/Initialization.h
index ca9e0a198cb9..dcdfa3c3cf64 100644
--- a/contrib/llvm-project/clang/include/clang/Sema/Initialization.h
+++ b/contrib/llvm-project/clang/include/clang/Sema/Initialization.h
@@ -55,6 +55,9 @@ public:
/// The entity being initialized is a function parameter.
EK_Parameter,
+ /// The entity being initialized is a non-type template parameter.
+ EK_TemplateParameter,
+
/// The entity being initialized is the result of a function call.
EK_Result,
@@ -145,7 +148,7 @@ private:
/// location of the 'return', 'throw', or 'new' keyword,
/// respectively. When Kind == EK_Temporary, the location where
/// the temporary is being created.
- unsigned Location;
+ SourceLocation Location;
/// Whether the entity being initialized may end up using the
/// named return value optimization (NRVO).
@@ -171,11 +174,12 @@ private:
IdentifierInfo *VarID;
/// The source location at which the capture occurs.
- unsigned Location;
+ SourceLocation Location;
};
union {
- /// When Kind == EK_Variable, EK_Member or EK_Binding, the variable.
+ /// When Kind == EK_Variable, EK_Member, EK_Binding, or
+ /// EK_TemplateParameter, the variable, binding, or template parameter.
VD Variable;
/// When Kind == EK_RelatedResult, the ObjectiveC method where
@@ -205,7 +209,7 @@ private:
struct C Capture;
};
- InitializedEntity() = default;
+ InitializedEntity() {};
/// Create the initialization entity for a variable.
InitializedEntity(VarDecl *Var, EntityKind EK = EK_Variable)
@@ -217,7 +221,8 @@ private:
InitializedEntity(EntityKind Kind, SourceLocation Loc, QualType Type,
bool NRVO = false)
: Kind(Kind), Type(Type) {
- LocAndNRVO.Location = Loc.getRawEncoding();
+ new (&LocAndNRVO) LN;
+ LocAndNRVO.Location = Loc;
LocAndNRVO.NRVO = NRVO;
}
@@ -234,8 +239,9 @@ private:
/// Create the initialization entity for a lambda capture.
InitializedEntity(IdentifierInfo *VarID, QualType FieldType, SourceLocation Loc)
: Kind(EK_LambdaCapture), Type(FieldType) {
+ new (&Capture) C;
Capture.VarID = VarID;
- Capture.Location = Loc.getRawEncoding();
+ Capture.Location = Loc;
}
public:
@@ -281,6 +287,17 @@ public:
return Entity;
}
+ /// Create the initialization entity for a template parameter.
+ static InitializedEntity
+ InitializeTemplateParameter(QualType T, NonTypeTemplateParmDecl *Param) {
+ InitializedEntity Entity;
+ Entity.Kind = EK_TemplateParameter;
+ Entity.Type = T;
+ Entity.Parent = nullptr;
+ Entity.Variable = {Param, false, false};
+ return Entity;
+ }
+
/// Create the initialization entity for the result of a function.
static InitializedEntity InitializeResult(SourceLocation ReturnLoc,
QualType Type, bool NRVO) {
@@ -441,6 +458,10 @@ public:
getKind() == EK_Parameter_CF_Audited);
}
+ bool isParamOrTemplateParamKind() const {
+ return isParameterKind() || getKind() == EK_TemplateParameter;
+ }
+
/// Determine whether this initialization consumes the
/// parameter.
bool isParameterConsumed() const {
@@ -482,14 +503,14 @@ public:
/// the result of a function call.
SourceLocation getReturnLoc() const {
assert(getKind() == EK_Result && "No 'return' location!");
- return SourceLocation::getFromRawEncoding(LocAndNRVO.Location);
+ return LocAndNRVO.Location;
}
/// Determine the location of the 'throw' keyword when initializing
/// an exception object.
SourceLocation getThrowLoc() const {
assert(getKind() == EK_Exception && "No 'throw' location!");
- return SourceLocation::getFromRawEncoding(LocAndNRVO.Location);
+ return LocAndNRVO.Location;
}
/// If this is an array, vector, or complex number element, get the
@@ -518,7 +539,7 @@ public:
/// field from a captured variable in a lambda.
SourceLocation getCaptureLoc() const {
assert(getKind() == EK_LambdaCapture && "Not a lambda capture!");
- return SourceLocation::getFromRawEncoding(Capture.Location);
+ return Capture.Location;
}
void setParameterCFAudited() {
@@ -821,6 +842,9 @@ public:
/// Perform a qualification conversion, producing an lvalue.
SK_QualificationConversionLValue,
+ /// Perform a function reference conversion, see [dcl.init.ref]p4.
+ SK_FunctionReferenceConversion,
+
/// Perform a conversion adding _Atomic to a type.
SK_AtomicConversion,
@@ -1204,17 +1228,6 @@ public:
/// constructor.
bool isConstructorInitialization() const;
- /// 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;
-
/// Add a new step in the initialization that resolves the address
/// of an overloaded function to a specific function declaration.
///
@@ -1269,6 +1282,10 @@ public:
void AddQualificationConversionStep(QualType Ty,
ExprValueKind Category);
+ /// Add a new step that performs a function reference conversion to the
+ /// given type.
+ void AddFunctionReferenceConversionStep(QualType Ty);
+
/// Add a new step that performs conversion from non-atomic to atomic
/// type.
void AddAtomicConversionStep(QualType Ty);
@@ -1336,10 +1353,6 @@ public:
/// from a zero constant.
void AddOCLZeroOpaqueTypeStep(QualType T);
- /// Add a step to initialize by zero types defined in the
- /// cl_intel_device_side_avc_motion_estimation OpenCL extension
- void AddOCLIntelSubgroupAVCZeroInitStep(QualType T);
-
/// Add steps to unwrap a initializer list for a reference around a
/// single element and rewrap it at the end.
void RewrapReferenceInitList(QualType T, InitListExpr *Syntactic);