File tree Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Expand file tree Collapse file tree 2 files changed +45
-2
lines changed Original file line number Diff line number Diff line change @@ -3246,13 +3246,17 @@ void MicrosoftCXXNameMangler::mangleTagTypeKind(TagTypeKind TTK) {
3246
3246
}
3247
3247
void MicrosoftCXXNameMangler::mangleType (const EnumType *T, Qualifiers,
3248
3248
SourceRange) {
3249
- mangleType (cast<TagType>(T)->getOriginalDecl ()-> getDefinitionOrSelf () );
3249
+ mangleType (cast<TagType>(T)->getOriginalDecl ());
3250
3250
}
3251
3251
void MicrosoftCXXNameMangler::mangleType (const RecordType *T, Qualifiers,
3252
3252
SourceRange) {
3253
- mangleType (cast<TagType>(T)->getOriginalDecl ()-> getDefinitionOrSelf () );
3253
+ mangleType (cast<TagType>(T)->getOriginalDecl ());
3254
3254
}
3255
3255
void MicrosoftCXXNameMangler::mangleType (const TagDecl *TD) {
3256
+ // MSVC chooses the tag kind of the definition if it exists, otherwise it
3257
+ // always picks the first declaration.
3258
+ const auto *Def = TD->getDefinition ();
3259
+ TD = Def ? Def : TD->getFirstDecl ();
3256
3260
mangleTagTypeKind (TD->getTagKind ());
3257
3261
mangleName (TD);
3258
3262
}
Original file line number Diff line number Diff line change @@ -358,3 +358,42 @@ struct s { enum {}; enum {}; };
358
358
// DBG-DAG: DW_TAG_enumeration_type{{.*}}identifier: ".?AW4<unnamed-type-$S3>@s@pr37723@@"
359
359
s x;
360
360
}
361
+
362
+ namespace InconsistentTagKinds {
363
+ namespace t1 {
364
+ class A ;
365
+ struct A ;
366
+ void f (A*) {}
367
+ // CHECK-DAG: @"?f@t1@InconsistentTagKinds@@YAXPAVA@12@@Z"
368
+ } // namespace t1
369
+ namespace t2 {
370
+ struct A ;
371
+ class A ;
372
+ void f (A*) {}
373
+ // CHECK-DAG: @"?f@t2@InconsistentTagKinds@@YAXPAUA@12@@Z"
374
+ } // namespace t2
375
+ namespace t3 {
376
+ class A {};
377
+ struct A ;
378
+ void f (A*) {}
379
+ // CHECK-DAG: @"?f@t3@InconsistentTagKinds@@YAXPAVA@12@@Z"
380
+ } // namespace t3
381
+ namespace t4 {
382
+ struct A {};
383
+ class A ;
384
+ void f (A*) {}
385
+ // CHECK-DAG: @"?f@t4@InconsistentTagKinds@@YAXPAUA@12@@Z"
386
+ } // namespace t4
387
+ namespace t5 {
388
+ class A ;
389
+ struct A {};
390
+ void f (A*) {}
391
+ // CHECK-DAG: @"?f@t5@InconsistentTagKinds@@YAXPAUA@12@@Z"
392
+ } // namespace t5
393
+ namespace t6 {
394
+ struct A ;
395
+ class A {};
396
+ void f (A*) {}
397
+ // CHECK-DAG: @"?f@t6@InconsistentTagKinds@@YAXPAVA@12@@Z"
398
+ } // namespace t6
399
+ } // namespace InconsistentTagKinds
You can’t perform that action at this time.
0 commit comments