summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-09-09 13:47:19 +0000
committerSteve Naroff <snaroff@apple.com>2008-09-09 13:47:19 +0000
commit58d5ea7ac91f75a4b6d0b754078db9e1470f53da (patch)
tree42c418d7b5ad6ccbc1f1ffba355d31097dc70e6f /clang
parentd7ba10c31b33f930e1599f89854b9e1eb43e0004 (diff)
downloadbcm5719-llvm-58d5ea7ac91f75a4b6d0b754078db9e1470f53da.tar.gz
bcm5719-llvm-58d5ea7ac91f75a4b6d0b754078db9e1470f53da.zip
Simplify typesAreBlockCompatible().
llvm-svn: 55989
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/AST/ASTContext.cpp42
1 files changed, 1 insertions, 41 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 62364bab318..bcda5ffcb53 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1795,47 +1795,7 @@ bool ASTContext::isObjCObjectPointerType(QualType Ty) const {
/// FIXME: When the dust settles on this integration, fold this into mergeTypes.
///
bool ASTContext::typesAreBlockCompatible(QualType lhs, QualType rhs) {
- if (lhs.getCVRQualifiers() != rhs.getCVRQualifiers())
- return false;
-
- QualType lcanon = getCanonicalType(lhs);
- QualType rcanon = getCanonicalType(rhs);
-
- // If two types are identical, they are are compatible
- if (lcanon == rcanon)
- return true;
- if (isa<FunctionType>(lcanon) && isa<FunctionType>(rcanon)) {
- const FunctionType *lbase = cast<FunctionType>(lcanon);
- const FunctionType *rbase = cast<FunctionType>(rcanon);
-
- // First check the return types.
- if (!typesAreBlockCompatible(lbase->getResultType(),rbase->getResultType()))
- return false;
-
- // Return types matched, now check the argument types.
- const FunctionTypeProto *lproto = dyn_cast<FunctionTypeProto>(lbase);
- const FunctionTypeProto *rproto = dyn_cast<FunctionTypeProto>(rbase);
-
- if (lproto && rproto) { // two C99 style function prototypes
- unsigned lproto_nargs = lproto->getNumArgs();
- unsigned rproto_nargs = rproto->getNumArgs();
-
- if (lproto_nargs != rproto_nargs)
- return false;
-
- if (lproto->isVariadic() || rproto->isVariadic())
- return false;
-
- // The use of ellipsis agree...now check the argument types.
- for (unsigned i = 0; i < lproto_nargs; i++)
- if (!typesAreBlockCompatible(lproto->getArgType(i),
- rproto->getArgType(i)))
- return false;
- return true;
- }
- return (!lproto && !rproto); // two K&R style function decls match.
- }
- return false;
+ return getCanonicalType(lhs) == getCanonicalType(rhs);
}
/// areCompatVectorTypes - Return true if the two specified vector types are
OpenPOWER on IntegriCloud