File tree Expand file tree Collapse file tree 6 files changed +36
-3
lines changed Expand file tree Collapse file tree 6 files changed +36
-3
lines changed Original file line number Diff line number Diff line change @@ -1290,6 +1290,9 @@ class ASTContext : public RefCountedBase<ASTContext> {
1290
1290
// Implicitly-declared type 'struct _GUID'.
1291
1291
mutable TagDecl *MSGuidTagDecl = nullptr ;
1292
1292
1293
+ // Implicitly-declared type 'struct type_info'.
1294
+ mutable TagDecl *MSTypeInfoTagDecl = nullptr ;
1295
+
1293
1296
// / Keep track of CUDA/HIP device-side variables ODR-used by host code.
1294
1297
// / This does not include extern shared variables used by device host
1295
1298
// / functions as addresses of shared variables are per warp, therefore
@@ -2381,6 +2384,15 @@ class ASTContext : public RefCountedBase<ASTContext> {
2381
2384
return getTagDeclType (MSGuidTagDecl);
2382
2385
}
2383
2386
2387
+ // / Retrieve the implicitly-predeclared 'struct type_info' declaration.
2388
+ TagDecl *getMSTypeInfoTagDecl () const {
2389
+ // Lazily create this type on demand - it's only needed for MS builds.
2390
+ if (!MSTypeInfoTagDecl) {
2391
+ MSTypeInfoTagDecl = buildImplicitRecord (" type_info" );
2392
+ }
2393
+ return MSTypeInfoTagDecl;
2394
+ }
2395
+
2384
2396
// / Return whether a declaration to a builtin is allowed to be
2385
2397
// / overloaded/redeclared.
2386
2398
bool canBuiltinBeRedeclared (const FunctionDecl *) const ;
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ enum PredefinedDeclIDs {
77
77
// / The internal '__NSConstantString' tag type.
78
78
PREDEF_DECL_CF_CONSTANT_STRING_TAG_ID,
79
79
80
+ // / The predeclared 'type_info' struct.
81
+ PREDEF_DECL_BUILTIN_MS_TYPE_INFO_TAG_ID,
82
+
80
83
#define BuiltinTemplate (BTName ) PREDEF_DECL##BTName##_ID,
81
84
#include " clang/Basic/BuiltinTemplates.inc"
82
85
Original file line number Diff line number Diff line change @@ -443,9 +443,7 @@ void Sema::Initialize() {
443
443
if (getLangOpts ().MSVCCompat ) {
444
444
if (getLangOpts ().CPlusPlus &&
445
445
IdResolver.begin (&Context.Idents .get (" type_info" )) == IdResolver.end ())
446
- PushOnScopeChains (
447
- Context.buildImplicitRecord (" type_info" , TagTypeKind::Class),
448
- TUScope);
446
+ PushOnScopeChains (Context.getMSTypeInfoTagDecl (), TUScope);
449
447
450
448
addImplicitTypedef (" size_t" , Context.getSizeType ());
451
449
}
Original file line number Diff line number Diff line change @@ -8318,6 +8318,9 @@ Decl *ASTReader::getPredefinedDecl(PredefinedDeclIDs ID) {
8318
8318
NewLoaded = Context.getCFConstantStringTagDecl ();
8319
8319
break ;
8320
8320
8321
+ case PREDEF_DECL_BUILTIN_MS_TYPE_INFO_TAG_ID:
8322
+ return Context.getMSTypeInfoTagDecl ();
8323
+
8321
8324
#define BuiltinTemplate (BTName ) \
8322
8325
case PREDEF_DECL##BTName##_ID: \
8323
8326
if (Context.Decl ##BTName) \
Original file line number Diff line number Diff line change @@ -5618,6 +5618,8 @@ void ASTWriter::PrepareWritingSpecialDecls(Sema &SemaRef) {
5618
5618
PREDEF_DECL_BUILTIN_MS_VA_LIST_ID);
5619
5619
RegisterPredefDecl (Context.MSGuidTagDecl ,
5620
5620
PREDEF_DECL_BUILTIN_MS_GUID_ID);
5621
+ RegisterPredefDecl (Context.MSTypeInfoTagDecl ,
5622
+ PREDEF_DECL_BUILTIN_MS_TYPE_INFO_TAG_ID);
5621
5623
RegisterPredefDecl (Context.ExternCContext , PREDEF_DECL_EXTERN_C_CONTEXT_ID);
5622
5624
RegisterPredefDecl (Context.CFConstantStringTypeDecl ,
5623
5625
PREDEF_DECL_CF_CONSTANT_STRING_ID);
Original file line number Diff line number Diff line change
1
+ // RUN: split-file %s %t
2
+
3
+ // RUN: %clang_cc1 -I%t -emit-module -o %t/a.pcm -fmodules %t/module.modulemap -fno-implicit-modules -fmodule-name=a -x c++-header -fms-compatibility
4
+ // RUN: %clang_cc1 -I%t -emit-module -o %t/b.pcm -fmodules %t/module.modulemap -fno-implicit-modules -fmodule-name=b -x c++-header -fms-compatibility -fmodule-file=%t/a.pcm
5
+
6
+ // --- module.modulemap
7
+ module a { header " a.h" }
8
+ module b { header " b.h" }
9
+
10
+ // --- a.h
11
+ type_info* foo;
12
+
13
+ // --- b.h
14
+ type_info* bar;
15
+
You can’t perform that action at this time.
0 commit comments