]> granicus.if.org Git - clang/commitdiff
Add volatile qualifiers for "this".
authorDevang Patel <dpatel@apple.com>
Tue, 13 Jul 2010 16:23:13 +0000 (16:23 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 13 Jul 2010 16:23:13 +0000 (16:23 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108245 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenCXX/member-qual-debug-info.cpp [new file with mode: 0644]

index a3c4003ff5be1fa3d065b8219dedaa40538a98db..4e158955f894bf78567e7dd36c2c04864021e19a 100644 (file)
@@ -537,11 +537,17 @@ CGDebugInfo::getOrCreateMethodType(const CXXMethodDecl *Method,
   llvm::DIType ThisPtrType = 
     DebugFactory.CreateArtificialType(getOrCreateType(ThisPtr, Unit));
 
-  if (Method->getTypeQualifiers() && Qualifiers::Const)
+  unsigned Quals = Method->getTypeQualifiers();
+  if (Quals & Qualifiers::Const)
     ThisPtrType = 
       DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_const_type, 
                                      Unit, "", Unit,
                                      0, 0, 0, 0, 0, ThisPtrType);
+  if (Quals & Qualifiers::Volatile)
+    ThisPtrType = 
+      DebugFactory.CreateDerivedType(llvm::dwarf::DW_TAG_volatile_type, 
+                                     Unit, "", Unit,
+                                     0, 0, 0, 0, 0, ThisPtrType);
 
   TypeCache[ThisPtr.getAsOpaquePtr()] = ThisPtrType;  
   Elts.push_back(ThisPtrType);
diff --git a/test/CodeGenCXX/member-qual-debug-info.cpp b/test/CodeGenCXX/member-qual-debug-info.cpp
new file mode 100644 (file)
index 0000000..c6e0991
--- /dev/null
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -g -S -masm-verbose -x c++ -o %t %s
+// RUN: grep DW_TAG_volatile_type %t | count 3
+// RUN: grep DW_TAG_const_type %t | count 3
+// one for decl, one for def, one for abbrev
+
+namespace A {
+  class B {
+  public:
+    void dump() const volatile;
+  };
+}
+
+int main () {
+  using namespace A;
+  B b;
+  return 0;
+}
+
+void A::B::dump() const volatile{
+}