CXXCatchContext, // C++ catch exception-declaration
ObjCCatchContext, // Objective-C catch exception-declaration
BlockLiteralContext, // Block literal declarator.
+ LambdaExprContext, // Lambda-expression declarator.
TemplateTypeArgContext, // Template type argument.
AliasDeclContext, // C++0x alias-declaration.
AliasTemplateContext // C++0x alias-declaration template.
case CXXCatchContext:
case ObjCCatchContext:
case BlockLiteralContext:
+ case LambdaExprContext:
case TemplateTypeArgContext:
return true;
}
case ObjCParameterContext:
case ObjCResultContext:
case BlockLiteralContext:
+ case LambdaExprContext:
case TemplateTypeArgContext:
return false;
}
case AliasDeclContext:
case AliasTemplateContext:
case BlockLiteralContext:
+ case LambdaExprContext:
case TemplateTypeArgContext:
return false;
}
void Sema::ActOnLambdaStart(SourceLocation StartLoc, Scope *CurScope) {
// FIXME: Add lambda-scope
- // FIXME: Build lambda-decl
// FIXME: PushDeclContext
// Enter a new evaluation context to insulate the block from any
}
void Sema::ActOnLambdaArguments(Declarator &ParamInfo, Scope *CurScope) {
- // FIXME: Implement
+ TypeSourceInfo *MethodTyInfo;
+ MethodTyInfo = GetTypeForDeclarator(ParamInfo, CurScope);
+
+ // FIXME: Build CXXMethodDecl
}
void Sema::ActOnLambdaError(SourceLocation StartLoc, Scope *CurScope) {
// If this is a missing declspec in a block literal return context, then it
// is inferred from the return statements inside the block.
- if (isOmittedBlockReturnType(declarator)) {
+ // The declspec is always missing in a lambda expr context; it is either
+ // specified with a trailing return type or inferred.
+ if (declarator.getContext() == Declarator::LambdaExprContext ||
+ isOmittedBlockReturnType(declarator)) {
Result = Context.DependentTy;
break;
}
case Declarator::KNRTypeListContext:
llvm_unreachable("K&R type lists aren't allowed in C++");
break;
+ case Declarator::LambdaExprContext:
+ llvm_unreachable("Can't specify a type specifier in lambda grammar");
+ break;
case Declarator::ObjCParameterContext:
case Declarator::ObjCResultContext:
case Declarator::PrototypeContext:
case Declarator::BlockContext:
case Declarator::ForContext:
case Declarator::BlockLiteralContext:
+ case Declarator::LambdaExprContext:
// C++0x [dcl.type]p3:
// A type-specifier-seq shall not define a class or enumeration unless
// it appears in the type-id of an alias-declaration (7.1.3) that is not
diag::err_trailing_return_in_parens)
<< T << D.getDeclSpec().getSourceRange();
D.setInvalidType(true);
- } else if (T.hasQualifiers() || !isa<AutoType>(T)) {
+ } else if (D.getContext() != Declarator::LambdaExprContext &&
+ (T.hasQualifiers() || !isa<AutoType>(T))) {
S.Diag(D.getDeclSpec().getTypeSpecTypeLoc(),
diag::err_trailing_return_without_auto)
<< T << D.getDeclSpec().getSourceRange();
case Declarator::CXXCatchContext:
case Declarator::ObjCCatchContext:
case Declarator::BlockLiteralContext:
+ case Declarator::LambdaExprContext:
case Declarator::TemplateTypeArgContext:
// FIXME: We may want to allow parameter packs in block-literal contexts
// in the future.