-// The useful interface defined by this file... Parse an ASCII file, and return
-// the internal representation in a nice slice'n'dice'able representation.
-//
-Module *llvm::ParseAssemblyFile(const std::string &Filename) {
- FILE *F = stdin;
-
- if (Filename != "-") {
- F = fopen(Filename.c_str(), "r");
-
- if (F == 0)
- throw ParseException(Filename, "Could not open file '" + Filename + "'");
- }
-
- Module *Result;
- try {
- Result = RunVMAsmParser(Filename, F);
- } catch (...) {
- if (F != stdin) fclose(F); // Make sure to close file descriptor if an
- throw; // exception is thrown
- }
-
- if (F != stdin)
- fclose(F);
+bool llvm::parseAssemblyInto(MemoryBufferRef F, Module &M, SMDiagnostic &Err) {
+ SourceMgr SM;
+ std::unique_ptr<MemoryBuffer> Buf = MemoryBuffer::getMemBuffer(F, false);
+ SM.AddNewSourceBuffer(std::move(Buf), SMLoc());