Fix crash when querying the CFG reported when using the thread safety analysis

on code using multi-dimensional arrays.  Fix by DeLesley Hutchins, and reported in
PR 12271.

llvm-svn: 153067
This commit is contained in:
Ted Kremenek 2012-03-19 23:48:41 +00:00
parent 0a2ac90525
commit e7d78882b4
2 changed files with 14 additions and 1 deletions

View File

@ -3087,7 +3087,7 @@ CFGImplicitDtor::getDestructorDecl(ASTContext &astContext) const {
const VarDecl *var = cast<CFGAutomaticObjDtor>(this)->getVarDecl();
QualType ty = var->getType();
ty = ty.getNonReferenceType();
if (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
while (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
ty = arrayType->getElementType();
}
const RecordType *recordType = ty->getAs<RecordType>();

View File

@ -0,0 +1,13 @@
// RUN: %clang -Weverything -fsyntax-only %s -verify
// This previously crashed due to a bug in the CFG. Exercising all
// warnings helps check CFG construction.
class PR12271 {
public:
PR12271();
~PR12271();
};
void testPR12271() {
PR12271 a[1][1];
}