create an MCStreamer and provide it to AsmParser.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74039 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-06-24 00:52:40 +00:00
parent f4a9061b6b
commit cbc23f75cd
4 changed files with 13 additions and 4 deletions

View File

@ -18,13 +18,16 @@
namespace llvm {
class MCInst;
class MCStreamer;
class AsmParser {
AsmLexer Lexer;
MCStreamer &Out;
struct X86Operand;
public:
AsmParser(SourceMgr &SM) : Lexer(SM) {}
AsmParser(SourceMgr &SM, MCStreamer &OutStr) : Lexer(SM), Out(OutStr) {}
~AsmParser() {}
bool Run();

View File

@ -1,4 +1,4 @@
set(LLVM_LINK_COMPONENTS support)
set(LLVM_LINK_COMPONENTS support MC)
add_llvm_tool(llvm-mc
llvm-mc.cpp

View File

@ -9,7 +9,7 @@
LEVEL = ../..
TOOLNAME = llvm-mc
LINK_COMPONENTS := support
LINK_COMPONENTS := support MC
# This tool has no plugins, optimize startup time.
TOOL_NO_EXPORTS = 1

View File

@ -12,6 +12,9 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/MC/MCContext.h"
#include "llvm/MC/MCStreamer.h"
#include "llvm/ADT/OwningPtr.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/MemoryBuffer.h"
@ -136,7 +139,10 @@ static int AssembleInput(const char *ProgName) {
// it later.
SrcMgr.setIncludeDirs(IncludeDirs);
AsmParser Parser(SrcMgr);
// FIXME: don't leak streamer, own.
MCContext Ctx;
OwningPtr<MCStreamer> Str(createAsmStreamer(Ctx, outs()));
AsmParser Parser(SrcMgr, *Str.get());
return Parser.Run();
}