summaryrefslogtreecommitdiff
path: root/src/shared/cplusplus
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@nokia.com>2010-06-18 09:08:00 +0200
committerErik Verbruggen <erik.verbruggen@nokia.com>2010-06-18 09:10:11 +0200
commit3c3af9c25b6e57dfc8c28a07679b90f902759a1a (patch)
tree09f637e73c510a3ba57a7aa4b9437a58573a61e7 /src/shared/cplusplus
parenta1a565b9c55b563460be0d5ca7aef6deb93e0ed1 (diff)
downloadqt-creator-3c3af9c25b6e57dfc8c28a07679b90f902759a1a.tar.gz
Fixed return-type checking for ObjC methods.
Diffstat (limited to 'src/shared/cplusplus')
-rw-r--r--src/shared/cplusplus/CheckDeclaration.cpp8
-rw-r--r--src/shared/cplusplus/CheckDeclarator.cpp4
-rw-r--r--src/shared/cplusplus/CheckName.cpp4
-rw-r--r--src/shared/cplusplus/CheckSpecifier.cpp13
-rw-r--r--src/shared/cplusplus/CheckSpecifier.h2
-rw-r--r--src/shared/cplusplus/Semantic.cpp4
-rw-r--r--src/shared/cplusplus/Semantic.h3
7 files changed, 9 insertions, 29 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp
index a0ae84fa5a..d38aa0eeee 100644
--- a/src/shared/cplusplus/CheckDeclaration.cpp
+++ b/src/shared/cplusplus/CheckDeclaration.cpp
@@ -720,10 +720,6 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
Symbol *symbol;
if (ast->function_body) {
- if (!semantic()->skipFunctionBodies()) {
- semantic()->check(ast->function_body, methodTy->members());
- }
-
symbol = methodTy;
} else {
Declaration *decl = control()->newDeclaration(selector->firstToken(), methodTy->name());
@@ -742,6 +738,10 @@ bool CheckDeclaration::visit(ObjCMethodDeclarationAST *ast)
_scope->enterSymbol(symbol);
+ if (ast->function_body && !semantic()->skipFunctionBodies()) {
+ semantic()->check(ast->function_body, methodTy->members());
+ }
+
return false;
}
diff --git a/src/shared/cplusplus/CheckDeclarator.cpp b/src/shared/cplusplus/CheckDeclarator.cpp
index 84edbd0292..8fb80549e6 100644
--- a/src/shared/cplusplus/CheckDeclarator.cpp
+++ b/src/shared/cplusplus/CheckDeclarator.cpp
@@ -260,7 +260,9 @@ bool CheckDeclarator::visit(ObjCMethodPrototypeAST *ast)
return false;
}
- FullySpecifiedType returnType = semantic()->check(ast->type_name, _scope);
+ FullySpecifiedType returnType;
+ if (ast->type_name && ast->type_name->type_id)
+ returnType = semantic()->check(ast->type_name->type_id, _scope);
unsigned location = ast->selector->firstToken();
diff --git a/src/shared/cplusplus/CheckName.cpp b/src/shared/cplusplus/CheckName.cpp
index d98c9b9610..4105268f93 100644
--- a/src/shared/cplusplus/CheckName.cpp
+++ b/src/shared/cplusplus/CheckName.cpp
@@ -394,8 +394,8 @@ bool CheckName::visit(ObjCMessageArgumentDeclarationAST *ast)
{
FullySpecifiedType type;
- if (ast->type_name)
- type = semantic()->check(ast->type_name, _scope);
+ if (ast->type_name && ast->type_name->type_id)
+ type = semantic()->check(ast->type_name->type_id, _scope);
if (ast->param_name) {
accept(ast->param_name);
diff --git a/src/shared/cplusplus/CheckSpecifier.cpp b/src/shared/cplusplus/CheckSpecifier.cpp
index e35d1d193c..422bd7f3c4 100644
--- a/src/shared/cplusplus/CheckSpecifier.cpp
+++ b/src/shared/cplusplus/CheckSpecifier.cpp
@@ -82,19 +82,6 @@ FullySpecifiedType CheckSpecifier::check(SpecifierListAST *specifier,
return switchFullySpecifiedType(previousType);
}
-FullySpecifiedType CheckSpecifier::check(ObjCTypeNameAST *typeName,
- Scope *scope,
- const FullySpecifiedType &ty)
-{
- FullySpecifiedType previousType = switchFullySpecifiedType(ty);
- Scope *previousScope = switchScope(scope);
-
- accept(typeName);
-
- (void) switchScope(previousScope);
- return switchFullySpecifiedType(previousType);
-}
-
SpecifierListAST *CheckSpecifier::switchSpecifier(SpecifierListAST *specifier)
{
SpecifierListAST *previousSpecifier = _specifier;
diff --git a/src/shared/cplusplus/CheckSpecifier.h b/src/shared/cplusplus/CheckSpecifier.h
index e66b306030..d4a1f4ed22 100644
--- a/src/shared/cplusplus/CheckSpecifier.h
+++ b/src/shared/cplusplus/CheckSpecifier.h
@@ -64,8 +64,6 @@ public:
FullySpecifiedType check(SpecifierListAST *specifier, Scope *scope,
const FullySpecifiedType &ty = FullySpecifiedType());
- FullySpecifiedType check(ObjCTypeNameAST *typeName, Scope *scope,
- const FullySpecifiedType &ty = FullySpecifiedType());
protected:
SpecifierListAST *switchSpecifier(SpecifierListAST *specifier);
diff --git a/src/shared/cplusplus/Semantic.cpp b/src/shared/cplusplus/Semantic.cpp
index 9dd1b9aca8..be08ebdf7a 100644
--- a/src/shared/cplusplus/Semantic.cpp
+++ b/src/shared/cplusplus/Semantic.cpp
@@ -169,10 +169,6 @@ FullySpecifiedType Semantic::check(PtrOperatorListAST *ptrOperators, const Fully
FullySpecifiedType Semantic::check(ObjCMethodPrototypeAST *methodPrototype, Scope *scope)
{ return d->checkDeclarator->check(methodPrototype, scope); }
-FullySpecifiedType Semantic::check(ObjCTypeNameAST *typeName, Scope *scope,
- const FullySpecifiedType &type)
-{ return d->checkSpecifier->check(typeName, scope, type); }
-
void Semantic::check(ObjCMessageArgumentDeclarationAST *arg, Scope *scope)
{ return d->checkName->check(arg, scope); }
diff --git a/src/shared/cplusplus/Semantic.h b/src/shared/cplusplus/Semantic.h
index 6aace93f75..cc6e345483 100644
--- a/src/shared/cplusplus/Semantic.h
+++ b/src/shared/cplusplus/Semantic.h
@@ -107,9 +107,6 @@ public:
const Name *check(NestedNameSpecifierListAST *name, Scope *scope);
- FullySpecifiedType check(ObjCTypeNameAST *typeName, Scope *scope,
- const FullySpecifiedType &type = FullySpecifiedType());
-
void check(ObjCMessageArgumentDeclarationAST *arg, Scope *scope);
void checkFunctionDefinition(FunctionDefinitionAST *ast);