if (const VarDecl *VD = dyn_cast<VarDecl>(D)) {
// If this is a variable, use the type of the variable.
- Records.push_back(VD->getType().getTypePtr()->getAsCXXRecordDecl());
+ if (const auto *RD = VD->getType().getTypePtr()->getAsCXXRecordDecl())
+ Records.push_back(RD);
continue;
}