File tree Expand file tree Collapse file tree 1 file changed +15
-13
lines changed
lldb/source/Plugins/TypeSystem/Swift Expand file tree Collapse file tree 1 file changed +15
-13
lines changed Original file line number Diff line number Diff line change @@ -2279,19 +2279,21 @@ bool TypeSystemSwiftTypeRef::IsVoidType(opaque_compiler_type_t type) {
2279
2279
// AST related queries
2280
2280
uint32_t TypeSystemSwiftTypeRef::GetPointerByteSize () {
2281
2281
auto impl = [&]() -> uint32_t {
2282
- if (auto *module = GetModule ()) {
2283
- auto &triple = module ->GetArchitecture ().GetTriple ();
2284
- if (triple.isArch64Bit ())
2285
- return 8 ;
2286
- if (triple.isArch32Bit ())
2287
- return 4 ;
2288
- if (triple.isArch16Bit ())
2289
- return 2 ;
2290
- }
2291
- // An expression context has no module. Since it's for expression
2292
- // evaluation we might as well defer to the SwiftASTContext.
2293
- if (auto *swift_ast_context = GetSwiftASTContext ())
2294
- return swift_ast_context->GetPointerByteSize ();
2282
+ llvm::Triple triple;
2283
+ if (auto *module = GetModule ())
2284
+ triple = module ->GetArchitecture ().GetTriple ();
2285
+ else if (auto target_sp = GetTargetWP ().lock ())
2286
+ triple = target_sp->GetArchitecture ().GetTriple ();
2287
+ else
2288
+ assert (false && " Expected module or target" );
2289
+
2290
+ if (triple.isArch64Bit ())
2291
+ return 8 ;
2292
+ if (triple.isArch32Bit ())
2293
+ return 4 ;
2294
+ if (triple.isArch16Bit ())
2295
+ return 2 ;
2296
+
2295
2297
return 0 ;
2296
2298
};
2297
2299
VALIDATE_AND_RETURN_STATIC (impl, GetPointerByteSize);
You can’t perform that action at this time.
0 commit comments