Skip to content

Commit 0c454df

Browse files
committed
[MC] Make changeSection private
Using changeSection externally would cause `CurFrag` to be out of sync of `SectionStack`. Remove some uses from MipsTargetStreamer.cpp.
1 parent 4a746e5 commit 0c454df

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

llvm/include/llvm/MC/MCStreamer.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,10 @@ class MCStreamer {
255255
/// discussion for future inclusion.
256256
bool AllowAutoPadding = false;
257257

258+
/// This is called by popSection and switchSection, if the current
259+
/// section changes.
260+
virtual void changeSection(MCSection *, uint32_t);
261+
258262
protected:
259263
MCFragment *CurFrag = nullptr;
260264

@@ -410,12 +414,6 @@ class MCStreamer {
410414
return SymbolOrdering.lookup(Sym);
411415
}
412416

413-
/// Update streamer for a new active section.
414-
///
415-
/// This is called by popSection and switchSection, if the current
416-
/// section changes.
417-
virtual void changeSection(MCSection *, uint32_t);
418-
419417
/// Save the current and previous section on the section stack.
420418
void pushSection() {
421419
SectionStack.push_back(

llvm/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -894,11 +894,11 @@ void MipsTargetELFStreamer::finish() {
894894

895895
// .bss, .text and .data are always at least 16-byte aligned.
896896
MCSection &TextSection = *OFI.getTextSection();
897-
S.changeSection(&TextSection);
897+
S.switchSection(&TextSection);
898898
MCSection &DataSection = *OFI.getDataSection();
899-
S.changeSection(&DataSection);
899+
S.switchSection(&DataSection);
900900
MCSection &BSSSection = *OFI.getBSSSection();
901-
S.changeSection(&BSSSection);
901+
S.switchSection(&BSSSection);
902902

903903
TextSection.ensureMinAlignment(Align(16));
904904
DataSection.ensureMinAlignment(Align(16));

0 commit comments

Comments
 (0)