diff options
-rw-r--r-- | compilerplugins/clang/commaoperator.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/compilerplugins/clang/commaoperator.cxx b/compilerplugins/clang/commaoperator.cxx index 4df9cea9b435..3e5df3d6e5d9 100644 --- a/compilerplugins/clang/commaoperator.cxx +++ b/compilerplugins/clang/commaoperator.cxx @@ -44,20 +44,22 @@ bool CommaOperator::VisitBinaryOperator(const BinaryOperator* binaryOp) return true; } const Stmt* parent = parentStmt(binaryOp); - if (isa<ParenExpr>(parent)) { - return true; - } - if (isa<BinaryOperator>(parent)) { - return true; - } - if (isa<ForStmt>(parent)) { - return true; - } - if (isa<ExprWithCleanups>(parent)) { - const Stmt* parent2 = parentStmt(parent); - if (isa<ForStmt>(parent2)) { + if (parent != nullptr) { + if (isa<ParenExpr>(parent)) { return true; } + if (isa<BinaryOperator>(parent)) { + return true; + } + if (isa<ForStmt>(parent)) { + return true; + } + if (isa<ExprWithCleanups>(parent)) { + const Stmt* parent2 = parentStmt(parent); + if (isa<ForStmt>(parent2)) { + return true; + } + } } // parent->dump(); report( |