Reverts r183466: "Perform dynamic alignment computations..."
This introduces bugs in TemplateSpecializationTypeLoc's angle bracket
locations.
Regression test follows in a subsequent commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183513 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaLambda.cpp b/lib/Sema/SemaLambda.cpp
index 3402f22..d647be3 100644
--- a/lib/Sema/SemaLambda.cpp
+++ b/lib/Sema/SemaLambda.cpp
@@ -445,7 +445,6 @@
assert(!DeductType.isNull() && "can't build reference to auto");
TLB.push<ReferenceTypeLoc>(DeductType).setSigilLoc(Loc);
}
- TypeSourceInfo *TSI = TLB.getTypeSourceInfo(Context, DeductType);
InitializationKind InitKind = InitializationKind::CreateDefault(Loc);
Expr *Init = InitExpr;
@@ -477,7 +476,8 @@
else
InitKind = InitializationKind::CreateCopy(Loc, Loc);
QualType DeducedType;
- if (DeduceAutoType(TSI, Init, DeducedType) == DAR_Failed) {
+ if (DeduceAutoType(TLB.getTemporaryTypeLoc(DeductType),
+ Init, DeducedType) == DAR_Failed) {
if (isa<InitListExpr>(Init))
Diag(Loc, diag::err_init_capture_deduction_failure_from_init_list)
<< Id << Init->getSourceRange();
@@ -492,7 +492,7 @@
// the closure type. This member is not a bit-field and not mutable.
// Core issue: the member is (probably...) public.
FieldDecl *NewFD = CheckFieldDecl(
- Id, DeducedType, TSI, LSI->Lambda,
+ Id, DeducedType, TLB.getTypeSourceInfo(Context, DeductType), LSI->Lambda,
Loc, /*Mutable*/ false, /*BitWidth*/ 0, ICIS_NoInit,
Loc, AS_public, /*PrevDecl*/ 0, /*Declarator*/ 0);
LSI->Lambda->addDecl(NewFD);