@@ -111,13 +111,13 @@ TypeRefBuilder::normalizeReflectionName(RemoteRef<char> reflectionName) {
111
111
case Node::Kind::OpaqueTypeDescriptorSymbolicReference:
112
112
// Symbolic references cannot be mangled, return a failure.
113
113
NormalizedReflectionNameCache.insert (std::make_pair (
114
- reflectionNameRemoteAddress, ( llvm::Optional<std::string>){} ));
114
+ reflectionNameRemoteAddress, llvm::Optional<std::string>() ));
115
115
return {};
116
116
default :
117
117
auto mangling = mangleNode (node);
118
118
if (!mangling.isSuccess ()) {
119
119
NormalizedReflectionNameCache.insert (std::make_pair (
120
- reflectionNameRemoteAddress, ( llvm::Optional<std::string>){} ));
120
+ reflectionNameRemoteAddress, llvm::Optional<std::string>() ));
121
121
return {};
122
122
}
123
123
NormalizedReflectionNameCache.insert (
@@ -415,6 +415,35 @@ TypeRefBuilder::getBuiltinTypeInfo(const TypeRef *TR) {
415
415
else
416
416
return nullptr ;
417
417
418
+ for (; NormalizedReflectionNameCacheLastReflectionInfoCache <
419
+ ReflectionInfos.size ();
420
+ NormalizedReflectionNameCacheLastReflectionInfoCache++) {
421
+ for (auto BuiltinTypeDescriptor :
422
+ ReflectionInfos[NormalizedReflectionNameCacheLastReflectionInfoCache]
423
+ .Builtin ) {
424
+ if (BuiltinTypeDescriptor->Stride <= 0 )
425
+ continue ;
426
+ if (!BuiltinTypeDescriptor->hasMangledTypeName ())
427
+ continue ;
428
+
429
+ auto Alignment = BuiltinTypeDescriptor->getAlignment ();
430
+ if (Alignment <= 0 )
431
+ continue ;
432
+ // Reject any alignment that's not a power of two.
433
+ if (Alignment & (Alignment - 1 ))
434
+ continue ;
435
+
436
+ auto CandidateMangledName =
437
+ readTypeRef (BuiltinTypeDescriptor, BuiltinTypeDescriptor->TypeName );
438
+ auto CandidateNormalizedName =
439
+ normalizeReflectionName (CandidateMangledName);
440
+ if (CandidateNormalizedName) {
441
+ BuiltInTypeDescriptorCache.insert (
442
+ std::make_pair (*CandidateNormalizedName, BuiltinTypeDescriptor));
443
+ }
444
+ }
445
+ }
446
+
418
447
if (const auto found = BuiltInTypeDescriptorCache.find (MangledName);
419
448
found != BuiltInTypeDescriptorCache.end ()) {
420
449
return found->second ;
0 commit comments