]> granicus.if.org Git - clang/commitdiff
Emit debug info for virtual functions.
authorDevang Patel <dpatel@apple.com>
Mon, 25 Jan 2010 23:17:15 +0000 (23:17 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 25 Jan 2010 23:17:15 +0000 (23:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94467 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 5768e5b4db5c4741769362d3b41ebcaa91248e27..2b03d2c603cc84d908ede84a05d1204dae2907f1 100644 (file)
@@ -562,14 +562,24 @@ CollectCXXMemberFunctions(const CXXRecordDecl *Decl,
       MethodLine = PLoc.getLine();
     }
 
+    // Collect virtual method info.
+    llvm::DIType ContainingType;
+    unsigned Virtuality = 0; 
+    unsigned VIndex = 0;
+    if (Method->isVirtual()) {
+      // FIXME: Identify pure virtual functions.
+      Virtuality = llvm::dwarf::DW_VIRTUALITY_virtual;
+      VIndex = CGM.getVtableInfo().getMethodVtableIndex(Method);
+      ContainingType = RecordTy;
+    }
+
     llvm::DISubprogram SP =
       DebugFactory.CreateSubprogram(RecordTy , MethodName, MethodName, 
                                     MethodLinkageName,
                                     MethodDefUnit, MethodLine,
                                     MethodTy, false, 
                                     Method->isThisDeclarationADefinition(),
-                                    0 /*Virtuality*/, 0 /*VIndex*/, 
-                                    llvm::DIType() /*ContainingType*/);
+                                    Virtuality, VIndex, ContainingType);
     if (Method->isThisDeclarationADefinition())
       SPCache[cast<FunctionDecl>(Method)] = llvm::WeakVH(SP.getNode());
     EltTys.push_back(SP);