diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-26 22:17:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-26 22:17:49 +0000 |
commit | b77792eabf5882cf9af8cc810599b20432fda6c2 (patch) | |
tree | b3b695e135c5fa6692bdfc0c1da441140d64e2e5 /lib/Sema/SemaDecl.cpp | |
parent | 806954b069dc1895353d4bd4f51e410869ac62f8 (diff) |
change more instances of QualType::getCanonicalType to call
ASTContext::getCanonicalType instead (PR2189)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 610bf61b60..e046ee9a66 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -384,7 +384,8 @@ Sema::MergeFunctionDecl(FunctionDecl *New, Decl *OldD, bool &Redeclaration) { /// We need to check this explicitly as an incomplete array definition is /// considered a VariableArrayType, so will not match a complete array /// definition that would be otherwise equivalent. -static bool areEquivalentArrayTypes(QualType NewQType, QualType OldQType) { +static bool areEquivalentArrayTypes(QualType NewQType, QualType OldQType, + ASTContext &Context) { const ArrayType *NewAT = NewQType->getAsArrayType(); const ArrayType *OldAT = OldQType->getAsArrayType(); @@ -403,8 +404,8 @@ static bool areEquivalentArrayTypes(QualType NewQType, QualType OldQType) { if (NewAT->isIncompleteArrayType() || OldAT->isIncompleteArrayType()) { if (NewAT->getIndexTypeQualifier() != OldAT->getIndexTypeQualifier()) return false; - NewQType = NewAT->getElementType().getCanonicalType(); - OldQType = OldAT->getElementType().getCanonicalType(); + NewQType = Context.getCanonicalType(NewAT->getElementType()); + OldQType = Context.getCanonicalType(OldAT->getElementType()); } return NewQType == OldQType; @@ -432,7 +433,8 @@ VarDecl *Sema::MergeVarDecl(VarDecl *New, Decl *OldD) { // Verify the types match. QualType OldCType = Context.getCanonicalType(Old->getType()); QualType NewCType = Context.getCanonicalType(New->getType()); - if (OldCType != NewCType && !areEquivalentArrayTypes(NewCType, OldCType)) { + if (OldCType != NewCType && + !areEquivalentArrayTypes(NewCType, OldCType, Context)) { Diag(New->getLocation(), diag::err_redefinition, New->getName()); Diag(Old->getLocation(), diag::err_previous_definition); return New; @@ -1252,7 +1254,8 @@ bool Sema::CheckForConstantInitializer(Expr *Init, QualType DclT) { if (Init->isNullPointerConstant(Context)) return false; if (Init->getType()->isArithmeticType()) { - QualType InitTy = Init->getType().getCanonicalType().getUnqualifiedType(); + QualType InitTy = Context.getCanonicalType(Init->getType()) + .getUnqualifiedType(); if (InitTy == Context.BoolTy) { // Special handling for pointers implicitly cast to bool; // (e.g. "_Bool rr = &rr;"). This is only legal at the top level. |