change AsmPrinter to switch sections using AsmStreamer instead of
doing it directly.  This requires const'izing a bunch of stuff that
took sections, but this seems like the right semantic thing to do:
emitting a label to a section shouldn't mutate the MCSection object
itself, for example.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79227 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index d46043b..7f23abe 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -98,23 +98,18 @@
 /// FIXME: Remove support for null sections.
 ///
 void AsmPrinter::SwitchToSection(const MCSection *NS) {
-  // If we're already in this section, we're done.
-  if (CurrentSection == NS) return;
-
   CurrentSection = NS;
-
-  if (NS == 0) return;
-  
-  NS->PrintSwitchToSection(*TAI, O);
+  // FIXME: Remove support for null sections!
+  if (NS)
+    OutStreamer.SwitchSection(NS);
 }
 
 void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
   MachineFunctionPass::getAnalysisUsage(AU);
   AU.addRequired<GCModuleInfo>();
-  if (ExuberantAsm) {
+  if (ExuberantAsm)
     AU.addRequired<MachineLoopInfo>();
-  }
 }
 
 bool AsmPrinter::doInitialization(Module &M) {