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 15edf8725a8044e5cb681a5773e0ada1249690cb f0baa6fe14e67f53291ef6423ef6ea67903031ab --extensions cpp,h -- clang/lib/CodeGen/MitigationTagging.cpp clang/lib/CodeGen/MitigationTagging.h clang/unittests/CodeGen/MitigationTaggingTest.cpp llvm/include/llvm/Analysis/MitigationAnalysis.h llvm/lib/Analysis/MitigationAnalysis.cpp clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CGClass.cpp clang/lib/CodeGen/CGDecl.cpp clang/lib/CodeGen/CGExpr.cpp clang/lib/CodeGen/CGExprCXX.cpp clang/lib/CodeGen/CodeGenModule.cpp clang/lib/Driver/ToolChains/Clang.cpp llvm/lib/Passes/PassBuilder.cpp llvm/lib/Passes/PassBuilderPipelines.cpp `````````` </details> <details> <summary> View the diff from clang-format here. </summary> ``````````diff diff --git a/clang/lib/CodeGen/MitigationTagging.cpp b/clang/lib/CodeGen/MitigationTagging.cpp index 82a56ac87e..2f6f4c4a0d 100644 --- a/clang/lib/CodeGen/MitigationTagging.cpp +++ b/clang/lib/CodeGen/MitigationTagging.cpp @@ -77,15 +77,15 @@ void AttachMitigationMetadataToFunction(llvm::Function &F, llvm::MDNode *CombinedMD = llvm::MDNode::get(Context, MDs); F.setMetadata(kindID, CombinedMD); } else { - F.setMetadata(kindID, - llvm::MDNode::get(Context, std::vector<llvm::Metadata *> {NewMD})); + F.setMetadata(kindID, llvm::MDNode::get( + Context, std::vector<llvm::Metadata *>{NewMD})); } } void AttachMitigationMetadataToFunction(CodeGenFunction &CGF, enum MitigationKey key, bool enabled) { - AttachMitigationMetadataToFunction(*(CGF.CurFn), key, enabled, - CGF.CGM.getCodeGenOpts().MitigationAnalysis); + AttachMitigationMetadataToFunction( + *(CGF.CurFn), key, enabled, CGF.CGM.getCodeGenOpts().MitigationAnalysis); } } // namespace CodeGen diff --git a/clang/unittests/CodeGen/MitigationTaggingTest.cpp b/clang/unittests/CodeGen/MitigationTaggingTest.cpp index 1e31b00c4e..7325cc0d64 100644 --- a/clang/unittests/CodeGen/MitigationTaggingTest.cpp +++ b/clang/unittests/CodeGen/MitigationTaggingTest.cpp @@ -20,13 +20,12 @@ using namespace clang; namespace { TEST(MitigationTaggingTest, FlagDisabled) { - const char TestProgram[] = - "void HasStackProtector(int x, int y) " - "{ " - " char buf[x]; " - " while(y) " - " buf[y--] = 0; " - "} "; + const char TestProgram[] = "void HasStackProtector(int x, int y) " + "{ " + " char buf[x]; " + " while(y) " + " buf[y--] = 0; " + "} "; clang::LangOptions LO; LO.CPlusPlus = 1; @@ -39,7 +38,8 @@ TEST(MitigationTaggingTest, FlagDisabled) { clang::ParseAST(Compiler.compiler.getSema(), false, false); auto M = - static_cast<clang::CodeGenerator&>(Compiler.compiler.getASTConsumer()).GetModule(); + static_cast<clang::CodeGenerator &>(Compiler.compiler.getASTConsumer()) + .GetModule(); auto FuncPtr = M->begin(); auto *MD = FuncPtr->getMetadata("security_mitigations"); @@ -47,13 +47,12 @@ TEST(MitigationTaggingTest, FlagDisabled) { } TEST(MitigationTaggingTest, MetadataEnabledOnly) { - const char TestProgram[] = - "void HasStackProtector(int x, int y) " - "{ " - " char buf[x]; " - " while(y) " - " buf[y--] = 0; " - "} "; + const char TestProgram[] = "void HasStackProtector(int x, int y) " + "{ " + " char buf[x]; " + " while(y) " + " buf[y--] = 0; " + "} "; clang::CodeGenOptions CGO; CGO.MitigationAnalysis = true; @@ -67,7 +66,8 @@ TEST(MitigationTaggingTest, MetadataEnabledOnly) { clang::ParseAST(Compiler.compiler.getSema(), false, false); auto M = - static_cast<clang::CodeGenerator&>(Compiler.compiler.getASTConsumer()).GetModule(); + static_cast<clang::CodeGenerator &>(Compiler.compiler.getASTConsumer()) + .GetModule(); auto FuncPtr = M->begin(); auto *MD = FuncPtr->getMetadata("security_mitigations"); @@ -76,7 +76,8 @@ TEST(MitigationTaggingTest, MetadataEnabledOnly) { // Get All Enabled Mitigations std::unordered_map<std::string, bool> MDs; for (unsigned i = 0, n = MD->getNumOperands(); i != n; ++i) { - if (MD->getOperand(i) == nullptr) continue; + if (MD->getOperand(i) == nullptr) + continue; auto *node = dyn_cast<MDNode>(MD->getOperand(i)); if (node == nullptr) @@ -106,13 +107,12 @@ TEST(MitigationTaggingTest, MetadataEnabledOnly) { } TEST(MitigationTaggingTest, AutoVarInitZeroEnabled) { - const char TestProgram[] = - "void HasStackProtector(int x, int y) " - "{ " - " char buf[x]; " - " while(y) " - " buf[y--] = 0; " - "} "; + const char TestProgram[] = "void HasStackProtector(int x, int y) " + "{ " + " char buf[x]; " + " while(y) " + " buf[y--] = 0; " + "} "; clang::CodeGenOptions CGO; CGO.MitigationAnalysis = true; @@ -127,7 +127,8 @@ TEST(MitigationTaggingTest, AutoVarInitZeroEnabled) { clang::ParseAST(Compiler.compiler.getSema(), false, false); auto M = - static_cast<clang::CodeGenerator&>(Compiler.compiler.getASTConsumer()).GetModule(); + static_cast<clang::CodeGenerator &>(Compiler.compiler.getASTConsumer()) + .GetModule(); auto FuncPtr = M->begin(); auto *MD = FuncPtr->getMetadata("security_mitigations"); @@ -136,7 +137,8 @@ TEST(MitigationTaggingTest, AutoVarInitZeroEnabled) { // Get All Enabled Mitigations std::unordered_map<std::string, bool> MDs; for (unsigned i = 0, n = MD->getNumOperands(); i != n; ++i) { - if (MD->getOperand(i) == nullptr) continue; + if (MD->getOperand(i) == nullptr) + continue; auto *node = dyn_cast<MDNode>(MD->getOperand(i)); if (node == nullptr) @@ -166,13 +168,12 @@ TEST(MitigationTaggingTest, AutoVarInitZeroEnabled) { } TEST(MitigationTaggingTest, StackClashEnabled) { - const char TestProgram[] = - "void HasStackProtector(int x, int y) " - "{ " - " char buf[x]; " - " while(y) " - " buf[y--] = 0; " - "} "; + const char TestProgram[] = "void HasStackProtector(int x, int y) " + "{ " + " char buf[x]; " + " while(y) " + " buf[y--] = 0; " + "} "; clang::CodeGenOptions CGO; CGO.MitigationAnalysis = true; @@ -187,7 +188,8 @@ TEST(MitigationTaggingTest, StackClashEnabled) { clang::ParseAST(Compiler.compiler.getSema(), false, false); auto M = - static_cast<clang::CodeGenerator&>(Compiler.compiler.getASTConsumer()).GetModule(); + static_cast<clang::CodeGenerator &>(Compiler.compiler.getASTConsumer()) + .GetModule(); auto FuncPtr = M->begin(); auto *MD = FuncPtr->getMetadata("security_mitigations"); @@ -196,7 +198,8 @@ TEST(MitigationTaggingTest, StackClashEnabled) { // Get All Enabled Mitigations std::unordered_map<std::string, bool> MDs; for (unsigned i = 0, n = MD->getNumOperands(); i != n; ++i) { - if (MD->getOperand(i) == nullptr) continue; + if (MD->getOperand(i) == nullptr) + continue; auto *node = dyn_cast<MDNode>(MD->getOperand(i)); if (node == nullptr) @@ -226,13 +229,12 @@ TEST(MitigationTaggingTest, StackClashEnabled) { } TEST(MitigationTaggingTest, StackProtectorEnabled) { - const char TestProgram[] = - "void HasStackProtector(int x, int y) " - "{ " - " char buf[x]; " - " while(y) " - " buf[y--] = 0; " - "} "; + const char TestProgram[] = "void HasStackProtector(int x, int y) " + "{ " + " char buf[x]; " + " while(y) " + " buf[y--] = 0; " + "} "; clang::CodeGenOptions CGO; CGO.MitigationAnalysis = true; @@ -247,7 +249,8 @@ TEST(MitigationTaggingTest, StackProtectorEnabled) { clang::ParseAST(Compiler.compiler.getSema(), false, false); auto M = - static_cast<clang::CodeGenerator&>(Compiler.compiler.getASTConsumer()).GetModule(); + static_cast<clang::CodeGenerator &>(Compiler.compiler.getASTConsumer()) + .GetModule(); auto FuncPtr = M->begin(); auto *MD = FuncPtr->getMetadata("security_mitigations"); @@ -256,7 +259,8 @@ TEST(MitigationTaggingTest, StackProtectorEnabled) { // Get All Enabled Mitigations std::unordered_map<std::string, bool> MDs; for (unsigned i = 0, n = MD->getNumOperands(); i != n; ++i) { - if (MD->getOperand(i) == nullptr) continue; + if (MD->getOperand(i) == nullptr) + continue; auto *node = dyn_cast<MDNode>(MD->getOperand(i)); if (node == nullptr) @@ -286,13 +290,12 @@ TEST(MitigationTaggingTest, StackProtectorEnabled) { } TEST(MitigationTaggingTest, StackProtectorStrongEnabled) { - const char TestProgram[] = - "void HasStackProtector(int x, int y) " - "{ " - " char buf[x]; " - " while(y) " - " buf[y--] = 0; " - "} "; + const char TestProgram[] = "void HasStackProtector(int x, int y) " + "{ " + " char buf[x]; " + " while(y) " + " buf[y--] = 0; " + "} "; clang::CodeGenOptions CGO; CGO.MitigationAnalysis = true; @@ -307,7 +310,8 @@ TEST(MitigationTaggingTest, StackProtectorStrongEnabled) { clang::ParseAST(Compiler.compiler.getSema(), false, false); auto M = - static_cast<clang::CodeGenerator&>(Compiler.compiler.getASTConsumer()).GetModule(); + static_cast<clang::CodeGenerator &>(Compiler.compiler.getASTConsumer()) + .GetModule(); auto FuncPtr = M->begin(); auto *MD = FuncPtr->getMetadata("security_mitigations"); @@ -316,7 +320,8 @@ TEST(MitigationTaggingTest, StackProtectorStrongEnabled) { // Get All Enabled Mitigations std::unordered_map<std::string, bool> MDs; for (unsigned i = 0, n = MD->getNumOperands(); i != n; ++i) { - if (MD->getOperand(i) == nullptr) continue; + if (MD->getOperand(i) == nullptr) + continue; auto *node = dyn_cast<MDNode>(MD->getOperand(i)); if (node == nullptr) @@ -346,13 +351,12 @@ TEST(MitigationTaggingTest, StackProtectorStrongEnabled) { } TEST(MitigationTaggingTest, StackProtectorAllEnabled) { - const char TestProgram[] = - "void HasStackProtector(int x, int y) " - "{ " - " char buf[x]; " - " while(y) " - " buf[y--] = 0; " - "} "; + const char TestProgram[] = "void HasStackProtector(int x, int y) " + "{ " + " char buf[x]; " + " while(y) " + " buf[y--] = 0; " + "} "; clang::CodeGenOptions CGO; CGO.MitigationAnalysis = true; @@ -367,7 +371,8 @@ TEST(MitigationTaggingTest, StackProtectorAllEnabled) { clang::ParseAST(Compiler.compiler.getSema(), false, false); auto M = - static_cast<clang::CodeGenerator&>(Compiler.compiler.getASTConsumer()).GetModule(); + static_cast<clang::CodeGenerator &>(Compiler.compiler.getASTConsumer()) + .GetModule(); auto FuncPtr = M->begin(); auto *MD = FuncPtr->getMetadata("security_mitigations"); @@ -376,7 +381,8 @@ TEST(MitigationTaggingTest, StackProtectorAllEnabled) { // Get All Enabled Mitigations std::unordered_map<std::string, bool> MDs; for (unsigned i = 0, n = MD->getNumOperands(); i != n; ++i) { - if (MD->getOperand(i) == nullptr) continue; + if (MD->getOperand(i) == nullptr) + continue; auto *node = dyn_cast<MDNode>(MD->getOperand(i)); if (node == nullptr) `````````` </details> https://github.com/llvm/llvm-project/pull/130103 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits