Add volatile qualifiers for "this".

llvm-svn: 108245
This commit is contained in:
Devang Patel 2010-07-13 16:23:13 +00:00
parent f39cf26cb5
commit 01c8c100c2
2 changed files with 27 additions and 1 deletions

View 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);

View File

@ -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{
}