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:
parent
0a2ac90525
commit
e7d78882b4
|
@ -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>();
|
||||
|
|
|
@ -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];
|
||||
}
|
Loading…
Reference in New Issue