From: Zhongxing Xu Date: Tue, 5 Jan 2010 09:27:03 +0000 (+0000) Subject: Revert r92318. Instead fix the analyzer: do not call X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ea95fc163e9fb4fd7506b6a0c26decd67022943;p=clang Revert r92318. Instead fix the analyzer: do not call ASTContext::hasSameUnqualifiedType() when one of the type is VariableArrayType. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92723 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index ad10aa38ed..fe96280609 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -2383,7 +2383,6 @@ QualType ASTContext::getUnqualifiedArrayType(QualType T, assert(!T.hasQualifiers() && "canonical array type has qualifiers!"); const ArrayType *AT = cast(T); QualType Elt = AT->getElementType(); - assert(Elt.isCanonical()); QualType UnqualElt = getUnqualifiedArrayType(Elt, Quals); if (Elt == UnqualElt) return T; @@ -2397,12 +2396,6 @@ QualType ASTContext::getUnqualifiedArrayType(QualType T, return getIncompleteArrayType(UnqualElt, IAT->getSizeModifier(), 0); } - if (const VariableArrayType *VAT = dyn_cast(T)) { - return getVariableArrayType(UnqualElt, VAT->getSizeExpr()->Retain(), - VAT->getSizeModifier(), 0, - SourceRange()); - } - const DependentSizedArrayType *DSAT = cast(T); return getDependentSizedArrayType(UnqualElt, DSAT->getSizeExpr()->Retain(), DSAT->getSizeModifier(), 0, diff --git a/lib/Analysis/SValuator.cpp b/lib/Analysis/SValuator.cpp index 49bc0c4c59..0e56026bb4 100644 --- a/lib/Analysis/SValuator.cpp +++ b/lib/Analysis/SValuator.cpp @@ -62,8 +62,9 @@ SValuator::CastResult SValuator::EvalCast(SVal val, const GRState *state, ASTContext &C = ValMgr.getContext(); // For const casts, just propagate the value. - if (C.hasSameUnqualifiedType(castTy, originalTy)) - return CastResult(state, val); + if (!castTy->isVariableArrayType() && !originalTy->isVariableArrayType()) + if (C.hasSameUnqualifiedType(castTy, originalTy)) + return CastResult(state, val); // Check for casts from pointers to integers. if (castTy->isIntegerType() && Loc::IsLocType(originalTy))