Skip to content

Commit 4927057

Browse files
Merge pull request #3241 from adrian-prantl/82537719
Remove unnecessary assertion and add a testcase.
2 parents d758d3c + 237059d commit 4927057

File tree

4 files changed

+36
-2
lines changed

4 files changed

+36
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,9 +2317,8 @@ lldb::Encoding TypeSystemSwiftTypeRef::GetEncoding(opaque_compiler_type_t type,
23172317
return referent_type.GetEncoding(count);
23182318
}
23192319
default:
2320-
assert(false && "Unhandled node kind");
23212320
LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
2322-
"GetEncoding: Unhandled node kind for type %s",
2321+
"No encoding for type %s",
23232322
AsMangledName(type));
23242323
break;
23252324
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SWIFT_SOURCES := main.swift
2+
3+
include Makefile.rules
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import lldb
2+
from lldbsuite.test.decorators import *
3+
import lldbsuite.test.lldbtest as lldbtest
4+
import lldbsuite.test.lldbutil as lldbutil
5+
import unittest2
6+
7+
8+
class TestSwiftAnyType(lldbtest.TestBase):
9+
10+
mydir = lldbtest.TestBase.compute_mydir(__file__)
11+
12+
@swiftTest
13+
def test_any_type(self):
14+
self.build()
15+
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
16+
self, 'Set breakpoint here', lldb.SBFileSpec('main.swift'))
17+
18+
frame = thread.frames[0]
19+
var_e = frame.FindVariable("e")
20+
# We don't have an encoding for enums.
21+
self.assertEqual(var_e.GetValueAsSigned(0xdead), 0xdead)
22+
self.assertEqual(var_e.GetValue(), 'B')
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
enum E {
2+
case A
3+
case B
4+
}
5+
func main(_ e: E) {
6+
print(e) // Set breakpoint here
7+
}
8+
9+
main(.B)
10+

0 commit comments

Comments
 (0)