summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-12-15 17:15:07 +0000
committerDouglas Gregor <dgregor@apple.com>2011-12-15 17:15:07 +0000
commit2039ca061f07fc5fae7ced01ae7d428c3203db7b (patch)
treec9cae431de102c0aee381dd56a8afc977ba0866b /clang
parent344b4d9f756592358fb4561d533b6e02092266c4 (diff)
downloadbcm5719-llvm-2039ca061f07fc5fae7ced01ae7d428c3203db7b.tar.gz
bcm5719-llvm-2039ca061f07fc5fae7ced01ae7d428c3203db7b.zip
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. llvm-svn: 146659
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/AST/DeclBase.h6
-rw-r--r--clang/lib/Sema/SemaOverload.cpp7
2 files changed, 7 insertions, 6 deletions
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h
index b0534b82804..ecd7762468e 100644
--- a/clang/include/clang/AST/DeclBase.h
+++ b/clang/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/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index d0d1484dd04..cf8df57eb3a 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud