@@ -166,6 +166,7 @@ class llvm::WinCOFFWriter {
166166 int getSectionNumber (const MCSection &Section) const ;
167167
168168private:
169+ MCContext &getContext () const { return OWriter.getContext (); }
169170 COFFSymbol *createSymbol (StringRef Name);
170171 COFFSymbol *GetOrCreateCOFFSymbol (const MCSymbol *Symbol);
171172 COFFSection *createSection (StringRef Name);
@@ -841,15 +842,14 @@ void WinCOFFWriter::recordRelocation(MCAssembler &Asm,
841842
842843 const MCSymbol &A = *Target.getAddSym ();
843844 if (!A.isRegistered ()) {
844- Asm.getContext ().reportError (Fixup.getLoc (), Twine (" symbol '" ) +
845- A.getName () +
846- " ' can not be undefined" );
845+ getContext ().reportError (Fixup.getLoc (), Twine (" symbol '" ) + A.getName () +
846+ " ' can not be undefined" );
847847 return ;
848848 }
849849 if (A.isTemporary () && A.isUndefined ()) {
850- Asm. getContext ().reportError (Fixup.getLoc (), Twine (" assembler label '" ) +
851- A.getName () +
852- " ' can not be undefined" );
850+ getContext ().reportError (Fixup.getLoc (), Twine (" assembler label '" ) +
851+ A.getName () +
852+ " ' can not be undefined" );
853853 return ;
854854 }
855855
@@ -862,7 +862,7 @@ void WinCOFFWriter::recordRelocation(MCAssembler &Asm,
862862 COFFSection *Sec = SectionMap[MCSec];
863863 if (const MCSymbol *B = Target.getSubSym ()) {
864864 if (!B->getFragment ()) {
865- Asm. getContext ().reportError (
865+ getContext ().reportError (
866866 Fixup.getLoc (),
867867 Twine (" symbol '" ) + B->getName () +
868868 " ' can not be undefined in a subtraction expression" );
@@ -920,7 +920,7 @@ void WinCOFFWriter::recordRelocation(MCAssembler &Asm,
920920
921921 Reloc.Data .VirtualAddress += Fixup.getOffset ();
922922 Reloc.Data .Type = OWriter.TargetObjectWriter ->getRelocType (
923- Asm. getContext (), Target, Fixup, Target.getSubSym (), Asm.getBackend ());
923+ getContext (), Target, Fixup, Target.getSubSym (), Asm.getBackend ());
924924
925925 // The *_REL32 relocations are relative to the end of the relocation,
926926 // not to the start.
@@ -1053,7 +1053,7 @@ uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) {
10531053 // It's an error to try to associate with an undefined symbol or a symbol
10541054 // without a section.
10551055 if (!AssocMCSym->isInSection ()) {
1056- Asm. getContext ().reportError (
1056+ getContext ().reportError (
10571057 SMLoc (), Twine (" cannot make section " ) + MCSec.getName () +
10581058 Twine (" associative with sectionless symbol " ) +
10591059 AssocMCSym->getName ());
@@ -1073,8 +1073,8 @@ uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) {
10731073
10741074 // Create the contents of the .llvm_addrsig section.
10751075 if (Mode != DwoOnly && OWriter.getEmitAddrsigSection ()) {
1076- auto *Sec = Asm. getContext ().getCOFFSection (
1077- " .llvm_addrsig " , COFF::IMAGE_SCN_LNK_REMOVE);
1076+ auto *Sec = getContext ().getCOFFSection (" .llvm_addrsig " ,
1077+ COFF::IMAGE_SCN_LNK_REMOVE);
10781078 auto *Frag = cast<MCDataFragment>(Sec->curFragList ()->Head );
10791079 raw_svector_ostream OS (Frag->getContents ());
10801080 for (const MCSymbol *S : OWriter.AddrsigSyms ) {
@@ -1095,8 +1095,8 @@ uint64_t WinCOFFWriter::writeObject(MCAssembler &Asm) {
10951095
10961096 // Create the contents of the .llvm.call-graph-profile section.
10971097 if (Mode != DwoOnly && !OWriter.getCGProfile ().empty ()) {
1098- auto *Sec = Asm. getContext ().getCOFFSection (
1099- " .llvm.call-graph-profile " , COFF::IMAGE_SCN_LNK_REMOVE);
1098+ auto *Sec = getContext ().getCOFFSection (" .llvm.call-graph-profile " ,
1099+ COFF::IMAGE_SCN_LNK_REMOVE);
11001100 auto *Frag = cast<MCDataFragment>(Sec->curFragList ()->Head );
11011101 raw_svector_ostream OS (Frag->getContents ());
11021102 for (const auto &CGPE : OWriter.getCGProfile ()) {
@@ -1205,7 +1205,7 @@ void WinCOFFObjectWriter::recordRelocation(MCAssembler &Asm,
12051205uint64_t WinCOFFObjectWriter::writeObject (MCAssembler &Asm) {
12061206 // If the assember had an error, then layout will not have completed, so we
12071207 // cannot write an object file.
1208- if (Asm. getContext ().hadError ())
1208+ if (getContext ().hadError ())
12091209 return 0 ;
12101210
12111211 uint64_t TotalSize = ObjWriter->writeObject (Asm);
0 commit comments