Bug 1483953 - Add a FixIt hint for the ExplicitImplicitChecker analysis. r=Ehsan

Differential Revision: https://phabricator.services.mozilla.com/D4191

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andi-Bogdan Postelnicu 2018-08-24 14:11:26 +00:00
parent 6ac001b7a4
commit 2238536677

View File

@ -24,10 +24,13 @@ void ExplicitImplicitChecker::check(const MatchFinder::MatchResult &Result) {
const CXXRecordDecl *Declaration =
Result.Nodes.getNodeAs<CXXRecordDecl>("class");
FixItHint FixItHint =
FixItHint::CreateInsertion(Ctor->getLocation(), "explicit ");
diag(Ctor->getLocation(), "bad implicit conversion constructor for %0",
DiagnosticIDs::Error)
<< Declaration->getDeclName();
diag(Ctor->getLocation(),
"consider adding the explicit keyword to the constructor",
DiagnosticIDs::Note);
DiagnosticIDs::Note)
<< FixItHint;
}