[PATCH] D34932: [clang-tidy] Resolve cppcoreguidelines-pro-type-member-init false positive
Jonas Devlieghere via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 3 09:47:16 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL307040: [clang-tidy] Resolve cppcoreguidelines-pro-type-member-init false positive (authored by JDevlieghere).
Changed prior to commit:
https://reviews.llvm.org/D34932?vs=105023&id=105102#toc
Repository:
rL LLVM
https://reviews.llvm.org/D34932
Files:
clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
Index: clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
+++ clang-tools-extra/trunk/clang-tidy/cppcoreguidelines/ProTypeMemberInitCheck.cpp
@@ -449,6 +449,9 @@
// 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());
Index: clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
===================================================================
--- clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
+++ clang-tools-extra/trunk/test/clang-tidy/cppcoreguidelines-pro-type-member-init.cpp
@@ -473,3 +473,16 @@
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);
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34932.105102.patch
Type: text/x-patch
Size: 1417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170703/1e3fb8d8/attachment-0001.bin>
More information about the cfe-commits
mailing list