@@ -303,19 +303,12 @@ static StringRef getPrettyScopeName(const DIScope *Scope) {
303
303
return StringRef ();
304
304
}
305
305
306
- const DISubprogram *CodeViewDebug::collectParentScopeNames (
306
+ static const DISubprogram *getQualifiedNameComponents (
307
307
const DIScope *Scope, SmallVectorImpl<StringRef> &QualifiedNameComponents) {
308
308
const DISubprogram *ClosestSubprogram = nullptr ;
309
309
while (Scope != nullptr ) {
310
310
if (ClosestSubprogram == nullptr )
311
311
ClosestSubprogram = dyn_cast<DISubprogram>(Scope);
312
-
313
- // If a type appears in a scope chain, make sure it gets emitted. The
314
- // frontend will be responsible for deciding if this should be a forward
315
- // declaration or a complete type.
316
- if (const auto *Ty = dyn_cast<DIType>(Scope))
317
- (void )getTypeIndex (Ty);
318
-
319
312
StringRef ScopeName = getPrettyScopeName (Scope);
320
313
if (!ScopeName.empty ())
321
314
QualifiedNameComponents.push_back (ScopeName);
@@ -324,9 +317,8 @@ const DISubprogram *CodeViewDebug::collectParentScopeNames(
324
317
return ClosestSubprogram;
325
318
}
326
319
327
- std::string
328
- CodeViewDebug::formatNestedName (ArrayRef<StringRef> QualifiedNameComponents,
329
- StringRef TypeName) {
320
+ static std::string getQualifiedName (ArrayRef<StringRef> QualifiedNameComponents,
321
+ StringRef TypeName) {
330
322
std::string FullyQualifiedName;
331
323
for (StringRef QualifiedNameComponent :
332
324
llvm::reverse (QualifiedNameComponents)) {
@@ -337,15 +329,10 @@ CodeViewDebug::formatNestedName(ArrayRef<StringRef> QualifiedNameComponents,
337
329
return FullyQualifiedName;
338
330
}
339
331
340
- std::string CodeViewDebug:: getFullyQualifiedName (const DIScope *Scope, StringRef Name) {
332
+ static std::string getFullyQualifiedName (const DIScope *Scope, StringRef Name) {
341
333
SmallVector<StringRef, 5 > QualifiedNameComponents;
342
- collectParentScopeNames (Scope, QualifiedNameComponents);
343
- return formatNestedName (QualifiedNameComponents, Name);
344
- }
345
-
346
- std::string CodeViewDebug::getFullyQualifiedName (const DIScope *Ty) {
347
- const DIScope *Scope = Ty->getScope ();
348
- return getFullyQualifiedName (Scope, getPrettyScopeName (Ty));
334
+ getQualifiedNameComponents (Scope, QualifiedNameComponents);
335
+ return getQualifiedName (QualifiedNameComponents, Name);
349
336
}
350
337
351
338
struct CodeViewDebug ::TypeLoweringScope {
@@ -360,6 +347,11 @@ struct CodeViewDebug::TypeLoweringScope {
360
347
CodeViewDebug &CVD;
361
348
};
362
349
350
+ static std::string getFullyQualifiedName (const DIScope *Ty) {
351
+ const DIScope *Scope = Ty->getScope ();
352
+ return getFullyQualifiedName (Scope, getPrettyScopeName (Ty));
353
+ }
354
+
363
355
TypeIndex CodeViewDebug::getScopeIndex (const DIScope *Scope) {
364
356
// No scope means global scope and that uses the zero index.
365
357
if (!Scope || isa<DIFile>(Scope))
@@ -1476,12 +1468,12 @@ void CodeViewDebug::addToUDTs(const DIType *Ty) {
1476
1468
if (!shouldEmitUdt (Ty))
1477
1469
return ;
1478
1470
1479
- SmallVector<StringRef, 5 > ParentScopeNames ;
1471
+ SmallVector<StringRef, 5 > QualifiedNameComponents ;
1480
1472
const DISubprogram *ClosestSubprogram =
1481
- collectParentScopeNames (Ty->getScope (), ParentScopeNames );
1473
+ getQualifiedNameComponents (Ty->getScope (), QualifiedNameComponents );
1482
1474
1483
1475
std::string FullyQualifiedName =
1484
- formatNestedName (ParentScopeNames , getPrettyScopeName (Ty));
1476
+ getQualifiedName (QualifiedNameComponents , getPrettyScopeName (Ty));
1485
1477
1486
1478
if (ClosestSubprogram == nullptr ) {
1487
1479
GlobalUDTs.emplace_back (std::move (FullyQualifiedName), Ty);
0 commit comments