@@ -30,6 +30,12 @@ int main(int argc, char *argv[]) {
3030 llvm::cl::opt<std::string> Package (
3131 " package" , llvm::cl::cat (Category),
3232 llvm::cl::desc (" Package name of generated Scala file" ));
33+ llvm::cl::opt<bool > NoLinkName (
34+ " no-link" , llvm::cl::cat (Category),
35+ llvm::cl::desc (" Library does not require linking" ));
36+ llvm::cl::opt<std::string> LinkName (
37+ " link" , llvm::cl::cat (Category),
38+ llvm::cl::desc (" Library to link with, e.g. -luv for libuv" ));
3339 clang::tooling::CommonOptionsParser op (argc, (const char **)argv, Category);
3440 clang::tooling::ClangTool Tool (op.getCompilations (),
3541 op.getSourcePathList ());
@@ -42,6 +48,14 @@ int main(int argc, char *argv[]) {
4248 return -1 ;
4349 }
4450
51+ auto linkName = LinkName.getValue ();
52+ if (linkName.empty ()) {
53+ linkName = libName;
54+ }
55+ if (NoLinkName.getValue ()) {
56+ linkName = " " ;
57+ }
58+
4559 auto objectName = libName;
4660 if (objectName == " native" ) {
4761 /* there are at most 3 objects in the file.
@@ -56,7 +70,7 @@ int main(int argc, char *argv[]) {
5670
5771 locations.clear ();
5872
59- IR ir (libName, objectName, Package.getValue ());
73+ IR ir (libName, linkName, objectName, Package.getValue ());
6074 ScalaFrontendActionFactory actionFactory (ir);
6175
6276 int result = Tool.run (&actionFactory);
0 commit comments