summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorAmjad Aboud <amjad.aboud@intel.com>2016-04-30 01:44:38 +0000
committerAmjad Aboud <amjad.aboud@intel.com>2016-04-30 01:44:38 +0000
commitdc4531e552af6c880a69d226d3666756198fbdc8 (patch)
tree938207c7b4b6b420ffcef9f607c16d96669e102d /clang/lib/CodeGen/CGDebugInfo.cpp
parent72da9391f0322c3868ade631066186b5233f75c3 (diff)
downloadbcm5719-llvm-dc4531e552af6c880a69d226d3666756198fbdc8.tar.gz
bcm5719-llvm-dc4531e552af6c880a69d226d3666756198fbdc8.zip
Reverting 268055 as it caused PR27579.
llvm-svn: 268151
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp41
1 files changed, 7 insertions, 34 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 69976d76f2e..29f597112c1 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -814,18 +814,15 @@ llvm::DIType *CGDebugInfo::CreateType(const TemplateSpecializationType *Ty,
llvm::DIType *CGDebugInfo::CreateType(const TypedefType *Ty,
llvm::DIFile *Unit) {
- TypedefNameDecl *TD = Ty->getDecl();
// We don't set size information, but do specify where the typedef was
// declared.
- SourceLocation Loc = TD->getLocation();
-
- llvm::DIScope *TDContext = getDeclarationLexicalScope(*TD, QualType(Ty, 0));
+ SourceLocation Loc = Ty->getDecl()->getLocation();
// Typedefs are derived from some other type.
return DBuilder.createTypedef(
getOrCreateType(Ty->getDecl()->getUnderlyingType(), Unit),
Ty->getDecl()->getName(), getOrCreateFile(Loc), getLineNumber(Loc),
- TDContext);
+ getDeclContextDescriptor(Ty->getDecl()));
}
llvm::DIType *CGDebugInfo::CreateType(const FunctionType *Ty,
@@ -1460,23 +1457,6 @@ llvm::DIType *CGDebugInfo::getOrCreateStandaloneType(QualType D,
return T;
}
-void CGDebugInfo::recordDeclarationLexicalScope(const Decl &D) {
- assert(LexicalBlockMap.find(&D) == LexicalBlockMap.end() &&
- "D is already mapped to lexical block scope");
- if (!LexicalBlockStack.empty())
- LexicalBlockMap[&D] = LexicalBlockStack.back();
-}
-
-llvm::DIScope *CGDebugInfo::getDeclarationLexicalScope(const Decl &D,
- QualType Ty) {
- auto I = LexicalBlockMap.find(&D);
- if (I != LexicalBlockMap.end()) {
- RetainedTypes.push_back(Ty.getAsOpaquePtr());
- return I->second;
- }
- return getDeclContextDescriptor(cast<Decl>(&D));
-}
-
void CGDebugInfo::completeType(const EnumDecl *ED) {
if (DebugKind <= codegenoptions::DebugLineTablesOnly)
return;
@@ -2080,7 +2060,7 @@ llvm::DIType *CGDebugInfo::CreateEnumType(const EnumType *Ty) {
// entered into the ReplaceMap: finalize() will replace the first
// FwdDecl with the second and then replace the second with
// complete type.
- llvm::DIScope *EDContext = getDeclarationLexicalScope(*ED, QualType(Ty, 0));
+ llvm::DIScope *EDContext = getDeclContextDescriptor(ED);
llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
llvm::TempDIScope TmpContext(DBuilder.createReplaceableCompositeType(
llvm::dwarf::DW_TAG_enumeration_type, "", TheCU, DefUnit, 0));
@@ -2124,7 +2104,7 @@ llvm::DIType *CGDebugInfo::CreateTypeDefinition(const EnumType *Ty) {
llvm::DIFile *DefUnit = getOrCreateFile(ED->getLocation());
unsigned Line = getLineNumber(ED->getLocation());
- llvm::DIScope *EnumContext = getDeclarationLexicalScope(*ED, QualType(Ty, 0));
+ llvm::DIScope *EnumContext = getDeclContextDescriptor(ED);
llvm::DIType *ClassTy =
ED->isFixed() ? getOrCreateType(ED->getIntegerType(), DefUnit) : nullptr;
return DBuilder.createEnumerationType(EnumContext, ED->getName(), DefUnit,
@@ -2385,7 +2365,7 @@ llvm::DICompositeType *CGDebugInfo::CreateLimitedType(const RecordType *Ty) {
unsigned Line = getLineNumber(RD->getLocation());
StringRef RDName = getClassName(RD);
- llvm::DIScope *RDContext = getDeclarationLexicalScope(*RD, QualType(Ty, 0));
+ llvm::DIScope *RDContext = getDeclContextDescriptor(RD);
// If we ended up creating the type during the context chain construction,
// just return that.
@@ -2556,15 +2536,8 @@ void CGDebugInfo::collectVarDeclProps(const VarDecl *VD, llvm::DIFile *&Unit,
if (DC->isRecord())
DC = CGM.getContext().getTranslationUnitDecl();
- if (VD->isStaticLocal()) {
- // Get context for static locals (that are technically globals) the same way
- // we do for "local" locals -- by using current lexical block.
- assert(!LexicalBlockStack.empty() && "Region stack mismatch, stack empty!");
- VDContext = LexicalBlockStack.back();
- } else {
- llvm::DIScope *Mod = getParentModuleOrNull(VD);
- VDContext = getContextDescriptor(cast<Decl>(DC), Mod ? Mod : TheCU);
- }
+ llvm::DIScope *Mod = getParentModuleOrNull(VD);
+ VDContext = getContextDescriptor(cast<Decl>(DC), Mod ? Mod : TheCU);
}
llvm::DISubprogram *
OpenPOWER on IntegriCloud