Skip to content

Remove a workaround in the debug info handling of zero-sized types. #25468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions lib/IRGen/IRGenDebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2182,11 +2182,6 @@ void IRGenDebugInfoImpl::emitVariableDeclaration(
if (Indirection)
Operands.push_back(llvm::dwarf::DW_OP_deref);

// There are variables without storage, such as "struct { func foo() {}
// }". Emit them as constant 0.
if (isa<llvm::UndefValue>(Piece))
Piece = llvm::ConstantInt::get(IGM.Int64Ty, 0);

if (IsPiece) {
// Advance the offset and align it for the next piece.
OffsetInBits += llvm::alignTo(SizeInBits, AlignInBits);
Expand Down
4 changes: 2 additions & 2 deletions test/DebugInfo/nostorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct AStruct {}

// CHECK2: define{{.*}}app
public func app() {
// No members? No storage! Emitted as a constant 0, because.
// CHECK2: call void @llvm.dbg.value(metadata i{{.*}} 0,
// No members? No storage!
// CHECK2: call void @llvm.dbg.value(metadata {{.*}}* undef,
// CHECK2-SAME: metadata ![[AT:.*]], metadata
// CHECK2: ![[AT]] = !DILocalVariable(name: "at",{{.*}}line: [[@LINE+1]]
var at = AStruct()
Expand Down