Move HasInstructions to MCSection.
[oota-llvm.git] / lib / MC / MCELFStreamer.cpp
index 0e4d637c8ce2d503c39f596aab86499511c62d7a..23546cc085db30945a6b0d8c1fe4a8e1a043cffd 100644 (file)
@@ -137,11 +137,14 @@ void MCELFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
 
 // If bundle aligment is used and there are any instructions in the section, it
 // needs to be aligned to at least the bundle size.
-static void setSectionAlignmentForBundling(
-    const MCAssembler &Assembler, MCSectionData *Section) {
-  if (Assembler.isBundlingEnabled() && Section && Section->hasInstructions() &&
-      Section->getSection().getAlignment() < Assembler.getBundleAlignSize())
-    Section->getSection().setAlignment(Assembler.getBundleAlignSize());
+static void setSectionAlignmentForBundling(const MCAssembler &Assembler,
+                                           MCSectionData *SD) {
+  if (!SD)
+    return;
+  MCSection &Section = SD->getSection();
+  if (Assembler.isBundlingEnabled() && Section.hasInstructions() &&
+      Section.getAlignment() < Assembler.getBundleAlignSize())
+    Section.setAlignment(Assembler.getBundleAlignSize());
 }
 
 void MCELFStreamer::ChangeSection(MCSection *Section,