Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::Assert Class Reference

#include <assert.h>

Inheritance diagram for dart::Assert:
dart::DynamicAssertionHelper

Public Member Functions

 Assert (const char *file, int line)
 
DART_NORETURN void Fail (const char *format,...) const PRINTF_ATTRIBUTE(2
 
template<typename T >
DART_NORETURN void T NotNull (const T p)
 
template<typename T >
T NotNull (const T p)
 
- Public Member Functions inherited from dart::DynamicAssertionHelper
 DynamicAssertionHelper (const char *file, int line)
 

Additional Inherited Members

- Protected Member Functions inherited from dart::DynamicAssertionHelper
void Print (const char *format, va_list arguments, bool will_abort=false) const
 
 DISALLOW_IMPLICIT_CONSTRUCTORS (DynamicAssertionHelper)
 
- Protected Attributes inherited from dart::DynamicAssertionHelper
const char *const file_
 
const int line_
 

Detailed Description

Definition at line 43 of file assert.h.

Constructor & Destructor Documentation

◆ Assert()

dart::Assert::Assert ( const char *  file,
int  line 
)
inline

Definition at line 45 of file assert.h.

Member Function Documentation

◆ Fail()

void dart::Assert::Fail ( const char *  format,
  ... 
) const

Definition at line 45 of file assert.cc.

45 {
46 va_list arguments;
47 va_start(arguments, format);
48 Print(format, arguments, /*will_abort=*/true);
49 va_end(arguments);
50
51 // Abort right away.
54 abort();
55}
void Print(const char *format, va_list arguments, bool will_abort=false) const
Definition: assert.cc:19
uint32_t uint32_t * format
va_start(args, format)
va_end(args)
DART_EXPORT void Dart_PrepareToAbort()
DART_EXPORT void Dart_DumpNativeStackTrace(void *context)

◆ NotNull() [1/2]

template<typename T >
DART_NORETURN void T dart::Assert::NotNull ( const T  p)

◆ NotNull() [2/2]

template<typename T >
T dart::Assert::NotNull ( const T  p)

Definition at line 101 of file assert.h.

101 {
102 if (p != nullptr) return p;
103 Fail("expected: not nullptr, found nullptr");
104 return nullptr;
105}
DART_NORETURN void Fail(const char *format,...) const PRINTF_ATTRIBUTE(2
Definition: assert.cc:45

The documentation for this class was generated from the following files: