@@ -337,9 +337,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
337
337
NoConvergence
338
338
} ConvergenceKind = NoConvergence;
339
339
340
- // / Whether source was present on the first DIFile encountered in each CU.
341
- DenseMap<const DICompileUnit *, bool > HasSourceDebugInfo;
342
-
343
340
// / Stores the count of how many objects were passed to llvm.localescape for a
344
341
// / given function and the largest index passed to llvm.localrecover.
345
342
DenseMap<Function *, std::pair<unsigned , unsigned >> FrameEscapeInfo;
@@ -621,9 +618,6 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
621
618
void verifyAttachedCallBundle (const CallBase &Call,
622
619
const OperandBundleUse &BU);
623
620
624
- // / Verify all-or-nothing property of DIFile source attribute within a CU.
625
- void verifySourceDebugInfo (const DICompileUnit &U, const DIFile &F);
626
-
627
621
// / Verify the llvm.experimental.noalias.scope.decl declarations
628
622
void verifyNoAliasScopeDecl ();
629
623
};
@@ -1420,8 +1414,6 @@ void Verifier::visitDICompileUnit(const DICompileUnit &N) {
1420
1414
1421
1415
CurrentSourceLang = (dwarf::SourceLanguage)N.getSourceLanguage ();
1422
1416
1423
- verifySourceDebugInfo (N, *N.getFile ());
1424
-
1425
1417
CheckDI ((N.getEmissionKind () <= DICompileUnit::LastEmissionKind),
1426
1418
" invalid emission kind" , &N);
1427
1419
@@ -1501,8 +1493,15 @@ void Verifier::visitDISubprogram(const DISubprogram &N) {
1501
1493
CheckDI (N.isDistinct (), " subprogram definitions must be distinct" , &N);
1502
1494
CheckDI (Unit, " subprogram definitions must have a compile unit" , &N);
1503
1495
CheckDI (isa<DICompileUnit>(Unit), " invalid unit type" , &N, Unit);
1504
- if (N.getFile ())
1505
- verifySourceDebugInfo (*N.getUnit (), *N.getFile ());
1496
+ // There's no good way to cross the CU boundary to insert a nested
1497
+ // DISubprogram definition in one CU into a type defined in another CU.
1498
+ auto *CT = dyn_cast_or_null<DICompositeType>(N.getRawScope ());
1499
+ if (CT && CT->getRawIdentifier () &&
1500
+ M.getContext ().isODRUniquingDebugTypes ())
1501
+ CheckDI (N.getDeclaration (),
1502
+ " definition subprograms cannot be nested within DICompositeType "
1503
+ " when enabling ODR" ,
1504
+ &N);
1506
1505
} else {
1507
1506
// Subprogram declarations (part of the type hierarchy).
1508
1507
CheckDI (!Unit, " subprogram declarations must not have a compile unit" , &N);
@@ -6697,14 +6696,6 @@ void Verifier::verifyAttachedCallBundle(const CallBase &Call,
6697
6696
}
6698
6697
}
6699
6698
6700
- void Verifier::verifySourceDebugInfo (const DICompileUnit &U, const DIFile &F) {
6701
- bool HasSource = F.getSource ().has_value ();
6702
- if (!HasSourceDebugInfo.count (&U))
6703
- HasSourceDebugInfo[&U] = HasSource;
6704
- CheckDI (HasSource == HasSourceDebugInfo[&U],
6705
- " inconsistent use of embedded source" );
6706
- }
6707
-
6708
6699
void Verifier::verifyNoAliasScopeDecl () {
6709
6700
if (NoAliasScopeDecls.empty ())
6710
6701
return ;
0 commit comments