Add support to let FE encode method access specifier.
authorDevang Patel <dpatel@apple.com>
Wed, 29 Sep 2010 21:44:16 +0000 (21:44 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 29 Sep 2010 21:44:16 +0000 (21:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115089 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/DebugInfo.h
lib/CodeGen/AsmPrinter/DwarfDebug.cpp

index b9e7f1be42d479f27d94f6af93ba916a2d38dec3..4fdbd3c84f41c30e5f4910a881cc9d755f437d65 100644 (file)
@@ -400,7 +400,20 @@ namespace llvm {
         return getUnsignedField(14); 
       return (getUnsignedField(14) & FlagArtificial) != 0;
     }
-
+    /// isPrivate - Return true if this subprogram has "private"
+    /// access specifier.
+    bool isPrivate() const    { 
+      if (getVersion() <= llvm::LLVMDebugVersion8)
+        return false;
+      return (getUnsignedField(14) & FlagPrivate) != 0;
+    }
+    /// isProtected - Return true if this subprogram has "protected"
+    /// access specifier.
+    bool isProtected() const    { 
+      if (getVersion() <= llvm::LLVMDebugVersion8)
+        return false;
+      return (getUnsignedField(14) & FlagProtected) != 0;
+    }
     unsigned isOptimized() const;
 
     StringRef getFilename() const    { 
index 36b9d75539f4ce9dfb0099e40df5ff8004bff5d7..d3e343c30879bbfe4a267d42c78bf209969212ad 100644 (file)
@@ -1069,8 +1069,19 @@ void DwarfDebug::constructTypeDIE(DIE &Buffer, DICompositeType CTy) {
     for (unsigned i = 0; i < N; ++i) {
       DIDescriptor Element = Elements.getElement(i);
       DIE *ElemDie = NULL;
-      if (Element.isSubprogram())
+      if (Element.isSubprogram()) {
+        DISubprogram SP(Element);
         ElemDie = createSubprogramDIE(DISubprogram(Element));
+        if (SP.isProtected())
+          addUInt(ElemDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_flag,
+                  dwarf::DW_ACCESS_protected);
+        else if (SP.isPrivate())
+          addUInt(ElemDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_flag,
+                  dwarf::DW_ACCESS_private);
+        else 
+          addUInt(ElemDie, dwarf::DW_AT_accessibility, dwarf::DW_FORM_flag,
+            dwarf::DW_ACCESS_public);
+      }
       else if (Element.isVariable()) {
         DIVariable DV(Element);
         ElemDie = new DIE(dwarf::DW_TAG_variable);