[llvm] [llvm-cgdata] Fix the build in the non-driver mode (PR #100077)

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 23 01:22:09 PDT 2024


https://github.com/petrhosek created https://github.com/llvm/llvm-project/pull/100077

This addresses the breakage introduced in #100066.

>From 4fa7249126a4a76a7e92be73558def88d1bdd4bb Mon Sep 17 00:00:00 2001
From: Petr Hosek <phosek at google.com>
Date: Tue, 23 Jul 2024 08:21:09 +0000
Subject: [PATCH] [llvm-cgdata] Fix the build in the non-driver mode

This addresses the breakage introduced in #100066.
---
 llvm/tools/llvm-cgdata/llvm-cgdata.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp b/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
index 3303ffd9d863b..4ad0357b95d86 100644
--- a/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
+++ b/llvm/tools/llvm-cgdata/llvm-cgdata.cpp
@@ -18,7 +18,7 @@
 #include "llvm/IR/LLVMContext.h"
 #include "llvm/Object/Archive.h"
 #include "llvm/Support/CommandLine.h"
-#include "llvm/Support/LLVMDriver.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/VirtualFileSystem.h"
 #include "llvm/Support/WithColor.h"
@@ -240,8 +240,8 @@ static int show_main(int argc, const char *argv[]) {
   return 0;
 }
 
-int llvm_cgdata_main(int argc, char **argvNonConst, const llvm::ToolContext &) {
-  const char **argv = const_cast<const char **>(argvNonConst);
+int main(int argc, const char **argv) {
+  llvm::InitLLVM X(argc, argv);
 
   StringRef ProgName(sys::path::filename(argv[0]));
 



More information about the llvm-commits mailing list