summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/include/llvm/MC/MCObjectStreamer.h4
-rw-r--r--llvm/include/llvm/MC/MCStreamer.h2
-rw-r--r--llvm/lib/MC/MCContext.cpp3
3 files changed, 4 insertions, 5 deletions
diff --git a/llvm/include/llvm/MC/MCObjectStreamer.h b/llvm/include/llvm/MC/MCObjectStreamer.h
index 1a1222562f1..c990534e538 100644
--- a/llvm/include/llvm/MC/MCObjectStreamer.h
+++ b/llvm/include/llvm/MC/MCObjectStreamer.h
@@ -147,8 +147,8 @@ public:
bool emitAbsoluteSymbolDiff(const MCSymbol *Hi, const MCSymbol *Lo,
unsigned Size) override;
- bool mayHaveInstructions() const override {
- return getCurrentSectionData()->hasInstructions();
+ bool mayHaveInstructions(const MCSection &Sec) const override {
+ return Assembler->getOrCreateSectionData(Sec).hasInstructions();
}
};
diff --git a/llvm/include/llvm/MC/MCStreamer.h b/llvm/include/llvm/MC/MCStreamer.h
index 3dec9491a26..9f679c2482f 100644
--- a/llvm/include/llvm/MC/MCStreamer.h
+++ b/llvm/include/llvm/MC/MCStreamer.h
@@ -728,7 +728,7 @@ public:
/// \brief Finish emission of machine code.
void Finish();
- virtual bool mayHaveInstructions() const { return true; }
+ virtual bool mayHaveInstructions(const MCSection &Sec) const { return true; }
};
/// Create a dummy machine code streamer, which does nothing. This is useful for
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index bbff9b7c6a5..cbc130f6bfa 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -442,8 +442,7 @@ bool MCContext::isValidDwarfFileNumber(unsigned FileNumber, unsigned CUID) {
void MCContext::finalizeDwarfSections(MCStreamer &MCOS) {
std::vector<const MCSection *> Keep;
for (const MCSection *Sec : SectionsForRanges) {
- MCOS.SwitchSection(Sec); // FIXME: pass the section to mayHaveInstructions
- if (MCOS.mayHaveInstructions())
+ if (MCOS.mayHaveInstructions(*Sec))
Keep.push_back(Sec);
}
SectionsForRanges.clear();
OpenPOWER on IntegriCloud