зеркало из https://github.com/microsoft/clang-1.git
Introduce Declarator::ObjCCatchContext, this will result in correct error for 'auto' in obj-c catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134271 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
9864c7dc02
Коммит
17b6399f84
|
@ -1351,6 +1351,7 @@ public:
|
|||
TemplateParamContext,// Within a template parameter list.
|
||||
CXXNewContext, // C++ new-expression.
|
||||
CXXCatchContext, // C++ catch exception-declaration
|
||||
ObjCCatchContext, // Objective-C catch exception-declaration
|
||||
BlockLiteralContext, // Block literal declarator.
|
||||
TemplateTypeArgContext, // Template type argument.
|
||||
AliasDeclContext, // C++0x alias-declaration.
|
||||
|
@ -1502,6 +1503,7 @@ public:
|
|||
case TemplateParamContext:
|
||||
case CXXNewContext:
|
||||
case CXXCatchContext:
|
||||
case ObjCCatchContext:
|
||||
case BlockLiteralContext:
|
||||
case TemplateTypeArgContext:
|
||||
return true;
|
||||
|
@ -1523,6 +1525,7 @@ public:
|
|||
case PrototypeContext:
|
||||
case TemplateParamContext:
|
||||
case CXXCatchContext:
|
||||
case ObjCCatchContext:
|
||||
return true;
|
||||
|
||||
case TypeNameContext:
|
||||
|
@ -1555,6 +1558,7 @@ public:
|
|||
case ObjCPrototypeContext:
|
||||
case TemplateParamContext:
|
||||
case CXXCatchContext:
|
||||
case ObjCCatchContext:
|
||||
case TypeNameContext:
|
||||
case CXXNewContext:
|
||||
case AliasDeclContext:
|
||||
|
|
|
@ -1633,10 +1633,7 @@ StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
|
|||
if (Tok.isNot(tok::ellipsis)) {
|
||||
DeclSpec DS(AttrFactory);
|
||||
ParseDeclarationSpecifiers(DS);
|
||||
// For some odd reason, the name of the exception variable is
|
||||
// optional. As a result, we need to use "PrototypeContext", because
|
||||
// we must accept either 'declarator' or 'abstract-declarator' here.
|
||||
Declarator ParmDecl(DS, Declarator::PrototypeContext);
|
||||
Declarator ParmDecl(DS, Declarator::ObjCCatchContext);
|
||||
ParseDeclarator(ParmDecl);
|
||||
|
||||
// Inform the actions module about the declarator, so it
|
||||
|
|
|
@ -1803,6 +1803,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
|
|||
}
|
||||
break;
|
||||
case Declarator::CXXCatchContext:
|
||||
case Declarator::ObjCCatchContext:
|
||||
Error = 4; // Exception declaration
|
||||
break;
|
||||
case Declarator::TemplateParamContext:
|
||||
|
@ -2441,6 +2442,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
|
|||
case Declarator::ForContext:
|
||||
case Declarator::ConditionContext:
|
||||
case Declarator::CXXCatchContext:
|
||||
case Declarator::ObjCCatchContext:
|
||||
case Declarator::BlockLiteralContext:
|
||||
case Declarator::TemplateTypeArgContext:
|
||||
// FIXME: We may want to allow parameter packs in block-literal contexts
|
||||
|
@ -2480,6 +2482,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S) {
|
|||
case Declarator::TemplateParamContext:
|
||||
case Declarator::CXXNewContext:
|
||||
case Declarator::CXXCatchContext:
|
||||
case Declarator::ObjCCatchContext:
|
||||
case Declarator::TemplateTypeArgContext:
|
||||
Diag(OwnedTagDecl->getLocation(),diag::err_type_defined_in_type_specifier)
|
||||
<< Context.getTypeDeclType(OwnedTagDecl);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -std=c++0x -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks %s
|
||||
// RUN: %clang_cc1 -std=c++0x -fobjc-nonfragile-abi -fsyntax-only -fobjc-arc -verify -fblocks -fobjc-exceptions %s
|
||||
|
||||
// "Move" semantics, trivial version.
|
||||
void move_it(__strong id &&from) {
|
||||
|
@ -25,4 +25,8 @@ void deduction(id obj) {
|
|||
for (auto x : array) {
|
||||
__strong id *xPtr = &x;
|
||||
}
|
||||
|
||||
@try {
|
||||
} @catch (auto e) { // expected-error {{'auto' not allowed in exception declaration}}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче