[cfe-commits] r94467 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Devang Patel dpatel at apple.com
Mon Jan 25 15:17:15 PST 2010


Author: dpatel
Date: Mon Jan 25 17:17:15 2010
New Revision: 94467

URL: http://llvm.org/viewvc/llvm-project?rev=94467&view=rev
Log:
Emit debug info for virtual functions.

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=94467&r1=94466&r2=94467&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Mon Jan 25 17:17:15 2010
@@ -562,14 +562,24 @@
       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);





More information about the cfe-commits mailing list