[llvm-commits] [llvm] r77976 - /llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Chris Lattner sabre at nondot.org
Mon Aug 3 11:04:54 PDT 2009


Author: lattner
Date: Mon Aug  3 13:04:42 2009
New Revision: 77976

URL: http://llvm.org/viewvc/llvm-project?rev=77976&view=rev
Log:
make SwitchToSection accept null sections for now.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=77976&r1=77975&r2=77976&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Mon Aug  3 13:04:42 2009
@@ -132,9 +132,14 @@
 }
 
 /// SwitchToSection - Switch to the specified section of the executable if we
-/// are not already in it!
+/// are not already in it!  If "NS" is null, then this causes us to exit the
+/// current section and not reenter another one.  This is generally used for
+/// asmprinter hacks.
+///
+/// FIXME: Remove support for null sections.
+///
 void AsmPrinter::SwitchToSection(const MCSection *NS) {
-  const std::string &NewSection = NS->getName();
+  const std::string &NewSection = NS ? NS->getName() : "";
 
   // If we're already in this section, we're done.
   if (CurrentSection == NewSection) return;
@@ -165,7 +170,7 @@
     O << TAI->getDataSectionStartSuffix() << '\n';
   }
 
-  IsInTextSection = NS->getKind().isText();
+  IsInTextSection = NS ? NS->getKind().isText() : false;
 }
 
 void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {





More information about the llvm-commits mailing list