[llvm-commits] [llvm] r103663 - /llvm/trunk/lib/MC/MCAssembler.cpp
Daniel Dunbar
daniel at zuster.org
Wed May 12 15:51:35 PDT 2010
Author: ddunbar
Date: Wed May 12 17:51:35 2010
New Revision: 103663
URL: http://llvm.org/viewvc/llvm-project?rev=103663&view=rev
Log:
MC: Explicitly check that only virtual fragments appear in virtual sections.
Modified:
llvm/trunk/lib/MC/MCAssembler.cpp
Modified: llvm/trunk/lib/MC/MCAssembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAssembler.cpp?rev=103663&r1=103662&r2=103663&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAssembler.cpp (original)
+++ llvm/trunk/lib/MC/MCAssembler.cpp Wed May 12 17:51:35 2010
@@ -534,6 +534,9 @@
case MCFragment::FT_Fill: {
MCFillFragment &FF = cast<MCFillFragment>(F);
+
+ assert(FF.getValueSize() && "Invalid virtual align in concrete fragment!");
+
for (uint64_t i = 0, e = FF.getSize() / FF.getValueSize(); i != e; ++i) {
switch (FF.getValueSize()) {
default:
@@ -578,6 +581,26 @@
// Ignore virtual sections.
if (getBackend().isVirtualSection(SD->getSection())) {
assert(SectionFileSize == 0 && "Invalid size for section!");
+
+ // Check that contents are only things legal inside a virtual section.
+ for (MCSectionData::const_iterator it = SD->begin(),
+ ie = SD->end(); it != ie; ++it) {
+ switch (it->getKind()) {
+ default:
+ assert(0 && "Invalid fragment in virtual section!");
+ case MCFragment::FT_Align:
+ assert(!cast<MCAlignFragment>(it)->getValueSize() &&
+ "Invalid align in virtual section!");
+ break;
+ case MCFragment::FT_Fill:
+ assert(!cast<MCFillFragment>(it)->getValueSize() &&
+ "Invalid fill in virtual section!");
+ break;
+ case MCFragment::FT_ZeroFill:
+ break;
+ }
+ }
+
return;
}
More information about the llvm-commits
mailing list