[LLVMdev] clang: compile c code from char array?

gafferuk gafferuk at gmail.com
Sat Aug 14 15:50:33 PDT 2010

Hi, how do I compile c code from a char array in clang?

Im using code from the interpreter example. 

char *cCode; // the char array
// fill array with code goes here...

// Initialize a compiler invocation object from the clang (-cc1) arguments.
  const driver::ArgStringList &CCArgs = Cmd->getArguments();
  llvm::OwningPtr<CompilerInvocation> CI(new CompilerInvocation);
                                     const_cast<const char
                                     const_cast<const char
**>(CCArgs.data()) +

  // Show the invocation, with -v.
  if (CI->getHeaderSearchOpts().Verbose) {
    llvm::errs() << "clang invocation:\n";
    C->PrintJob(llvm::errs(), C->getJobs(), "\n", true);
    llvm::errs() << "\n";
View this message in context: http://old.nabble.com/clang%3A-compile-c-code-from-char-array--tp29439679p29439679.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.

More information about the llvm-dev mailing list