summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp b/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp
index a07e0fff024..6c2f0a368af 100644
--- a/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp
+++ b/clang-tools-extra/clang-tidy/google/ExplicitMakePairCheck.cpp
@@ -25,8 +25,8 @@ namespace tidy {
namespace google {
namespace build {
-void
-ExplicitMakePairCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
+void ExplicitMakePairCheck::registerMatchers(
+ ast_matchers::MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
@@ -39,7 +39,8 @@ ExplicitMakePairCheck::registerMatchers(ast_matchers::MatchFinder *Finder) {
callee(expr(ignoringParenImpCasts(
declRefExpr(hasExplicitTemplateArgs(),
to(functionDecl(hasName("::std::make_pair"))))
- .bind("declref"))))).bind("call"),
+ .bind("declref")))))
+ .bind("call"),
this);
}
@@ -61,13 +62,13 @@ void ExplicitMakePairCheck::check(const MatchFinder::MatchResult &Result) {
Arg1->getType() != Call->getArg(1)->getType()) {
diag(Call->getLocStart(), "for C++11-compatibility, use pair directly")
<< FixItHint::CreateReplacement(
- SourceRange(DeclRef->getLocStart(), DeclRef->getLAngleLoc()),
- "std::pair<");
+ SourceRange(DeclRef->getLocStart(), DeclRef->getLAngleLoc()),
+ "std::pair<");
} else {
diag(Call->getLocStart(),
"for C++11-compatibility, omit template arguments from make_pair")
<< FixItHint::CreateRemoval(
- SourceRange(DeclRef->getLAngleLoc(), DeclRef->getRAngleLoc()));
+ SourceRange(DeclRef->getLAngleLoc(), DeclRef->getRAngleLoc()));
}
}
OpenPOWER on IntegriCloud