-static inline std::auto_ptr<Module> LoadFile(const std::string &FN,
- LLVMContext& Context) {
- sys::Path Filename;
- if (!Filename.set(FN)) {
- errs() << "Invalid file name: '" << FN << "'\n";
- return std::auto_ptr<Module>();
- }
-
- std::string ErrorMessage;
- if (Filename.exists()) {
- if (Verbose) errs() << "Loading '" << Filename.c_str() << "'\n";
- Module* Result = 0;
-
- const std::string &FNStr = Filename.toString();
- if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(FNStr,
- &ErrorMessage)) {
- Result = ParseBitcodeFile(Buffer, Context, &ErrorMessage);
- delete Buffer;
- }
- if (Result) return std::auto_ptr<Module>(Result); // Load successful!
+static inline Module *LoadFile(const char *argv0, const std::string &FN,
+ LLVMContext& Context) {
+ SMDiagnostic Err;
+ if (Verbose) errs() << "Loading '" << FN << "'\n";
+ Module* Result = 0;