[llvm] Llvm cgdata retry (PR #101461)

via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 01:44:59 PDT 2024


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 7088a5ed880f29129ec844c66068e8cb61ca98bf 7852c16f53046192880f7237ae7039e9a17d2ca3 --extensions h,inc,cpp -- llvm/include/llvm/CodeGenData/CodeGenData.h llvm/include/llvm/CodeGenData/CodeGenData.inc llvm/include/llvm/CodeGenData/CodeGenDataReader.h llvm/include/llvm/CodeGenData/CodeGenDataWriter.h llvm/lib/CodeGenData/CodeGenData.cpp llvm/lib/CodeGenData/CodeGenDataReader.cpp llvm/lib/CodeGenData/CodeGenDataWriter.cpp llvm/tools/llvm-cgdata/llvm-cgdata.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp b/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
index 794b641865..d6e520d332 100644
--- a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
+++ b/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
@@ -71,7 +71,6 @@ public:
 };
 } // end anonymous namespace
 
-
 // Options
 static std::string ToolName;
 static std::string OutputFilename = "-";
@@ -112,8 +111,9 @@ static void exitWithErrorCode(std::error_code EC, StringRef Whence = "") {
 static int convert_main(int argc, const char *argv[]) {
   std::error_code EC;
   raw_fd_ostream OS(OutputFilename, EC,
-                    OutputFormat == CGDataFormat::Text ? sys::fs::OF_TextWithCRLF
-                                            : sys::fs::OF_None);
+                    OutputFormat == CGDataFormat::Text
+                        ? sys::fs::OF_TextWithCRLF
+                        : sys::fs::OF_None);
   if (EC)
     exitWithErrorCode(EC, OutputFilename);
 
@@ -164,7 +164,8 @@ static bool handleArchive(StringRef Filename, Archive &Arch,
 
 static bool handleBuffer(StringRef Filename, MemoryBufferRef Buffer,
                          OutlinedHashTreeRecord &GlobalOutlineRecord) {
-  Expected<std::unique_ptr<object::Binary>> BinOrErr = object::createBinary(Buffer);
+  Expected<std::unique_ptr<object::Binary>> BinOrErr =
+      object::createBinary(Buffer);
   if (Error E = BinOrErr.takeError())
     exitWithError(std::move(E), Filename);
 
@@ -208,8 +209,9 @@ static int merge_main(int argc, const char *argv[]) {
 
   std::error_code EC;
   raw_fd_ostream OS(OutputFilename, EC,
-                    OutputFormat == CGDataFormat::Text ? sys::fs::OF_TextWithCRLF
-                                            : sys::fs::OF_None);
+                    OutputFormat == CGDataFormat::Text
+                        ? sys::fs::OF_TextWithCRLF
+                        : sys::fs::OF_None);
   if (EC)
     exitWithErrorCode(EC, OutputFilename);
 
@@ -263,9 +265,10 @@ static void parseArgs(int argc, char **argv) {
       });
 
   if (Args.hasArg(OPT_help)) {
-    Tbl.printHelp(llvm::outs(),
-                  "llvm-cgdata [options] <action> (<binary files>|<.cgdata file>)",
-                  ToolName.c_str());
+    Tbl.printHelp(
+        llvm::outs(),
+        "llvm-cgdata [options] <action> (<binary files>|<.cgdata file>)",
+        ToolName.c_str());
     std::exit(0);
   }
   if (Args.hasArg(OPT_version)) {
@@ -297,7 +300,8 @@ static void parseArgs(int argc, char **argv) {
     OutputFilename = Args.getLastArgValue(OPT_output);
     for (auto &Filename : InputFilenames)
       if (Filename == OutputFilename)
-        exitWithError("Input file name cannot be the same as the output file name!\n");
+        exitWithError(
+            "Input file name cannot be the same as the output file name!\n");
   }
 
   SmallVector<opt::Arg *, 1> ActionArgs(Args.filtered(OPT_action_group));
@@ -333,7 +337,7 @@ int llvm_cgdata_main(int argc, char **argvNonConst, const llvm::ToolContext &) {
   const char **argv = const_cast<const char **>(argvNonConst);
   parseArgs(argc, argvNonConst);
 
-  switch(Action) {
+  switch (Action) {
   case CGDataAction::Convert:
     return convert_main(argc, argv);
   case CGDataAction::Merge:

``````````

</details>


https://github.com/llvm/llvm-project/pull/101461


More information about the llvm-commits mailing list