[PATCH] [clang-tidy] Detect dependent initializer_lists in google-explicit-constructor.
Daniel Jasper
djasper at google.com
Thu Feb 5 04:18:05 PST 2015
Looks good.
================
Comment at: clang-tidy/google/ExplicitConstructorCheck.cpp:61
@@ -55,6 +60,3 @@
ClassTemplateDecl *Template = Specialization->getSpecializedTemplate();
- // First use the fast getName() method to avoid unnecessary calls to the
- // slow getQualifiedNameAsString().
- return Template->getName() == "initializer_list" &&
- Template->getQualifiedNameAsString() == "std::initializer_list";
+ return Template->getName() == "initializer_list";
}
----------------
I am fine with removing the extra-check here as I don't think it'll lead to a significant amount of false negatives, but please mention that in the patch description.
================
Comment at: test/clang-tidy/google-explicit-constructor.cpp:66
@@ -65,3 +65,3 @@
explicit B(const ::std::initializer_list<char> &list5) {}
- // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: initializer-list constructor should not be declared explicit [google-explicit-constructor]
+ // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: initializer-list constructor should not be declared explicit
// CHECK-FIXES: {{^ }}B(const ::std::initializer_list<char> &list5) {}
----------------
I recommend not checking the full error message every time. It is just too much churn if the warning gets changed.
http://reviews.llvm.org/D7431
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list