aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCStreamer.h
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2012-12-10 22:49:11 +0000
committerLang Hames <lhames@gmail.com>2012-12-10 22:49:11 +0000
commit07f6a4fde0a1b081fbefd986345c9b2f4f85e88a (patch)
treee55ccef79ff78d44d9c3e1595d718842a15e869e /include/llvm/MC/MCStreamer.h
parent079e0819bc4a0dde6ce427757130db85216167de (diff)
downloadexternal_llvm-07f6a4fde0a1b081fbefd986345c9b2f4f85e88a.zip
external_llvm-07f6a4fde0a1b081fbefd986345c9b2f4f85e88a.tar.gz
external_llvm-07f6a4fde0a1b081fbefd986345c9b2f4f85e88a.tar.bz2
Defer call to InitSections until after MCContext has been initialized. If
InitSections is called before the MCContext is initialized it could cause duplicate temporary symbols to be emitted later (after context initialization resets the temporary label counter). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169785 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/MC/MCStreamer.h')
-rw-r--r--include/llvm/MC/MCStreamer.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/llvm/MC/MCStreamer.h b/include/llvm/MC/MCStreamer.h
index 3b368c3..c411030 100644
--- a/include/llvm/MC/MCStreamer.h
+++ b/include/llvm/MC/MCStreamer.h
@@ -70,6 +70,8 @@ namespace llvm {
SmallVector<std::pair<const MCSection *,
const MCSection *>, 4> SectionStack;
+ bool AutoInitSections;
+
protected:
MCStreamer(MCContext &Ctx);
@@ -214,6 +216,17 @@ namespace llvm {
SectionStack.back().first = Section;
}
+ /// Initialize the streamer.
+ void InitStreamer() {
+ if (AutoInitSections)
+ InitSections();
+ }
+
+ /// Tell this MCStreamer to call InitSections upon initialization.
+ void setAutoInitSections(bool AutoInitSections) {
+ this->AutoInitSections = AutoInitSections;
+ }
+
/// InitSections - Create the default sections and set the initial one.
virtual void InitSections() = 0;