Skip to content

Commit dce951c

Browse files
committed
TypeSystemSwiftTypeRef: Fall through if TypeSystemClang fails
to report Size/Align info and continue with the Swift language runtime. This would otherwise cause a fallback to SwiftASTContext and a TypeSystemSwiftTypeRef/SwiftASTContext verification error.
1 parent 155cbe1 commit dce951c

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,7 +2830,8 @@ TypeSystemSwiftTypeRef::GetBitSize(opaque_compiler_type_t type,
28302830
// pointer instead of the underlying object.
28312831
if (Flags(clang_type.GetTypeInfo()).AllSet(eTypeIsObjC | eTypeIsClass))
28322832
return GetPointerByteSize() * 8;
2833-
return clang_type.GetBitSize(exe_scope);
2833+
if (auto clang_size = clang_type.GetBitSize(exe_scope))
2834+
return clang_size;
28342835
}
28352836
if (!exe_scope) {
28362837
LLDB_LOGF(GetLog(LLDBLog::Types),
@@ -4253,7 +4254,8 @@ TypeSystemSwiftTypeRef::GetTypeBitAlign(opaque_compiler_type_t type,
42534254
// object pointer instead of the underlying object.
42544255
if (Flags(clang_type.GetTypeInfo()).AllSet(eTypeIsObjC | eTypeIsClass))
42554256
return GetPointerByteSize() * 8;
4256-
return clang_type.GetTypeBitAlign(exe_scope);
4257+
if (auto clang_align = clang_type.GetTypeBitAlign(exe_scope))
4258+
return clang_align;
42574259
}
42584260
if (!exe_scope) {
42594261
LLDB_LOGF(GetLog(LLDBLog::Types),
@@ -4264,7 +4266,8 @@ TypeSystemSwiftTypeRef::GetTypeBitAlign(opaque_compiler_type_t type,
42644266
}
42654267
if (auto *runtime =
42664268
SwiftLanguageRuntime::Get(exe_scope->CalculateProcess())) {
4267-
if (auto result = runtime->GetBitAlignment({weak_from_this(), type}, exe_scope))
4269+
if (auto result =
4270+
runtime->GetBitAlignment({weak_from_this(), type}, exe_scope))
42684271
return result;
42694272
// If this is an expression context, perhaps the type was
42704273
// defined in the expression. In that case we don't have debug

lldb/test/API/functionalities/progress_reporting/swift_progress_reporting/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
SWIFT_SOURCES := main.swift
2-
2+
SWIFT_BRIDGING_HEADER := bridging.h
3+
SWIFT_PRECOMPILE_BRIDGING_HEADER := YES
34
LD_EXTRAS := -L. -linvisible
45
SWIFTFLAGS_EXTRAS := -I.
56

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
struct FromBridgingHeader {};

lldb/test/API/functionalities/progress_reporting/swift_progress_reporting/main.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Foundation
44
func main() {
55
let boo = Invisible.👻()
66
let s = NSAttributedString(string: "Hello")
7+
let b = FromBridgingHeader()
78
print("break here")
89
}
910

0 commit comments

Comments
 (0)