aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-18 06:15:16 +0000
committerChris Lattner <sabre@nondot.org>2009-08-18 06:15:16 +0000
commitd69d8ad1c3569a5cbf08e795dfc3582e75c3b9ff (patch)
treebbaf94dcb552ae8dcfb382c406cb1c7685278508 /include/llvm/MC
parent2c3a75c3853a35b38796daea0bc551c51b80b3c0 (diff)
downloadexternal_llvm-d69d8ad1c3569a5cbf08e795dfc3582e75c3b9ff.zip
external_llvm-d69d8ad1c3569a5cbf08e795dfc3582e75c3b9ff.tar.gz
external_llvm-d69d8ad1c3569a5cbf08e795dfc3582e75c3b9ff.tar.bz2
Make AsmStreamer maintain a notion of the current section, pushing it up from the
MCAsmStreamer. Based on this, eliminate the current section from AsmPrinter. While I'm at it, clean up the last of the horrible "switch to null section" stuff and add an assert. This change is in preparation for completely eliminating asmprinter::switchtosection. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79324 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC')
-rw-r--r--include/llvm/MC/MCStreamer.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index 48096c7..4d55990 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -69,6 +69,9 @@ namespace llvm {
protected:
MCStreamer(MCContext &Ctx);
+ /// CurSection - This is the current section code is being emitted to, it is
+ /// kept up to date by SwitchSection.
+ const MCSection *CurSection;
public:
virtual ~MCStreamer();
@@ -78,11 +81,16 @@ namespace llvm {
/// @{
/// SwitchSection - Set the current section where code is being emitted to
- /// @param Section.
+ /// @param Section. This is required to update CurSection.
///
/// This corresponds to assembler directives like .section, .text, etc.
virtual void SwitchSection(const MCSection *Section) = 0;
+
+ /// getCurrentSection - Return the current seciton that the streamer is
+ /// emitting code to.
+ const MCSection *getCurrentSection() const { return CurSection; }
+
/// EmitLabel - Emit a label for @param Symbol into the current section.
///
/// This corresponds to an assembler statement such as: