Skip to content

Commit 5504a18

Browse files
committed
Only emit DWARF types for structs when -gdwarf-types is specified.
1 parent e2f05f0 commit 5504a18

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/IRGen/IRGenDebugInfo.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,11 +1408,15 @@ llvm::DIType *IRGenDebugInfo::createType(DebugTypeInfo DbgTy,
14081408
auto *StructTy = BaseTy->castTo<StructType>();
14091409
auto *Decl = StructTy->getDecl();
14101410
auto L = getDebugLoc(SM, Decl);
1411-
return createStructType(DbgTy, Decl, StructTy, Scope,
1412-
getOrCreateFile(L.Filename), L.Line, SizeInBits,
1413-
AlignInBits, Flags,
1414-
nullptr, // DerivedFrom
1415-
llvm::dwarf::DW_LANG_Swift, MangledName);
1411+
auto *File = getOrCreateFile(L.Filename);
1412+
if (Opts.DebugInfoKind > IRGenDebugInfoKind::ASTTypes)
1413+
return createStructType(DbgTy, Decl, StructTy, Scope, File, L.Line,
1414+
SizeInBits, AlignInBits, Flags,
1415+
nullptr, // DerivedFrom
1416+
llvm::dwarf::DW_LANG_Swift, MangledName);
1417+
else
1418+
return createOpaqueStruct(Scope, Decl->getName().str(), File, L.Line,
1419+
SizeInBits, AlignInBits, Flags, MangledName);
14161420
}
14171421

14181422
case TypeKind::Class: {

test/DebugInfo/bool.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend %s -emit-ir -g -o - | FileCheck %s
1+
// RUN: %target-swift-frontend %s -emit-ir -gdwarf-types -o - | FileCheck %s
22

33
func markUsed<T>(_ t: T) {}
44

0 commit comments

Comments
 (0)