summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2015-03-31 16:24:44 +0000
committerAlexander Kornienko <alexfh@google.com>2015-03-31 16:24:44 +0000
commit0b024619dfe4da40b6c8a7ef46bdc1815d11f7a7 (patch)
tree0414906bf29e84ce9e4dfb93fcca936aa322435f /clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
parentd399d94837e045fb189a5aa051743899052a1dd2 (diff)
downloadbcm5719-llvm-0b024619dfe4da40b6c8a7ef46bdc1815d11f7a7.tar.gz
bcm5719-llvm-0b024619dfe4da40b6c8a7ef46bdc1815d11f7a7.zip
[clang-tidy] Clarify message for the google-explicit-constructor check
Use "constructors that are callable with a single argument" instead of "single-argument constructors" when referring to constructors using default arguments or parameter packs. llvm-svn: 233702
Diffstat (limited to 'clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
index d262f9fa89c..9552e1afa34 100644
--- a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
@@ -113,8 +113,12 @@ void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
takesInitializerList)
return;
+ bool SingleArgument =
+ Ctor->getNumParams() == 1 && !Ctor->getParamDecl(0)->isParameterPack();
SourceLocation Loc = Ctor->getLocation();
- diag(Loc, "single-argument constructors must be explicit")
+ diag(Loc, SingleArgument ? "single-argument constructors must be explicit"
+ : "constructors that are callable with a single "
+ "argument must be marked explicit")
<< FixItHint::CreateInsertion(Loc, "explicit ");
}
OpenPOWER on IntegriCloud