mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-28 22:43:29 +00:00
Redirected errors from the AsmParser to the proper
error stream, in cases where the AsmParser is being invoked by EDDisassembler. Before, they were being sent to errs() because no error handler was installed in the SourceMgr. llvm-svn: 129177
This commit is contained in:
parent
b64c921079
commit
0c1aa958e2
@ -334,6 +334,15 @@ int EDDisassembler::printInst(std::string &str, MCInst &inst) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void diag_handler(const SMDiagnostic &diag,
|
||||
void *context)
|
||||
{
|
||||
if (context) {
|
||||
EDDisassembler *disassembler = static_cast<EDDisassembler*>(context);
|
||||
diag.Print("", disassembler->ErrorStream);
|
||||
}
|
||||
}
|
||||
|
||||
int EDDisassembler::parseInst(SmallVectorImpl<MCParsedAsmOperand*> &operands,
|
||||
SmallVectorImpl<AsmToken> &tokens,
|
||||
const std::string &str) {
|
||||
@ -356,6 +365,7 @@ int EDDisassembler::parseInst(SmallVectorImpl<MCParsedAsmOperand*> &operands,
|
||||
SMLoc instLoc;
|
||||
|
||||
SourceMgr sourceMgr;
|
||||
sourceMgr.setDiagHandler(diag_handler, static_cast<void*>(this));
|
||||
sourceMgr.AddNewSourceBuffer(buf, SMLoc()); // ownership of buf handed over
|
||||
MCContext context(*AsmInfo, NULL);
|
||||
OwningPtr<MCStreamer> streamer(createNullStreamer(context));
|
||||
|
Loading…
Reference in New Issue
Block a user