Skip to content

Instantly share code, notes, and snippets.

@jgouly
Created March 16, 2012 21:51
Show Gist options
  • Save jgouly/2052963 to your computer and use it in GitHub Desktop.
Save jgouly/2052963 to your computer and use it in GitHub Desktop.
#include <llvm/Support/IRReader.h>
#include <llvm/LLVMContext.h>
#include <llvm/Module.h>
#include <llvm/Support/raw_ostream.h>
using namespace llvm;
int main()
{
std::string error;
Module *stdlib;
SMDiagnostic Err;
stdlib = ParseIRFile("bonestd.ll", Err, getGlobalContext());
for(Module::iterator i = stdlib->begin(), e = stdlib->end();
i != e; ++i)
{
// delete the functions here
}
std::string err;
raw_fd_ostream fs("bonestd.ll", err);
stdlib->print(fs, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment