[LLVMdev] Programmatic compilation of C++ file into bitcode

Trevor Harmon Trevor.W.Harmon at nasa.gov
Thu Feb 25 15:30:24 PST 2010


On Feb 25, 2010, at 2:28 PM, Trevor Harmon wrote:

> I'm not sure how the other program can find the output, unless
> of course the analyzer simply dumps the file to a hard-coded
> location (/tmp?).


Replying to myself again...

After sifting through many of the existing transforms, I discovered  
that new command-line parameters can be added to opt simply by  
declaring them in the transform code, such as in this example from  
Internalize.cpp:

   static cl::opt<std::string>
     APIFile("internalize-public-api-file", cl::value_desc("filename"),
       cl::desc("A file containing list of symbol names to preserve"));

So, the calling program can simply pass the name of a file to opt as a  
parameter, and it will then know exactly where the analyzer will send  
its output.

Trevor




More information about the llvm-dev mailing list