Skip to content

Remove unnecessary assertion and add a testcase. #3241

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
merged 1 commit into from
Sep 9, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -2317,9 +2317,8 @@ lldb::Encoding TypeSystemSwiftTypeRef::GetEncoding(opaque_compiler_type_t type,
return referent_type.GetEncoding(count);
}
default:
assert(false && "Unhandled node kind");
LLDB_LOGF(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES),
"GetEncoding: Unhandled node kind for type %s",
"No encoding for type %s",
AsMangledName(type));
break;
}
Expand Down
3 changes: 3 additions & 0 deletions lldb/test/API/lang/swift/enum_as_value/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SWIFT_SOURCES := main.swift

include Makefile.rules
22 changes: 22 additions & 0 deletions lldb/test/API/lang/swift/enum_as_value/TestSwiftEnumAsValue.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import lldb
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbtest as lldbtest
import lldbsuite.test.lldbutil as lldbutil
import unittest2


class TestSwiftAnyType(lldbtest.TestBase):

mydir = lldbtest.TestBase.compute_mydir(__file__)

@swiftTest
def test_any_type(self):
self.build()
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
self, 'Set breakpoint here', lldb.SBFileSpec('main.swift'))

frame = thread.frames[0]
var_e = frame.FindVariable("e")
# We don't have an encoding for enums.
self.assertEqual(var_e.GetValueAsSigned(0xdead), 0xdead)
self.assertEqual(var_e.GetValue(), 'B')
10 changes: 10 additions & 0 deletions lldb/test/API/lang/swift/enum_as_value/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
enum E {
case A
case B
}
func main(_ e: E) {
print(e) // Set breakpoint here
}

main(.B)