Skip to content

Commit 668e33c

Browse files
author
Andrés Villegas
committed
[dwp][libtool-darwin][sancov] Enable llvm-driver
Enable llvm-driver for: llvm-dwp llvm-libtoo-darwin sancov Differential Revision: https://reviews.llvm.org/D156758
1 parent 2734f15 commit 668e33c

File tree

6 files changed

+13
-3
lines changed

6 files changed

+13
-3
lines changed

llvm/tools/llvm-dwp/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ add_llvm_tool(llvm-dwp
2121
DEPENDS
2222
intrinsics_gen
2323
DwpOptsTableGen
24+
GENERATE_DRIVER
2425
)
2526

2627
if(LLVM_INSTALL_BINUTILS_SYMLINKS)

llvm/tools/llvm-dwp/llvm-dwp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "llvm/Support/CommandLine.h"
2929
#include "llvm/Support/FileSystem.h"
3030
#include "llvm/Support/InitLLVM.h"
31+
#include "llvm/Support/LLVMDriver.h"
3132
#include "llvm/Support/MemoryBuffer.h"
3233
#include "llvm/Support/TargetSelect.h"
3334
#include "llvm/Support/ToolOutputFile.h"
@@ -125,7 +126,7 @@ static Expected<Triple> readTargetTriple(StringRef FileName) {
125126
return ErrOrObj->getBinary()->makeTriple();
126127
}
127128

128-
int main(int argc, char **argv) {
129+
int llvm_dwp_main(int argc, char **argv, const llvm::ToolContext &) {
129130
InitLLVM X(argc, argv);
130131

131132
DwpOptTable Tbl;

llvm/tools/llvm-libtool-darwin/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ add_llvm_tool(llvm-libtool-darwin
1818

1919
DEPENDS
2020
LibtoolDarwinOptsTableGen
21+
GENERATE_DRIVER
2122
)
2223

2324
if(LLVM_INSTALL_CCTOOLS_SYMLINKS)

llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
#include "llvm/Option/Option.h"
2525
#include "llvm/Support/CommandLine.h"
2626
#include "llvm/Support/InitLLVM.h"
27+
#include "llvm/Support/LLVMDriver.h"
2728
#include "llvm/Support/LineIterator.h"
2829
#include "llvm/Support/TargetSelect.h"
2930
#include "llvm/Support/VirtualFileSystem.h"
3031
#include "llvm/Support/WithColor.h"
3132
#include "llvm/Support/YAMLTraits.h"
3233
#include "llvm/Support/raw_ostream.h"
3334
#include "llvm/TextAPI/Architecture.h"
35+
#include <cstdlib>
3436
#include <map>
3537
#include <type_traits>
3638

@@ -733,7 +735,7 @@ static Expected<Config> parseCommandLine(int Argc, char **Argv) {
733735
return C;
734736
}
735737

736-
int main(int Argc, char **Argv) {
738+
int llvm_libtool_darwin_main(int Argc, char **Argv, const llvm::ToolContext &) {
737739
InitLLVM X(Argc, Argv);
738740
Expected<Config> ConfigOrErr = parseCommandLine(Argc, Argv);
739741
if (!ConfigOrErr) {
@@ -760,4 +762,5 @@ int main(int Argc, char **Argv) {
760762
}
761763
break;
762764
}
765+
return EXIT_SUCCESS;
763766
}

llvm/tools/sancov/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ add_llvm_tool(sancov
2020

2121
DEPENDS
2222
SancovOptsTableGen
23+
GENERATE_DRIVER
2324
)

llvm/tools/sancov/sancov.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "llvm/Support/FileSystem.h"
3939
#include "llvm/Support/InitLLVM.h"
4040
#include "llvm/Support/JSON.h"
41+
#include "llvm/Support/LLVMDriver.h"
4142
#include "llvm/Support/MD5.h"
4243
#include "llvm/Support/MemoryBuffer.h"
4344
#include "llvm/Support/Path.h"
@@ -1221,7 +1222,7 @@ static void parseArgs(int Argc, char **Argv) {
12211222
ClIgnorelist = Args.getLastArgValue(OPT_ignorelist_EQ);
12221223
}
12231224

1224-
int main(int Argc, char **Argv) {
1225+
int sancov_main(int Argc, char **Argv, const llvm::ToolContext &) {
12251226
llvm::InitLLVM X(Argc, Argv);
12261227

12271228
llvm::InitializeAllTargetInfos();
@@ -1273,4 +1274,6 @@ int main(int Argc, char **Argv) {
12731274
case PrintCovPointsAction:
12741275
llvm_unreachable("unsupported action");
12751276
}
1277+
1278+
return 0;
12761279
}

0 commit comments

Comments
 (0)