-static inline std::auto_ptr<Module> LoadFile(const std::string &FN) {
- std::string Filename = FN;
- std::string ErrorMessage;
-
- unsigned NextLibPathIdx = 0;
- bool FoundAFile = false;
-
- while (1) {
- if (Verbose) std::cerr << "Loading '" << Filename << "'\n";
- if (FileExists(Filename)) FoundAFile = true;
- Module *Result = ParseBytecodeFile(Filename, &ErrorMessage);
- if (Result) return std::auto_ptr<Module>(Result); // Load successful!
-
- if (Verbose) {
- std::cerr << "Error opening bytecode file: '" << Filename << "'";
- if (ErrorMessage.size()) std::cerr << ": " << ErrorMessage;
- std::cerr << "\n";
- }
-
- if (NextLibPathIdx == LibPaths.size()) break;
- Filename = LibPaths[NextLibPathIdx++] + "/" + FN;
+static inline std::auto_ptr<Module> LoadFile(const char *argv0,
+ const std::string &FN,
+ LLVMContext& Context) {
+ sys::Path Filename;
+ if (!Filename.set(FN)) {
+ errs() << "Invalid file name: '" << FN << "'\n";
+ return std::auto_ptr<Module>();