Changeset View
Standalone View
clang/lib/Sema/TreeTransform.h
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 12,957 Lines • ▼ Show 20 Lines | QualType NewCallOpType = TransformFunctionProtoType( | ||||
}); | }); | ||||
if (NewCallOpType.isNull()) | if (NewCallOpType.isNull()) | ||||
return ExprError(); | return ExprError(); | ||||
NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, | NewCallOpTSI = NewCallOpTLBuilder.getTypeSourceInfo(getSema().Context, | ||||
NewCallOpType); | NewCallOpType); | ||||
} | } | ||||
// Transform the trailing requires clause | // Transform the trailing requires clause | ||||
ExprResult NewTrailingRequiresClause; | ExprResult NewTrailingRequiresClause = | ||||
if (Expr *TRC = E->getCallOperator()->getTrailingRequiresClause()) | E->getCallOperator()->getTrailingRequiresClause(); | ||||
ChuanqiXu: I think we could eliminate `NewTrailingRequiresClause` | |||||
// FIXME: Concepts: Substitution into requires clause should only happen | |||||
// when checking satisfaction. | |||||
NewTrailingRequiresClause = getDerived().TransformExpr(TRC); | |||||
// Create the local class that will describe the lambda. | // Create the local class that will describe the lambda. | ||||
// FIXME: KnownDependent below is wrong when substituting inside a templated | // FIXME: KnownDependent below is wrong when substituting inside a templated | ||||
// context that isn't a DeclContext (such as a variable template). | // context that isn't a DeclContext (such as a variable template). | ||||
CXXRecordDecl *OldClass = E->getLambdaClass(); | CXXRecordDecl *OldClass = E->getLambdaClass(); | ||||
CXXRecordDecl *Class | CXXRecordDecl *Class | ||||
= getSema().createLambdaClosureType(E->getIntroducerRange(), | = getSema().createLambdaClosureType(E->getIntroducerRange(), | ||||
NewCallOpTSI, | NewCallOpTSI, | ||||
Show All 18 Lines | TreeTransform<Derived>::TransformLambdaExpr(LambdaExpr *E) { | ||||
LSI->CallOperator = NewCallOperator; | LSI->CallOperator = NewCallOperator; | ||||
getDerived().transformAttrs(E->getCallOperator(), NewCallOperator); | getDerived().transformAttrs(E->getCallOperator(), NewCallOperator); | ||||
getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator}); | getDerived().transformedLocalDecl(E->getCallOperator(), {NewCallOperator}); | ||||
// Number the lambda for linkage purposes if necessary. | // Number the lambda for linkage purposes if necessary. | ||||
getSema().handleLambdaNumbering(Class, NewCallOperator, Mangling); | getSema().handleLambdaNumbering(Class, NewCallOperator, Mangling); | ||||
That doesn't look right. // This asserts because 'y' is not in the Scope's "FindInstantiationOf" [y = x]() requires(constraint<decltype(y)>){} But i suspect this should explode even more spectacularly in some cases? cor3ntin: That doesn't look right.
At best if you don't transform the trailing return type you wouldn't… | |||||
So the point of the patch here is that we cannot transform this until we need to 'check' this constraint. I also missed the 'call' of the lambdas in each of those cases, so it does need to be 'checked', which means it needs to be 'substituted'.
I think it cannot be substituted either, because the type might be different by the time you get to the need to check, see here: https://godbolt.org/z/GxP9T6fa1 erichkeane: >At best if you don't transform the trailing return type you wouldn't refer to the transformed… | |||||
Hrm.... i just discovered "RebuildExprInCurrentInstantiation". I wonder if all of these places should be doing THAT instead... erichkeane: Hrm.... i just discovered "RebuildExprInCurrentInstantiation". I wonder if all of these places… | |||||
This does.... SOMETHING, just not the right thing :/ It DOES do some work it seems, but not enough to update everything? I have no idea what is messed up here. I'm pretty much out of ideas here. erichkeane: >Hrm.... i just discovered "RebuildExprInCurrentInstantiation". I wonder if all of these places… | |||||
// Introduce the context of the call operator. | // Introduce the context of the call operator. | ||||
Sema::ContextRAII SavedContext(getSema(), NewCallOperator, | Sema::ContextRAII SavedContext(getSema(), NewCallOperator, | ||||
/*NewThisContext*/false); | /*NewThisContext*/false); | ||||
// Enter the scope of the lambda. | // Enter the scope of the lambda. | ||||
getSema().buildLambdaScope(LSI, NewCallOperator, | getSema().buildLambdaScope(LSI, NewCallOperator, | ||||
E->getIntroducerRange(), | E->getIntroducerRange(), | ||||
E->getCaptureDefault(), | E->getCaptureDefault(), | ||||
▲ Show 20 Lines • Show All 1,910 Lines • Show Last 20 Lines |
I think we could eliminate NewTrailingRequiresClause