summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/cppcoreguidelines
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/cppcoreguidelines')
-rw-r--r--clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
index 7aba5242962..d41175e27d2 100644
--- a/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -208,8 +208,12 @@ computeInsertions(const CXXConstructorDecl::init_const_range &Inits,
void getInitializationsInOrder(const CXXRecordDecl *ClassDecl,
SmallVectorImpl<const NamedDecl *> &Decls) {
Decls.clear();
- for (const auto &Base : ClassDecl->bases())
- Decls.emplace_back(getCanonicalRecordDecl(Base.getType()));
+ for (const auto &Base : ClassDecl->bases()) {
+ // Decl may be null if the base class is a template parameter.
+ if (const NamedDecl *Decl = getCanonicalRecordDecl(Base.getType())) {
+ Decls.emplace_back(Decl);
+ }
+ }
Decls.append(ClassDecl->fields().begin(), ClassDecl->fields().end());
}
OpenPOWER on IntegriCloud