[clang-tidy] FunctionASTVisitor::TraverseStmt - use cast<> instead of dyn_cast<> to avoid dereference of nullptr

The pointer is referenced immediately, so assert the cast is correct instead of returning nullptr
This commit is contained in:
Simon Pilgrim 2022-02-12 11:04:20 +00:00
parent ed5d659038
commit 9acba5206a
1 changed files with 1 additions and 2 deletions

View File

@ -444,8 +444,7 @@ public:
// A little beautification.
// For conditional operator "cond ? true : false" point at the "?"
// symbol.
ConditionalOperator *COp = dyn_cast<ConditionalOperator>(Node);
Location = COp->getQuestionLoc();
Location = cast<ConditionalOperator>(Node)->getQuestionLoc();
}
// If we have found any reasons, let's account it.