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 origin/main HEAD --extensions cpp,h --
clang/include/clang/Lex/HeaderSearchOptions.h
clang/include/clang/Serialization/ASTWriter.h clang/lib/CodeGen/CGDeclCXX.cpp
clang/lib/CodeGen/CGObjCMac.cpp clang/lib/Sema/SemaOverload.cpp
clang/lib/Sema/SemaStmt.cpp lld/ELF/Driver.cpp
llvm/include/llvm/ADT/GenericUniformityImpl.h llvm/include/llvm/ADT/SetVector.h
llvm/include/llvm/ADT/SmallPtrSet.h
mlir/lib/Dialect/SCF/Transforms/ParallelLoopFusion.cpp
offload/plugins-nextgen/common/include/RPC.h
offload/plugins-nextgen/common/src/RPC.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index bff45a866..f6c74c5a5 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -1938,88 +1938,80 @@ Sema::ActOnDoStmt(SourceLocation DoLoc, Stmt *Body,
namespace {
// Use SetVector since the diagnostic cares about the ordering of the Decl's.
- using DeclSetVector = llvm::SetVector<VarDecl *>;
+using DeclSetVector = llvm::SetVector<VarDecl *>;
- // This visitor will traverse a conditional statement and store all
- // the evaluated decls into a vector. Simple is set to true if none
- // of the excluded constructs are used.
- class DeclExtractor : public EvaluatedExprVisitor<DeclExtractor> {
- DeclSetVector &Decls;
- SmallVectorImpl<SourceRange> &Ranges;
- bool Simple;
- public:
- typedef EvaluatedExprVisitor<DeclExtractor> Inherited;
+// This visitor will traverse a conditional statement and store all
+// the evaluated decls into a vector. Simple is set to true if none
+// of the excluded constructs are used.
+class DeclExtractor : public EvaluatedExprVisitor<DeclExtractor> {
+ DeclSetVector &Decls;
+ SmallVectorImpl<SourceRange> &Ranges;
+ bool Simple;
- DeclExtractor(Sema &S, DeclSetVector &Decls,
- SmallVectorImpl<SourceRange> &Ranges) :
- Inherited(S.Context),
- Decls(Decls),
- Ranges(Ranges),
- Simple(true) {}
-
- bool isSimple() { return Simple; }
+public:
+ typedef EvaluatedExprVisitor<DeclExtractor> Inherited;
- // Replaces the method in EvaluatedExprVisitor.
- void VisitMemberExpr(MemberExpr* E) {
- Simple = false;
- }
+ DeclExtractor(Sema &S, DeclSetVector &Decls,
+ SmallVectorImpl<SourceRange> &Ranges)
+ : Inherited(S.Context), Decls(Decls), Ranges(Ranges), Simple(true) {}
- // Any Stmt not explicitly listed will cause the condition to be marked
- // complex.
- void VisitStmt(Stmt *S) { Simple = false; }
+ bool isSimple() { return Simple; }
- void VisitBinaryOperator(BinaryOperator *E) {
- Visit(E->getLHS());
- Visit(E->getRHS());
- }
+ // Replaces the method in EvaluatedExprVisitor.
+ void VisitMemberExpr(MemberExpr *E) { Simple = false; }
- void VisitCastExpr(CastExpr *E) {
- Visit(E->getSubExpr());
- }
+ // Any Stmt not explicitly listed will cause the condition to be marked
+ // complex.
+ void VisitStmt(Stmt *S) { Simple = false; }
- void VisitUnaryOperator(UnaryOperator *E) {
- // Skip checking conditionals with derefernces.
- if (E->getOpcode() == UO_Deref)
- Simple = false;
- else
- Visit(E->getSubExpr());
- }
+ void VisitBinaryOperator(BinaryOperator *E) {
+ Visit(E->getLHS());
+ Visit(E->getRHS());
+ }
- void VisitConditionalOperator(ConditionalOperator *E) {
- Visit(E->getCond());
- Visit(E->getTrueExpr());
- Visit(E->getFalseExpr());
- }
+ void VisitCastExpr(CastExpr *E) { Visit(E->getSubExpr()); }
- void VisitParenExpr(ParenExpr *E) {
+ void VisitUnaryOperator(UnaryOperator *E) {
+ // Skip checking conditionals with derefernces.
+ if (E->getOpcode() == UO_Deref)
+ Simple = false;
+ else
Visit(E->getSubExpr());
- }
-
- void VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
- Visit(E->getOpaqueValue()->getSourceExpr());
- Visit(E->getFalseExpr());
- }
+ }
- void VisitIntegerLiteral(IntegerLiteral *E) { }
- void VisitFloatingLiteral(FloatingLiteral *E) { }
- void VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) { }
- void VisitCharacterLiteral(CharacterLiteral *E) { }
- void VisitGNUNullExpr(GNUNullExpr *E) { }
- void VisitImaginaryLiteral(ImaginaryLiteral *E) { }
+ void VisitConditionalOperator(ConditionalOperator *E) {
+ Visit(E->getCond());
+ Visit(E->getTrueExpr());
+ Visit(E->getFalseExpr());
+ }
- void VisitDeclRefExpr(DeclRefExpr *E) {
- VarDecl *VD = dyn_cast<VarDecl>(E->getDecl());
- if (!VD) {
- // Don't allow unhandled Decl types.
- Simple = false;
- return;
- }
+ void VisitParenExpr(ParenExpr *E) { Visit(E->getSubExpr()); }
- Ranges.push_back(E->getSourceRange());
+ void VisitBinaryConditionalOperator(BinaryConditionalOperator *E) {
+ Visit(E->getOpaqueValue()->getSourceExpr());
+ Visit(E->getFalseExpr());
+ }
- Decls.insert(VD);
+ void VisitIntegerLiteral(IntegerLiteral *E) {}
+ void VisitFloatingLiteral(FloatingLiteral *E) {}
+ void VisitCXXBoolLiteralExpr(CXXBoolLiteralExpr *E) {}
+ void VisitCharacterLiteral(CharacterLiteral *E) {}
+ void VisitGNUNullExpr(GNUNullExpr *E) {}
+ void VisitImaginaryLiteral(ImaginaryLiteral *E) {}
+
+ void VisitDeclRefExpr(DeclRefExpr *E) {
+ VarDecl *VD = dyn_cast<VarDecl>(E->getDecl());
+ if (!VD) {
+ // Don't allow unhandled Decl types.
+ Simple = false;
+ return;
}
+ Ranges.push_back(E->getSourceRange());
+
+ Decls.insert(VD);
+ }
+
}; // end class DeclExtractor
// DeclMatcher checks to see if the decls are used in a non-evaluated
``````````
</details>
https://github.com/llvm/llvm-project/pull/231880
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits