[ffigen] Support for Nested structs (#133) (#161)
Co-authored-by: J-P Nurmi <jpnurmi@gmail.com>
diff --git a/pkgs/ffigen/.github/workflows/test-package.yml b/pkgs/ffigen/.github/workflows/test-package.yml
index 83fe4d6..1b5ae04 100644
--- a/pkgs/ffigen/.github/workflows/test-package.yml
+++ b/pkgs/ffigen/.github/workflows/test-package.yml
@@ -14,18 +14,18 @@
jobs:
# Check code formatting and static analysis on a single OS (linux)
- # against Dart stable.
+ # against Dart dev.
analyze:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
- sdk: [beta] # TODO(127):Revert to stable when null safety reaches stable branch.
+ sdk: [2.12.0-198.0.dev] # TODO(127): Revert to stable.
steps:
- uses: actions/checkout@v2
- - uses: dart-lang/setup-dart@v0.1
+ - uses: dart-lang/setup-dart@v1.0
with:
- channel: ${{ matrix.sdk }}
+ sdk: ${{ matrix.sdk }}
- id: install
name: Install dependencies
run: dart pub get
@@ -42,9 +42,9 @@
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- - uses: dart-lang/setup-dart@v0.1
+ - uses: dart-lang/setup-dart@v1.0
with:
- channel: beta # TODO(127):Revert to stable when null safety reaches stable branch.
+ sdk: 2.12.0-198.0.dev # TODO(127): Revert to stable.
- name: Install dependencies
run: dart pub get
- name: Install libclang-10-dev
diff --git a/pkgs/ffigen/CHANGELOG.md b/pkgs/ffigen/CHANGELOG.md
index 38fa2af..4fcb483 100644
--- a/pkgs/ffigen/CHANGELOG.md
+++ b/pkgs/ffigen/CHANGELOG.md
@@ -1,3 +1,6 @@
+# 2.0.0-dev.0
+- Added support for Nested structs.
+
# 2.0.0-nullsafety.1
- Removed the need for `--no-sound-null-safety` flag.
diff --git a/pkgs/ffigen/example/c_json/pubspec.yaml b/pkgs/ffigen/example/c_json/pubspec.yaml
index dd99e63..931aaea 100644
--- a/pkgs/ffigen/example/c_json/pubspec.yaml
+++ b/pkgs/ffigen/example/c_json/pubspec.yaml
@@ -5,7 +5,7 @@
name: c_json_example
environment:
- sdk: '>=2.12.0-29.10.beta <3.0.0'
+ sdk: '>=2.12.0-198.0.dev <3.0.0'
dependencies:
ffi: ^0.2.0-nullsafety.1
diff --git a/pkgs/ffigen/example/libclang-example/generated_bindings.dart b/pkgs/ffigen/example/libclang-example/generated_bindings.dart
index d694962..616826f 100644
--- a/pkgs/ffigen/example/libclang-example/generated_bindings.dart
+++ b/pkgs/ffigen/example/libclang-example/generated_bindings.dart
@@ -2761,7 +2761,32 @@
/// Describes the availability of a given entity on a particular platform, e.g.,
/// a particular class might only be available on Mac OS 10.7 or newer.
-class CXPlatformAvailability extends ffi.Struct {}
+class CXPlatformAvailability extends ffi.Struct {
+ /// A string that describes the platform for which this structure
+ /// provides availability information.
+ ///
+ /// Possible values are "ios" or "macos".
+ external CXString Platform;
+
+ /// The version number in which this entity was introduced.
+ external CXVersion Introduced;
+
+ /// The version number in which this entity was deprecated (but is
+ /// still available).
+ external CXVersion Deprecated;
+
+ /// The version number in which this entity was obsoleted, and therefore
+ /// is no longer available.
+ external CXVersion Obsoleted;
+
+ /// Whether the entity is unconditionally unavailable on this platform.
+ @ffi.Int32()
+ external int Unavailable;
+
+ /// An optional message to provide to a user of this API, e.g., to
+ /// suggest replacement APIs.
+ external CXString Message;
+}
class CXCursorSetImpl extends ffi.Struct {}
@@ -3112,20 +3137,127 @@
}
/// Data for ppIncludedFile callback.
-class CXIdxIncludedFileInfo extends ffi.Struct {}
+class CXIdxIncludedFileInfo extends ffi.Struct {
+ /// Location of '#' in the \#include/\#import directive.
+ external CXIdxLoc hashLoc;
+
+ /// Filename as written in the \#include/\#import directive.
+ external ffi.Pointer<ffi.Int8> filename;
+
+ /// The actual file that the \#include/\#import directive resolved to.
+ external ffi.Pointer<ffi.Void> file;
+
+ @ffi.Int32()
+ external int isImport;
+
+ @ffi.Int32()
+ external int isAngled;
+
+ /// Non-zero if the directive was automatically turned into a module
+ /// import.
+ @ffi.Int32()
+ external int isModuleImport;
+}
/// Data for IndexerCallbacks#importedASTFile.
-class CXIdxImportedASTFileInfo extends ffi.Struct {}
+class CXIdxImportedASTFileInfo extends ffi.Struct {
+ /// Top level AST file containing the imported PCH, module or submodule.
+ external ffi.Pointer<ffi.Void> file;
-class CXIdxAttrInfo extends ffi.Struct {}
+ /// The imported module or NULL if the AST file is a PCH.
+ external ffi.Pointer<ffi.Void> module;
-class CXIdxEntityInfo extends ffi.Struct {}
+ /// Location where the file is imported. Applicable only for modules.
+ external CXIdxLoc loc;
-class CXIdxContainerInfo extends ffi.Struct {}
+ /// Non-zero if an inclusion directive was automatically turned into
+ /// a module import. Applicable only for modules.
+ @ffi.Int32()
+ external int isImplicit;
+}
-class CXIdxIBOutletCollectionAttrInfo extends ffi.Struct {}
+class CXIdxAttrInfo extends ffi.Struct {
+ @ffi.Int32()
+ external int kind;
-class CXIdxDeclInfo extends ffi.Struct {}
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+}
+
+class CXIdxEntityInfo extends ffi.Struct {
+ @ffi.Int32()
+ external int kind;
+
+ @ffi.Int32()
+ external int templateKind;
+
+ @ffi.Int32()
+ external int lang;
+
+ external ffi.Pointer<ffi.Int8> name;
+
+ external ffi.Pointer<ffi.Int8> USR;
+
+ external CXCursor cursor;
+
+ external ffi.Pointer<ffi.Pointer<CXIdxAttrInfo>> attributes;
+
+ @ffi.Uint32()
+ external int numAttributes;
+}
+
+class CXIdxContainerInfo extends ffi.Struct {
+ external CXCursor cursor;
+}
+
+class CXIdxIBOutletCollectionAttrInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxAttrInfo> attrInfo;
+
+ external ffi.Pointer<CXIdxEntityInfo> objcClass;
+
+ external CXCursor classCursor;
+
+ external CXIdxLoc classLoc;
+}
+
+class CXIdxDeclInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxEntityInfo> entityInfo;
+
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+
+ external ffi.Pointer<CXIdxContainerInfo> semanticContainer;
+
+ /// Generally same as #semanticContainer but can be different in
+ /// cases like out-of-line C++ member functions.
+ external ffi.Pointer<CXIdxContainerInfo> lexicalContainer;
+
+ @ffi.Int32()
+ external int isRedeclaration;
+
+ @ffi.Int32()
+ external int isDefinition;
+
+ @ffi.Int32()
+ external int isContainer;
+
+ external ffi.Pointer<CXIdxContainerInfo> declAsContainer;
+
+ /// Whether the declaration exists in code or was created implicitly
+ /// by the compiler, e.g. implicit Objective-C methods for properties.
+ @ffi.Int32()
+ external int isImplicit;
+
+ external ffi.Pointer<ffi.Pointer<CXIdxAttrInfo>> attributes;
+
+ @ffi.Uint32()
+ external int numAttributes;
+
+ @ffi.Uint32()
+ external int flags;
+}
class CXIdxObjCContainerDeclInfo extends ffi.Struct {
external ffi.Pointer<CXIdxDeclInfo> declInfo;
@@ -3134,9 +3266,21 @@
external int kind;
}
-class CXIdxBaseClassInfo extends ffi.Struct {}
+class CXIdxBaseClassInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxEntityInfo> base;
-class CXIdxObjCProtocolRefInfo extends ffi.Struct {}
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+}
+
+class CXIdxObjCProtocolRefInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxEntityInfo> protocol;
+
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+}
class CXIdxObjCProtocolRefListInfo extends ffi.Struct {
external ffi.Pointer<ffi.Pointer<CXIdxObjCProtocolRefInfo>> protocols;
@@ -3153,7 +3297,17 @@
external ffi.Pointer<CXIdxObjCProtocolRefListInfo> protocols;
}
-class CXIdxObjCCategoryDeclInfo extends ffi.Struct {}
+class CXIdxObjCCategoryDeclInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxObjCContainerDeclInfo> containerInfo;
+
+ external ffi.Pointer<CXIdxEntityInfo> objcClass;
+
+ external CXCursor classCursor;
+
+ external CXIdxLoc classLoc;
+
+ external ffi.Pointer<CXIdxObjCProtocolRefListInfo> protocols;
+}
class CXIdxObjCPropertyDeclInfo extends ffi.Struct {
external ffi.Pointer<CXIdxDeclInfo> declInfo;
@@ -3173,7 +3327,36 @@
}
/// Data for IndexerCallbacks#indexEntityReference.
-class CXIdxEntityRefInfo extends ffi.Struct {}
+class CXIdxEntityRefInfo extends ffi.Struct {
+ @ffi.Int32()
+ external int kind;
+
+ /// Reference cursor.
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+
+ /// The entity that gets referenced.
+ external ffi.Pointer<CXIdxEntityInfo> referencedEntity;
+
+ /// Immediate "parent" of the reference. For example:
+ ///
+ /// \code
+ /// Foo *var;
+ /// \endcode
+ ///
+ /// The parent of reference of type 'Foo' is the variable 'var'.
+ /// For references inside statement bodies of functions/methods,
+ /// the parentEntity will be the function/method.
+ external ffi.Pointer<CXIdxEntityInfo> parentEntity;
+
+ /// Lexical container context of the reference.
+ external ffi.Pointer<CXIdxContainerInfo> container;
+
+ /// Sets of symbol roles of the reference.
+ @ffi.Int32()
+ external int role;
+}
/// A group of callbacks used by #clang_indexSourceFile and
/// #clang_indexTranslationUnit.
diff --git a/pkgs/ffigen/example/libclang-example/pubspec.yaml b/pkgs/ffigen/example/libclang-example/pubspec.yaml
index f45148f..7e8fc93 100644
--- a/pkgs/ffigen/example/libclang-example/pubspec.yaml
+++ b/pkgs/ffigen/example/libclang-example/pubspec.yaml
@@ -5,7 +5,7 @@
name: libclang_example
environment:
- sdk: '>=2.12.0-29.10.beta <3.0.0'
+ sdk: '>=2.12.0-198.0.dev <3.0.0'
dev_dependencies:
ffigen:
diff --git a/pkgs/ffigen/example/simple/pubspec.yaml b/pkgs/ffigen/example/simple/pubspec.yaml
index 9e461ec..ce3aa5e 100644
--- a/pkgs/ffigen/example/simple/pubspec.yaml
+++ b/pkgs/ffigen/example/simple/pubspec.yaml
@@ -5,7 +5,7 @@
name: simple_example
environment:
- sdk: '>=2.12.0-29.10.beta <3.0.0'
+ sdk: '>=2.12.0-198.0.dev <3.0.0'
dev_dependencies:
ffigen:
diff --git a/pkgs/ffigen/lib/src/code_generator/type.dart b/pkgs/ffigen/lib/src/code_generator/type.dart
index 0f2071e..014413a 100644
--- a/pkgs/ffigen/lib/src/code_generator/type.dart
+++ b/pkgs/ffigen/lib/src/code_generator/type.dart
@@ -187,7 +187,7 @@
}
}
- String? getDartType(Writer w) {
+ String getDartType(Writer w) {
switch (broadType) {
case BroadType.NativeType:
return _primitives[nativeType!]!.dart;
diff --git a/pkgs/ffigen/lib/src/header_parser/clang_bindings/clang_bindings.dart b/pkgs/ffigen/lib/src/header_parser/clang_bindings/clang_bindings.dart
index db84398..213f771 100644
--- a/pkgs/ffigen/lib/src/header_parser/clang_bindings/clang_bindings.dart
+++ b/pkgs/ffigen/lib/src/header_parser/clang_bindings/clang_bindings.dart
@@ -58,10 +58,9 @@
int excludeDeclarationsFromPCH,
int displayDiagnostics,
) {
- _clang_createIndex ??=
+ return (_clang_createIndex ??=
_dylib.lookupFunction<_c_clang_createIndex, _dart_clang_createIndex>(
- 'clang_createIndex');
- return _clang_createIndex!(
+ 'clang_createIndex'))(
excludeDeclarationsFromPCH,
displayDiagnostics,
);
@@ -76,10 +75,9 @@
void clang_disposeIndex(
ffi.Pointer<ffi.Void> index,
) {
- _clang_disposeIndex ??=
+ return (_clang_disposeIndex ??=
_dylib.lookupFunction<_c_clang_disposeIndex, _dart_clang_disposeIndex>(
- 'clang_disposeIndex');
- return _clang_disposeIndex!(
+ 'clang_disposeIndex'))(
index,
);
}
@@ -91,10 +89,9 @@
int clang_getNumDiagnostics(
ffi.Pointer<CXTranslationUnitImpl> Unit,
) {
- _clang_getNumDiagnostics ??= _dylib.lookupFunction<
+ return (_clang_getNumDiagnostics ??= _dylib.lookupFunction<
_c_clang_getNumDiagnostics,
- _dart_clang_getNumDiagnostics>('clang_getNumDiagnostics');
- return _clang_getNumDiagnostics!(
+ _dart_clang_getNumDiagnostics>('clang_getNumDiagnostics'))(
Unit,
);
}
@@ -112,9 +109,9 @@
ffi.Pointer<CXTranslationUnitImpl> Unit,
int Index,
) {
- _clang_getDiagnostic ??= _dylib.lookupFunction<_c_clang_getDiagnostic,
- _dart_clang_getDiagnostic>('clang_getDiagnostic');
- return _clang_getDiagnostic!(
+ return (_clang_getDiagnostic ??= _dylib.lookupFunction<
+ _c_clang_getDiagnostic,
+ _dart_clang_getDiagnostic>('clang_getDiagnostic'))(
Unit,
Index,
);
@@ -126,10 +123,9 @@
void clang_disposeDiagnostic(
ffi.Pointer<ffi.Void> Diagnostic,
) {
- _clang_disposeDiagnostic ??= _dylib.lookupFunction<
+ return (_clang_disposeDiagnostic ??= _dylib.lookupFunction<
_c_clang_disposeDiagnostic,
- _dart_clang_disposeDiagnostic>('clang_disposeDiagnostic');
- return _clang_disposeDiagnostic!(
+ _dart_clang_disposeDiagnostic>('clang_disposeDiagnostic'))(
Diagnostic,
);
}
@@ -149,10 +145,9 @@
int num_unsaved_files,
int options,
) {
- _clang_parseTranslationUnit ??= _dylib.lookupFunction<
+ return (_clang_parseTranslationUnit ??= _dylib.lookupFunction<
_c_clang_parseTranslationUnit,
- _dart_clang_parseTranslationUnit>('clang_parseTranslationUnit');
- return _clang_parseTranslationUnit!(
+ _dart_clang_parseTranslationUnit>('clang_parseTranslationUnit'))(
CIdx,
source_filename,
command_line_args,
@@ -169,10 +164,9 @@
void clang_disposeTranslationUnit(
ffi.Pointer<CXTranslationUnitImpl> arg0,
) {
- _clang_disposeTranslationUnit ??= _dylib.lookupFunction<
+ return (_clang_disposeTranslationUnit ??= _dylib.lookupFunction<
_c_clang_disposeTranslationUnit,
- _dart_clang_disposeTranslationUnit>('clang_disposeTranslationUnit');
- return _clang_disposeTranslationUnit!(
+ _dart_clang_disposeTranslationUnit>('clang_disposeTranslationUnit'))(
arg0,
);
}
@@ -183,10 +177,9 @@
int clang_EvalResult_getKind(
ffi.Pointer<ffi.Void> E,
) {
- _clang_EvalResult_getKind ??= _dylib.lookupFunction<
+ return (_clang_EvalResult_getKind ??= _dylib.lookupFunction<
_c_clang_EvalResult_getKind,
- _dart_clang_EvalResult_getKind>('clang_EvalResult_getKind');
- return _clang_EvalResult_getKind!(
+ _dart_clang_EvalResult_getKind>('clang_EvalResult_getKind'))(
E,
);
}
@@ -198,10 +191,9 @@
int clang_EvalResult_getAsInt(
ffi.Pointer<ffi.Void> E,
) {
- _clang_EvalResult_getAsInt ??= _dylib.lookupFunction<
+ return (_clang_EvalResult_getAsInt ??= _dylib.lookupFunction<
_c_clang_EvalResult_getAsInt,
- _dart_clang_EvalResult_getAsInt>('clang_EvalResult_getAsInt');
- return _clang_EvalResult_getAsInt!(
+ _dart_clang_EvalResult_getAsInt>('clang_EvalResult_getAsInt'))(
E,
);
}
@@ -214,10 +206,10 @@
int clang_EvalResult_getAsLongLong(
ffi.Pointer<ffi.Void> E,
) {
- _clang_EvalResult_getAsLongLong ??= _dylib.lookupFunction<
- _c_clang_EvalResult_getAsLongLong,
- _dart_clang_EvalResult_getAsLongLong>('clang_EvalResult_getAsLongLong');
- return _clang_EvalResult_getAsLongLong!(
+ return (_clang_EvalResult_getAsLongLong ??= _dylib.lookupFunction<
+ _c_clang_EvalResult_getAsLongLong,
+ _dart_clang_EvalResult_getAsLongLong>(
+ 'clang_EvalResult_getAsLongLong'))(
E,
);
}
@@ -229,10 +221,9 @@
double clang_EvalResult_getAsDouble(
ffi.Pointer<ffi.Void> E,
) {
- _clang_EvalResult_getAsDouble ??= _dylib.lookupFunction<
+ return (_clang_EvalResult_getAsDouble ??= _dylib.lookupFunction<
_c_clang_EvalResult_getAsDouble,
- _dart_clang_EvalResult_getAsDouble>('clang_EvalResult_getAsDouble');
- return _clang_EvalResult_getAsDouble!(
+ _dart_clang_EvalResult_getAsDouble>('clang_EvalResult_getAsDouble'))(
E,
);
}
@@ -246,10 +237,9 @@
ffi.Pointer<ffi.Int8> clang_EvalResult_getAsStr(
ffi.Pointer<ffi.Void> E,
) {
- _clang_EvalResult_getAsStr ??= _dylib.lookupFunction<
+ return (_clang_EvalResult_getAsStr ??= _dylib.lookupFunction<
_c_clang_EvalResult_getAsStr,
- _dart_clang_EvalResult_getAsStr>('clang_EvalResult_getAsStr');
- return _clang_EvalResult_getAsStr!(
+ _dart_clang_EvalResult_getAsStr>('clang_EvalResult_getAsStr'))(
E,
);
}
@@ -260,10 +250,9 @@
void clang_EvalResult_dispose(
ffi.Pointer<ffi.Void> E,
) {
- _clang_EvalResult_dispose ??= _dylib.lookupFunction<
+ return (_clang_EvalResult_dispose ??= _dylib.lookupFunction<
_c_clang_EvalResult_dispose,
- _dart_clang_EvalResult_dispose>('clang_EvalResult_dispose');
- return _clang_EvalResult_dispose!(
+ _dart_clang_EvalResult_dispose>('clang_EvalResult_dispose'))(
E,
);
}
@@ -273,9 +262,9 @@
ffi.Pointer<ffi.Int8> clang_getCString_wrap(
ffi.Pointer<CXString> string,
) {
- _clang_getCString_wrap ??= _dylib.lookupFunction<_c_clang_getCString_wrap,
- _dart_clang_getCString_wrap>('clang_getCString_wrap');
- return _clang_getCString_wrap!(
+ return (_clang_getCString_wrap ??= _dylib.lookupFunction<
+ _c_clang_getCString_wrap,
+ _dart_clang_getCString_wrap>('clang_getCString_wrap'))(
string,
);
}
@@ -285,10 +274,9 @@
void clang_disposeString_wrap(
ffi.Pointer<CXString> string,
) {
- _clang_disposeString_wrap ??= _dylib.lookupFunction<
+ return (_clang_disposeString_wrap ??= _dylib.lookupFunction<
_c_clang_disposeString_wrap,
- _dart_clang_disposeString_wrap>('clang_disposeString_wrap');
- return _clang_disposeString_wrap!(
+ _dart_clang_disposeString_wrap>('clang_disposeString_wrap'))(
string,
);
}
@@ -298,10 +286,9 @@
int clang_getCursorKind_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_getCursorKind_wrap ??= _dylib.lookupFunction<
+ return (_clang_getCursorKind_wrap ??= _dylib.lookupFunction<
_c_clang_getCursorKind_wrap,
- _dart_clang_getCursorKind_wrap>('clang_getCursorKind_wrap');
- return _clang_getCursorKind_wrap!(
+ _dart_clang_getCursorKind_wrap>('clang_getCursorKind_wrap'))(
cursor,
);
}
@@ -311,11 +298,10 @@
ffi.Pointer<CXString> clang_getCursorKindSpelling_wrap(
int kind,
) {
- _clang_getCursorKindSpelling_wrap ??= _dylib.lookupFunction<
+ return (_clang_getCursorKindSpelling_wrap ??= _dylib.lookupFunction<
_c_clang_getCursorKindSpelling_wrap,
_dart_clang_getCursorKindSpelling_wrap>(
- 'clang_getCursorKindSpelling_wrap');
- return _clang_getCursorKindSpelling_wrap!(
+ 'clang_getCursorKindSpelling_wrap'))(
kind,
);
}
@@ -325,10 +311,9 @@
ffi.Pointer<CXType> clang_getCursorType_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_getCursorType_wrap ??= _dylib.lookupFunction<
+ return (_clang_getCursorType_wrap ??= _dylib.lookupFunction<
_c_clang_getCursorType_wrap,
- _dart_clang_getCursorType_wrap>('clang_getCursorType_wrap');
- return _clang_getCursorType_wrap!(
+ _dart_clang_getCursorType_wrap>('clang_getCursorType_wrap'))(
cursor,
);
}
@@ -338,10 +323,9 @@
ffi.Pointer<CXString> clang_getTypeSpelling_wrap(
ffi.Pointer<CXType> type,
) {
- _clang_getTypeSpelling_wrap ??= _dylib.lookupFunction<
+ return (_clang_getTypeSpelling_wrap ??= _dylib.lookupFunction<
_c_clang_getTypeSpelling_wrap,
- _dart_clang_getTypeSpelling_wrap>('clang_getTypeSpelling_wrap');
- return _clang_getTypeSpelling_wrap!(
+ _dart_clang_getTypeSpelling_wrap>('clang_getTypeSpelling_wrap'))(
type,
);
}
@@ -349,12 +333,12 @@
_dart_clang_getTypeSpelling_wrap? _clang_getTypeSpelling_wrap;
ffi.Pointer<CXString> clang_getTypeKindSpelling_wrap(
- int? typeKind,
+ int typeKind,
) {
- _clang_getTypeKindSpelling_wrap ??= _dylib.lookupFunction<
- _c_clang_getTypeKindSpelling_wrap,
- _dart_clang_getTypeKindSpelling_wrap>('clang_getTypeKindSpelling_wrap');
- return _clang_getTypeKindSpelling_wrap!(
+ return (_clang_getTypeKindSpelling_wrap ??= _dylib.lookupFunction<
+ _c_clang_getTypeKindSpelling_wrap,
+ _dart_clang_getTypeKindSpelling_wrap>(
+ 'clang_getTypeKindSpelling_wrap'))(
typeKind,
);
}
@@ -364,10 +348,9 @@
ffi.Pointer<CXType> clang_getResultType_wrap(
ffi.Pointer<CXType> functionType,
) {
- _clang_getResultType_wrap ??= _dylib.lookupFunction<
+ return (_clang_getResultType_wrap ??= _dylib.lookupFunction<
_c_clang_getResultType_wrap,
- _dart_clang_getResultType_wrap>('clang_getResultType_wrap');
- return _clang_getResultType_wrap!(
+ _dart_clang_getResultType_wrap>('clang_getResultType_wrap'))(
functionType,
);
}
@@ -377,10 +360,9 @@
ffi.Pointer<CXType> clang_getPointeeType_wrap(
ffi.Pointer<CXType> pointerType,
) {
- _clang_getPointeeType_wrap ??= _dylib.lookupFunction<
+ return (_clang_getPointeeType_wrap ??= _dylib.lookupFunction<
_c_clang_getPointeeType_wrap,
- _dart_clang_getPointeeType_wrap>('clang_getPointeeType_wrap');
- return _clang_getPointeeType_wrap!(
+ _dart_clang_getPointeeType_wrap>('clang_getPointeeType_wrap'))(
pointerType,
);
}
@@ -390,10 +372,9 @@
ffi.Pointer<CXType> clang_getCanonicalType_wrap(
ffi.Pointer<CXType> typerefType,
) {
- _clang_getCanonicalType_wrap ??= _dylib.lookupFunction<
+ return (_clang_getCanonicalType_wrap ??= _dylib.lookupFunction<
_c_clang_getCanonicalType_wrap,
- _dart_clang_getCanonicalType_wrap>('clang_getCanonicalType_wrap');
- return _clang_getCanonicalType_wrap!(
+ _dart_clang_getCanonicalType_wrap>('clang_getCanonicalType_wrap'))(
typerefType,
);
}
@@ -403,10 +384,9 @@
ffi.Pointer<CXType> clang_Type_getNamedType_wrap(
ffi.Pointer<CXType> elaboratedType,
) {
- _clang_Type_getNamedType_wrap ??= _dylib.lookupFunction<
+ return (_clang_Type_getNamedType_wrap ??= _dylib.lookupFunction<
_c_clang_Type_getNamedType_wrap,
- _dart_clang_Type_getNamedType_wrap>('clang_Type_getNamedType_wrap');
- return _clang_Type_getNamedType_wrap!(
+ _dart_clang_Type_getNamedType_wrap>('clang_Type_getNamedType_wrap'))(
elaboratedType,
);
}
@@ -416,10 +396,9 @@
ffi.Pointer<CXCursor> clang_getTypeDeclaration_wrap(
ffi.Pointer<CXType> cxtype,
) {
- _clang_getTypeDeclaration_wrap ??= _dylib.lookupFunction<
+ return (_clang_getTypeDeclaration_wrap ??= _dylib.lookupFunction<
_c_clang_getTypeDeclaration_wrap,
- _dart_clang_getTypeDeclaration_wrap>('clang_getTypeDeclaration_wrap');
- return _clang_getTypeDeclaration_wrap!(
+ _dart_clang_getTypeDeclaration_wrap>('clang_getTypeDeclaration_wrap'))(
cxtype,
);
}
@@ -429,11 +408,10 @@
ffi.Pointer<CXType> clang_getTypedefDeclUnderlyingType_wrap(
ffi.Pointer<CXCursor> cxcursor,
) {
- _clang_getTypedefDeclUnderlyingType_wrap ??= _dylib.lookupFunction<
+ return (_clang_getTypedefDeclUnderlyingType_wrap ??= _dylib.lookupFunction<
_c_clang_getTypedefDeclUnderlyingType_wrap,
_dart_clang_getTypedefDeclUnderlyingType_wrap>(
- 'clang_getTypedefDeclUnderlyingType_wrap');
- return _clang_getTypedefDeclUnderlyingType_wrap!(
+ 'clang_getTypedefDeclUnderlyingType_wrap'))(
cxcursor,
);
}
@@ -445,10 +423,9 @@
ffi.Pointer<CXString> clang_getCursorSpelling_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_getCursorSpelling_wrap ??= _dylib.lookupFunction<
+ return (_clang_getCursorSpelling_wrap ??= _dylib.lookupFunction<
_c_clang_getCursorSpelling_wrap,
- _dart_clang_getCursorSpelling_wrap>('clang_getCursorSpelling_wrap');
- return _clang_getCursorSpelling_wrap!(
+ _dart_clang_getCursorSpelling_wrap>('clang_getCursorSpelling_wrap'))(
cursor,
);
}
@@ -458,11 +435,10 @@
ffi.Pointer<CXCursor> clang_getTranslationUnitCursor_wrap(
ffi.Pointer<CXTranslationUnitImpl> tu,
) {
- _clang_getTranslationUnitCursor_wrap ??= _dylib.lookupFunction<
+ return (_clang_getTranslationUnitCursor_wrap ??= _dylib.lookupFunction<
_c_clang_getTranslationUnitCursor_wrap,
_dart_clang_getTranslationUnitCursor_wrap>(
- 'clang_getTranslationUnitCursor_wrap');
- return _clang_getTranslationUnitCursor_wrap!(
+ 'clang_getTranslationUnitCursor_wrap'))(
tu,
);
}
@@ -474,10 +450,9 @@
ffi.Pointer<ffi.Void> diag,
int opts,
) {
- _clang_formatDiagnostic_wrap ??= _dylib.lookupFunction<
+ return (_clang_formatDiagnostic_wrap ??= _dylib.lookupFunction<
_c_clang_formatDiagnostic_wrap,
- _dart_clang_formatDiagnostic_wrap>('clang_formatDiagnostic_wrap');
- return _clang_formatDiagnostic_wrap!(
+ _dart_clang_formatDiagnostic_wrap>('clang_formatDiagnostic_wrap'))(
diag,
opts,
);
@@ -492,10 +467,9 @@
ffi.Pointer<ffi.NativeFunction<ModifiedCXCursorVisitor>> _modifiedVisitor,
int uid,
) {
- _clang_visitChildren_wrap ??= _dylib.lookupFunction<
+ return (_clang_visitChildren_wrap ??= _dylib.lookupFunction<
_c_clang_visitChildren_wrap,
- _dart_clang_visitChildren_wrap>('clang_visitChildren_wrap');
- return _clang_visitChildren_wrap!(
+ _dart_clang_visitChildren_wrap>('clang_visitChildren_wrap'))(
parent,
_modifiedVisitor,
uid,
@@ -507,11 +481,10 @@
int clang_Cursor_getNumArguments_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_getNumArguments_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_getNumArguments_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_getNumArguments_wrap,
_dart_clang_Cursor_getNumArguments_wrap>(
- 'clang_Cursor_getNumArguments_wrap');
- return _clang_Cursor_getNumArguments_wrap!(
+ 'clang_Cursor_getNumArguments_wrap'))(
cursor,
);
}
@@ -522,10 +495,9 @@
ffi.Pointer<CXCursor> cursor,
int i,
) {
- _clang_Cursor_getArgument_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_getArgument_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_getArgument_wrap,
- _dart_clang_Cursor_getArgument_wrap>('clang_Cursor_getArgument_wrap');
- return _clang_Cursor_getArgument_wrap!(
+ _dart_clang_Cursor_getArgument_wrap>('clang_Cursor_getArgument_wrap'))(
cursor,
i,
);
@@ -536,10 +508,9 @@
int clang_getNumArgTypes_wrap(
ffi.Pointer<CXType> cxtype,
) {
- _clang_getNumArgTypes_wrap ??= _dylib.lookupFunction<
+ return (_clang_getNumArgTypes_wrap ??= _dylib.lookupFunction<
_c_clang_getNumArgTypes_wrap,
- _dart_clang_getNumArgTypes_wrap>('clang_getNumArgTypes_wrap');
- return _clang_getNumArgTypes_wrap!(
+ _dart_clang_getNumArgTypes_wrap>('clang_getNumArgTypes_wrap'))(
cxtype,
);
}
@@ -550,9 +521,9 @@
ffi.Pointer<CXType> cxtype,
int i,
) {
- _clang_getArgType_wrap ??= _dylib.lookupFunction<_c_clang_getArgType_wrap,
- _dart_clang_getArgType_wrap>('clang_getArgType_wrap');
- return _clang_getArgType_wrap!(
+ return (_clang_getArgType_wrap ??= _dylib.lookupFunction<
+ _c_clang_getArgType_wrap,
+ _dart_clang_getArgType_wrap>('clang_getArgType_wrap'))(
cxtype,
i,
);
@@ -563,11 +534,10 @@
int clang_getEnumConstantDeclValue_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_getEnumConstantDeclValue_wrap ??= _dylib.lookupFunction<
+ return (_clang_getEnumConstantDeclValue_wrap ??= _dylib.lookupFunction<
_c_clang_getEnumConstantDeclValue_wrap,
_dart_clang_getEnumConstantDeclValue_wrap>(
- 'clang_getEnumConstantDeclValue_wrap');
- return _clang_getEnumConstantDeclValue_wrap!(
+ 'clang_getEnumConstantDeclValue_wrap'))(
cursor,
);
}
@@ -580,9 +550,9 @@
ffi.Pointer<CXSourceRange> c1,
ffi.Pointer<CXSourceRange> c2,
) {
- _clang_equalRanges_wrap ??= _dylib.lookupFunction<_c_clang_equalRanges_wrap,
- _dart_clang_equalRanges_wrap>('clang_equalRanges_wrap');
- return _clang_equalRanges_wrap!(
+ return (_clang_equalRanges_wrap ??= _dylib.lookupFunction<
+ _c_clang_equalRanges_wrap,
+ _dart_clang_equalRanges_wrap>('clang_equalRanges_wrap'))(
c1,
c2,
);
@@ -594,11 +564,10 @@
ffi.Pointer<CXSourceRange> clang_Cursor_getCommentRange_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_getCommentRange_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_getCommentRange_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_getCommentRange_wrap,
_dart_clang_Cursor_getCommentRange_wrap>(
- 'clang_Cursor_getCommentRange_wrap');
- return _clang_Cursor_getCommentRange_wrap!(
+ 'clang_Cursor_getCommentRange_wrap'))(
cursor,
);
}
@@ -609,11 +578,10 @@
ffi.Pointer<CXString> clang_Cursor_getRawCommentText_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_getRawCommentText_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_getRawCommentText_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_getRawCommentText_wrap,
_dart_clang_Cursor_getRawCommentText_wrap>(
- 'clang_Cursor_getRawCommentText_wrap');
- return _clang_Cursor_getRawCommentText_wrap!(
+ 'clang_Cursor_getRawCommentText_wrap'))(
cursor,
);
}
@@ -625,11 +593,10 @@
ffi.Pointer<CXString> clang_Cursor_getBriefCommentText_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_getBriefCommentText_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_getBriefCommentText_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_getBriefCommentText_wrap,
_dart_clang_Cursor_getBriefCommentText_wrap>(
- 'clang_Cursor_getBriefCommentText_wrap');
- return _clang_Cursor_getBriefCommentText_wrap!(
+ 'clang_Cursor_getBriefCommentText_wrap'))(
cursor,
);
}
@@ -640,10 +607,9 @@
ffi.Pointer<CXSourceLocation> clang_getCursorLocation_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_getCursorLocation_wrap ??= _dylib.lookupFunction<
+ return (_clang_getCursorLocation_wrap ??= _dylib.lookupFunction<
_c_clang_getCursorLocation_wrap,
- _dart_clang_getCursorLocation_wrap>('clang_getCursorLocation_wrap');
- return _clang_getCursorLocation_wrap!(
+ _dart_clang_getCursorLocation_wrap>('clang_getCursorLocation_wrap'))(
cursor,
);
}
@@ -657,10 +623,9 @@
ffi.Pointer<ffi.Uint32> column,
ffi.Pointer<ffi.Uint32> offset,
) {
- _clang_getFileLocation_wrap ??= _dylib.lookupFunction<
+ return (_clang_getFileLocation_wrap ??= _dylib.lookupFunction<
_c_clang_getFileLocation_wrap,
- _dart_clang_getFileLocation_wrap>('clang_getFileLocation_wrap');
- return _clang_getFileLocation_wrap!(
+ _dart_clang_getFileLocation_wrap>('clang_getFileLocation_wrap'))(
location,
file,
line,
@@ -674,9 +639,9 @@
ffi.Pointer<CXString> clang_getFileName_wrap(
ffi.Pointer<ffi.Void> SFile,
) {
- _clang_getFileName_wrap ??= _dylib.lookupFunction<_c_clang_getFileName_wrap,
- _dart_clang_getFileName_wrap>('clang_getFileName_wrap');
- return _clang_getFileName_wrap!(
+ return (_clang_getFileName_wrap ??= _dylib.lookupFunction<
+ _c_clang_getFileName_wrap,
+ _dart_clang_getFileName_wrap>('clang_getFileName_wrap'))(
SFile,
);
}
@@ -686,10 +651,9 @@
int clang_getNumElements_wrap(
ffi.Pointer<CXType> cxtype,
) {
- _clang_getNumElements_wrap ??= _dylib.lookupFunction<
+ return (_clang_getNumElements_wrap ??= _dylib.lookupFunction<
_c_clang_getNumElements_wrap,
- _dart_clang_getNumElements_wrap>('clang_getNumElements_wrap');
- return _clang_getNumElements_wrap!(
+ _dart_clang_getNumElements_wrap>('clang_getNumElements_wrap'))(
cxtype,
);
}
@@ -699,10 +663,10 @@
ffi.Pointer<CXType> clang_getArrayElementType_wrap(
ffi.Pointer<CXType> cxtype,
) {
- _clang_getArrayElementType_wrap ??= _dylib.lookupFunction<
- _c_clang_getArrayElementType_wrap,
- _dart_clang_getArrayElementType_wrap>('clang_getArrayElementType_wrap');
- return _clang_getArrayElementType_wrap!(
+ return (_clang_getArrayElementType_wrap ??= _dylib.lookupFunction<
+ _c_clang_getArrayElementType_wrap,
+ _dart_clang_getArrayElementType_wrap>(
+ 'clang_getArrayElementType_wrap'))(
cxtype,
);
}
@@ -712,11 +676,10 @@
int clang_Cursor_isMacroFunctionLike_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_isMacroFunctionLike_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_isMacroFunctionLike_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_isMacroFunctionLike_wrap,
_dart_clang_Cursor_isMacroFunctionLike_wrap>(
- 'clang_Cursor_isMacroFunctionLike_wrap');
- return _clang_Cursor_isMacroFunctionLike_wrap!(
+ 'clang_Cursor_isMacroFunctionLike_wrap'))(
cursor,
);
}
@@ -727,11 +690,10 @@
int clang_Cursor_isMacroBuiltin_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_isMacroBuiltin_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_isMacroBuiltin_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_isMacroBuiltin_wrap,
_dart_clang_Cursor_isMacroBuiltin_wrap>(
- 'clang_Cursor_isMacroBuiltin_wrap');
- return _clang_Cursor_isMacroBuiltin_wrap!(
+ 'clang_Cursor_isMacroBuiltin_wrap'))(
cursor,
);
}
@@ -741,10 +703,9 @@
ffi.Pointer<ffi.Void> clang_Cursor_Evaluate_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_Evaluate_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_Evaluate_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_Evaluate_wrap,
- _dart_clang_Cursor_Evaluate_wrap>('clang_Cursor_Evaluate_wrap');
- return _clang_Cursor_Evaluate_wrap!(
+ _dart_clang_Cursor_Evaluate_wrap>('clang_Cursor_Evaluate_wrap'))(
cursor,
);
}
@@ -754,10 +715,9 @@
int clang_Cursor_isAnonymous_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_isAnonymous_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_isAnonymous_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_isAnonymous_wrap,
- _dart_clang_Cursor_isAnonymous_wrap>('clang_Cursor_isAnonymous_wrap');
- return _clang_Cursor_isAnonymous_wrap!(
+ _dart_clang_Cursor_isAnonymous_wrap>('clang_Cursor_isAnonymous_wrap'))(
cursor,
);
}
@@ -767,11 +727,10 @@
int clang_Cursor_isAnonymousRecordDecl_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_Cursor_isAnonymousRecordDecl_wrap ??= _dylib.lookupFunction<
+ return (_clang_Cursor_isAnonymousRecordDecl_wrap ??= _dylib.lookupFunction<
_c_clang_Cursor_isAnonymousRecordDecl_wrap,
_dart_clang_Cursor_isAnonymousRecordDecl_wrap>(
- 'clang_Cursor_isAnonymousRecordDecl_wrap');
- return _clang_Cursor_isAnonymousRecordDecl_wrap!(
+ 'clang_Cursor_isAnonymousRecordDecl_wrap'))(
cursor,
);
}
@@ -782,10 +741,9 @@
ffi.Pointer<CXString> clang_getCursorUSR_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_getCursorUSR_wrap ??= _dylib.lookupFunction<
+ return (_clang_getCursorUSR_wrap ??= _dylib.lookupFunction<
_c_clang_getCursorUSR_wrap,
- _dart_clang_getCursorUSR_wrap>('clang_getCursorUSR_wrap');
- return _clang_getCursorUSR_wrap!(
+ _dart_clang_getCursorUSR_wrap>('clang_getCursorUSR_wrap'))(
cursor,
);
}
@@ -795,11 +753,10 @@
int clang_getFieldDeclBitWidth_wrap(
ffi.Pointer<CXCursor> cursor,
) {
- _clang_getFieldDeclBitWidth_wrap ??= _dylib.lookupFunction<
+ return (_clang_getFieldDeclBitWidth_wrap ??= _dylib.lookupFunction<
_c_clang_getFieldDeclBitWidth_wrap,
_dart_clang_getFieldDeclBitWidth_wrap>(
- 'clang_getFieldDeclBitWidth_wrap');
- return _clang_getFieldDeclBitWidth_wrap!(
+ 'clang_getFieldDeclBitWidth_wrap'))(
cursor,
);
}
@@ -814,10 +771,10 @@
/// Use \c clang_getCString() to retrieve the string data and, once finished
/// with the string data, call \c clang_disposeString() to free the string.
class CXString extends ffi.Struct {
- ffi.Pointer<ffi.Void>? data;
+ external ffi.Pointer<ffi.Void> data;
@ffi.Uint32()
- int? private_flags;
+ external int private_flags;
}
class CXTranslationUnitImpl extends ffi.Struct {}
@@ -831,14 +788,14 @@
/// The file whose contents have not yet been saved.
///
/// This file must already exist in the file system.
- ffi.Pointer<ffi.Int8>? Filename;
+ external ffi.Pointer<ffi.Int8> Filename;
/// A buffer containing the unsaved contents of this file.
- ffi.Pointer<ffi.Int8>? Contents;
+ external ffi.Pointer<ffi.Int8> Contents;
/// The length of the unsaved contents of this buffer.
@ffi.Uint64()
- int? Length;
+ external int Length;
}
/// Identifies a specific source location within a translation
@@ -847,14 +804,14 @@
/// Use clang_getExpansionLocation() or clang_getSpellingLocation()
/// to map a source location to a particular file, line, and column.
class CXSourceLocation extends ffi.Struct {
- ffi.Pointer<ffi.Void>? _unique_ptr_data_item_0;
- ffi.Pointer<ffi.Void>? _unique_ptr_data_item_1;
+ external ffi.Pointer<ffi.Void> _unique_ptr_data_item_0;
+ external ffi.Pointer<ffi.Void> _unique_ptr_data_item_1;
/// Helper for array `ptr_data`.
ArrayHelper_CXSourceLocation_ptr_data_level0 get ptr_data =>
ArrayHelper_CXSourceLocation_ptr_data_level0(this, [2], 0, 0);
@ffi.Uint32()
- int? int_data;
+ external int int_data;
}
/// Helper for array `ptr_data` in struct `CXSourceLocation`.
@@ -873,7 +830,7 @@
}
}
- ffi.Pointer<ffi.Void>? operator [](int index) {
+ ffi.Pointer<ffi.Void> operator [](int index) {
_checkBounds(index);
switch (_absoluteIndex + index) {
case 0:
@@ -905,17 +862,17 @@
/// Use clang_getRangeStart() and clang_getRangeEnd() to retrieve the
/// starting and end locations from a source range, respectively.
class CXSourceRange extends ffi.Struct {
- ffi.Pointer<ffi.Void>? _unique_ptr_data_item_0;
- ffi.Pointer<ffi.Void>? _unique_ptr_data_item_1;
+ external ffi.Pointer<ffi.Void> _unique_ptr_data_item_0;
+ external ffi.Pointer<ffi.Void> _unique_ptr_data_item_1;
/// Helper for array `ptr_data`.
ArrayHelper_CXSourceRange_ptr_data_level0 get ptr_data =>
ArrayHelper_CXSourceRange_ptr_data_level0(this, [2], 0, 0);
@ffi.Uint32()
- int? begin_int_data;
+ external int begin_int_data;
@ffi.Uint32()
- int? end_int_data;
+ external int end_int_data;
}
/// Helper for array `ptr_data` in struct `CXSourceRange`.
@@ -934,7 +891,7 @@
}
}
- ffi.Pointer<ffi.Void>? operator [](int index) {
+ ffi.Pointer<ffi.Void> operator [](int index) {
_checkBounds(index);
switch (_absoluteIndex + index) {
case 0:
@@ -1472,46 +1429,49 @@
/// \endcode
static const int CXCursor_CXXFunctionalCastExpr = 128;
+ /// OpenCL's addrspace_cast<> expression.
+ static const int CXCursor_CXXAddrspaceCastExpr = 129;
+
/// A C++ typeid expression (C++ [expr.typeid]).
- static const int CXCursor_CXXTypeidExpr = 129;
+ static const int CXCursor_CXXTypeidExpr = 130;
/// [C++ 2.13.5] C++ Boolean Literal.
- static const int CXCursor_CXXBoolLiteralExpr = 130;
+ static const int CXCursor_CXXBoolLiteralExpr = 131;
/// [C++0x 2.14.7] C++ Pointer Literal.
- static const int CXCursor_CXXNullPtrLiteralExpr = 131;
+ static const int CXCursor_CXXNullPtrLiteralExpr = 132;
/// Represents the "this" expression in C++
- static const int CXCursor_CXXThisExpr = 132;
+ static const int CXCursor_CXXThisExpr = 133;
/// [C++ 15] C++ Throw Expression.
///
/// This handles 'throw' and 'throw' assignment-expression. When
/// assignment-expression isn't present, Op will be null.
- static const int CXCursor_CXXThrowExpr = 133;
+ static const int CXCursor_CXXThrowExpr = 134;
/// A new expression for memory allocation and constructor calls, e.g:
/// "new CXXNewExpr(foo)".
- static const int CXCursor_CXXNewExpr = 134;
+ static const int CXCursor_CXXNewExpr = 135;
/// A delete expression for memory deallocation and destructor calls,
/// e.g. "delete[] pArray".
- static const int CXCursor_CXXDeleteExpr = 135;
+ static const int CXCursor_CXXDeleteExpr = 136;
/// A unary expression. (noexcept, sizeof, or other traits)
- static const int CXCursor_UnaryExpr = 136;
+ static const int CXCursor_UnaryExpr = 137;
/// An Objective-C string literal i.e. @"foo".
- static const int CXCursor_ObjCStringLiteral = 137;
+ static const int CXCursor_ObjCStringLiteral = 138;
/// An Objective-C \@encode expression.
- static const int CXCursor_ObjCEncodeExpr = 138;
+ static const int CXCursor_ObjCEncodeExpr = 139;
/// An Objective-C \@selector expression.
- static const int CXCursor_ObjCSelectorExpr = 139;
+ static const int CXCursor_ObjCSelectorExpr = 140;
/// An Objective-C \@protocol expression.
- static const int CXCursor_ObjCProtocolExpr = 140;
+ static const int CXCursor_ObjCProtocolExpr = 141;
/// An Objective-C "bridged" cast expression, which casts between
/// Objective-C pointers and C pointers, transferring ownership in the process.
@@ -1519,7 +1479,7 @@
/// \code
/// NSString *str = (__bridge_transfer NSString *)CFCreateString();
/// \endcode
- static const int CXCursor_ObjCBridgedCastExpr = 141;
+ static const int CXCursor_ObjCBridgedCastExpr = 142;
/// Represents a C++0x pack expansion that produces a sequence of
/// expressions.
@@ -1533,7 +1493,7 @@
/// f(static_cast<Types&&>(args)...);
/// }
/// \endcode
- static const int CXCursor_PackExpansionExpr = 142;
+ static const int CXCursor_PackExpansionExpr = 143;
/// Represents an expression that computes the length of a parameter
/// pack.
@@ -1544,24 +1504,30 @@
/// static const unsigned value = sizeof...(Types);
/// };
/// \endcode
- static const int CXCursor_SizeOfPackExpr = 143;
- static const int CXCursor_LambdaExpr = 144;
+ static const int CXCursor_SizeOfPackExpr = 144;
+ static const int CXCursor_LambdaExpr = 145;
/// Objective-c Boolean Literal.
- static const int CXCursor_ObjCBoolLiteralExpr = 145;
+ static const int CXCursor_ObjCBoolLiteralExpr = 146;
/// Represents the "self" expression in an Objective-C method.
- static const int CXCursor_ObjCSelfExpr = 146;
+ static const int CXCursor_ObjCSelfExpr = 147;
- /// OpenMP 4.0 [2.4, Array Section].
- static const int CXCursor_OMPArraySectionExpr = 147;
+ /// OpenMP 5.0 [2.1.5, Array Section].
+ static const int CXCursor_OMPArraySectionExpr = 148;
/// Represents an @available(...) check.
- static const int CXCursor_ObjCAvailabilityCheckExpr = 148;
+ static const int CXCursor_ObjCAvailabilityCheckExpr = 149;
/// Fixed point literal
- static const int CXCursor_FixedPointLiteral = 149;
- static const int CXCursor_LastExpr = 149;
+ static const int CXCursor_FixedPointLiteral = 150;
+
+ /// OpenMP 5.0 [2.1.4, Array Shaping].
+ static const int CXCursor_OMPArrayShapingExpr = 151;
+
+ /// OpenMP 5.0 [2.1.6 Iterators]
+ static const int CXCursor_OMPIteratorExpr = 152;
+ static const int CXCursor_LastExpr = 152;
static const int CXCursor_FirstStmt = 200;
/// A statement whose specific kind is not exposed via this
@@ -1843,7 +1809,13 @@
/// OpenMP parallel master directive.
static const int CXCursor_OMPParallelMasterDirective = 285;
- static const int CXCursor_LastStmt = 285;
+
+ /// OpenMP depobj directive.
+ static const int CXCursor_OMPDepobjDirective = 286;
+
+ /// OpenMP scan directive.
+ static const int CXCursor_OMPScanDirective = 287;
+ static const int CXCursor_LastStmt = 287;
/// Cursor that represents the translation unit itself.
///
@@ -1939,14 +1911,14 @@
/// source code into the AST.
class CXCursor extends ffi.Struct {
@ffi.Int32()
- int? kind;
+ external int kind;
@ffi.Int32()
- int? xdata;
+ external int xdata;
- ffi.Pointer<ffi.Void>? _unique_data_item_0;
- ffi.Pointer<ffi.Void>? _unique_data_item_1;
- ffi.Pointer<ffi.Void>? _unique_data_item_2;
+ external ffi.Pointer<ffi.Void> _unique_data_item_0;
+ external ffi.Pointer<ffi.Void> _unique_data_item_1;
+ external ffi.Pointer<ffi.Void> _unique_data_item_2;
/// Helper for array `data`.
ArrayHelper_CXCursor_data_level0 get data =>
@@ -1969,7 +1941,7 @@
}
}
- ffi.Pointer<ffi.Void>? operator [](int index) {
+ ffi.Pointer<ffi.Void> operator [](int index) {
_checkBounds(index);
switch (_absoluteIndex + index) {
case 0:
@@ -2046,8 +2018,9 @@
static const int CXType_UShortAccum = 36;
static const int CXType_UAccum = 37;
static const int CXType_ULongAccum = 38;
+ static const int CXType_BFloat16 = 39;
static const int CXType_FirstBuiltin = 2;
- static const int CXType_LastBuiltin = 38;
+ static const int CXType_LastBuiltin = 39;
static const int CXType_Complex = 100;
static const int CXType_Pointer = 101;
static const int CXType_BlockPointer = 102;
@@ -2129,15 +2102,16 @@
static const int CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174;
static const int CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175;
static const int CXType_ExtVector = 176;
+ static const int CXType_Atomic = 177;
}
/// The type of an element in the abstract syntax tree.
class CXType extends ffi.Struct {
@ffi.Int32()
- int? kind;
+ external int kind;
- ffi.Pointer<ffi.Void>? _unique_data_item_0;
- ffi.Pointer<ffi.Void>? _unique_data_item_1;
+ external ffi.Pointer<ffi.Void> _unique_data_item_0;
+ external ffi.Pointer<ffi.Void> _unique_data_item_1;
/// Helper for array `data`.
ArrayHelper_CXType_data_level0 get data =>
@@ -2160,7 +2134,7 @@
}
}
- ffi.Pointer<ffi.Void>? operator [](int index) {
+ ffi.Pointer<ffi.Void> operator [](int index) {
_checkBounds(index);
switch (_absoluteIndex + index) {
case 0:
@@ -2217,11 +2191,11 @@
const int CINDEX_VERSION_MAJOR = 0;
-const int CINDEX_VERSION_MINOR = 59;
+const int CINDEX_VERSION_MINOR = 60;
-const int CINDEX_VERSION = 59;
+const int CINDEX_VERSION = 60;
-const String CINDEX_VERSION_STRING = '0.59';
+const String CINDEX_VERSION_STRING = '0.60';
typedef _c_clang_createIndex = ffi.Pointer<ffi.Void> Function(
ffi.Int32 excludeDeclarationsFromPCH,
@@ -2398,7 +2372,7 @@
);
typedef _dart_clang_getTypeKindSpelling_wrap = ffi.Pointer<CXString> Function(
- int? typeKind,
+ int typeKind,
);
typedef _c_clang_getResultType_wrap = ffi.Pointer<CXType> Function(
diff --git a/pkgs/ffigen/lib/src/header_parser/includer.dart b/pkgs/ffigen/lib/src/header_parser/includer.dart
index 67efefc..baa5b59 100644
--- a/pkgs/ffigen/lib/src/header_parser/includer.dart
+++ b/pkgs/ffigen/lib/src/header_parser/includer.dart
@@ -62,9 +62,9 @@
/// True if a cursor should be included based on headers config, used on root
/// declarations.
-bool shouldIncludeRootCursor(String? sourceFile) {
- // Handle null in case of system headers or macros.
- if (sourceFile == null) {
+bool shouldIncludeRootCursor(String sourceFile) {
+ // Handle empty string in case of system headers or macros.
+ if (sourceFile.isEmpty) {
return false;
}
diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart
index 704eade..0261838 100644
--- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart
+++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/macro_parser.dart
@@ -61,10 +61,8 @@
final index = clang.clang_createIndex(0, 0);
Pointer<Pointer<Utf8>> clangCmdArgs = nullptr;
var cmdLen = 0;
- if (config.compilerOpts != null) {
- clangCmdArgs = createDynamicStringArray(config.compilerOpts);
- cmdLen = config.compilerOpts.length;
- }
+ clangCmdArgs = createDynamicStringArray(config.compilerOpts);
+ cmdLen = config.compilerOpts.length;
final tu = clang.clang_parseTranslationUnit(
index,
Utf8.toUtf8(file.path).cast(),
@@ -166,11 +164,7 @@
/// Returns true if cursor is from generated file.
bool isFromGeneratedFile(Pointer<clang_types.CXCursor> cursor) {
final s = cursor.sourceFileName();
- if (s == null || s.isEmpty) {
- return false;
- } else {
- return p.basename(s) == _generatedFileBaseName;
- }
+ return p.basename(s) == _generatedFileBaseName;
}
/// Base name of generated file.
diff --git a/pkgs/ffigen/lib/src/header_parser/sub_parsers/structdecl_parser.dart b/pkgs/ffigen/lib/src/header_parser/sub_parsers/structdecl_parser.dart
index bce2eb4..0c014d7 100644
--- a/pkgs/ffigen/lib/src/header_parser/sub_parsers/structdecl_parser.dart
+++ b/pkgs/ffigen/lib/src/header_parser/sub_parsers/structdecl_parser.dart
@@ -17,7 +17,6 @@
/// Holds temporary information regarding [struc] while parsing.
class _ParsedStruc {
Struc? struc;
- bool nestedStructMember = false;
bool unimplementedMemberType = false;
bool flexibleArrayMember = false;
bool arrayMember = false;
@@ -63,7 +62,7 @@
}
if (bindingsIndex.isSeenStruct(structUsr)) {
- _stack.top.struc = bindingsIndex.getSeenStruct(structUsr);
+ _stack.top.struc = bindingsIndex.getSeenStruct(structUsr)!;
// If struct is seen, update it's name.
_stack.top.struc!.name = config.structDecl.renameUsingConfig(structName);
@@ -73,7 +72,6 @@
void _setStructMembers(Pointer<clang_types.CXCursor> cursor) {
_stack.top.arrayMember = false;
- _stack.top.nestedStructMember = false;
_stack.top.unimplementedMemberType = false;
final resultCode = clang.clang_visitChildren_wrap(
@@ -92,12 +90,6 @@
_logger.warning(
'Removed All Struct Members from: ${_stack.top.struc!.name}(${_stack.top.struc!.originalName}), Array members not supported');
return _stack.top.struc!.members.clear();
- } else if (_stack.top.nestedStructMember) {
- _logger.fine(
- '---- Removed Struct members, reason: struct has struct members ${cursor.completeStringRepr()}');
- _logger.warning(
- 'Removed All Struct Members from ${_stack.top.struc!.name}(${_stack.top.struc!.originalName}), Nested Structures not supported.');
- return _stack.top.struc!.members.clear();
} else if (_stack.top.unimplementedMemberType) {
_logger.fine(
'---- Removed Struct members, reason: member with unimplementedtype ${cursor.completeStringRepr()}');
@@ -135,18 +127,8 @@
_logger.finer('===== member: ${cursor.completeStringRepr()}');
final mt = cursor.type().toCodeGenTypeAndDispose();
- //TODO(4): Remove these when support for Structs by value arrives.
- if (mt.broadType == BroadType.Struct) {
- // Setting this flag will exclude adding members for this struct's
- // bindings.
- _stack.top.nestedStructMember = true;
- } else if (mt.broadType == BroadType.ConstantArray) {
+ if (mt.broadType == BroadType.ConstantArray) {
_stack.top.arrayMember = true;
- if (mt.child!.broadType == BroadType.Struct) {
- // Setting this flag will exclude adding members for this struct's
- // bindings.
- _stack.top.nestedStructMember = true;
- }
} else if (mt.broadType == BroadType.IncompleteArray) {
// TODO(68): Structs with flexible Array Members are not supported.
_stack.top.flexibleArrayMember = true;
diff --git a/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart b/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart
index 2c77030..defa1d3 100644
--- a/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart
+++ b/pkgs/ffigen/lib/src/header_parser/type_extractor/extractor.dart
@@ -41,14 +41,13 @@
final spelling = cxtype.spelling();
if (config.typedefNativeTypeMappings.containsKey(spelling)) {
_logger.fine(' Type Mapped from typedef-map');
- return Type.nativeType(config.typedefNativeTypeMappings[spelling!]);
+ return Type.nativeType(config.typedefNativeTypeMappings[spelling]);
}
// Get name from supported typedef name if config allows.
if (config.useSupportedTypedefs) {
if (suportedTypedefToSuportedNativeType.containsKey(spelling)) {
_logger.fine(' Type Mapped from supported typedef');
- return Type.nativeType(
- suportedTypedefToSuportedNativeType[spelling!]);
+ return Type.nativeType(suportedTypedefToSuportedNativeType[spelling]);
}
}
diff --git a/pkgs/ffigen/lib/src/header_parser/utils.dart b/pkgs/ffigen/lib/src/header_parser/utils.dart
index ca7f0cf..f24c187 100644
--- a/pkgs/ffigen/lib/src/header_parser/utils.dart
+++ b/pkgs/ffigen/lib/src/header_parser/utils.dart
@@ -45,7 +45,7 @@
clang_types
.CXDiagnosticDisplayOptions.CXDiagnostic_DisplayCategoryName,
);
- logger.severe(' ' + cxstring.toStringAndDispose()!);
+ logger.severe(' ' + cxstring.toStringAndDispose());
clang.clang_disposeDiagnostic(diag);
}
}
@@ -58,7 +58,7 @@
extension CXCursorExt on Pointer<clang_types.CXCursor> {
String usr() {
- return clang.clang_getCursorUSR_wrap(this).toStringAndDispose()!;
+ return clang.clang_getCursorUSR_wrap(this).toStringAndDispose();
}
/// Returns the kind int from [clang_types.CXCursorKind].
@@ -68,14 +68,14 @@
/// Name of the cursor (E.g function name, Struct name, Parameter name).
String spelling() {
- return clang.clang_getCursorSpelling_wrap(this).toStringAndDispose()!;
+ return clang.clang_getCursorSpelling_wrap(this).toStringAndDispose();
}
/// Spelling for a [clang_types.CXCursorKind], useful for debug purposes.
String kindSpelling() {
return clang
.clang_getCursorKindSpelling_wrap(clang.clang_getCursorKind_wrap(this))
- .toStringAndDispose()!;
+ .toStringAndDispose();
}
/// for debug: returns [spelling] [kind] [kindSpelling] [type] [typeSpelling].
@@ -102,7 +102,7 @@
return r;
}
- String? sourceFileName() {
+ String sourceFileName() {
final cxsource = clang.clang_getCursorLocation_wrap(this);
final cxfilePtr = allocate<Pointer<Void>>();
final line = allocate<Uint32>();
@@ -234,7 +234,7 @@
}
/// Spelling for a [clang_types.CXTypeKind], useful for debug purposes.
- String? spelling() {
+ String spelling() {
return clang.clang_getTypeSpelling_wrap(this).toStringAndDispose();
}
@@ -243,8 +243,8 @@
return ref.kind;
}
- String? kindSpelling() {
- return clang.clang_getTypeKindSpelling_wrap(kind()).toStringAndDispose();
+ String kindSpelling() {
+ return clang.clang_getTypeKindSpelling_wrap(kind()!).toStringAndDispose();
}
/// For debugging: returns [spelling] [kind] [kindSpelling].
@@ -264,17 +264,17 @@
///
/// Make sure to dispose CXstring using dispose method, or use the
/// [toStringAndDispose] method.
- String? string() {
- String? s;
+ String string() {
final cstring = clang.clang_getCString_wrap(this);
if (cstring != nullptr) {
- s = Utf8.fromUtf8(cstring.cast());
+ return Utf8.fromUtf8(cstring.cast());
+ } else {
+ return '';
}
- return s;
}
/// Converts CXString to dart string and disposes CXString.
- String? toStringAndDispose() {
+ String toStringAndDispose() {
// Note: clang_getCString_wrap returns a const char *, calling free will result in error.
final s = string();
clang.clang_disposeString_wrap(this);
diff --git a/pkgs/ffigen/pubspec.yaml b/pkgs/ffigen/pubspec.yaml
index aaddf64..44f1f1c 100644
--- a/pkgs/ffigen/pubspec.yaml
+++ b/pkgs/ffigen/pubspec.yaml
@@ -3,12 +3,12 @@
# BSD-style license that can be found in the LICENSE file.
name: ffigen
-version: 2.0.0-nullsafety.1
+version: 2.0.0-dev.0
homepage: https://github.com/dart-lang/ffigen
description: Experimental generator for FFI bindings, using LibClang to parse C header files.
environment:
- sdk: '>=2.12.0-29.10.beta <3.0.0'
+ sdk: '>=2.12.0-198.0.dev <3.0.0'
dependencies:
ffi: ^0.2.0-nullsafety.1
diff --git a/pkgs/ffigen/test/header_parser_tests/function_n_struct_test.dart b/pkgs/ffigen/test/header_parser_tests/function_n_struct_test.dart
index 9c3107c..f8852d5 100644
--- a/pkgs/ffigen/test/header_parser_tests/function_n_struct_test.dart
+++ b/pkgs/ffigen/test/header_parser_tests/function_n_struct_test.dart
@@ -41,7 +41,8 @@
expected.getBindingAsString('func2'));
});
test('Struct2 nested struct member', () {
- expect((actual.getBinding('Struct2') as Struc).members.isEmpty, true);
+ expect(actual.getBindingAsString('Struct2'),
+ expected.getBindingAsString('Struct2'));
});
test('Struct3 flexible array member', () {
expect((actual.getBinding('Struct3') as Struc).members.isEmpty, true);
@@ -53,7 +54,13 @@
}
Library expectedLibrary() {
- final struc2 = Struc(name: 'Struct2', members: []);
+ final struc1 = Struc(name: 'Struct1', members: []);
+ final struc2 = Struc(name: 'Struct2', members: [
+ Member(
+ name: 'a',
+ type: Type.struct(struc1),
+ ),
+ ]);
final struc3 = Struc(name: 'Struct3', members: []);
return Library(
name: 'Bindings',
@@ -84,7 +91,12 @@
SupportedNativeType.Void,
),
),
- Struc(name: 'Struct4'),
+ Struc(name: 'Struct4', members: [
+ Member(
+ name: 'a',
+ type: Type.struct(struc1),
+ ),
+ ]),
],
);
}
diff --git a/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart b/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart
index e6cc63e..60698fc 100644
--- a/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart
+++ b/pkgs/ffigen/test/large_integration_tests/_expected_libclang_bindings.dart
@@ -3328,7 +3328,30 @@
/// Describes the availability of a given entity on a particular platform, e.g.,
/// a particular class might only be available on Mac OS 10.7 or newer.
-class CXPlatformAvailability extends ffi.Struct {}
+class CXPlatformAvailability extends ffi.Struct {
+ /// A string that describes the platform for which this structure provides
+ /// availability information.
+ external CXString Platform;
+
+ /// The version number in which this entity was introduced.
+ external CXVersion Introduced;
+
+ /// The version number in which this entity was deprecated (but is still
+ /// available).
+ external CXVersion Deprecated;
+
+ /// The version number in which this entity was obsoleted, and therefore is no
+ /// longer available.
+ external CXVersion Obsoleted;
+
+ /// Whether the entity is unconditionally unavailable on this platform.
+ @ffi.Int32()
+ external int Unavailable;
+
+ /// An optional message to provide to a user of this API, e.g., to suggest
+ /// replacement APIs.
+ external CXString Message;
+}
/// Describe the "language" of the entity referred to by a cursor.
abstract class CXLanguageKind {
@@ -4112,10 +4135,43 @@
}
/// Data for ppIncludedFile callback.
-class CXIdxIncludedFileInfo extends ffi.Struct {}
+class CXIdxIncludedFileInfo extends ffi.Struct {
+ /// Location of '#' in the #include/#import directive.
+ external CXIdxLoc hashLoc;
+
+ /// Filename as written in the #include/#import directive.
+ external ffi.Pointer<ffi.Int8> filename;
+
+ /// The actual file that the #include/#import directive resolved to.
+ external ffi.Pointer<ffi.Void> file;
+
+ @ffi.Int32()
+ external int isImport;
+
+ @ffi.Int32()
+ external int isAngled;
+
+ /// Non-zero if the directive was automatically turned into a module import.
+ @ffi.Int32()
+ external int isModuleImport;
+}
/// Data for IndexerCallbacks#importedASTFile.
-class CXIdxImportedASTFileInfo extends ffi.Struct {}
+class CXIdxImportedASTFileInfo extends ffi.Struct {
+ /// Top level AST file containing the imported PCH, module or submodule.
+ external ffi.Pointer<ffi.Void> file;
+
+ /// The imported module or NULL if the AST file is a PCH.
+ external ffi.Pointer<ffi.Void> module;
+
+ /// Location where the file is imported. Applicable only for modules.
+ external CXIdxLoc loc;
+
+ /// Non-zero if an inclusion directive was automatically turned into a module
+ /// import. Applicable only for modules.
+ @ffi.Int32()
+ external int isImplicit;
+}
abstract class CXIdxEntityKind {
static const int CXIdxEntity_Unexposed = 0;
@@ -4173,19 +4229,92 @@
static const int CXIdxAttr_IBOutletCollection = 3;
}
-class CXIdxAttrInfo extends ffi.Struct {}
+class CXIdxAttrInfo extends ffi.Struct {
+ @ffi.Int32()
+ external int kind;
-class CXIdxEntityInfo extends ffi.Struct {}
+ external CXCursor cursor;
-class CXIdxContainerInfo extends ffi.Struct {}
+ external CXIdxLoc loc;
+}
-class CXIdxIBOutletCollectionAttrInfo extends ffi.Struct {}
+class CXIdxEntityInfo extends ffi.Struct {
+ @ffi.Int32()
+ external int kind;
+
+ @ffi.Int32()
+ external int templateKind;
+
+ @ffi.Int32()
+ external int lang;
+
+ external ffi.Pointer<ffi.Int8> name;
+
+ external ffi.Pointer<ffi.Int8> USR;
+
+ external CXCursor cursor;
+
+ external ffi.Pointer<ffi.Pointer<CXIdxAttrInfo>> attributes;
+
+ @ffi.Uint32()
+ external int numAttributes;
+}
+
+class CXIdxContainerInfo extends ffi.Struct {
+ external CXCursor cursor;
+}
+
+class CXIdxIBOutletCollectionAttrInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxAttrInfo> attrInfo;
+
+ external ffi.Pointer<CXIdxEntityInfo> objcClass;
+
+ external CXCursor classCursor;
+
+ external CXIdxLoc classLoc;
+}
abstract class CXIdxDeclInfoFlags {
static const int CXIdxDeclFlag_Skipped = 1;
}
-class CXIdxDeclInfo extends ffi.Struct {}
+class CXIdxDeclInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxEntityInfo> entityInfo;
+
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+
+ external ffi.Pointer<CXIdxContainerInfo> semanticContainer;
+
+ /// Generally same as #semanticContainer but can be different in cases like
+ /// out-of-line C++ member functions.
+ external ffi.Pointer<CXIdxContainerInfo> lexicalContainer;
+
+ @ffi.Int32()
+ external int isRedeclaration;
+
+ @ffi.Int32()
+ external int isDefinition;
+
+ @ffi.Int32()
+ external int isContainer;
+
+ external ffi.Pointer<CXIdxContainerInfo> declAsContainer;
+
+ /// Whether the declaration exists in code or was created implicitly by the
+ /// compiler, e.g. implicit Objective-C methods for properties.
+ @ffi.Int32()
+ external int isImplicit;
+
+ external ffi.Pointer<ffi.Pointer<CXIdxAttrInfo>> attributes;
+
+ @ffi.Uint32()
+ external int numAttributes;
+
+ @ffi.Uint32()
+ external int flags;
+}
abstract class CXIdxObjCContainerKind {
static const int CXIdxObjCContainer_ForwardRef = 0;
@@ -4200,9 +4329,21 @@
external int kind;
}
-class CXIdxBaseClassInfo extends ffi.Struct {}
+class CXIdxBaseClassInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxEntityInfo> base;
-class CXIdxObjCProtocolRefInfo extends ffi.Struct {}
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+}
+
+class CXIdxObjCProtocolRefInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxEntityInfo> protocol;
+
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+}
class CXIdxObjCProtocolRefListInfo extends ffi.Struct {
external ffi.Pointer<ffi.Pointer<CXIdxObjCProtocolRefInfo>> protocols;
@@ -4219,7 +4360,17 @@
external ffi.Pointer<CXIdxObjCProtocolRefListInfo> protocols;
}
-class CXIdxObjCCategoryDeclInfo extends ffi.Struct {}
+class CXIdxObjCCategoryDeclInfo extends ffi.Struct {
+ external ffi.Pointer<CXIdxObjCContainerDeclInfo> containerInfo;
+
+ external ffi.Pointer<CXIdxEntityInfo> objcClass;
+
+ external CXCursor classCursor;
+
+ external CXIdxLoc classLoc;
+
+ external ffi.Pointer<CXIdxObjCProtocolRefListInfo> protocols;
+}
class CXIdxObjCPropertyDeclInfo extends ffi.Struct {
external ffi.Pointer<CXIdxDeclInfo> declInfo;
@@ -4263,7 +4414,28 @@
}
/// Data for IndexerCallbacks#indexEntityReference.
-class CXIdxEntityRefInfo extends ffi.Struct {}
+class CXIdxEntityRefInfo extends ffi.Struct {
+ @ffi.Int32()
+ external int kind;
+
+ /// Reference cursor.
+ external CXCursor cursor;
+
+ external CXIdxLoc loc;
+
+ /// The entity that gets referenced.
+ external ffi.Pointer<CXIdxEntityInfo> referencedEntity;
+
+ /// Immediate "parent" of the reference. For example:
+ external ffi.Pointer<CXIdxEntityInfo> parentEntity;
+
+ /// Lexical container context of the reference.
+ external ffi.Pointer<CXIdxContainerInfo> container;
+
+ /// Sets of symbol roles of the reference.
+ @ffi.Int32()
+ external int role;
+}
/// A group of callbacks used by #clang_indexSourceFile and
/// #clang_indexTranslationUnit.