aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorMichael Kuperstein <michael.m.kuperstein@intel.com>2015-07-01 12:34:39 +0000
committerMichael Kuperstein <michael.m.kuperstein@intel.com>2015-07-01 12:34:39 +0000
commitdef554db451cafb36b71d95823eaf65538b0a3b7 (patch)
tree8fdaeb52ea97dd90bdedaa01e739add6fb5e70cb /clang/lib/CodeGen/CGDecl.cpp
parent01e8185c31f323e288f030b0eff8584f535637a5 (diff)
downloadllvm-def554db451cafb36b71d95823eaf65538b0a3b7.zip
llvm-def554db451cafb36b71d95823eaf65538b0a3b7.tar.gz
llvm-def554db451cafb36b71d95823eaf65538b0a3b7.tar.bz2
[DebugInfo] Fix debug info generation for function static variables, typedefs, and records
Function static variables, typedefs and records (class, struct or union) declared inside a lexical scope were associated with the function as their parent scope, rather than the lexical scope they are defined or declared in. This fixes PR19238 Patch by: amjad.aboud@intel.com Differential Revision: http://reviews.llvm.org/D9760 llvm-svn: 241154
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r--clang/lib/CodeGen/CGDecl.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp
index 07dbce4..7550266 100644
--- a/clang/lib/CodeGen/CGDecl.cpp
+++ b/clang/lib/CodeGen/CGDecl.cpp
@@ -81,10 +81,8 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
case Decl::UsingShadow:
llvm_unreachable("Declaration should not be in declstmts!");
case Decl::Function: // void X();
- case Decl::Record: // struct/union/class X;
case Decl::Enum: // enum X;
case Decl::EnumConstant: // enum ? { X = ? }
- case Decl::CXXRecord: // struct/union/class X; [C++]
case Decl::StaticAssert: // static_assert(X, ""); [C++0x]
case Decl::Label: // __label__ x;
case Decl::Import:
@@ -93,6 +91,12 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
// None of these decls require codegen support.
return;
+ case Decl::CXXRecord: // struct/union/class X; [C++]
+ case Decl::Record: // struct/union/class X;
+ if (CGDebugInfo *DI = getDebugInfo())
+ DI->recordDeclarationLexicalScope(D);
+ return;
+
case Decl::NamespaceAlias:
if (CGDebugInfo *DI = getDebugInfo())
DI->EmitNamespaceAlias(cast<NamespaceAliasDecl>(D));
@@ -117,6 +121,9 @@ void CodeGenFunction::EmitDecl(const Decl &D) {
const TypedefNameDecl &TD = cast<TypedefNameDecl>(D);
QualType Ty = TD.getUnderlyingType();
+ if (CGDebugInfo *DI = getDebugInfo())
+ DI->recordDeclarationLexicalScope(D);
+
if (Ty->isVariablyModifiedType())
EmitVariablyModifiedType(Ty);
}