@@ -2862,27 +2862,38 @@ Error MCCASBuilder::createAppleObjCSection() {
2862
2862
return finalizeSection<AppleObjCSectionRef>();
2863
2863
}
2864
2864
2865
- static ArrayRef<char > getFragmentContents (const MCFragment &Fragment) {
2865
+ static void getFragmentContents (const MCFragment &Fragment,
2866
+ SmallVectorImpl<char > &FragContents) {
2866
2867
switch (Fragment.getKind ()) {
2867
2868
#define MCFRAGMENT_NODE_REF (MCFragmentName, MCEnumName, MCEnumIdentifier ) \
2868
2869
case MCFragment::MCEnumName: { \
2869
- return Fragment.getContents (); \
2870
+ FragContents.append (Fragment.getContents ().begin (), \
2871
+ Fragment.getContents ().end ()); \
2872
+ \
2873
+ return ; \
2870
2874
}
2871
2875
#define MCFRAGMENT_ENCODED_FRAGMENT_ONLY
2872
2876
#include " llvm/MCCAS/MCCASObjectV1.def"
2873
2877
case MCFragment::FT_CVInlineLines: {
2874
2878
const MCCVInlineLineTableFragment &SF =
2875
2879
cast<MCCVInlineLineTableFragment>(Fragment);
2876
- return SF.getContents ();
2880
+ FragContents.append (SF.getContents ().begin (), SF.getContents ().end ());
2881
+ return ;
2877
2882
}
2878
2883
case MCFragment::FT_LEB: {
2879
- return Fragment.getContents ();
2884
+ auto FixedContent = Fragment.getContents ();
2885
+ auto VarContent = Fragment.getVarContents ();
2886
+ FragContents.append (FixedContent.begin (), FixedContent.end ());
2887
+ FragContents.append (VarContent.begin (), VarContent.end ());
2888
+ return ;
2880
2889
}
2881
2890
case MCFragment::FT_Align: {
2882
- return Fragment.getContents ();
2891
+ FragContents.append (Fragment.getContents ().begin (),
2892
+ Fragment.getContents ().end ());
2893
+ return ;
2883
2894
}
2884
2895
default :
2885
- return ArrayRef< char >() ;
2896
+ return ;
2886
2897
}
2887
2898
}
2888
2899
@@ -2914,7 +2925,8 @@ partitionFragment(MCAssembler &Asm, SmallVector<char, 0> &Addends,
2914
2925
ArrayRef<MachO::any_relocation_info> RelocationBuffer,
2915
2926
const MCFragment &Fragment, uint64_t &RelocationBufferIndex,
2916
2927
bool IsLittleEndian) {
2917
- auto FragmentContents = getFragmentContents (Fragment);
2928
+ SmallVector<char , 0 > FragmentContents;
2929
+ getFragmentContents (Fragment, FragmentContents);
2918
2930
// / FragmentIndex: It denotes the index into the FragmentContents that is used
2919
2931
// / to copy the data that deduplicates in the \p FinalFragmentContents.
2920
2932
uint64_t FragmentIndex = 0 ;
0 commit comments