[clang-tools-extra] r307040 - [clang-tidy] Resolve cppcoreguidelines-pro-type-member-init false positive
Jonas Devlieghere via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 3 09:46:47 PDT 2017
Author: jdevlieghere
Date: Mon Jul 3 09:46:46 2017
New Revision: 307040
URL: http://llvm.org/viewvc/llvm-project?rev=307040&view=rev
Log:
[clang-tidy] Resolve cppcoreguidelines-pro-type-member-init false positive
Summary: https://bugs.llvm.org/show_bug.cgi?id=33557
Reviewers: Eugene.Zelenko, alexfh, aaron.ballman, hokein
Reviewed By: aaron.ballman, hokein
Subscribers: cfe-commits, nemanjai, xazax.hun, kbarton
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D34932
Modified:
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
Modified: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp?rev=307040&r1=307039&r2=307040&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp Mon Jul 3 09:46:46 2017
@@ -449,6 +449,9 @@ void ProTypeMemberInitCheck::checkMissin
// Remove any bases that were explicitly written in the initializer list.
if (Ctor) {
+ if (Ctor->isImplicit())
+ return;
+
for (const CXXCtorInitializer *Init : Ctor->inits()) {
if (Init->isBaseInitializer() && Init->isWritten())
BasesToInit.erase(Init->getBaseClass()->getAsCXXRecordDecl());
Modified: clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp?rev=307040&r1=307039&r2=307040&view=diff
==============================================================================
--- clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp (original)
+++ clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp Mon Jul 3 09:46:46 2017
@@ -473,3 +473,16 @@ struct NegativeInitializedBitfieldMember
unsigned F : 5;
unsigned G : 5;
};
+
+struct NegativeImplicitInheritedCtorBase {
+ NegativeImplicitInheritedCtorBase(unsigned F) : F(F) {}
+ unsigned F;
+};
+
+struct NegativeImplicitInheritedCtor : NegativeImplicitInheritedCtorBase {
+ using NegativeImplicitInheritedCtorBase::NegativeImplicitInheritedCtorBase;
+};
+
+void Bug33557() {
+ NegativeImplicitInheritedCtor I(5);
+}
More information about the cfe-commits
mailing list