[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:
Felix Berger 2016-05-03 01:41:19 +00:00
Родитель 087b7bae77
Коммит fd58c1bcb9
2 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -31,6 +31,8 @@ void fieldsRequiringInit(const RecordDecl::field_range &Fields,
ASTContext &Context, ASTContext &Context,
SmallPtrSetImpl<const FieldDecl *> &FieldsToInit) { SmallPtrSetImpl<const FieldDecl *> &FieldsToInit) {
for (const FieldDecl *F : Fields) { for (const FieldDecl *F : Fields) {
if (F->hasInClassInitializer())
continue;
QualType Type = F->getType(); QualType Type = F->getType();
if (!F->hasInClassInitializer() && if (!F->hasInClassInitializer() &&
type_traits::isTriviallyDefaultConstructible(Type, Context)) type_traits::isTriviallyDefaultConstructible(Type, Context))

Просмотреть файл

@ -85,6 +85,14 @@ struct NegativeInitializedInBody {
int I; 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) \ #define UNINITIALIZED_FIELD_IN_MACRO_BODY(FIELD) \
struct UninitializedField##FIELD { \ struct UninitializedField##FIELD { \
UninitializedField##FIELD() {} \ UninitializedField##FIELD() {} \