diff options
Diffstat (limited to 'lib/Analysis/CheckNSError.cpp')
-rw-r--r-- | lib/Analysis/CheckNSError.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/Analysis/CheckNSError.cpp b/lib/Analysis/CheckNSError.cpp index c91442b5e8..c1382d0377 100644 --- a/lib/Analysis/CheckNSError.cpp +++ b/lib/Analysis/CheckNSError.cpp @@ -162,16 +162,22 @@ NSErrorCheck::CheckSignature(FunctionDecl& F, QualType& ResultTy, bool NSErrorCheck::CheckNSErrorArgument(QualType ArgTy) { const PointerType* PPT = ArgTy->getAsPointerType(); - if (!PPT) return false; + if (!PPT) + return false; + + const ObjCObjectPointerType* PT = + PPT->getPointeeType()->getAsObjCObjectPointerType(); + + if (!PT) + return false; - const PointerType* PT = PPT->getPointeeType()->getAsPointerType(); - if (!PT) return false; + const ObjCInterfaceDecl *ID = PT->getInterfaceDecl(); - const ObjCInterfaceType *IT = - PT->getPointeeType()->getAsObjCInterfaceType(); + // FIXME: Can ID ever be NULL? + if (ID) + return II == ID->getIdentifier(); - if (!IT) return false; - return IT->getDecl()->getIdentifier() == II; + return false; } bool NSErrorCheck::CheckCFErrorArgument(QualType ArgTy) { |