[llvm] r368720 - [NFC][AIX] Use assert instead of llvm_unreachable
David Tenty via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 13 10:04:51 PDT 2019
Author: daltenty
Date: Tue Aug 13 10:04:51 2019
New Revision: 368720
URL: http://llvm.org/viewvc/llvm-project?rev=368720&view=rev
Log:
[NFC][AIX] Use assert instead of llvm_unreachable
Addresses post-commit comments on https://reviews.llvm.org/D64825. Use
assert instead of llvm_unreachable to check if invalid csect types are being
generated. Use report_fatal_error on unimplemented XCOFF features.
Differential Revision: https://reviews.llvm.org/D64825
Modified:
llvm/trunk/include/llvm/MC/MCStreamer.h
llvm/trunk/lib/MC/MCAsmStreamer.cpp
llvm/trunk/lib/MC/MCSectionXCOFF.cpp
llvm/trunk/lib/MC/MCXCOFFStreamer.cpp
Modified: llvm/trunk/include/llvm/MC/MCStreamer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCStreamer.h?rev=368720&r1=368719&r2=368720&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCStreamer.h (original)
+++ llvm/trunk/include/llvm/MC/MCStreamer.h Tue Aug 13 10:04:51 2019
@@ -544,7 +544,7 @@ public:
/// \param ByteAlignment - The alignment of the symbol in bytes. Must be a power
/// of 2.
virtual void EmitXCOFFLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
- unsigned ByteAlignment);
+ unsigned ByteAlignment);
/// Emit an ELF .size directive.
///
Modified: llvm/trunk/lib/MC/MCAsmStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCAsmStreamer.cpp?rev=368720&r1=368719&r2=368720&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCAsmStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCAsmStreamer.cpp Tue Aug 13 10:04:51 2019
@@ -759,14 +759,14 @@ void MCAsmStreamer::EmitCOFFImgRel32(MCS
EmitEOL();
}
-// We need an XCOFF specific version of this directive as the AIX syntax
+// We need an XCOFF-specific version of this directive as the AIX syntax
// requires a QualName argument identifying the csect name and storage mapping
// class to appear before the alignment if we are specifying it.
void MCAsmStreamer::EmitXCOFFLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlignment) {
assert(MAI->getLCOMMDirectiveAlignmentType() == LCOMM::Log2Alignment &&
- "We only support writing log base-2 alignment format with XCOFF");
- assert(isPowerOf2_32(ByteAlignment) && "alignment must be a power of 2");
+ "We only support writing log base-2 alignment format with XCOFF.");
+ assert(isPowerOf2_32(ByteAlignment) && "Alignment must be a power of 2.");
OS << "\t.lcomm\t";
Symbol->print(OS, MAI);
Modified: llvm/trunk/lib/MC/MCSectionXCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCSectionXCOFF.cpp?rev=368720&r1=368719&r2=368720&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCSectionXCOFF.cpp (original)
+++ llvm/trunk/lib/MC/MCSectionXCOFF.cpp Tue Aug 13 10:04:51 2019
@@ -29,12 +29,12 @@ void MCSectionXCOFF::PrintSwitchToSectio
}
if (getKind().isBSSLocal() || getKind().isCommon()) {
- if (getMappingClass() != XCOFF::XMC_RW &&
- getMappingClass() != XCOFF::XMC_BS)
- llvm_unreachable("Generated a storage-mapping class for a common/bss "
- "csect we don't understand how to switch to.");
- if (getCSectType() != XCOFF::XTY_CM)
- llvm_unreachable("wrong csect type for .bss csect");
+ assert((getMappingClass() == XCOFF::XMC_RW ||
+ getMappingClass() == XCOFF::XMC_BS) &&
+ "Generated a storage-mapping class for a common/bss csect we don't "
+ "understand how to switch to.");
+ assert(getCSectType() == XCOFF::XTY_CM &&
+ "wrong csect type for .bss csect");
// Don't have to print a directive for switching to section for commons.
// '.comm' and '.lcomm' directives for the variable will create the needed
// csect.
Modified: llvm/trunk/lib/MC/MCXCOFFStreamer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCXCOFFStreamer.cpp?rev=368720&r1=368719&r2=368720&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCXCOFFStreamer.cpp (original)
+++ llvm/trunk/lib/MC/MCXCOFFStreamer.cpp Tue Aug 13 10:04:51 2019
@@ -60,5 +60,5 @@ MCStreamer *llvm::createXCOFFStreamer(MC
void MCXCOFFStreamer::EmitXCOFFLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
unsigned ByteAlign) {
- llvm_unreachable("Not implemented yet.");
-}
\ No newline at end of file
+ report_fatal_error("Emission of local commons not implemented yet.");
+}
More information about the llvm-commits
mailing list