Remove redundant passing around of a "ContainsAutoType" flag.
This flag serves no purpose other than to prevent us walking through a type to check whether it contains an 'auto' specifier; this duplication of information is error-prone, does not appear to provide any performance benefit, and will become less practical once we support C++1z deduced class template types and eventually constrained types from the Concepts TS. No functionality change intended. llvm-svn: 291737
This commit is contained in:
parent
9700acba11
commit
3beb7c6b5f
|
@ -1791,9 +1791,8 @@ public:
|
|||
bool SetParamDefaultArgument(ParmVarDecl *Param, Expr *DefaultArg,
|
||||
SourceLocation EqualLoc);
|
||||
|
||||
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit,
|
||||
bool TypeMayContainAuto);
|
||||
void ActOnUninitializedDecl(Decl *dcl, bool TypeMayContainAuto);
|
||||
void AddInitializerToDecl(Decl *dcl, Expr *init, bool DirectInit);
|
||||
void ActOnUninitializedDecl(Decl *dcl);
|
||||
void ActOnInitializerError(Decl *Dcl);
|
||||
bool canInitializeWithParenthesizedList(QualType TargetType);
|
||||
|
||||
|
@ -1808,8 +1807,7 @@ public:
|
|||
void FinalizeDeclaration(Decl *D);
|
||||
DeclGroupPtrTy FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
|
||||
ArrayRef<Decl *> Group);
|
||||
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef<Decl *> Group,
|
||||
bool TypeMayContainAuto = true);
|
||||
DeclGroupPtrTy BuildDeclaratorGroup(MutableArrayRef<Decl *> Group);
|
||||
|
||||
/// Should be called on all declarations that might have attached
|
||||
/// documentation comments.
|
||||
|
@ -4921,8 +4919,7 @@ public:
|
|||
TypeSourceInfo *AllocTypeInfo,
|
||||
Expr *ArraySize,
|
||||
SourceRange DirectInitRange,
|
||||
Expr *Initializer,
|
||||
bool TypeMayContainAuto = true);
|
||||
Expr *Initializer);
|
||||
|
||||
bool CheckAllocatedType(QualType AllocType, SourceLocation Loc,
|
||||
SourceRange R);
|
||||
|
|
|
@ -1591,7 +1591,7 @@ Parser::ParseSimpleDeclaration(unsigned Context,
|
|||
DS.complete(TheDecl);
|
||||
if (AnonRecord) {
|
||||
Decl* decls[] = {AnonRecord, TheDecl};
|
||||
return Actions.BuildDeclaratorGroup(decls, /*TypeMayContainAuto=*/false);
|
||||
return Actions.BuildDeclaratorGroup(decls);
|
||||
}
|
||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||
}
|
||||
|
@ -2045,8 +2045,6 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
|
|||
}
|
||||
}
|
||||
|
||||
bool TypeContainsAuto = D.getDeclSpec().containsPlaceholderType();
|
||||
|
||||
// Parse declarator '=' initializer.
|
||||
// If a '==' or '+=' is found, suggest a fixit to '='.
|
||||
if (isTokenEqualOrEqualTypo()) {
|
||||
|
@ -2106,7 +2104,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
|
|||
Actions.ActOnInitializerError(ThisDecl);
|
||||
} else
|
||||
Actions.AddInitializerToDecl(ThisDecl, Init.get(),
|
||||
/*DirectInit=*/false, TypeContainsAuto);
|
||||
/*DirectInit=*/false);
|
||||
}
|
||||
} else if (Tok.is(tok::l_paren)) {
|
||||
// Parse C++ direct initializer: '(' expression-list ')'
|
||||
|
@ -2149,7 +2147,7 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
|
|||
T.getCloseLocation(),
|
||||
Exprs);
|
||||
Actions.AddInitializerToDecl(ThisDecl, Initializer.get(),
|
||||
/*DirectInit=*/true, TypeContainsAuto);
|
||||
/*DirectInit=*/true);
|
||||
}
|
||||
} else if (getLangOpts().CPlusPlus11 && Tok.is(tok::l_brace) &&
|
||||
(!CurParsedObjCImpl || !D.isFunctionDeclarator())) {
|
||||
|
@ -2171,11 +2169,10 @@ Decl *Parser::ParseDeclarationAfterDeclaratorAndAttributes(
|
|||
if (Init.isInvalid()) {
|
||||
Actions.ActOnInitializerError(ThisDecl);
|
||||
} else
|
||||
Actions.AddInitializerToDecl(ThisDecl, Init.get(),
|
||||
/*DirectInit=*/true, TypeContainsAuto);
|
||||
Actions.AddInitializerToDecl(ThisDecl, Init.get(), /*DirectInit=*/true);
|
||||
|
||||
} else {
|
||||
Actions.ActOnUninitializedDecl(ThisDecl, TypeContainsAuto);
|
||||
Actions.ActOnUninitializedDecl(ThisDecl);
|
||||
}
|
||||
|
||||
Actions.FinalizeDeclaration(ThisDecl);
|
||||
|
|
|
@ -710,7 +710,7 @@ Parser::ParseUsingDeclaration(unsigned Context,
|
|||
: "using declaration"))
|
||||
SkipUntil(tok::semi);
|
||||
|
||||
return Actions.BuildDeclaratorGroup(DeclsInGroup, /*MayContainAuto*/false);
|
||||
return Actions.BuildDeclaratorGroup(DeclsInGroup);
|
||||
}
|
||||
|
||||
Decl *Parser::ParseAliasDeclarationAfterDeclarator(
|
||||
|
@ -2539,7 +2539,7 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
|||
DS.complete(TheDecl);
|
||||
if (AnonRecord) {
|
||||
Decl* decls[] = {AnonRecord, TheDecl};
|
||||
return Actions.BuildDeclaratorGroup(decls, /*TypeMayContainAuto=*/false);
|
||||
return Actions.BuildDeclaratorGroup(decls);
|
||||
}
|
||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||
}
|
||||
|
@ -2769,11 +2769,10 @@ Parser::ParseCXXClassMemberDeclaration(AccessSpecifier AS,
|
|||
if (Init.isInvalid())
|
||||
SkipUntil(tok::comma, StopAtSemi | StopBeforeMatch);
|
||||
else if (ThisDecl)
|
||||
Actions.AddInitializerToDecl(ThisDecl, Init.get(), EqualLoc.isInvalid(),
|
||||
DS.containsPlaceholderType());
|
||||
Actions.AddInitializerToDecl(ThisDecl, Init.get(), EqualLoc.isInvalid());
|
||||
} else if (ThisDecl && DS.getStorageClassSpec() == DeclSpec::SCS_static)
|
||||
// No initializer.
|
||||
Actions.ActOnUninitializedDecl(ThisDecl, DS.containsPlaceholderType());
|
||||
Actions.ActOnUninitializedDecl(ThisDecl);
|
||||
|
||||
if (ThisDecl) {
|
||||
if (!ThisDecl->isInvalidDecl()) {
|
||||
|
|
|
@ -1818,8 +1818,7 @@ Sema::ConditionResult Parser::ParseCXXCondition(StmtResult *InitStmt,
|
|||
}
|
||||
|
||||
if (!InitExpr.isInvalid())
|
||||
Actions.AddInitializerToDecl(DeclOut, InitExpr.get(), !CopyInitialization,
|
||||
DS.containsPlaceholderType());
|
||||
Actions.AddInitializerToDecl(DeclOut, InitExpr.get(), !CopyInitialization);
|
||||
else
|
||||
Actions.ActOnInitializerError(DeclOut);
|
||||
|
||||
|
|
|
@ -938,7 +938,7 @@ Parser::ParseDeclOrFunctionDefInternal(ParsedAttributesWithRange &attrs,
|
|||
Actions.setCurrentOpenCLExtensionForDecl(TheDecl);
|
||||
if (AnonRecord) {
|
||||
Decl* decls[] = {AnonRecord, TheDecl};
|
||||
return Actions.BuildDeclaratorGroup(decls, /*TypeMayContainAuto=*/false);
|
||||
return Actions.BuildDeclaratorGroup(decls);
|
||||
}
|
||||
return Actions.ConvertDeclToDeclGroup(TheDecl);
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ static FunctionScopeInfo *checkCoroutineContext(Sema &S, SourceLocation Loc,
|
|||
S.Context.getTrivialTypeSourceInfo(T, Loc), SC_None);
|
||||
S.CheckVariableDeclarationType(ScopeInfo->CoroutinePromise);
|
||||
if (!ScopeInfo->CoroutinePromise->isInvalidDecl())
|
||||
S.ActOnUninitializedDecl(ScopeInfo->CoroutinePromise, false);
|
||||
S.ActOnUninitializedDecl(ScopeInfo->CoroutinePromise);
|
||||
}
|
||||
|
||||
return ScopeInfo;
|
||||
|
|
|
@ -4504,7 +4504,7 @@ Decl *Sema::BuildAnonymousStructOrUnion(Scope *S, DeclSpec &DS,
|
|||
// trivial in almost all cases, except if a union member has an in-class
|
||||
// initializer:
|
||||
// union { int n = 0; };
|
||||
ActOnUninitializedDecl(Anon, /*TypeMayContainAuto=*/false);
|
||||
ActOnUninitializedDecl(Anon);
|
||||
}
|
||||
Anon->setImplicit();
|
||||
|
||||
|
@ -9796,8 +9796,7 @@ QualType Sema::deduceVarTypeFromInitializer(VarDecl *VDecl,
|
|||
/// AddInitializerToDecl - Adds the initializer Init to the
|
||||
/// declaration dcl. If DirectInit is true, this is C++ direct
|
||||
/// initialization rather than copy initialization.
|
||||
void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
|
||||
bool DirectInit, bool TypeMayContainAuto) {
|
||||
void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init, bool DirectInit) {
|
||||
// If there is no declaration, there was an error parsing it. Just ignore
|
||||
// the initializer.
|
||||
if (!RealDecl || RealDecl->isInvalidDecl()) {
|
||||
|
@ -9822,7 +9821,7 @@ void Sema::AddInitializerToDecl(Decl *RealDecl, Expr *Init,
|
|||
}
|
||||
|
||||
// C++11 [decl.spec.auto]p6. Deduce the type which 'auto' stands in for.
|
||||
if (TypeMayContainAuto && VDecl->getType()->isUndeducedType()) {
|
||||
if (VDecl->getType()->isUndeducedType()) {
|
||||
// Attempt typo correction early so that the type of the init expression can
|
||||
// be deduced based on the chosen correction if the original init contains a
|
||||
// TypoExpr.
|
||||
|
@ -10294,8 +10293,7 @@ bool Sema::canInitializeWithParenthesizedList(QualType TargetType) {
|
|||
TargetType->getContainedAutoType();
|
||||
}
|
||||
|
||||
void Sema::ActOnUninitializedDecl(Decl *RealDecl,
|
||||
bool TypeMayContainAuto) {
|
||||
void Sema::ActOnUninitializedDecl(Decl *RealDecl) {
|
||||
// If there is no declaration, there was an error parsing it. Just ignore it.
|
||||
if (!RealDecl)
|
||||
return;
|
||||
|
@ -10311,7 +10309,7 @@ void Sema::ActOnUninitializedDecl(Decl *RealDecl,
|
|||
}
|
||||
|
||||
// C++11 [dcl.spec.auto]p3
|
||||
if (TypeMayContainAuto && Type->getContainedAutoType()) {
|
||||
if (Type->isUndeducedType()) {
|
||||
Diag(Var->getLocation(), diag::err_auto_var_requires_init)
|
||||
<< Var->getDeclName() << Type;
|
||||
Var->setInvalidDecl();
|
||||
|
@ -11095,32 +11093,32 @@ Sema::DeclGroupPtrTy Sema::FinalizeDeclaratorGroup(Scope *S, const DeclSpec &DS,
|
|||
}
|
||||
}
|
||||
|
||||
return BuildDeclaratorGroup(Decls, DS.containsPlaceholderType());
|
||||
return BuildDeclaratorGroup(Decls);
|
||||
}
|
||||
|
||||
/// BuildDeclaratorGroup - convert a list of declarations into a declaration
|
||||
/// group, performing any necessary semantic checking.
|
||||
Sema::DeclGroupPtrTy
|
||||
Sema::BuildDeclaratorGroup(MutableArrayRef<Decl *> Group,
|
||||
bool TypeMayContainAuto) {
|
||||
// C++0x [dcl.spec.auto]p7:
|
||||
// If the type deduced for the template parameter U is not the same in each
|
||||
Sema::BuildDeclaratorGroup(MutableArrayRef<Decl *> Group) {
|
||||
// C++14 [dcl.spec.auto]p7: (DR1347)
|
||||
// If the type that replaces the placeholder type is not the same in each
|
||||
// deduction, the program is ill-formed.
|
||||
// FIXME: When initializer-list support is added, a distinction is needed
|
||||
// between the deduced type U and the deduced type which 'auto' stands for.
|
||||
// auto a = 0, b = { 1, 2, 3 };
|
||||
// is legal because the deduced type U is 'int' in both cases.
|
||||
if (TypeMayContainAuto && Group.size() > 1) {
|
||||
if (Group.size() > 1) {
|
||||
QualType Deduced;
|
||||
CanQualType DeducedCanon;
|
||||
VarDecl *DeducedDecl = nullptr;
|
||||
for (unsigned i = 0, e = Group.size(); i != e; ++i) {
|
||||
if (VarDecl *D = dyn_cast<VarDecl>(Group[i])) {
|
||||
AutoType *AT = D->getType()->getContainedAutoType();
|
||||
// FIXME: DR1265: if we have a function pointer declaration, we can have
|
||||
// an 'auto' from a trailing return type. In that case, the return type
|
||||
// must match the various other uses of 'auto'.
|
||||
if (!AT)
|
||||
continue;
|
||||
// Don't reissue diagnostics when instantiating a template.
|
||||
if (AT && D->isInvalidDecl())
|
||||
if (D->isInvalidDecl())
|
||||
break;
|
||||
QualType U = AT ? AT->getDeducedType() : QualType();
|
||||
QualType U = AT->getDeducedType();
|
||||
if (!U.isNull()) {
|
||||
CanQualType UCanon = Context.getCanonicalType(U);
|
||||
if (Deduced.isNull()) {
|
||||
|
|
|
@ -1712,7 +1712,7 @@ Sema::ActOnForwardProtocolDeclaration(SourceLocation AtProtocolLoc,
|
|||
DeclsInGroup.push_back(PDecl);
|
||||
}
|
||||
|
||||
return BuildDeclaratorGroup(DeclsInGroup, false);
|
||||
return BuildDeclaratorGroup(DeclsInGroup);
|
||||
}
|
||||
|
||||
Decl *Sema::
|
||||
|
@ -2019,7 +2019,7 @@ Sema::ActOnFinishObjCImplementation(Decl *ObjCImpDecl, ArrayRef<Decl *> Decls) {
|
|||
|
||||
DeclsInGroup.push_back(ObjCImpDecl);
|
||||
|
||||
return BuildDeclaratorGroup(DeclsInGroup, false);
|
||||
return BuildDeclaratorGroup(DeclsInGroup);
|
||||
}
|
||||
|
||||
void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
|
||||
|
@ -3043,7 +3043,7 @@ Sema::ActOnForwardClassDeclaration(SourceLocation AtClassLoc,
|
|||
DeclsInGroup.push_back(IDecl);
|
||||
}
|
||||
|
||||
return BuildDeclaratorGroup(DeclsInGroup, false);
|
||||
return BuildDeclaratorGroup(DeclsInGroup);
|
||||
}
|
||||
|
||||
static bool tryMatchRecordTypes(ASTContext &Context,
|
||||
|
|
|
@ -1504,14 +1504,12 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
|
|||
SourceLocation PlacementLParen, MultiExprArg PlacementArgs,
|
||||
SourceLocation PlacementRParen, SourceRange TypeIdParens,
|
||||
Declarator &D, Expr *Initializer) {
|
||||
bool TypeContainsAuto = D.getDeclSpec().containsPlaceholderType();
|
||||
|
||||
Expr *ArraySize = nullptr;
|
||||
// If the specified type is an array, unwrap it and save the expression.
|
||||
if (D.getNumTypeObjects() > 0 &&
|
||||
D.getTypeObject(0).Kind == DeclaratorChunk::Array) {
|
||||
DeclaratorChunk &Chunk = D.getTypeObject(0);
|
||||
if (TypeContainsAuto)
|
||||
DeclaratorChunk &Chunk = D.getTypeObject(0);
|
||||
if (D.getDeclSpec().containsPlaceholderType())
|
||||
return ExprError(Diag(Chunk.Loc, diag::err_new_array_of_auto)
|
||||
<< D.getSourceRange());
|
||||
if (Chunk.Arr.hasStatic)
|
||||
|
@ -1588,8 +1586,7 @@ Sema::ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
|
|||
TInfo,
|
||||
ArraySize,
|
||||
DirectInitRange,
|
||||
Initializer,
|
||||
TypeContainsAuto);
|
||||
Initializer);
|
||||
}
|
||||
|
||||
static bool isLegalArrayNewInitializer(CXXNewExpr::InitializationStyle Style,
|
||||
|
@ -1621,8 +1618,7 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
|
|||
TypeSourceInfo *AllocTypeInfo,
|
||||
Expr *ArraySize,
|
||||
SourceRange DirectInitRange,
|
||||
Expr *Initializer,
|
||||
bool TypeMayContainAuto) {
|
||||
Expr *Initializer) {
|
||||
SourceRange TypeRange = AllocTypeInfo->getTypeLoc().getSourceRange();
|
||||
SourceLocation StartLoc = Range.getBegin();
|
||||
|
||||
|
@ -1648,7 +1644,7 @@ Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
|
|||
}
|
||||
|
||||
// C++11 [dcl.spec.auto]p6. Deduce the type which 'auto' stands in for.
|
||||
if (TypeMayContainAuto && AllocType->isUndeducedType()) {
|
||||
if (AllocType->isUndeducedType()) {
|
||||
if (initStyle == CXXNewExpr::NoInit || NumInits == 0)
|
||||
return ExprError(Diag(StartLoc, diag::err_auto_new_requires_ctor_arg)
|
||||
<< AllocType << TypeRange);
|
||||
|
|
|
@ -1089,7 +1089,7 @@ void Sema::EndOpenMPDSABlock(Stmt *CurDirective) {
|
|||
auto *VDPrivate = buildVarDecl(
|
||||
*this, DE->getExprLoc(), Type.getUnqualifiedType(),
|
||||
VD->getName(), VD->hasAttrs() ? &VD->getAttrs() : nullptr);
|
||||
ActOnUninitializedDecl(VDPrivate, /*TypeMayContainAuto=*/false);
|
||||
ActOnUninitializedDecl(VDPrivate);
|
||||
if (VDPrivate->isInvalidDecl())
|
||||
continue;
|
||||
PrivateCopies.push_back(buildDeclRefExpr(
|
||||
|
@ -1762,8 +1762,7 @@ static OMPCapturedExprDecl *buildCaptureDecl(Sema &S, IdentifierInfo *Id,
|
|||
if (!WithInit)
|
||||
CED->addAttr(OMPCaptureNoInitAttr::CreateImplicit(C, SourceRange()));
|
||||
S.CurContext->addHiddenDecl(CED);
|
||||
S.AddInitializerToDecl(CED, Init, /*DirectInit=*/false,
|
||||
/*TypeMayContainAuto=*/true);
|
||||
S.AddInitializerToDecl(CED, Init, /*DirectInit=*/false);
|
||||
return CED;
|
||||
}
|
||||
|
||||
|
@ -3976,33 +3975,32 @@ CheckOpenMPLoop(OpenMPDirectiveKind DKind, Expr *CollapseLoopCountExpr,
|
|||
// Lower bound variable, initialized with zero.
|
||||
VarDecl *LBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.lb");
|
||||
LB = buildDeclRefExpr(SemaRef, LBDecl, VType, InitLoc);
|
||||
SemaRef.AddInitializerToDecl(
|
||||
LBDecl, SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
|
||||
/*DirectInit*/ false, /*TypeMayContainAuto*/ false);
|
||||
SemaRef.AddInitializerToDecl(LBDecl,
|
||||
SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
|
||||
/*DirectInit*/ false);
|
||||
|
||||
// Upper bound variable, initialized with last iteration number.
|
||||
VarDecl *UBDecl = buildVarDecl(SemaRef, InitLoc, VType, ".omp.ub");
|
||||
UB = buildDeclRefExpr(SemaRef, UBDecl, VType, InitLoc);
|
||||
SemaRef.AddInitializerToDecl(UBDecl, LastIteration.get(),
|
||||
/*DirectInit*/ false,
|
||||
/*TypeMayContainAuto*/ false);
|
||||
/*DirectInit*/ false);
|
||||
|
||||
// A 32-bit variable-flag where runtime returns 1 for the last iteration.
|
||||
// This will be used to implement clause 'lastprivate'.
|
||||
QualType Int32Ty = SemaRef.Context.getIntTypeForBitwidth(32, true);
|
||||
VarDecl *ILDecl = buildVarDecl(SemaRef, InitLoc, Int32Ty, ".omp.is_last");
|
||||
IL = buildDeclRefExpr(SemaRef, ILDecl, Int32Ty, InitLoc);
|
||||
SemaRef.AddInitializerToDecl(
|
||||
ILDecl, SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
|
||||
/*DirectInit*/ false, /*TypeMayContainAuto*/ false);
|
||||
SemaRef.AddInitializerToDecl(ILDecl,
|
||||
SemaRef.ActOnIntegerConstant(InitLoc, 0).get(),
|
||||
/*DirectInit*/ false);
|
||||
|
||||
// Stride variable returned by runtime (we initialize it to 1 by default).
|
||||
VarDecl *STDecl =
|
||||
buildVarDecl(SemaRef, InitLoc, StrideVType, ".omp.stride");
|
||||
ST = buildDeclRefExpr(SemaRef, STDecl, StrideVType, InitLoc);
|
||||
SemaRef.AddInitializerToDecl(
|
||||
STDecl, SemaRef.ActOnIntegerConstant(InitLoc, 1).get(),
|
||||
/*DirectInit*/ false, /*TypeMayContainAuto*/ false);
|
||||
SemaRef.AddInitializerToDecl(STDecl,
|
||||
SemaRef.ActOnIntegerConstant(InitLoc, 1).get(),
|
||||
/*DirectInit*/ false);
|
||||
|
||||
// Build expression: UB = min(UB, LastIteration)
|
||||
// It is necessary for CodeGen of directives with static scheduling.
|
||||
|
@ -7523,7 +7521,7 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
|
|||
Type = Type.getUnqualifiedType();
|
||||
auto VDPrivate = buildVarDecl(*this, ELoc, Type, D->getName(),
|
||||
D->hasAttrs() ? &D->getAttrs() : nullptr);
|
||||
ActOnUninitializedDecl(VDPrivate, /*TypeMayContainAuto=*/false);
|
||||
ActOnUninitializedDecl(VDPrivate);
|
||||
if (VDPrivate->isInvalidDecl())
|
||||
continue;
|
||||
auto VDPrivateRefExpr = buildDeclRefExpr(
|
||||
|
@ -7829,7 +7827,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
|
|||
RefExpr->getExprLoc());
|
||||
AddInitializerToDecl(VDPrivate,
|
||||
DefaultLvalueConversion(VDInitRefExpr).get(),
|
||||
/*DirectInit=*/false, /*TypeMayContainAuto=*/false);
|
||||
/*DirectInit=*/false);
|
||||
}
|
||||
if (VDPrivate->isInvalidDecl()) {
|
||||
if (IsImplicitClause) {
|
||||
|
@ -8679,10 +8677,9 @@ OMPClause *Sema::ActOnOpenMPReductionClause(
|
|||
}
|
||||
}
|
||||
if (Init && DeclareReductionRef.isUnset()) {
|
||||
AddInitializerToDecl(RHSVD, Init, /*DirectInit=*/false,
|
||||
/*TypeMayContainAuto=*/false);
|
||||
AddInitializerToDecl(RHSVD, Init, /*DirectInit=*/false);
|
||||
} else if (!Init)
|
||||
ActOnUninitializedDecl(RHSVD, /*TypeMayContainAuto=*/false);
|
||||
ActOnUninitializedDecl(RHSVD);
|
||||
if (RHSVD->isInvalidDecl())
|
||||
continue;
|
||||
if (!RHSVD->hasInit() && DeclareReductionRef.isUnset()) {
|
||||
|
@ -8931,7 +8928,7 @@ OMPClause *Sema::ActOnOpenMPLinearClause(
|
|||
else
|
||||
InitExpr = VD ? SimpleRefExpr : Ref;
|
||||
AddInitializerToDecl(Init, DefaultLvalueConversion(InitExpr).get(),
|
||||
/*DirectInit=*/false, /*TypeMayContainAuto=*/false);
|
||||
/*DirectInit=*/false);
|
||||
auto InitRef = buildDeclRefExpr(*this, Init, Type, ELoc);
|
||||
|
||||
DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_linear, Ref);
|
||||
|
@ -11009,7 +11006,7 @@ OMPClause *Sema::ActOnOpenMPUseDevicePtrClause(ArrayRef<Expr *> VarList,
|
|||
RefExpr->getExprLoc());
|
||||
AddInitializerToDecl(VDPrivate,
|
||||
DefaultLvalueConversion(VDInitRefExpr).get(),
|
||||
/*DirectInit=*/false, /*TypeMayContainAuto=*/false);
|
||||
/*DirectInit=*/false);
|
||||
|
||||
// If required, build a capture to implement the privatization initialized
|
||||
// with the current list item value.
|
||||
|
|
|
@ -1881,8 +1881,7 @@ static bool FinishForRangeVarDecl(Sema &SemaRef, VarDecl *Decl, Expr *Init,
|
|||
SemaRef.inferObjCARCLifetime(Decl))
|
||||
Decl->setInvalidDecl();
|
||||
|
||||
SemaRef.AddInitializerToDecl(Decl, Init, /*DirectInit=*/false,
|
||||
/*TypeMayContainAuto=*/false);
|
||||
SemaRef.AddInitializerToDecl(Decl, Init, /*DirectInit=*/false);
|
||||
SemaRef.FinalizeDeclaration(Decl);
|
||||
SemaRef.CurContext->addHiddenDecl(Decl);
|
||||
return false;
|
||||
|
@ -2005,8 +2004,7 @@ StmtResult Sema::ActOnCXXForRangeStmt(Scope *S, SourceLocation ForLoc,
|
|||
|
||||
// Claim the type doesn't contain auto: we've already done the checking.
|
||||
DeclGroupPtrTy RangeGroup =
|
||||
BuildDeclaratorGroup(MutableArrayRef<Decl *>((Decl **)&RangeVar, 1),
|
||||
/*TypeMayContainAuto=*/ false);
|
||||
BuildDeclaratorGroup(MutableArrayRef<Decl *>((Decl **)&RangeVar, 1));
|
||||
StmtResult RangeDecl = ActOnDeclStmt(RangeGroup, RangeLoc, RangeLoc);
|
||||
if (RangeDecl.isInvalid()) {
|
||||
LoopVar->setInvalidDecl();
|
||||
|
@ -2408,8 +2406,7 @@ Sema::BuildCXXForRangeStmt(SourceLocation ForLoc, SourceLocation CoawaitLoc,
|
|||
// Attach *__begin as initializer for VD. Don't touch it if we're just
|
||||
// trying to determine whether this would be a valid range.
|
||||
if (!LoopVar->isInvalidDecl() && Kind != BFRK_Check) {
|
||||
AddInitializerToDecl(LoopVar, DerefExpr.get(), /*DirectInit=*/false,
|
||||
/*TypeMayContainAuto=*/true);
|
||||
AddInitializerToDecl(LoopVar, DerefExpr.get(), /*DirectInit=*/false);
|
||||
if (LoopVar->isInvalidDecl())
|
||||
NoteForRangeBeginEndFunction(*this, BeginExpr.get(), BEF_begin);
|
||||
}
|
||||
|
|
|
@ -4085,7 +4085,6 @@ void Sema::InstantiateVariableInitializer(
|
|||
}
|
||||
|
||||
if (!Init.isInvalid()) {
|
||||
bool TypeMayContainAuto = true;
|
||||
Expr *InitExpr = Init.get();
|
||||
|
||||
if (Var->hasAttr<DLLImportAttr>() &&
|
||||
|
@ -4094,9 +4093,9 @@ void Sema::InstantiateVariableInitializer(
|
|||
// Do not dynamically initialize dllimport variables.
|
||||
} else if (InitExpr) {
|
||||
bool DirectInit = OldVar->isDirectInit();
|
||||
AddInitializerToDecl(Var, InitExpr, DirectInit, TypeMayContainAuto);
|
||||
AddInitializerToDecl(Var, InitExpr, DirectInit);
|
||||
} else
|
||||
ActOnUninitializedDecl(Var, TypeMayContainAuto);
|
||||
ActOnUninitializedDecl(Var);
|
||||
} else {
|
||||
// FIXME: Not too happy about invalidating the declaration
|
||||
// because of a bogus initializer.
|
||||
|
@ -4119,7 +4118,7 @@ void Sema::InstantiateVariableInitializer(
|
|||
if (Var->isCXXForRangeDecl())
|
||||
return;
|
||||
|
||||
ActOnUninitializedDecl(Var, false);
|
||||
ActOnUninitializedDecl(Var);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue