diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-15 17:15:07 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-15 17:15:07 +0000 |
commit | dec1cc4ec73e96f315ab7dee51459700c0ad821d (patch) | |
tree | be971eb2108779cbec4b45cb43d2bef64176f7e8 | |
parent | 161794732195881c33305f701f6e58721998541f (diff) |
Two null Decl*'s don't refer to the same declaration, because they
don't refer to anything. Amusingly, we were relying on this in one
place. Thanks to Chandler for noticing the weirdness in
declaresSameEntity.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146659 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/AST/DeclBase.h | 6 | ||||
-rw-r--r-- | lib/Sema/SemaOverload.cpp | 7 |
2 files changed, 7 insertions, 6 deletions
diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index b0534b8280..ecd7762468 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -762,12 +762,12 @@ protected: /// \brief Determine whether two declarations declare the same entity. inline bool declaresSameEntity(const Decl *D1, const Decl *D2) { - if (D1 == D2) - return true; - if (!D1 || !D2) return false; + if (D1 == D2) + return true; + return D1->getCanonicalDecl() == D2->getCanonicalDecl(); } diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index d0d1484dd0..cf8df57eb3 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -2262,7 +2262,7 @@ void Sema::HandleFunctionTypeMismatch(PartialDiagnostic &PDiag, } /// FunctionArgTypesAreEqual - This routine checks two function proto types -/// for equlity of their argument types. Caller has already checked that +/// for equality of their argument types. Caller has already checked that /// they have same number of arguments. This routine assumes that Objective-C /// pointer types which only differ in their protocol qualifiers are equal. /// If the parameters are different, ArgPos will have the the parameter index @@ -2300,8 +2300,9 @@ bool Sema::FunctionArgTypesAreEqual(const FunctionProtoType *OldType, ToType->getAs<ObjCObjectPointerType>()) { if (const ObjCObjectPointerType *PTFr = FromType->getAs<ObjCObjectPointerType>()) - if (declaresSameEntity(PTTo->getInterfaceDecl(), - PTFr->getInterfaceDecl())) + if (Context.hasSameUnqualifiedType( + PTTo->getObjectType()->getBaseType(), + PTFr->getObjectType()->getBaseType())) continue; } if (ArgPos) *ArgPos = O - OldType->arg_type_begin(); |