[cfe-commits] r126834 - /cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
John McCall
rjmccall at apple.com
Tue Mar 1 22:57:14 PST 2011
Author: rjmccall
Date: Wed Mar 2 00:57:14 2011
New Revision: 126834
URL: http://llvm.org/viewvc/llvm-project?rev=126834&view=rev
Log:
Hack in something so that we emit better debug information about
captured __block variables in the block-literal type.
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=126834&r1=126833&r2=126834&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Mar 2 00:57:14 2011
@@ -2049,10 +2049,24 @@
}
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;
More information about the cfe-commits
mailing list