from binding import *
from ..namespace import llvm
from raw_ostream import raw_ostream

@llvm.Class(raw_ostream)
class formatted_raw_ostream:
    _include_ = 'llvm/Support/FormattedStream.h'
    new = Constructor(ref(raw_ostream), cast(bool, Bool))


from binding import *
from ..namespace import llvm
from raw_ostream import raw_ostream

@llvm.Class(raw_ostream)
class formatted_raw_ostream:
    _include_ = 'llvm/Support/FormattedStream.h'
    _new = Constructor(ref(raw_ostream), cast(bool, Bool))

    @CustomPythonStaticMethod
    def new(stream, destroy=False):
        inst = formatted_raw_ostream._new(stream, destroy)
        inst.__underlying_stream = stream # to prevent it being freed first
        return inst


Fix formatted_raw_ostream ownership error with the underlying stream.
Fix formatted_raw_ostream ownership error with the underlying stream.

  from binding import *
  from ..namespace import llvm
  from raw_ostream import raw_ostream
  
  @llvm.Class(raw_ostream)
  class formatted_raw_ostream:
      _include_ = 'llvm/Support/FormattedStream.h'
-     new = Constructor(ref(raw_ostream), cast(bool, Bool))
+     _new = Constructor(ref(raw_ostream), cast(bool, Bool))
+ 
+     @CustomPythonStaticMethod
+     def new(stream, destroy=False):
+         inst = formatted_raw_ostream._new(stream, destroy)
+         inst.__underlying_stream = stream # to prevent it being freed first
+         return inst
  
  
Fix formatted_raw_ostream ownership error with the underlying stream.
## Code Before:
from binding import *
from ..namespace import llvm
from raw_ostream import raw_ostream

@llvm.Class(raw_ostream)
class formatted_raw_ostream:
    _include_ = 'llvm/Support/FormattedStream.h'
    new = Constructor(ref(raw_ostream), cast(bool, Bool))


## Instruction:
Fix formatted_raw_ostream ownership error with the underlying stream.
## Code After:
from binding import *
from ..namespace import llvm
from raw_ostream import raw_ostream

@llvm.Class(raw_ostream)
class formatted_raw_ostream:
    _include_ = 'llvm/Support/FormattedStream.h'
    _new = Constructor(ref(raw_ostream), cast(bool, Bool))

    @CustomPythonStaticMethod
    def new(stream, destroy=False):
        inst = formatted_raw_ostream._new(stream, destroy)
        inst.__underlying_stream = stream # to prevent it being freed first
        return inst

