Skip to content

Commit

Permalink
[dwp][libtool-darwin][sancov] Enable llvm-driver
Browse files Browse the repository at this point in the history
Enable llvm-driver for:
llvm-dwp
llvm-libtoo-darwin
sancov

Differential Revision: https://reviews.llvm.org/D156758
  • Loading branch information
Andrés Villegas committed Aug 1, 2023
1 parent 2734f15 commit 668e33c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions llvm/tools/llvm-dwp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ add_llvm_tool(llvm-dwp
DEPENDS
intrinsics_gen
DwpOptsTableGen
GENERATE_DRIVER
)

if(LLVM_INSTALL_BINUTILS_SYMLINKS)
Expand Down
3 changes: 2 additions & 1 deletion llvm/tools/llvm-dwp/llvm-dwp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions llvm/tools/llvm-libtool-darwin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ add_llvm_tool(llvm-libtool-darwin

DEPENDS
LibtoolDarwinOptsTableGen
GENERATE_DRIVER
)

if(LLVM_INSTALL_CCTOOLS_SYMLINKS)
Expand Down
5 changes: 4 additions & 1 deletion llvm/tools/llvm-libtool-darwin/llvm-libtool-darwin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@
#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"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/YAMLTraits.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/TextAPI/Architecture.h"
#include <cstdlib>
#include <map>
#include <type_traits>

Expand Down Expand Up @@ -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) {
Expand All @@ -760,4 +762,5 @@ int main(int Argc, char **Argv) {
}
break;
}
return EXIT_SUCCESS;
}
1 change: 1 addition & 0 deletions llvm/tools/sancov/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ add_llvm_tool(sancov

DEPENDS
SancovOptsTableGen
GENERATE_DRIVER
)
5 changes: 4 additions & 1 deletion llvm/tools/sancov/sancov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1273,4 +1274,6 @@ int main(int Argc, char **Argv) {
case PrintCovPointsAction:
llvm_unreachable("unsupported action");
}

return 0;
}

0 comments on commit 668e33c

Please sign in to comment.