in facebook-clang-plugins/libtooling/ASTExporter.h [1845:1893]
void ASTExporter<ATDWriter>::dumpClassLambdaCapture(const LambdaCapture *C) {
LambdaCaptureKind CK = C->getCaptureKind();
bool CapturesThis = C->capturesThis();
bool CapturesVariable = C->capturesVariable();
bool CapturesVLAType = C->capturesVLAType();
VarDecl *decl = C->capturesVariable() ? C->getCapturedVar() : nullptr;
bool IsInitCapture = decl && decl->isInitCapture();
bool IsImplicit = C->isImplicit();
SourceRange source_range = C->getLocation();
bool IsPackExpansion = C->isPackExpansion();
ObjectScope Scope(OF,
2 + CapturesThis + CapturesVariable + CapturesVLAType +
IsInitCapture + (bool)decl + IsImplicit +
IsPackExpansion);
OF.emitTag("capture_kind");
switch (CK) {
case LCK_This:
OF.emitSimpleVariant("LCK_This");
break;
case LCK_ByCopy:
OF.emitSimpleVariant("LCK_ByCopy");
break;
case LCK_ByRef:
OF.emitSimpleVariant("LCK_ByRef");
break;
case LCK_VLAType:
OF.emitSimpleVariant("LCK_VLAType");
break;
case LCK_StarThis:
OF.emitSimpleVariant("LCK_StarThis");
break;
};
OF.emitFlag("capture_this", CapturesThis);
OF.emitFlag("capture_variable", CapturesVariable);
OF.emitFlag("capture_VLAtype", CapturesVLAType);
if (decl) {
if (IsInitCapture) {
OF.emitTag("init_captured_vardecl");
dumpDecl(decl);
}
OF.emitTag("captured_var");
dumpDeclRef(*decl);
}
OF.emitFlag("is_implicit", IsImplicit);
OF.emitTag("location");
dumpSourceRange(source_range);
OF.emitFlag("is_pack_expansion", IsPackExpansion);
}