[cfe-dev] LLVM Command line support for 2 libs in the app

Anton Smirnov dev at antonsmirnov.name
Sat Sep 27 11:56:37 PDT 2014


Hello.

Is there any opportunity to clear arguments list when using LLVM command
line?

---

I have two static libs that use LLVM command line
<http://llvm.org/docs/CommandLine.html> to parse arguments:

// lib1
void main(int argc, const char **argv) {

  cl::opt<bool>LibOption1( ... ) // arg1
  cl::ParseCommandLineOptions(argc, argv, "lib1\n");
}

.

// lib2
void main(int argc, const char **argv) {

  cl::opt<bool>LibOption2( ... ) // arg2
  cl::ParseCommandLineOptions(argc, argv, "lib2\n"); // crash here!
}

The app is linked against two this libs and they parse arguments just fine
if having only 1 lib in the app and crash while parsing arguments if having
both libs in the app.

It seems that in lines with // arg argument is added in some global static
list (?) of arguments and this makes them have mixed arguments list and
affect to each other.

Is there any opportunity to reset that global list before declaring
arguments?

---

Regards, Anton.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140928/e3ef2204/attachment.html>


More information about the cfe-dev mailing list