[llvm] 668e33c - [dwp][libtool-darwin][sancov] Enable llvm-driver

Andrés Villegas via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 11:36:24 PDT 2023


Author: Andrés Villegas
Date: 2023-08-01T18:36:07Z
New Revision: 668e33c6401abe7844691fb7d47a3cf2d2012dbc

URL: https://github.com/llvm/llvm-project/commit/668e33c6401abe7844691fb7d47a3cf2d2012dbc
DIFF: https://github.com/llvm/llvm-project/commit/668e33c6401abe7844691fb7d47a3cf2d2012dbc.diff

LOG: [dwp][libtool-darwin][sancov] Enable llvm-driver

Enable llvm-driver for:
llvm-dwp
llvm-libtoo-darwin
sancov

Differential Revision: https://reviews.llvm.org/D156758

Added: 
    

Modified: 
    llvm/tools/llvm-dwp/CMakeLists.txt
    llvm/tools/llvm-dwp/llvm-dwp.cpp
    llvm/tools/llvm-libtool-darwin/CMakeLists.txt
    llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
    llvm/tools/sancov/CMakeLists.txt
    llvm/tools/sancov/sancov.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-dwp/CMakeLists.txt b/llvm/tools/llvm-dwp/CMakeLists.txt
index e27c0c3ca16f02..d38385ce708310 100644
--- a/llvm/tools/llvm-dwp/CMakeLists.txt
+++ b/llvm/tools/llvm-dwp/CMakeLists.txt
@@ -21,6 +21,7 @@ add_llvm_tool(llvm-dwp
   DEPENDS
   intrinsics_gen
   DwpOptsTableGen
+  GENERATE_DRIVER
   )
 
 if(LLVM_INSTALL_BINUTILS_SYMLINKS)

diff  --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index 350a37345e2c60..01fd45857489b3 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -28,6 +28,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/InitLLVM.h"
+#include "llvm/Support/LLVMDriver.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/ToolOutputFile.h"
@@ -125,7 +126,7 @@ static Expected<Triple> readTargetTriple(StringRef FileName) {
   return ErrOrObj->getBinary()->makeTriple();
 }
 
-int main(int argc, char **argv) {
+int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
   InitLLVM X(argc, argv);
 
   DwpOptTable Tbl;

diff  --git a/llvm/tools/llvm-libtool-darwin/CMakeLists.txt b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt
index bc4b31fc281b70..eb95a5ff7a0ee9 100644
--- a/llvm/tools/llvm-libtool-darwin/CMakeLists.txt
+++ b/llvm/tools/llvm-libtool-darwin/CMakeLists.txt
@@ -18,6 +18,7 @@ add_llvm_tool(llvm-libtool-darwin
 
   DEPENDS
   LibtoolDarwinOptsTableGen
+  GENERATE_DRIVER
 )
 
 if(LLVM_INSTALL_CCTOOLS_SYMLINKS)

diff  --git a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
index 9188cada2edb9c..9ca0887527e688 100644
--- a/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
+++ b/llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
@@ -24,6 +24,7 @@
 #include "llvm/Option/Option.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/InitLLVM.h"
+#include "llvm/Support/LLVMDriver.h"
 #include "llvm/Support/LineIterator.h"
 #include "llvm/Support/TargetSelect.h"
 #include "llvm/Support/VirtualFileSystem.h"
@@ -31,6 +32,7 @@
 #include "llvm/Support/YAMLTraits.h"
 #include "llvm/Support/raw_ostream.h"
 #include "llvm/TextAPI/Architecture.h"
+#include <cstdlib>
 #include <map>
 #include <type_traits>
 
@@ -733,7 +735,7 @@ static Expected<Config> parseCommandLine(int Argc, char **Argv) {
   return C;
 }
 
-int main(int Argc, char **Argv) {
+int llvm_libtool_darwin_main(int Argc, char **Argv, const llvm::ToolContext &) {
   InitLLVM X(Argc, Argv);
   Expected<Config> ConfigOrErr = parseCommandLine(Argc, Argv);
   if (!ConfigOrErr) {
@@ -760,4 +762,5 @@ int main(int Argc, char **Argv) {
     }
     break;
   }
+  return EXIT_SUCCESS;
 }

diff  --git a/llvm/tools/sancov/CMakeLists.txt b/llvm/tools/sancov/CMakeLists.txt
index 71a1ced689c785..a174ddf618eed6 100644
--- a/llvm/tools/sancov/CMakeLists.txt
+++ b/llvm/tools/sancov/CMakeLists.txt
@@ -20,4 +20,5 @@ add_llvm_tool(sancov
 
   DEPENDS
   SancovOptsTableGen
+  GENERATE_DRIVER
   )

diff  --git a/llvm/tools/sancov/sancov.cpp b/llvm/tools/sancov/sancov.cpp
index 12eca011c613e9..b33bb0eae7c62e 100644
--- a/llvm/tools/sancov/sancov.cpp
+++ b/llvm/tools/sancov/sancov.cpp
@@ -38,6 +38,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/JSON.h"
+#include "llvm/Support/LLVMDriver.h"
 #include "llvm/Support/MD5.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/Path.h"
@@ -1221,7 +1222,7 @@ static void parseArgs(int Argc, char **Argv) {
   ClIgnorelist = Args.getLastArgValue(OPT_ignorelist_EQ);
 }
 
-int main(int Argc, char **Argv) {
+int sancov_main(int Argc, char **Argv, const llvm::ToolContext &) {
   llvm::InitLLVM X(Argc, Argv);
 
   llvm::InitializeAllTargetInfos();
@@ -1273,4 +1274,6 @@ int main(int Argc, char **Argv) {
   case PrintCovPointsAction:
     llvm_unreachable("unsupported action");
   }
+
+  return 0;
 }


        


More information about the llvm-commits mailing list