summaryrefslogtreecommitdiffstats
path: root/tools/llvm-mc/llvm-mc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-mc/llvm-mc.cpp')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index 66e1260..3c23990 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -152,7 +152,7 @@ static int AsLexInput(const char *ProgName) {
if (!TheTarget)
return 1;
- const MCAsmInfo *MAI = TheTarget->createAsmInfo(TripleName);
+ llvm::OwningPtr<MCAsmInfo> MAI((MCAsmInfo*) TheTarget->createAsmInfo(TripleName));
assert(MAI && "Unable to create target asm info!");
AsmLexer Lexer(*MAI);
@@ -260,7 +260,7 @@ static int AssembleInput(const char *ProgName) {
SrcMgr.setIncludeDirs(IncludeDirs);
- const MCAsmInfo *MAI = TheTarget->createAsmInfo(TripleName);
+ llvm::OwningPtr<MCAsmInfo> MAI((MCAsmInfo*) TheTarget->createAsmInfo(TripleName));
assert(MAI && "Unable to create target asm info!");
MCContext Ctx(*MAI);
@@ -278,18 +278,17 @@ static int AssembleInput(const char *ProgName) {
return 1;
}
- OwningPtr<MCInstPrinter> IP;
OwningPtr<MCCodeEmitter> CE;
OwningPtr<MCStreamer> Str;
OwningPtr<TargetAsmBackend> TAB;
if (FileType == OFT_AssemblyFile) {
- IP.reset(TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out));
+ MCInstPrinter *IP =
+ TheTarget->createMCInstPrinter(OutputAsmVariant, *MAI, *Out);
if (ShowEncoding)
CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
Str.reset(createAsmStreamer(Ctx, *Out,TM->getTargetData()->isLittleEndian(),
- /*asmverbose*/true, IP.get(), CE.get(),
- ShowInst));
+ /*asmverbose*/true, IP, CE.get(), ShowInst));
} else {
assert(FileType == OFT_ObjectFile && "Invalid file type!");
CE.reset(TheTarget->createCodeEmitter(*TM, Ctx));
@@ -319,13 +318,9 @@ static int AssembleInput(const char *ProgName) {
}
static int DisassembleInput(const char *ProgName) {
- std::string Error;
- const Target *TheTarget = TargetRegistry::lookupTarget(TripleName, Error);
- if (TheTarget == 0) {
- errs() << ProgName << ": error: unable to get target for '" << TripleName
- << "', see --version and --triple.\n";
+ const Target *TheTarget = GetTarget(ProgName);
+ if (!TheTarget)
return 0;
- }
std::string ErrorMessage;
OpenPOWER on IntegriCloud