[cfe-commits] r146659 - in /cfe/trunk: include/clang/AST/DeclBase.h lib/Sema/SemaOverload.cpp
Douglas Gregor
dgregor at apple.com
Thu Dec 15 09:15:08 PST 2011
Author: dgregor
Date: Thu Dec 15 11:15:07 2011
New Revision: 146659
URL: http://llvm.org/viewvc/llvm-project?rev=146659&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=146659&r1=146658&r2=146659&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Thu Dec 15 11:15:07 2011
@@ -762,12 +762,12 @@
/// \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();
}
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=146659&r1=146658&r2=146659&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Dec 15 11:15:07 2011
@@ -2262,7 +2262,7 @@
}
/// 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 @@
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();
More information about the cfe-commits
mailing list