[clang-tidy] ProTypeMemberInitCheck - check that field decls do not have in-class initializer.
Reviewers: alexfh, JVApen, aaron.ballman Subscribers: flx, aaron.ballman, cfe-commits Differential Revision: http://reviews.llvm.org/D18300 git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@268352 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
087b7bae77
Коммит
fd58c1bcb9
|
@ -31,6 +31,8 @@ void fieldsRequiringInit(const RecordDecl::field_range &Fields,
|
|||
ASTContext &Context,
|
||||
SmallPtrSetImpl<const FieldDecl *> &FieldsToInit) {
|
||||
for (const FieldDecl *F : Fields) {
|
||||
if (F->hasInClassInitializer())
|
||||
continue;
|
||||
QualType Type = F->getType();
|
||||
if (!F->hasInClassInitializer() &&
|
||||
type_traits::isTriviallyDefaultConstructible(Type, Context))
|
||||
|
|
|
@ -85,6 +85,14 @@ struct NegativeInitializedInBody {
|
|||
int I;
|
||||
};
|
||||
|
||||
struct A {};
|
||||
template <class> class AA;
|
||||
template <class T> class NegativeTemplateConstructor {
|
||||
NegativeTemplateConstructor(const AA<T> &, A) {}
|
||||
bool Bool{false};
|
||||
// CHECK-FIXES: bool Bool{false};
|
||||
};
|
||||
|
||||
#define UNINITIALIZED_FIELD_IN_MACRO_BODY(FIELD) \
|
||||
struct UninitializedField##FIELD { \
|
||||
UninitializedField##FIELD() {} \
|
||||
|
|
Загрузка…
Ссылка в новой задаче