[cfe-commits] r102033 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/field-access-debug-info.cpp

Devang Patel dpatel at apple.com
Wed Apr 21 16:12:37 PDT 2010


Author: dpatel
Date: Wed Apr 21 18:12:37 2010
New Revision: 102033

URL: http://llvm.org/viewvc/llvm-project?rev=102033&view=rev
Log:
Encode field accessibility.

Added:
    cfe/trunk/test/CodeGenCXX/field-access-debug-info.cpp
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=102033&r1=102032&r2=102033&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Apr 21 18:12:37 2010
@@ -525,13 +525,20 @@
 
     uint64_t FieldOffset = RL.getFieldOffset(FieldNo);
 
+    unsigned Flags = 0;
+    AccessSpecifier Access = I->getAccess();
+    if (Access == clang::AS_private)
+      Flags |= llvm::DIType::FlagPrivate;
+    else if (Access == clang::AS_protected)
+      Flags |= llvm::DIType::FlagProtected;
+
     // Create a DW_TAG_member node to remember the offset of this field in the
     // struct.  FIXME: This is an absolutely insane way to capture this
     // information.  When we gut debug info, this should be fixed.
     FieldTy = DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_member, Unit,
                                              FieldName, FieldDefUnit,
                                              FieldLine, FieldSize, FieldAlign,
-                                             FieldOffset, 0, FieldTy);
+                                             FieldOffset, Flags, FieldTy);
     EltTys.push_back(FieldTy);
   }
 }

Added: cfe/trunk/test/CodeGenCXX/field-access-debug-info.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/field-access-debug-info.cpp?rev=102033&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/field-access-debug-info.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/field-access-debug-info.cpp Wed Apr 21 18:12:37 2010
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -g -S -masm-verbose -o %t %s
+// RUN: grep DW_AT_accessibility %t
+
+class A {
+public:
+  int p;
+private:
+  int pr;
+};
+
+A a;





More information about the cfe-commits mailing list