Refactor some parser interfaces to fix PR3278 and a FIXME:
ParseAssemblyString with a specified module would not parse
into the module, it would create and return a new one.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61635 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 5582bfa..e44e650 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -51,19 +51,12 @@
}
/// Run: module ::= toplevelentity*
-Module *LLParser::Run() {
- M = new Module(Lex.getFilename());
-
+bool LLParser::Run() {
// Prime the lexer.
Lex.Lex();
- if (ParseTopLevelEntities() ||
- ValidateEndOfModule()) {
- delete M;
- return 0;
- }
-
- return M;
+ return ParseTopLevelEntities() ||
+ ValidateEndOfModule();
}
/// ValidateEndOfModule - Do final validity and sanity checks at the end of the