[NFC][Coroutines] Use structured binding with llvm::enumerate in CoroSplit (#116879)
[llvm-project.git] / lldb / bindings / interface / SBFileExtensions.i
blob23d097e48305bcd4b40b4aa50f6c2b7e4e093c34
1 %extend lldb::SBFile {
2 static lldb::SBFile MakeBorrowed(lldb::FileSP BORROWED) {
3 return lldb::SBFile(BORROWED);
5 static lldb::SBFile MakeForcingIOMethods(lldb::FileSP FORCE_IO_METHODS) {
6 return lldb::SBFile(FORCE_IO_METHODS);
8 static lldb::SBFile MakeBorrowedForcingIOMethods(lldb::FileSP BORROWED_FORCE_IO_METHODS) {
9 return lldb::SBFile(BORROWED_FORCE_IO_METHODS);
12 #ifdef SWIGPYTHON
13 %pythoncode {
14 @classmethod
15 def Create(cls, file, borrow=False, force_io_methods=False):
16 """
17 Create a SBFile from a python file object, with options.
19 If borrow is set then the underlying file will
20 not be closed when the SBFile is closed or destroyed.
22 If force_scripting_io is set then the python read/write
23 methods will be called even if a file descriptor is available.
24 """
25 if borrow:
26 if force_io_methods:
27 return cls.MakeBorrowedForcingIOMethods(file)
28 else:
29 return cls.MakeBorrowed(file)
30 else:
31 if force_io_methods:
32 return cls.MakeForcingIOMethods(file)
33 else:
34 return cls(file)
36 #endif