Skip to content

Commit 47f7711

Browse files
committed
Rewrite type compatibility testing to do type merging rather than just
testing compatibility. This is necessary for some constructs, like merging redeclarations. Also, there are some ObjC changes to make sure that typesAreCompatible(a,b) == typesAreCompatible(b,a). I don't have any ObjC code beyond the testsuite, so please tell me if there are any cases where this doesn't behave as expected. llvm-svn: 55158
1 parent 9b29ec7 commit 47f7711

File tree

4 files changed

+215
-157
lines changed

4 files changed

+215
-157
lines changed

clang/include/clang/AST/ASTContext.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,6 @@ class ASTContext {
397397

398398
/// Compatibility predicates used to check assignment expressions.
399399
bool typesAreCompatible(QualType, QualType); // C99 6.2.7p1
400-
bool pointerTypesAreCompatible(QualType, QualType); // C99 6.7.5.1p2
401-
bool referenceTypesAreCompatible(QualType, QualType); // C++ 5.17p6
402-
bool functionTypesAreCompatible(QualType, QualType); // C99 6.7.5.3p15
403400

404401
bool isObjCIdType(QualType T) const {
405402
if (!IdStructType) // ObjC isn't enabled
@@ -416,6 +413,14 @@ class ASTContext {
416413
return T->getAsStructureType() == SelStructType;
417414
}
418415

416+
// Check the safety of assignment from LHS to RHS
417+
bool canAssignObjCInterfaces(const ObjCInterfaceType *LHS,
418+
const ObjCInterfaceType *RHS);
419+
420+
// Functions for calculating composite types
421+
QualType mergeTypes(QualType, QualType);
422+
QualType mergeFunctionTypes(QualType, QualType);
423+
419424
//===--------------------------------------------------------------------===//
420425
// Integer Predicates
421426
//===--------------------------------------------------------------------===//

0 commit comments

Comments
 (0)