C++ function signature: Abort on unexpected function name.

Change-Id: Iaaa3907f709ea9ed567f59725399efd9024f3bc0
Reviewed-on: http://codereview.qt-project.org/5319
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
This commit is contained in:
Christian Kamm
2011-09-21 14:39:48 +02:00
parent 95590db0b8
commit 9cc4751857

View File

@@ -510,15 +510,22 @@ Utils::ChangeSet FunctionDeclDefLink::changes(const Snapshot &snapshot, int targ
if (!newFunction)
return changes;
LookupContext sourceContext(sourceDocument, snapshot);
LookupContext targetContext(targetFile->cppDocument(), snapshot);
Overview overview;
overview.setShowReturnTypes(true);
overview.setShowTemplateParameters(true);
overview.setShowArgumentNames(true);
overview.setShowFunctionSignatures(true);
// abort if the name of the newly parsed function is not the expected one
DeclaratorIdAST *newDeclId = getDeclaratorId(newDef->declarator);
if (!newDeclId || !newDeclId->name || !newDeclId->name->name
|| overview(newDeclId->name->name) != nameInitial) {
return changes;
}
LookupContext sourceContext(sourceDocument, snapshot);
LookupContext targetContext(targetFile->cppDocument(), snapshot);
// sync return type
{
// set up for rewriting return type