[cfe-commits] r164253 - in /cfe/trunk: lib/CodeGen/CGDebugInfo.cpp test/CodeGenCXX/debug-lambda-this.cpp
Eric Christopher
echristo at apple.com
Wed Sep 19 14:47:35 PDT 2012
Author: echristo
Date: Wed Sep 19 16:47:34 2012
New Revision: 164253
URL: http://llvm.org/viewvc/llvm-project?rev=164253&view=rev
Log:
Handle a captured this for the debug information as well.
Added:
cfe/trunk/test/CodeGenCXX/debug-lambda-this.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=164253&r1=164252&r2=164253&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Sep 19 16:47:34 2012
@@ -809,6 +809,16 @@
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 {
Added: cfe/trunk/test/CodeGenCXX/debug-lambda-this.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/debug-lambda-this.cpp?rev=164253&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenCXX/debug-lambda-this.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/debug-lambda-this.cpp Wed Sep 19 16:47:34 2012
@@ -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 ]
More information about the cfe-commits
mailing list