[llvm-commits] [dragonegg] r92477 - /dragonegg/trunk/llvm-debug.cpp
Duncan Sands
baldrick at free.fr
Mon Jan 4 03:56:33 PST 2010
Author: baldrick
Date: Mon Jan 4 05:56:32 2010
New Revision: 92477
URL: http://llvm.org/viewvc/llvm-project?rev=92477&view=rev
Log:
Port commit 90475 (dpatel) from llvm-gcc:
Emit debug info for virtual functions and virtual base classes.
Modified:
dragonegg/trunk/llvm-debug.cpp
Modified: dragonegg/trunk/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/dragonegg/trunk/llvm-debug.cpp?rev=92477&r1=92476&r2=92477&view=diff
==============================================================================
--- dragonegg/trunk/llvm-debug.cpp (original)
+++ dragonegg/trunk/llvm-debug.cpp Mon Jan 4 05:56:32 2010
@@ -249,6 +249,13 @@
expanded_location Loc = GetNodeLocation(FnDecl, false);
StringRef LinkageName = getLinkageName(FnDecl);
+ unsigned Virtuality = 0;
+ unsigned VIndex = 0;
+ DIType ContainingType;
+ if (DECL_VINDEX (FnDecl)) {
+ Virtuality = dwarf::DW_VIRTUALITY_virtual;
+ ContainingType = getOrCreateType(DECL_CONTEXT (FnDecl));
+ }
DISubprogram SP =
DebugFactory.CreateSubprogram(findRegion(FnDecl),
lang_hooks.dwarf_name(FnDecl, 0),
@@ -257,7 +264,9 @@
getOrCreateCompileUnit(Loc.file), CurLineNo,
FNType,
Fn->hasInternalLinkage(),
- true /*definition*/);
+ true /*definition*/,
+ Virtuality, VIndex, ContainingType);
+
SPCache[FnDecl] = WeakVH(SP.getNode());
@@ -670,18 +679,30 @@
llvm::SmallVector<llvm::DIDescriptor, 16> EltTys;
if (tree binfo = TYPE_BINFO(type)) {
+ VEC(tree,gc) *accesses = BINFO_BASE_ACCESSES (binfo);
+
for (unsigned i = 0, e = BINFO_N_BASE_BINFOS(binfo); i != e; ++i) {
tree BInfo = BINFO_BASE_BINFO(binfo, i);
tree BInfoType = BINFO_TYPE (BInfo);
DIType BaseClass = getOrCreateType(BInfoType);
-
+ unsigned Flags = 0;
+ if (BINFO_VIRTUAL_P (BInfo))
+ Flags = llvm::DIType::FlagVirtual;
+ if (accesses) {
+ tree access = VEC_index (tree, accesses, i);
+ if (access == access_protected_node)
+ Flags |= llvm::DIType::FlagProtected;
+ else if (access == access_private_node)
+ Flags |= llvm::DIType::FlagPrivate;
+ }
+
// FIXME : name, size, align etc...
DIType DTy =
DebugFactory.CreateDerivedType(DW_TAG_inheritance,
findRegion(type), StringRef(),
llvm::DICompileUnit(), 0,0,0,
- getINTEGER_CSTVal(BINFO_OFFSET(BInfo)),
- 0, BaseClass);
+ getINTEGER_CSTVal(BINFO_OFFSET(BInfo))*8,
+ Flags, BaseClass);
EltTys.push_back(DTy);
}
}
@@ -749,11 +770,19 @@
const char *MemberName = lang_hooks.dwarf_name(Member, 0);
StringRef LinkageName = getLinkageName(Member);
DIType SPTy = getOrCreateType(TREE_TYPE(Member));
+ unsigned Virtuality = 0;
+ unsigned VIndex = 0;
+ DIType ContainingType;
+ if (DECL_VINDEX (Member)) {
+ Virtuality = dwarf::DW_VIRTUALITY_virtual;
+ ContainingType = getOrCreateType(DECL_CONTEXT(Member));
+ }
DISubprogram SP =
DebugFactory.CreateSubprogram(findRegion(Member), MemberName, MemberName,
LinkageName,
getOrCreateCompileUnit(MemLoc.file),
- MemLoc.line, SPTy, false, false);
+ MemLoc.line, SPTy, false, false,
+ Virtuality, VIndex, ContainingType);
EltTys.push_back(SP);
SPCache[Member] = WeakVH(SP.getNode());
}
More information about the llvm-commits
mailing list