diff options
| author | John McCall <rjmccall@apple.com> | 2011-03-02 06:57:14 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2011-03-02 06:57:14 +0000 |
| commit | 81a325e038cefeac1d31462a8844672846ef5ed6 (patch) | |
| tree | cdacbdaba87680bf78abe76551ba0907494cec45 /clang/lib | |
| parent | 1e49a6d9bc3db451941b021f77a7c3551648bc58 (diff) | |
| download | bcm5719-llvm-81a325e038cefeac1d31462a8844672846ef5ed6.tar.gz bcm5719-llvm-81a325e038cefeac1d31462a8844672846ef5ed6.zip | |
Hack in something so that we emit better debug information about
captured __block variables in the block-literal type.
llvm-svn: 126834
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 49eb6c3d4c8..e6d2af3a533 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -2049,10 +2049,24 @@ void CGDebugInfo::EmitDeclareOfBlockLiteralArgVariable(const CGBlockInfo &block, } const VarDecl *variable = capture->getVariable(); - QualType type = (capture->isByRef() ? C.VoidPtrTy : variable->getType()); llvm::StringRef name = variable->getName(); - fields.push_back(createFieldType(name, type, 0, loc, AS_public, - offsetInBits, tunit)); + + llvm::DIType fieldType; + if (capture->isByRef()) { + std::pair<uint64_t,unsigned> ptrInfo = C.getTypeInfo(C.VoidPtrTy); + + // FIXME: this creates a second copy of this type! + uint64_t xoffset; + fieldType = EmitTypeForVarWithBlocksAttr(variable, &xoffset); + fieldType = DBuilder.createPointerType(fieldType, ptrInfo.first); + fieldType = DBuilder.createMemberType(name, tunit, line, + ptrInfo.first, ptrInfo.second, + offsetInBits, 0, fieldType); + } else { + fieldType = createFieldType(name, variable->getType(), 0, + loc, AS_public, offsetInBits, tunit); + } + fields.push_back(fieldType); } llvm::SmallString<36> typeName; |

