Skip to content

Commit

Permalink
Merge pull request #66 from chp-io/bsl-tidy-fix
Browse files Browse the repository at this point in the history
Fix bsl-non-safe-integral-types-are-forbidden
  • Loading branch information
chp-io authored Feb 4, 2022
2 parents 1b019f9 + acfbb0f commit 288e191
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ void NonSafeIntegralTypesAreForbiddenCheck::check_field_decl(const MatchFinder::
if (Record->isStruct())
return;

auto const *DC = Record->getParent();
while (!isa<TranslationUnitDecl>(Decl::castFromDeclContext(DC))) {
if (const auto *Rec = dyn_cast<RecordDecl>(DC)) {
if (Rec->isStruct()) {
return;
}
}
DC = DC->getParent();
}

auto const QT = FD->getType().getNonReferenceType().getCanonicalType().getUnqualifiedType();
if (!QT->isIntegerType())
return;
Expand Down

0 comments on commit 288e191

Please sign in to comment.