@@ -227,20 +227,6 @@ llvm::DIScope *CGDebugInfo::getContextDescriptor(const Decl *Context,
227
227
return Default;
228
228
}
229
229
230
- void CGDebugInfo::recordDeclarationLexicalScope (const Decl &D) {
231
- assert (LexicalBlockMap.find (&D) == LexicalBlockMap.end () &&
232
- " D is already mapped to a lexical block scope" );
233
- if (!LexicalBlockStack.empty ())
234
- LexicalBlockMap.insert ({&D, LexicalBlockStack.back ()});
235
- }
236
-
237
- llvm::DIScope *CGDebugInfo::getDeclarationLexicalScope (const Decl *D) {
238
- auto I = LexicalBlockMap.find (D);
239
- if (I != LexicalBlockMap.end ())
240
- return I->second ;
241
- return getDeclContextDescriptor (cast<Decl>(D));
242
- }
243
-
244
230
PrintingPolicy CGDebugInfo::getPrintingPolicy () const {
245
231
PrintingPolicy PP = CGM.getContext ().getPrintingPolicy ();
246
232
@@ -1360,13 +1346,13 @@ llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
1360
1346
// declared.
1361
1347
SourceLocation Loc = Ty->getDecl ()->getLocation ();
1362
1348
1363
- llvm::DIScope *TDContext = getDeclarationLexicalScope (Ty->getDecl ());
1364
1349
uint32_t Align = getDeclAlignIfRequired (Ty->getDecl (), CGM.getContext ());
1365
1350
// Typedefs are derived from some other type.
1366
1351
llvm::DINodeArray Annotations = CollectBTFDeclTagAnnotations (Ty->getDecl ());
1367
1352
return DBuilder.createTypedef (Underlying, Ty->getDecl ()->getName (),
1368
1353
getOrCreateFile (Loc), getLineNumber (Loc),
1369
- TDContext, Align, Annotations);
1354
+ getDeclContextDescriptor (Ty->getDecl ()), Align,
1355
+ Annotations);
1370
1356
}
1371
1357
1372
1358
static unsigned getDwarfCC (CallingConv CC) {
@@ -3265,7 +3251,7 @@ llvm::DIType *CGDebugInfo::CreateEnumType(const EnumType *Ty) {
3265
3251
// entered into the ReplaceMap: finalize() will replace the first
3266
3252
// FwdDecl with the second and then replace the second with
3267
3253
// complete type.
3268
- llvm::DIScope *EDContext = getDeclarationLexicalScope (ED);
3254
+ llvm::DIScope *EDContext = getDeclContextDescriptor (ED);
3269
3255
llvm::DIFile *DefUnit = getOrCreateFile (ED->getLocation ());
3270
3256
llvm::TempDIScope TmpContext (DBuilder.createReplaceableCompositeType (
3271
3257
llvm::dwarf::DW_TAG_enumeration_type, " " , TheCU, DefUnit, 0 ));
@@ -3308,7 +3294,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
3308
3294
3309
3295
llvm::DIFile *DefUnit = getOrCreateFile (ED->getLocation ());
3310
3296
unsigned Line = getLineNumber (ED->getLocation ());
3311
- llvm::DIScope *EnumContext = getDeclarationLexicalScope (ED);
3297
+ llvm::DIScope *EnumContext = getDeclContextDescriptor (ED);
3312
3298
llvm::DIType *ClassTy = getOrCreateType (ED->getIntegerType (), DefUnit);
3313
3299
return DBuilder.createEnumerationType (EnumContext, ED->getName (), DefUnit,
3314
3300
Line, Size, Align, EltArray, ClassTy,
@@ -3611,7 +3597,7 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
3611
3597
Line = getLineNumber (Loc);
3612
3598
}
3613
3599
3614
- llvm::DIScope *RDContext = getDeclarationLexicalScope (RD);
3600
+ llvm::DIScope *RDContext = getDeclContextDescriptor (RD);
3615
3601
3616
3602
// If we ended up creating the type during the context chain construction,
3617
3603
// just return that.
@@ -3804,14 +3790,6 @@ void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit,
3804
3790
TemplateParameters = nullptr ;
3805
3791
}
3806
3792
3807
- // Get context for static locals (that are technically globals) the same way
3808
- // we do for "local" locals -- by using current lexical block.
3809
- if (VD->isStaticLocal ()) {
3810
- assert (!LexicalBlockStack.empty () && " Region stack mismatch, stack empty!" );
3811
- VDContext = LexicalBlockStack.back ();
3812
- return ;
3813
- }
3814
-
3815
3793
// Since we emit declarations (DW_AT_members) for static members, place the
3816
3794
// definition of those static members in the namespace they were declared in
3817
3795
// in the source code (the lexical decl context).
0 commit comments