Skip to content

Commit 288e191

Browse files
authored
Merge pull request #66 from chp-io/bsl-tidy-fix
Fix bsl-non-safe-integral-types-are-forbidden
2 parents 1b019f9 + acfbb0f commit 288e191

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

clang-tools-extra/clang-tidy/bsl/NonSafeIntegralTypesAreForbiddenCheck.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ void NonSafeIntegralTypesAreForbiddenCheck::check_field_decl(const MatchFinder::
134134
if (Record->isStruct())
135135
return;
136136

137+
auto const *DC = Record->getParent();
138+
while (!isa<TranslationUnitDecl>(Decl::castFromDeclContext(DC))) {
139+
if (const auto *Rec = dyn_cast<RecordDecl>(DC)) {
140+
if (Rec->isStruct()) {
141+
return;
142+
}
143+
}
144+
DC = DC->getParent();
145+
}
146+
137147
auto const QT = FD->getType().getNonReferenceType().getCanonicalType().getUnqualifiedType();
138148
if (!QT->isIntegerType())
139149
return;

0 commit comments

Comments
 (0)