From a9d0ffe57ebd29da49ab722a25d37f58a0c91dc8 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 11 Apr 2009 18:01:59 +0000 Subject: simplify this code to not bother stripping to canonical types, and indent code properly llvm-svn: 68866 --- clang/lib/Sema/SemaDeclObjC.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'clang/lib/Sema/SemaDeclObjC.cpp') diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 74a03164313..a73b440577b 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -764,25 +764,22 @@ void Sema::WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method, void Sema::WarnConflictingTypedMethods(ObjCMethodDecl *ImpMethodDecl, ObjCMethodDecl *IntfMethodDecl) { bool err = false; - QualType ImpMethodQType = - Context.getCanonicalType(ImpMethodDecl->getResultType()); - QualType IntfMethodQType = - Context.getCanonicalType(IntfMethodDecl->getResultType()); - if (!Context.typesAreCompatible(IntfMethodQType, ImpMethodQType)) + if (!Context.typesAreCompatible(IntfMethodDecl->getResultType(), + ImpMethodDecl->getResultType())) err = true; - else for (ObjCMethodDecl::param_iterator IM=ImpMethodDecl->param_begin(), - IF=IntfMethodDecl->param_begin(), - EM=ImpMethodDecl->param_end(); IM!=EM; ++IM, IF++) { - ImpMethodQType = Context.getCanonicalType((*IM)->getType()); - IntfMethodQType = Context.getCanonicalType((*IF)->getType()); - if (!Context.typesAreCompatible(IntfMethodQType, ImpMethodQType)) { - err = true; - break; + else + for (ObjCMethodDecl::param_iterator IM=ImpMethodDecl->param_begin(), + IF = IntfMethodDecl->param_begin(), EM = ImpMethodDecl->param_end(); + IM != EM; ++IM, ++IF) { + if (!Context.typesAreCompatible((*IF)->getType(), (*IM)->getType())) { + err = true; + break; + } } - } + if (err) { Diag(ImpMethodDecl->getLocation(), diag::warn_conflicting_types) - << ImpMethodDecl->getDeclName(); + << ImpMethodDecl->getDeclName(); Diag(IntfMethodDecl->getLocation(), diag::note_previous_definition); } } -- cgit v1.2.3