@@ -1303,29 +1303,30 @@ public static class Helpers
1303
1303
public static readonly string CreateInstanceIdentifier = Generator . GeneratedIdentifier ( "CreateInstance" ) ;
1304
1304
public static readonly string GetOrCreateInstanceIdentifier = Generator . GeneratedIdentifier ( "GetOrCreateInstance" ) ;
1305
1305
1306
- public static string GetSuffixForInternal ( DeclarationContext @class )
1306
+ public static string GetSuffixForInternal ( Class @class )
1307
1307
{
1308
- if ( @class == null )
1309
- return string . Empty ;
1310
-
1311
- Class template = null ;
1312
1308
var specialization = @class as ClassTemplateSpecialization ??
1313
1309
@class . Namespace as ClassTemplateSpecialization ;
1314
- if ( specialization != null )
1315
- {
1316
- template = specialization . TemplatedDecl . TemplatedClass ;
1317
- if ( @class != specialization )
1318
- template = template . Classes . FirstOrDefault ( c => c . Name == @class . Name ) ;
1319
- }
1320
1310
1321
- if ( template == null || ! template . HasDependentValueFieldInLayout ( ) )
1311
+ if ( specialization == null )
1322
1312
return string . Empty ;
1323
1313
1324
- if ( specialization . Arguments . All (
1325
- a => a . Type . Type ? . IsAddress ( ) == true ) )
1326
- return "_Ptr" ;
1314
+ Class template = specialization . TemplatedDecl . TemplatedClass ;
1315
+ if ( @class != specialization )
1316
+ template = template . Classes . FirstOrDefault ( c => c . Name == @class . Name ) ;
1327
1317
1328
- return GetSuffixFor ( specialization ) ;
1318
+ if ( template . HasDependentValueFieldInLayout ( ) )
1319
+ {
1320
+ if ( specialization . Arguments . All (
1321
+ a => a . Type . Type ? . IsAddress ( ) == true ) )
1322
+ return "_Ptr" ;
1323
+ return GetSuffixFor ( specialization ) ;
1324
+ }
1325
+ // HACK: Clang can't always resolve complex templates such as the base of std::atomic in msvc
1326
+ return ( from @base in @class . Bases
1327
+ let suffix = GetSuffixForInternal ( @base . Class )
1328
+ where suffix . Length > 0
1329
+ select suffix ) . DefaultIfEmpty ( string . Empty ) . First ( ) ;
1329
1330
}
1330
1331
1331
1332
public static string GetSuffixFor ( Declaration decl )
0 commit comments