github-actions[bot] wrote: <!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning: <details> <summary> You can test this locally with the following command: </summary> ``````````bash git-clang-format --diff 3c6f91e5b671321c95259dabecdbdfe4a6d69ce1 3da6980d1957c19bdb821c6059c032b1e1c55863 -- clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp index 86b42b12c9..7ef6b9d1df 100644 --- a/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp +++ b/clang/lib/Analysis/FlowSensitive/DataflowEnvironment.cpp @@ -500,85 +500,85 @@ public: ResultObjectMap[E] = Loc; - switch(E->getStmtClass()) { - // The following AST node kinds are "original initializers": They are the - // lowest-level AST node that initializes a given object, and nothing - // below them can initialize the same object (or part of it). - case Stmt::CXXConstructExprClass: - case Stmt::CallExprClass: - case Stmt::LambdaExprClass: - case Stmt::CXXDefaultArgExprClass: - case Stmt::CXXDefaultInitExprClass: - case Stmt::CXXStdInitializerListExprClass: + switch (E->getStmtClass()) { + // The following AST node kinds are "original initializers": They are the + // lowest-level AST node that initializes a given object, and nothing + // below them can initialize the same object (or part of it). + case Stmt::CXXConstructExprClass: + case Stmt::CallExprClass: + case Stmt::LambdaExprClass: + case Stmt::CXXDefaultArgExprClass: + case Stmt::CXXDefaultInitExprClass: + case Stmt::CXXStdInitializerListExprClass: + return; + case Stmt::BinaryOperatorClass: { + auto *Op = cast<BinaryOperator>(E); + if (Op->getOpcode() == BO_Cmp) { + // Builtin `<=>` returns a `std::strong_ordering` object. We + // consider this to be an "original" initializer too (see above). return; - case Stmt::BinaryOperatorClass: { - auto *Op = cast<BinaryOperator>(E); - if (Op->getOpcode() == BO_Cmp) { - // Builtin `<=>` returns a `std::strong_ordering` object. We - // consider this to be an "original" initializer too (see above). - return; - } - if (Op->isCommaOp()) { - PropagateResultObject(Op->getRHS(), Loc); - return; - } - // We don't expect any other binary operators to produce a record - // prvalue, so if we get here, we've hit some case we don't know - // about. - assert(false); + } + if (Op->isCommaOp()) { + PropagateResultObject(Op->getRHS(), Loc); return; } - case Stmt::BinaryConditionalOperatorClass: - case Stmt::ConditionalOperatorClass: { - auto *Cond = cast<AbstractConditionalOperator>(E); - PropagateResultObject(Cond->getTrueExpr(), Loc); - PropagateResultObject(Cond->getFalseExpr(), Loc); + // We don't expect any other binary operators to produce a record + // prvalue, so if we get here, we've hit some case we don't know + // about. + assert(false); + return; + } + case Stmt::BinaryConditionalOperatorClass: + case Stmt::ConditionalOperatorClass: { + auto *Cond = cast<AbstractConditionalOperator>(E); + PropagateResultObject(Cond->getTrueExpr(), Loc); + PropagateResultObject(Cond->getFalseExpr(), Loc); + return; + } + case Stmt::InitListExprClass: { + auto *InitList = cast<InitListExpr>(E); + if (!InitList->isSemanticForm()) + return; + if (InitList->isTransparent()) { + PropagateResultObject(InitList->getInit(0), Loc); return; } - case Stmt::InitListExprClass: { - auto *InitList = cast<InitListExpr>(E); - if (!InitList->isSemanticForm()) - return; - if (InitList->isTransparent()) { - PropagateResultObject(InitList->getInit(0), Loc); - return; - } - RecordInitListHelper InitListHelper(InitList); + RecordInitListHelper InitListHelper(InitList); - for (auto [Base, Init] : InitListHelper.base_inits()) { - assert(Base->getType().getCanonicalType() == - Init->getType().getCanonicalType()); + for (auto [Base, Init] : InitListHelper.base_inits()) { + assert(Base->getType().getCanonicalType() == + Init->getType().getCanonicalType()); - // Storage location for the base class is the same as that of the - // derived class because we "flatten" the object hierarchy and put all - // fields in `RecordStorageLocation` of the derived class. - PropagateResultObject(Init, Loc); - } - - for (auto [Field, Init] : InitListHelper.field_inits()) { - // Fields of non-record type are handled in - // `TransferVisitor::VisitInitListExpr()`. - if (!Field->getType()->isRecordType()) - continue; - PropagateResultObject( - Init, cast<RecordStorageLocation>(Loc->getChild(*Field))); - } - return; + // Storage location for the base class is the same as that of the + // derived class because we "flatten" the object hierarchy and put all + // fields in `RecordStorageLocation` of the derived class. + PropagateResultObject(Init, Loc); } - default: { - // All other expression nodes that propagate a record prvalue should - // have exactly one child. - SmallVector<Stmt *, 1> Children(E->child_begin(), E->child_end()); - LLVM_DEBUG({ - if (Children.size() != 1) - E->dump(); - }); - assert(Children.size() == 1); - for (Stmt *S : Children) - PropagateResultObject(cast<Expr>(S), Loc); - return; + + for (auto [Field, Init] : InitListHelper.field_inits()) { + // Fields of non-record type are handled in + // `TransferVisitor::VisitInitListExpr()`. + if (!Field->getType()->isRecordType()) + continue; + PropagateResultObject( + Init, cast<RecordStorageLocation>(Loc->getChild(*Field))); } + return; + } + default: { + // All other expression nodes that propagate a record prvalue should + // have exactly one child. + SmallVector<Stmt *, 1> Children(E->child_begin(), E->child_end()); + LLVM_DEBUG({ + if (Children.size() != 1) + E->dump(); + }); + assert(Children.size() == 1); + for (Stmt *S : Children) + PropagateResultObject(cast<Expr>(S), Loc); + return; + } } } `````````` </details> https://github.com/llvm/llvm-project/pull/88865 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits