Handle a captured this for the debug information as well.

llvm-svn: 164253
This commit is contained in:
Eric Christopher 2012-09-19 21:47:34 +00:00
parent 0f143ae8af
commit 7106ec3ecb
2 changed files with 25 additions and 0 deletions

View File

@ -809,6 +809,16 @@ CollectRecordFields(const RecordDecl *record, llvm::DIFile tunit,
Field->getAccess(), layout.getFieldOffset(fieldno),
VUnit, RecordTy);
elements.push_back(fieldType);
} else {
assert(C.capturesThis() && "Field that isn't captured and isn't this?");
FieldDecl *f = *Field;
llvm::DIFile VUnit = getOrCreateFile(f->getLocation());
QualType type = f->getType();
llvm::DIType fieldType
= createFieldType("this", type, 0, f->getLocation(), f->getAccess(),
layout.getFieldOffset(fieldNo), VUnit, RecordTy);
elements.push_back(fieldType);
}
}
} else {

View File

@ -0,0 +1,15 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10.0.0 -emit-llvm -o - %s -fexceptions -std=c++11 -g | FileCheck %s
struct D {
D();
D(const D&);
int x;
int d(int x);
};
int D::d(int x) {
[=] {
return this->x;
}();
}
// CHECK: metadata !{i32 {{.*}}, metadata !"this", metadata !6, i32 11, i64 64, i64 64, i64 0, i32 1, metadata !37} ; [ DW_TAG_member ] [this] [line 11, size 64, align 64, offset 0] [private] [from ]