summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-01-12 02:27:38 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-01-12 02:27:38 +0000
commit5ceef6b013ae141fdda2dcda40d5f65e44693075 (patch)
treeb534deb1cd29ab352b81151b62f5d3b06de21904
parent4a19ab5950cd9f1bd9f86336bb3d09dfa4c93d44 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291737 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Sema/Sema.h11
-rw-r--r--lib/Parse/ParseDecl.cpp13
-rw-r--r--lib/Parse/ParseDeclCXX.cpp9
-rw-r--r--lib/Parse/ParseExprCXX.cpp3
-rw-r--r--lib/Parse/Parser.cpp2
-rw-r--r--lib/Sema/SemaCoroutine.cpp2
-rw-r--r--lib/Sema/SemaDecl.cpp36
-rw-r--r--lib/Sema/SemaDeclObjC.cpp6
-rw-r--r--lib/Sema/SemaExprCXX.cpp14
-rw-r--r--lib/Sema/SemaOpenMP.cpp39
-rw-r--r--lib/Sema/SemaStmt.cpp9
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp7
12 files changed, 65 insertions, 86 deletions
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 01141b32f7..c180a8ea3e 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -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);
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 833d93e454..2d32087801 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -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);
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index 4002b09d2b..1fdf14c0e9 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -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()) {
diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp
index 545ab36c13..124266a42b 100644
--- a/lib/Parse/ParseExprCXX.cpp
+++ b/lib/Parse/ParseExprCXX.cpp
@@ -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);
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 7194a92429..52e5194e62 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -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);
}
diff --git a/lib/Sema/SemaCoroutine.cpp b/lib/Sema/SemaCoroutine.cpp
index f6115c1bee..9814b4a84f 100644
--- a/lib/Sema/SemaCoroutine.cpp
+++ b/lib/Sema/SemaCoroutine.cpp
@@ -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;
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index cdc9882d14..adcf2ee00e 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -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()) {
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index d172c951e7..b43e5b9e32 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -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,
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 1379440e8a..b2fb33f534 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -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);
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp
index 55a188701d..dcd19c8d81 100644
--- a/lib/Sema/SemaOpenMP.cpp
+++ b/lib/Sema/SemaOpenMP.cpp
@@ -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.
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 50f0a22ff0..a8832e9a1c 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -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);
}
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index d2a5e5cb53..7042400aeb 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -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);
}
}