aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-03 18:04:42 +0000
committerChris Lattner <sabre@nondot.org>2009-08-03 18:04:42 +0000
commitd54a6b8c58bf0228b965ab00c7d9e2e87239161f (patch)
tree6fd4a137a334807dad17bf60da1f438e29059d2f
parentd1a919e1396ce4bc424f4f24bb69d79a2afd7ea0 (diff)
make SwitchToSection accept null sections for now.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77976 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/AsmPrinter/AsmPrinter.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
index 0a81bd7c2a..c2a89b2d7e 100644
--- a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+++ b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
@@ -132,9 +132,14 @@ void AsmPrinter::SwitchToDataSection(const char *NewSection,
}
/// 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 @@ void AsmPrinter::SwitchToSection(const MCSection *NS) {
O << TAI->getDataSectionStartSuffix() << '\n';
}
- IsInTextSection = NS->getKind().isText();
+ IsInTextSection = NS ? NS->getKind().isText() : false;
}
void AsmPrinter::getAnalysisUsage(AnalysisUsage &AU) const {