mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
Split Finish into Finish and FinishImpl to have a common place to do end of
file error checking. Use that to error on an unfinished cfi_startproc. The error is not nice, but is already better than a segmentation fault. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147717 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
977679d603
commit
99b4237c16
@ -204,7 +204,9 @@ private:
|
||||
const VariantKind Kind;
|
||||
|
||||
explicit MCSymbolRefExpr(const MCSymbol *_Symbol, VariantKind _Kind)
|
||||
: MCExpr(MCExpr::SymbolRef), Symbol(_Symbol), Kind(_Kind) {}
|
||||
: MCExpr(MCExpr::SymbolRef), Symbol(_Symbol), Kind(_Kind) {
|
||||
assert(Symbol);
|
||||
}
|
||||
|
||||
public:
|
||||
/// @name Construction
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
virtual void EmitDwarfAdvanceFrameAddr(const MCSymbol *LastLabel,
|
||||
const MCSymbol *Label);
|
||||
virtual void EmitGPRel32Value(const MCExpr *Value);
|
||||
virtual void Finish();
|
||||
virtual void FinishImpl();
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
@ -590,8 +590,10 @@ namespace llvm {
|
||||
virtual void EmitRegSave(const SmallVectorImpl<unsigned> &RegList,
|
||||
bool isVector);
|
||||
|
||||
/// FinishImpl - Streamer specific finalization.
|
||||
virtual void FinishImpl() = 0;
|
||||
/// Finish - Finish emission of machine code.
|
||||
virtual void Finish() = 0;
|
||||
void Finish();
|
||||
};
|
||||
|
||||
/// createNullStreamer - Create a dummy machine code streamer, which does
|
||||
|
@ -255,7 +255,7 @@ public:
|
||||
/// indicated by the hasRawTextSupport() predicate.
|
||||
virtual void EmitRawText(StringRef String);
|
||||
|
||||
virtual void Finish();
|
||||
virtual void FinishImpl();
|
||||
|
||||
/// @}
|
||||
};
|
||||
@ -1285,7 +1285,7 @@ void MCAsmStreamer::EmitRawText(StringRef String) {
|
||||
EmitEOL();
|
||||
}
|
||||
|
||||
void MCAsmStreamer::Finish() {
|
||||
void MCAsmStreamer::FinishImpl() {
|
||||
// Dump out the dwarf file & directory tables and line tables.
|
||||
if (getContext().hasDwarfFiles() && !UseLoc)
|
||||
MCDwarfFileTable::Emit(this);
|
||||
|
@ -356,7 +356,7 @@ void MCELFStreamer::EmitInstToData(const MCInst &Inst) {
|
||||
DF->getContents().append(Code.begin(), Code.end());
|
||||
}
|
||||
|
||||
void MCELFStreamer::Finish() {
|
||||
void MCELFStreamer::FinishImpl() {
|
||||
EmitFrames(true);
|
||||
|
||||
for (std::vector<LocalCommon>::const_iterator i = LocalCommons.begin(),
|
||||
@ -379,7 +379,7 @@ void MCELFStreamer::Finish() {
|
||||
SectData.setAlignment(ByteAlignment);
|
||||
}
|
||||
|
||||
this->MCObjectStreamer::Finish();
|
||||
this->MCObjectStreamer::FinishImpl();
|
||||
}
|
||||
|
||||
MCStreamer *llvm::createELFStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
|
||||
virtual void EmitFileDirective(StringRef Filename);
|
||||
|
||||
virtual void Finish();
|
||||
virtual void FinishImpl();
|
||||
|
||||
private:
|
||||
virtual void EmitInstToFragment(const MCInst &Inst);
|
||||
|
@ -243,9 +243,9 @@ public:
|
||||
return Child->EmitRawText(String);
|
||||
}
|
||||
|
||||
virtual void Finish() {
|
||||
LogCall("Finish");
|
||||
return Child->Finish();
|
||||
virtual void FinishImpl() {
|
||||
LogCall("FinishImpl");
|
||||
return Child->FinishImpl();
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -89,7 +89,7 @@ public:
|
||||
//report_fatal_error("unsupported directive: '.file'");
|
||||
}
|
||||
|
||||
virtual void Finish();
|
||||
virtual void FinishImpl();
|
||||
|
||||
/// @}
|
||||
};
|
||||
@ -375,7 +375,7 @@ void MCMachOStreamer::EmitInstToData(const MCInst &Inst) {
|
||||
DF->getContents().append(Code.begin(), Code.end());
|
||||
}
|
||||
|
||||
void MCMachOStreamer::Finish() {
|
||||
void MCMachOStreamer::FinishImpl() {
|
||||
EmitFrames(true);
|
||||
|
||||
// We have to set the fragment atom associations so we can relax properly for
|
||||
@ -407,7 +407,7 @@ void MCMachOStreamer::Finish() {
|
||||
}
|
||||
}
|
||||
|
||||
this->MCObjectStreamer::Finish();
|
||||
this->MCObjectStreamer::FinishImpl();
|
||||
}
|
||||
|
||||
MCStreamer *llvm::createMachOStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||
|
@ -94,7 +94,7 @@ namespace {
|
||||
StringRef FileName) {}
|
||||
virtual void EmitInstruction(const MCInst &Inst) {}
|
||||
|
||||
virtual void Finish() {}
|
||||
virtual void FinishImpl() {}
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
@ -255,7 +255,7 @@ void MCObjectStreamer::EmitGPRel32Value(const MCExpr *Value) {
|
||||
DF->getContents().resize(DF->getContents().size() + 4, 0);
|
||||
}
|
||||
|
||||
void MCObjectStreamer::Finish() {
|
||||
void MCObjectStreamer::FinishImpl() {
|
||||
// Dump out the dwarf file & directory tables and line tables.
|
||||
if (getContext().hasDwarfFiles())
|
||||
MCDwarfFileTable::Emit(this);
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
unsigned MaxBytesToEmit = 0);
|
||||
virtual void EmitValueToOffset(const MCExpr *Offset,
|
||||
unsigned char Value = 0);
|
||||
virtual void Finish();
|
||||
virtual void FinishImpl();
|
||||
|
||||
|
||||
virtual void EmitSymbolAttribute(MCSymbol *Symbol, MCSymbolAttr Attribute) {
|
||||
@ -224,10 +224,10 @@ void MCPureStreamer::EmitInstToData(const MCInst &Inst) {
|
||||
DF->getContents().append(Code.begin(), Code.end());
|
||||
}
|
||||
|
||||
void MCPureStreamer::Finish() {
|
||||
void MCPureStreamer::FinishImpl() {
|
||||
// FIXME: Handle DWARF tables?
|
||||
|
||||
this->MCObjectStreamer::Finish();
|
||||
this->MCObjectStreamer::FinishImpl();
|
||||
}
|
||||
|
||||
MCStreamer *llvm::createPureStreamer(MCContext &Context, MCAsmBackend &MAB,
|
||||
|
@ -652,3 +652,10 @@ void MCStreamer::EmitW64Tables() {
|
||||
|
||||
MCWin64EHUnwindEmitter::Emit(*this);
|
||||
}
|
||||
|
||||
void MCStreamer::Finish() {
|
||||
if (!FrameInfos.empty() && !FrameInfos.back().End)
|
||||
report_fatal_error("Unfinished frame!");
|
||||
|
||||
FinishImpl();
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ public:
|
||||
virtual void EmitFileDirective(StringRef Filename);
|
||||
virtual void EmitInstruction(const MCInst &Instruction);
|
||||
virtual void EmitWin64EHHandlerData();
|
||||
virtual void Finish();
|
||||
virtual void FinishImpl();
|
||||
|
||||
private:
|
||||
virtual void EmitInstToFragment(const MCInst &Inst) {
|
||||
@ -401,9 +401,9 @@ void WinCOFFStreamer::EmitWin64EHHandlerData() {
|
||||
MCWin64EHUnwindEmitter::EmitUnwindInfo(*this, getCurrentW64UnwindInfo());
|
||||
}
|
||||
|
||||
void WinCOFFStreamer::Finish() {
|
||||
void WinCOFFStreamer::FinishImpl() {
|
||||
EmitW64Tables();
|
||||
MCObjectStreamer::Finish();
|
||||
MCObjectStreamer::FinishImpl();
|
||||
}
|
||||
|
||||
namespace llvm
|
||||
|
@ -176,7 +176,7 @@ public:
|
||||
/// indicated by the hasRawTextSupport() predicate.
|
||||
virtual void EmitRawText(StringRef String);
|
||||
|
||||
virtual void Finish();
|
||||
virtual void FinishImpl();
|
||||
|
||||
/// @}
|
||||
|
||||
@ -540,7 +540,7 @@ void PTXMCAsmStreamer::EmitRawText(StringRef String) {
|
||||
EmitEOL();
|
||||
}
|
||||
|
||||
void PTXMCAsmStreamer::Finish() {}
|
||||
void PTXMCAsmStreamer::FinishImpl() {}
|
||||
|
||||
namespace llvm {
|
||||
MCStreamer *createPTXAsmStreamer(MCContext &Context,
|
||||
|
5
test/MC/AsmParser/cfi-unfinished-frame.s
Normal file
5
test/MC/AsmParser/cfi-unfinished-frame.s
Normal file
@ -0,0 +1,5 @@
|
||||
// RUN: not llvm-mc -filetype=asm -triple x86_64-pc-linux-gnu %s -o %t 2>%t.out
|
||||
// RUN: FileCheck -input-file=%t.out %s
|
||||
|
||||
.cfi_startproc
|
||||
// CHECK: Unfinished frame
|
@ -603,7 +603,7 @@ namespace {
|
||||
if (Inst.getOperand(i).isExpr())
|
||||
AddValueSymbols(Inst.getOperand(i).getExpr());
|
||||
}
|
||||
virtual void Finish() {}
|
||||
virtual void FinishImpl() {}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user