[clang-tidy] Fix FP on cppcoreguidelines-pro-type-member-init with forward decl (#190521)
Fixes https://github.com/llvm/llvm-project/issues/155416.
This commit is contained in:
parent
ce1a9fd766
commit
e326ff2a88
@ -572,7 +572,8 @@ void ProTypeMemberInitCheck::checkMissingBaseClassInitializer(
|
||||
|
||||
for (const CXXCtorInitializer *Init : Ctor->inits())
|
||||
if (Init->isBaseInitializer() && Init->isWritten())
|
||||
BasesToInit.erase(Init->getBaseClass()->getAsCXXRecordDecl());
|
||||
BasesToInit.erase(
|
||||
Init->getBaseClass()->getAsCXXRecordDecl()->getCanonicalDecl());
|
||||
}
|
||||
|
||||
if (BasesToInit.empty())
|
||||
|
||||
@ -291,6 +291,11 @@ Changes in existing checks
|
||||
<clang-tidy/checks/cppcoreguidelines/missing-std-forward>` check by fixing
|
||||
a false positive for constrained template parameters.
|
||||
|
||||
- Improved :doc:`cppcoreguidelines-pro-type-member-init
|
||||
<clang-tidy/checks/cppcoreguidelines/pro-type-member-init>` check by fixing
|
||||
a false positive when a base class has a forward declaration before its
|
||||
definition.
|
||||
|
||||
- Improved :doc:`cppcoreguidelines-pro-type-vararg
|
||||
<clang-tidy/checks/cppcoreguidelines/pro-type-vararg>` check by no longer
|
||||
warning on builtins with custom type checking (e.g., type-generic builtins
|
||||
|
||||
@ -611,3 +611,27 @@ namespace PR37250 {
|
||||
const V v;
|
||||
const S s{v};
|
||||
}
|
||||
|
||||
namespace PR155416 {
|
||||
struct S;
|
||||
|
||||
struct S {
|
||||
int a;
|
||||
};
|
||||
|
||||
struct C : S {
|
||||
C() : S{0} {}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct St;
|
||||
|
||||
template<typename T>
|
||||
struct St{
|
||||
T a;
|
||||
};
|
||||
|
||||
struct Ct : St<int> {
|
||||
Ct() : St{0} {}
|
||||
};
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user