summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/google
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2015-11-28 02:25:02 +0000
committerAlexander Kornienko <alexfh@google.com>2015-11-28 02:25:02 +0000
commit5eb134cc20b5805fd88075dd6aea6f78e749ca9c (patch)
tree590f42a12855cf111eba72772b6d5009375b2201 /clang-tools-extra/clang-tidy/google
parent88f4919a0c2a5ca3a70aa8f5b5fe58808753ae82 (diff)
downloadbcm5719-llvm-5eb134cc20b5805fd88075dd6aea6f78e749ca9c.tar.gz
bcm5719-llvm-5eb134cc20b5805fd88075dd6aea6f78e749ca9c.zip
[clang-tidy] google-explicit-constructor: improve the warning message
Also switch some more tests to %check_clang_tidy. llvm-svn: 254216
Diffstat (limited to 'clang-tools-extra/clang-tidy/google')
-rw-r--r--clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
index 68baf708007..e3095fe536e 100644
--- a/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/ExplicitConstructorCheck.cpp
@@ -119,9 +119,11 @@ void ExplicitConstructorCheck::check(const MatchFinder::MatchResult &Result) {
bool SingleArgument =
Ctor->getNumParams() == 1 && !Ctor->getParamDecl(0)->isParameterPack();
SourceLocation Loc = Ctor->getLocation();
- diag(Loc, SingleArgument ? "single-argument constructors must be explicit"
- : "constructors that are callable with a single "
- "argument must be marked explicit")
+ diag(Loc,
+ "%0 must be marked explicit to avoid unintentional implicit conversions")
+ << (SingleArgument
+ ? "single-argument constructors"
+ : "constructors that are callable with a single argument")
<< FixItHint::CreateInsertion(Loc, "explicit ");
}
OpenPOWER on IntegriCloud