}
public:
- const CXXDestructorDecl *getDestructorDecl() const;
- bool isNoReturn() const;
+ const CXXDestructorDecl *getDestructorDecl(ASTContext &astContext) const;
+ bool isNoReturn(ASTContext &astContext) const;
static bool classof(const CFGElement *E) {
Kind kind = E->getKind();
return Builder.buildCFG(D, Statement, C, BO);
}
-const CXXDestructorDecl *CFGImplicitDtor::getDestructorDecl() const {
+const CXXDestructorDecl *
+CFGImplicitDtor::getDestructorDecl(ASTContext &astContext) const {
switch (getKind()) {
case CFGElement::Invalid:
case CFGElement::Statement:
const VarDecl *var = cast<CFGAutomaticObjDtor>(this)->getVarDecl();
QualType ty = var->getType();
ty = ty.getNonReferenceType();
+ if (const ArrayType *arrayType = astContext.getAsArrayType(ty)) {
+ ty = arrayType->getElementType();
+ }
const RecordType *recordType = ty->getAs<RecordType>();
const CXXRecordDecl *classDecl =
cast<CXXRecordDecl>(recordType->getDecl());
return 0;
}
-bool CFGImplicitDtor::isNoReturn() const {
- if (const CXXDestructorDecl *cdecl = getDestructorDecl()) {
+bool CFGImplicitDtor::isNoReturn(ASTContext &astContext) const {
+ if (const CXXDestructorDecl *cdecl = getDestructorDecl(astContext)) {
QualType ty = cdecl->getType();
return cast<FunctionType>(ty)->getNoReturnAttr();
}
// FIXME: The right solution is to just sever the edges in the
// CFG itself.
if (const CFGImplicitDtor *iDtor = ri->getAs<CFGImplicitDtor>())
- if (iDtor->isNoReturn()) {
+ if (iDtor->isNoReturn(AC.getASTContext())) {
hasNoReturnDtor = true;
HasFakeEdge = true;
break;