summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2016-01-29 15:21:43 +0000
committerAlexander Kornienko <alexfh@google.com>2016-01-29 15:21:43 +0000
commit42e8cf4a70c04088db873a670a290ec396dbfc3f (patch)
tree73b846fc25b9f6bcd6098ce791e7cbd3131f89fe /clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
parent40d307d12089fb7ee05dd5900cea6362fce89f1f (diff)
downloadbcm5719-llvm-42e8cf4a70c04088db873a670a290ec396dbfc3f.tar.gz
bcm5719-llvm-42e8cf4a70c04088db873a670a290ec396dbfc3f.zip
[clang-tidy] Fix style issues. NFC
llvm-svn: 259196
Diffstat (limited to 'clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp b/clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
index 1752e2d0f10..c20598e40a4 100644
--- a/clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
+++ b/clang-tools-extra/clang-tidy/performance/ImplicitCastInLoopCheck.cpp
@@ -36,8 +36,7 @@ bool IsNonTrivialImplicitCast(const Stmt* ST) {
}
} // namespace
-void ImplicitCastInLoopCheck::registerMatchers(
- ast_matchers::MatchFinder* Finder) {
+void ImplicitCastInLoopCheck::registerMatchers(MatchFinder *Finder) {
// We look for const ref loop variables that (optionally inside an
// ExprWithCleanup) materialize a temporary, and contain a implicit cast. The
// check on the implicit cast is done in check() because we can't access
@@ -57,28 +56,25 @@ void ImplicitCastInLoopCheck::registerMatchers(
this);
}
-void ImplicitCastInLoopCheck::check(
- const ast_matchers::MatchFinder::MatchResult &Result) {
+void ImplicitCastInLoopCheck::check(const MatchFinder::MatchResult &Result) {
const auto* VD = Result.Nodes.getNodeAs<VarDecl>("faulty-var");
const auto* Init = Result.Nodes.getNodeAs<Expr>("init");
const auto* OperatorCall =
Result.Nodes.getNodeAs<CXXOperatorCallExpr>("operator-call");
- if (const auto* Cleanup = dyn_cast<ExprWithCleanups>(Init)) {
+ if (const auto* Cleanup = dyn_cast<ExprWithCleanups>(Init))
Init = Cleanup->getSubExpr();
- }
+
const auto* Materialized = dyn_cast<MaterializeTemporaryExpr>(Init);
- if (!Materialized) {
+ if (!Materialized)
return;
- }
// We ignore NoOp casts. Those are generated if the * operator on the
// iterator returns a value instead of a reference, and the loop variable
// is a reference. This situation is fine (it probably produces the same
// code at the end).
- if (IsNonTrivialImplicitCast(Materialized->getTemporary())) {
+ if (IsNonTrivialImplicitCast(Materialized->getTemporary()))
ReportAndFix(Result.Context, VD, OperatorCall);
- }
}
void ImplicitCastInLoopCheck::ReportAndFix(
OpenPOWER on IntegriCloud