Skip to content

Commit 360160b

Browse files
committed
[SharedCache] Remove designator initialization
Fixes MSVC C++17 failing to compile, hopefully.
1 parent 8f9645b commit 360160b

File tree

3 files changed

+96
-93
lines changed

3 files changed

+96
-93
lines changed

view/sharedcache/api/sharedcacheapi.h

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ namespace SharedCacheAPI {
139139
std::string installName;
140140

141141
std::vector<std::pair<uint64_t, bool>> entryPoints;
142-
std::vector<uint64_t> m_entryPoints; //list of entrypoints
142+
std::vector<uint64_t> m_entryPoints; // list of entrypoints
143143

144144
symtab_command symtab;
145145
dysymtab_command dysymtab;
@@ -152,7 +152,7 @@ namespace SharedCacheAPI {
152152

153153
uint64_t relocationBase;
154154
// Section and program headers, internally use 64-bit form as it is a superset of 32-bit
155-
std::vector<segment_command_64> segments; //only three types of sections __TEXT, __DATA, __IMPORT
155+
std::vector<segment_command_64> segments; // only three types of sections __TEXT, __DATA, __IMPORT
156156
segment_command_64 linkeditSegment;
157157
std::vector<section_64> sections;
158158
std::vector<std::string> sectionNames;
@@ -167,6 +167,7 @@ namespace SharedCacheAPI {
167167

168168
std::string exportTriePath;
169169

170+
bool linkeditPresent = false;
170171
bool dysymPresent = false;
171172
bool dyldInfoPresent = false;
172173
bool exportTriePresent = false;
@@ -186,7 +187,7 @@ namespace SharedCacheAPI {
186187
MSS_SUBCLASS(symtab);
187188
MSS_SUBCLASS(dysymtab);
188189
MSS_SUBCLASS(dyldInfo);
189-
// MSS_SUBCLASS(routines64);
190+
MSS_SUBCLASS(routines64);
190191
MSS_SUBCLASS(functionStarts);
191192
MSS_SUBCLASS(moduleInitSections);
192193
MSS_SUBCLASS(exportTrie);
@@ -202,6 +203,7 @@ namespace SharedCacheAPI {
202203
MSS_SUBCLASS(buildVersion);
203204
MSS_SUBCLASS(buildToolVersions);
204205
MSS(exportTriePath);
206+
MSS(linkeditPresent);
205207
MSS(dysymPresent);
206208
MSS(dyldInfoPresent);
207209
MSS(exportTriePresent);
@@ -212,41 +214,42 @@ namespace SharedCacheAPI {
212214
}
213215

214216
static SharedCacheMachOHeader Load(SharedCacheCore::DeserializationContext& context) {
215-
return SharedCacheMachOHeader {
216-
.MSL(textBase),
217-
.MSL(loadCommandOffset),
218-
.MSL(ident),
219-
.MSL(identifierPrefix),
220-
.MSL(installName),
221-
.MSL(entryPoints),
222-
.MSL(m_entryPoints),
223-
.MSL(symtab),
224-
.MSL(dysymtab),
225-
.MSL(dyldInfo),
226-
// .MSL(routines64), // FIXME CRASH but also do we even use this?
227-
.MSL(functionStarts),
228-
.MSL(moduleInitSections),
229-
.MSL(exportTrie),
230-
.MSL(chainedFixups),
231-
.MSL(relocationBase),
232-
.MSL(segments),
233-
.MSL(linkeditSegment),
234-
.MSL(sections),
235-
.MSL(sectionNames),
236-
.MSL(symbolStubSections),
237-
.MSL(symbolPointerSections),
238-
.MSL(dylibs),
239-
.MSL(buildVersion),
240-
.MSL(buildToolVersions),
241-
.MSL(exportTriePath),
242-
.MSL(dysymPresent),
243-
.MSL(dyldInfoPresent),
244-
.MSL(exportTriePresent),
245-
.MSL(chainedFixupsPresent),
246-
// .MSL(routinesPresent),
247-
.MSL(functionStartsPresent),
248-
.MSL(relocatable),
249-
};
217+
SharedCacheMachOHeader header;
218+
header.MSL(textBase);
219+
header.MSL(loadCommandOffset);
220+
header.MSL(ident);
221+
header.MSL(identifierPrefix);
222+
header.MSL(installName);
223+
header.MSL(entryPoints);
224+
header.MSL(m_entryPoints);
225+
header.MSL(symtab);
226+
header.MSL(dysymtab);
227+
header.MSL(dyldInfo);
228+
header.MSL(routines64);
229+
header.MSL(functionStarts);
230+
header.MSL(moduleInitSections);
231+
header.MSL(exportTrie);
232+
header.MSL(chainedFixups);
233+
header.MSL(relocationBase);
234+
header.MSL(segments);
235+
header.MSL(linkeditSegment);
236+
header.MSL(sections);
237+
header.MSL(sectionNames);
238+
header.MSL(symbolStubSections);
239+
header.MSL(symbolPointerSections);
240+
header.MSL(dylibs);
241+
header.MSL(buildVersion);
242+
header.MSL(buildToolVersions);
243+
header.MSL(exportTriePath);
244+
header.MSL(linkeditPresent);
245+
header.MSL(dysymPresent);
246+
header.MSL(dyldInfoPresent);
247+
header.MSL(exportTriePresent);
248+
header.MSL(chainedFixupsPresent);
249+
header.MSL(routinesPresent);
250+
header.MSL(functionStartsPresent);
251+
header.MSL(relocatable);
252+
return header;
250253
}
251254
};
252255

view/sharedcache/core/SharedCache.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3591,11 +3591,11 @@ void BackingCache::Store(SerializationContext& context) const
35913591

35923592
BackingCache BackingCache::Load(DeserializationContext& context)
35933593
{
3594-
return BackingCache {
3595-
.MSL(path),
3596-
.MSL(isPrimary),
3597-
.MSL(mappings),
3598-
};
3594+
BackingCache cache;
3595+
cache.MSL(path);
3596+
cache.MSL(isPrimary);
3597+
cache.MSL(mappings);
3598+
return cache;
35993599
}
36003600

36013601
#if defined(__GNUC__) || defined(__clang__)

view/sharedcache/core/SharedCache.h

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ namespace SharedCacheCore {
4545
}
4646

4747
static MemoryRegion Load(DeserializationContext& context) {
48-
return MemoryRegion {
49-
.MSL(prettyName),
50-
.MSL(start),
51-
.MSL(size),
52-
.MSL(loaded),
53-
.MSL(rawViewOffsetIfLoaded),
54-
.headerInitialized = false, // NOTE: I guess this is not stored?
55-
.MSL_CAST(flags, uint64_t, BNSegmentFlag),
56-
};
48+
MemoryRegion region;
49+
region.MSL(prettyName);
50+
region.MSL(start);
51+
region.MSL(size);
52+
region.MSL(loaded);
53+
region.MSL(rawViewOffsetIfLoaded);
54+
region.headerInitialized = false; // NOTE: I guess this is not stored?
55+
region.MSL_CAST(flags, uint64_t, BNSegmentFlag);
56+
return region;
5757
}
5858
};
5959

@@ -80,11 +80,11 @@ namespace SharedCacheCore {
8080
regions.push_back(MemoryRegion::LoadFromString(region.GetString()));
8181
}
8282

83-
return CacheImage {
84-
.MSL(installName),
85-
.MSL(headerLocation),
86-
.regions = std::move(regions),
87-
};
83+
CacheImage image;
84+
image.MSL(installName);
85+
image.MSL(headerLocation);
86+
image.regions = std::move(regions);
87+
return image;
8888
}
8989
};
9090

@@ -471,42 +471,42 @@ namespace SharedCacheCore {
471471
}
472472

473473
static SharedCacheMachOHeader Load(DeserializationContext& context) {
474-
return SharedCacheMachOHeader {
475-
.MSL(textBase),
476-
.MSL(loadCommandOffset),
477-
.MSL(ident),
478-
.MSL(identifierPrefix),
479-
.MSL(installName),
480-
.MSL(entryPoints),
481-
.MSL(m_entryPoints),
482-
.MSL(symtab),
483-
.MSL(dysymtab),
484-
.MSL(dyldInfo),
485-
.MSL(routines64),
486-
.MSL(functionStarts),
487-
.MSL(moduleInitSections),
488-
.MSL(exportTrie),
489-
.MSL(chainedFixups),
490-
.MSL(relocationBase),
491-
.MSL(segments),
492-
.MSL(linkeditSegment),
493-
.MSL(sections),
494-
.MSL(sectionNames),
495-
.MSL(symbolStubSections),
496-
.MSL(symbolPointerSections),
497-
.MSL(dylibs),
498-
.MSL(buildVersion),
499-
.MSL(buildToolVersions),
500-
.MSL(exportTriePath),
501-
.MSL(linkeditPresent),
502-
.MSL(dysymPresent),
503-
.MSL(dyldInfoPresent),
504-
.MSL(exportTriePresent),
505-
.MSL(chainedFixupsPresent),
506-
.MSL(routinesPresent),
507-
.MSL(functionStartsPresent),
508-
.MSL(relocatable),
509-
};
474+
SharedCacheMachOHeader header;
475+
header.MSL(textBase);
476+
header.MSL(loadCommandOffset);
477+
header.MSL(ident);
478+
header.MSL(identifierPrefix);
479+
header.MSL(installName);
480+
header.MSL(entryPoints);
481+
header.MSL(m_entryPoints);
482+
header.MSL(symtab);
483+
header.MSL(dysymtab);
484+
header.MSL(dyldInfo);
485+
header.MSL(routines64);
486+
header.MSL(functionStarts);
487+
header.MSL(moduleInitSections);
488+
header.MSL(exportTrie);
489+
header.MSL(chainedFixups);
490+
header.MSL(relocationBase);
491+
header.MSL(segments);
492+
header.MSL(linkeditSegment);
493+
header.MSL(sections);
494+
header.MSL(sectionNames);
495+
header.MSL(symbolStubSections);
496+
header.MSL(symbolPointerSections);
497+
header.MSL(dylibs);
498+
header.MSL(buildVersion);
499+
header.MSL(buildToolVersions);
500+
header.MSL(exportTriePath);
501+
header.MSL(linkeditPresent);
502+
header.MSL(dysymPresent);
503+
header.MSL(dyldInfoPresent);
504+
header.MSL(exportTriePresent);
505+
header.MSL(chainedFixupsPresent);
506+
header.MSL(routinesPresent);
507+
header.MSL(functionStartsPresent);
508+
header.MSL(relocatable);
509+
return header;
510510
}
511511
};
512512

0 commit comments

Comments
 (0)