diff --git a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 202d9b67fd1..28de40b9edf 100644 --- a/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -22,7 +22,6 @@ #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/MC/MCParser/AsmParser.h" #include "llvm/Target/TargetAsmParser.h" #include "llvm/Target/TargetMachine.h" #include "llvm/Target/TargetRegistry.h" @@ -72,16 +71,18 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, unsigned LocCookie) const { // Tell SrcMgr about this buffer, it takes ownership of the buffer. SrcMgr.AddNewSourceBuffer(Buffer, SMLoc()); - AsmParser Parser(TM.getTarget(), SrcMgr, OutContext, OutStreamer, *MAI); - OwningPtr TAP(TM.getTarget().createAsmParser(Parser)); + OwningPtr Parser(createMCAsmParser(TM.getTarget(), SrcMgr, + OutContext, OutStreamer, + *MAI)); + OwningPtr TAP(TM.getTarget().createAsmParser(*Parser)); if (!TAP) report_fatal_error("Inline asm not supported by this streamer because" " we don't have an asm parser for this target\n"); - Parser.setTargetParser(*TAP.get()); + Parser->setTargetParser(*TAP.get()); // Don't implicitly switch to the text section before the asm. - int Res = Parser.Run(/*NoInitialTextSection*/ true, - /*NoFinalize*/ true); + int Res = Parser->Run(/*NoInitialTextSection*/ true, + /*NoFinalize*/ true); if (Res && !HasDiagHandler) report_fatal_error("Error parsing inline asm\n"); } diff --git a/tools/edis/EDDisassembler.cpp b/tools/edis/EDDisassembler.cpp index 85e41e61af9..5a59e34f576 100644 --- a/tools/edis/EDDisassembler.cpp +++ b/tools/edis/EDDisassembler.cpp @@ -27,7 +27,6 @@ #include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCParser/AsmLexer.h" -#include "llvm/MC/MCParser/AsmParser.h" #include "llvm/MC/MCParser/MCAsmParser.h" #include "llvm/MC/MCParser/MCParsedAsmOperand.h" #include "llvm/Support/MemoryBuffer.h" @@ -364,11 +363,13 @@ int EDDisassembler::parseInst(SmallVectorImpl &operands, sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over MCContext context(*AsmInfo); OwningPtr streamer(createNullStreamer(context)); - AsmParser genericParser(*Tgt, sourceMgr, context, *streamer, *AsmInfo); - OwningPtr TargetParser(Tgt->createAsmParser(genericParser)); + OwningPtr genericParser(createMCAsmParser(*Tgt, sourceMgr, + context, *streamer, + *AsmInfo)); + OwningPtr TargetParser(Tgt->createAsmParser(*genericParser)); - AsmToken OpcodeToken = genericParser.Lex(); - AsmToken NextToken = genericParser.Lex(); // consume next token, because specificParser expects us to + AsmToken OpcodeToken = genericParser->Lex(); + AsmToken NextToken = genericParser->Lex(); // consume next token, because specificParser expects us to if (OpcodeToken.is(AsmToken::Identifier)) { instName = OpcodeToken.getString(); diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 34cf8cedbd5..ffa49142303 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -12,13 +12,13 @@ // //===----------------------------------------------------------------------===// +#include "llvm/MC/MCParser/AsmLexer.h" #include "llvm/MC/MCParser/MCAsmLexer.h" #include "llvm/MC/MCContext.h" #include "llvm/MC/MCCodeEmitter.h" #include "llvm/MC/MCInstPrinter.h" #include "llvm/MC/MCSectionMachO.h" #include "llvm/MC/MCStreamer.h" -#include "llvm/MC/MCParser/AsmParser.h" #include "llvm/Target/TargetAsmBackend.h" #include "llvm/Target/TargetAsmParser.h" #include "llvm/Target/TargetData.h" @@ -312,17 +312,18 @@ static int AssembleInput(const char *ProgName) { Str.reset(createLoggingStreamer(Str.take(), errs())); } - AsmParser Parser(*TheTarget, SrcMgr, Ctx, *Str.get(), *MAI); - OwningPtr TAP(TheTarget->createAsmParser(Parser)); + OwningPtr Parser(createMCAsmParser(*TheTarget, SrcMgr, Ctx, + *Str.get(), *MAI)); + OwningPtr TAP(TheTarget->createAsmParser(*Parser)); if (!TAP) { errs() << ProgName << ": error: this target does not support assembly parsing.\n"; return 1; } - Parser.setTargetParser(*TAP.get()); + Parser->setTargetParser(*TAP.get()); - int Res = Parser.Run(NoInitialTextSection); + int Res = Parser->Run(NoInitialTextSection); delete Out; // Delete output on errors.