[PATCH] [clang-tidy] Detect dependent initializer_lists in google-explicit-constructor.
Alexander Kornienko
alexfh at google.com
Thu Feb 5 04:49:04 PST 2015
================
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";
}
----------------
djasper wrote:
> 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.
The main reason to remove the qualified name comparison was to make the check consistent with the newly added handling of instantiation-dependent argument types (where I was lazy to check qualified name).
After thinking a bit, I'll better make both consistent in a different way. PTAL.
================
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) {}
----------------
djasper wrote:
> I recommend not checking the full error message every time. It is just too much churn if the warning gets changed.
You're right. I removed the check name, but I can make the patterns even shorter.
http://reviews.llvm.org/D7431
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list