Fixes for `const` in name error, unnamed inline structs and empty structs. (#169)
* Fix windows issues
* Added test for unnamed struct
* Fix error due to const function pointer in structs
* Mark empty struct as incomplete, mark struct with array of incomplete struct as incomplete.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4ab98d4..cfb41c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+# 2.0.2
+- Fixed illegal use of `const` in name, crash due to unnamed inline structs and
+structs having `Opaque` members.
+
# 2.0.1
- Switch to preview release of `package:quiver`.
diff --git a/example/libclang-example/pubspec.yaml b/example/libclang-example/pubspec.yaml
index 61373da..2f64d88 100644
--- a/example/libclang-example/pubspec.yaml
+++ b/example/libclang-example/pubspec.yaml
@@ -27,7 +27,7 @@
- '**CXString.h'
- '**Index.h'
- compiler-opts: '-I/usr/lib/llvm-9/include/ -I/usr/lib/llvm-10/include/ -I/usr/lib/llvm-11/include/ -IC:\Progra~1\LLVM\include -I/usr/local/opt/llvm/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ -Wno-nullability-completeness'
+ compiler-opts: '-Ithird_party/libclang/include -IC:\Progra~1\LLVM\include -I/usr/local/opt/llvm/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ -Wno-nullability-completeness'
functions:
include:
- 'clang_.*' # Can be a regexp, '.' matches any character.
diff --git a/lib/src/code_generator/type.dart b/lib/src/code_generator/type.dart
index f6e5001..c732e15 100644
--- a/lib/src/code_generator/type.dart
+++ b/lib/src/code_generator/type.dart
@@ -100,13 +100,13 @@
factory Type.pointer(Type child) {
return Type._(broadType: BroadType.Pointer, child: child);
}
- factory Type.struct(Struc? struc) {
+ factory Type.struct(Struc struc) {
return Type._(broadType: BroadType.Struct, struc: struc);
}
- factory Type.nativeFunc(Typedef? nativeFunc) {
+ factory Type.nativeFunc(Typedef nativeFunc) {
return Type._(broadType: BroadType.NativeFunction, nativeFunc: nativeFunc);
}
- factory Type.nativeType(SupportedNativeType? nativeType) {
+ factory Type.nativeType(SupportedNativeType nativeType) {
return Type._(broadType: BroadType.NativeType, nativeType: nativeType);
}
factory Type.constantArray(int length, Type elementType) {
@@ -164,7 +164,9 @@
/// Returns true if the type is a [Struc] and is incomplete.
bool get isIncompleteStruct =>
- broadType == BroadType.Struct && struc!.isInComplete;
+ (broadType == BroadType.Struct && struc != null && struc!.isInComplete) ||
+ (broadType == BroadType.ConstantArray &&
+ getBaseArrayType().isIncompleteStruct);
String getCType(Writer w) {
switch (broadType) {
diff --git a/lib/src/header_parser/clang_bindings/clang_bindings.dart b/lib/src/header_parser/clang_bindings/clang_bindings.dart
index b834217..7cccd4a 100644
--- a/lib/src/header_parser/clang_bindings/clang_bindings.dart
+++ b/lib/src/header_parser/clang_bindings/clang_bindings.dart
@@ -525,6 +525,19 @@
_dart_clang_Cursor_isFunctionInlined? _clang_Cursor_isFunctionInlined;
+ /// Returns the typedef name of the given type.
+ CXString clang_getTypedefName(
+ CXType CT,
+ ) {
+ return (_clang_getTypedefName ??= _dylib.lookupFunction<
+ _c_clang_getTypedefName,
+ _dart_clang_getTypedefName>('clang_getTypedefName'))(
+ CT,
+ );
+ }
+
+ _dart_clang_getTypedefName? _clang_getTypedefName;
+
/// For pointer types, returns the type of the pointee.
CXType clang_getPointeeType(
CXType T,
@@ -2586,6 +2599,14 @@
CXCursor C,
);
+typedef _c_clang_getTypedefName = CXString Function(
+ CXType CT,
+);
+
+typedef _dart_clang_getTypedefName = CXString Function(
+ CXType CT,
+);
+
typedef _c_clang_getPointeeType = CXType Function(
CXType T,
);
diff --git a/lib/src/header_parser/sub_parsers/structdecl_parser.dart b/lib/src/header_parser/sub_parsers/structdecl_parser.dart
index dffd502..ac59f5c 100644
--- a/lib/src/header_parser/sub_parsers/structdecl_parser.dart
+++ b/lib/src/header_parser/sub_parsers/structdecl_parser.dart
@@ -54,7 +54,17 @@
final structName = name ?? cursor.spelling();
if (structName.isEmpty) {
- _logger.finest('unnamed structure or typedef structure declaration');
+ if (ignoreFilter) {
+ // This struct is defined inside some other struct and hence must be generated.
+ _stack.top.struc = Struc(
+ name: incrementalNamer.name('unnamedStruct'),
+ usr: structUsr,
+ dartDoc: getCursorDocComment(cursor),
+ );
+ _setStructMembers(cursor);
+ } else {
+ _logger.finest('unnamed structure or typedef structure declaration');
+ }
} else if ((ignoreFilter || shouldIncludeStruct(structUsr, structName)) &&
(!bindingsIndex.isSeenStruct(structUsr))) {
_logger.fine(
@@ -130,7 +140,10 @@
_stack.top.struc!.members.clear();
}
- _stack.top.struc!.isInComplete = _stack.top.isInComplete;
+ // C allow empty structs, but it's undefined behaviour at runtine. So we need
+ // to mark a struct incomplete if it has no members.
+ _stack.top.struc!.isInComplete =
+ _stack.top.isInComplete || _stack.top.struc!.members.isEmpty;
}
/// Visitor for the struct cursor [CXCursorKind.CXCursor_StructDecl].
@@ -145,18 +158,21 @@
final mt = cursor.type().toCodeGenType();
if (mt.broadType == BroadType.ConstantArray) {
_stack.top.arrayMember = true;
- } else if (mt.broadType == BroadType.IncompleteArray) {
+ }
+ if (mt.broadType == BroadType.IncompleteArray) {
// TODO(68): Structs with flexible Array Members are not supported.
_stack.top.flexibleArrayMember = true;
- } else if (clang.clang_getFieldDeclBitWidth(cursor) != -1) {
+ }
+ if (clang.clang_getFieldDeclBitWidth(cursor) != -1) {
// TODO(84): Struct with bitfields are not suppoorted.
_stack.top.bitFieldMember = true;
- } else if (mt.broadType == BroadType.Handle) {
+ }
+ if (mt.broadType == BroadType.Handle) {
_stack.top.dartHandleMember = true;
- } else if (mt.isIncompleteStruct) {
+ }
+ if (mt.isIncompleteStruct) {
_stack.top.incompleteStructMember = true;
}
-
if (mt.getBaseType().broadType == BroadType.Unimplemented) {
_stack.top.unimplementedMemberType = true;
}
diff --git a/lib/src/header_parser/sub_parsers/var_parser.dart b/lib/src/header_parser/sub_parsers/var_parser.dart
index d0248ec..a19c4b2 100644
--- a/lib/src/header_parser/sub_parsers/var_parser.dart
+++ b/lib/src/header_parser/sub_parsers/var_parser.dart
@@ -27,8 +27,7 @@
_logger.fine('++++ Adding Global: ${cursor.completeStringRepr()}');
final type = cursor.type().toCodeGenType();
- if (type.getBaseType().broadType == BroadType.Unimplemented ||
- type.getBaseType().isIncompleteStruct) {
+ if (type.getBaseType().broadType == BroadType.Unimplemented) {
_logger.fine(
'---- Removed Global, reason: unsupported type: ${cursor.completeStringRepr()}');
_logger.warning("Skipped global variable '$name', type not supported.");
diff --git a/lib/src/header_parser/type_extractor/cxtypekindmap.dart b/lib/src/header_parser/type_extractor/cxtypekindmap.dart
index 1ecfdb3..0fe81aa 100644
--- a/lib/src/header_parser/type_extractor/cxtypekindmap.dart
+++ b/lib/src/header_parser/type_extractor/cxtypekindmap.dart
@@ -27,8 +27,8 @@
clang.CXTypeKind.CXType_Enum: SupportedNativeType.Int32,
};
-SupportedNativeType? get enumNativeType =>
- cxTypeKindToSupportedNativeTypes[clang.CXTypeKind.CXType_Enum];
+SupportedNativeType get enumNativeType =>
+ cxTypeKindToSupportedNativeTypes[clang.CXTypeKind.CXType_Enum]!;
var suportedTypedefToSuportedNativeType = <String, SupportedNativeType>{
'uint8_t': SupportedNativeType.Uint8,
diff --git a/lib/src/header_parser/type_extractor/extractor.dart b/lib/src/header_parser/type_extractor/extractor.dart
index e216d02..46d6a41 100644
--- a/lib/src/header_parser/type_extractor/extractor.dart
+++ b/lib/src/header_parser/type_extractor/extractor.dart
@@ -35,16 +35,17 @@
}
return Type.pointer(s);
case clang_types.CXTypeKind.CXType_Typedef:
- final spelling = cxtype.spelling();
+ final spelling = clang.clang_getTypedefName(cxtype).toStringAndDispose();
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]!);
}
}
@@ -52,7 +53,7 @@
final ct = clang.clang_getTypedefDeclUnderlyingType(
clang.clang_getTypeDeclaration(cxtype));
- final s = getCodeGenType(ct, parentName: parentName ?? cxtype.spelling());
+ final s = getCodeGenType(ct, parentName: parentName ?? spelling);
return s;
case clang_types.CXTypeKind.CXType_Elaborated:
final et = clang.clang_Type_getNamedType(cxtype);
@@ -86,7 +87,7 @@
default:
if (cxTypeKindToSupportedNativeTypes.containsKey(kind)) {
return Type.nativeType(
- cxTypeKindToSupportedNativeTypes[kind],
+ cxTypeKindToSupportedNativeTypes[kind]!,
);
} else {
_logger.fine(
@@ -113,11 +114,11 @@
// Also add a struct binding, if its unseen.
// TODO(23): Check if we should auto add struct.
if (bindingsIndex.isSeenStruct(structUsr)) {
- type = Type.struct(bindingsIndex.getSeenStruct(structUsr));
+ type = Type.struct(bindingsIndex.getSeenStruct(structUsr)!);
} else {
final struc = parseStructDeclaration(cursor,
name: structName, ignoreFilter: true);
- type = Type.struct(struc);
+ type = Type.struct(struc!);
// Add to bindings if it's not Dart_Handle.
if (!(config.useDartHandle && structUsr == strings.dartHandleUsr)) {
@@ -176,5 +177,5 @@
}
}
- return Type.nativeFunc(typedefC);
+ return Type.nativeFunc(typedefC!);
}
diff --git a/lib/src/strings.dart b/lib/src/strings.dart
index 99e0c68..d5041aa 100644
--- a/lib/src/strings.dart
+++ b/lib/src/strings.dart
@@ -132,7 +132,7 @@
'/usr/lib/llvm-11/lib/'
];
const windowsDylibLocations = [
- r'C:\Program Files\LLVM\lib',
+ r'C:\Program Files\LLVM\bin\',
];
const macOsDylibLocations = [
'/usr/local/opt/llvm/lib/',
diff --git a/pubspec.yaml b/pubspec.yaml
index ccb3e8b..bdc549d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
name: ffigen
-version: 2.0.1
+version: 2.0.2
homepage: https://github.com/dart-lang/ffigen
description: Generator for FFI bindings, using LibClang to parse C header files.
diff --git a/test/example_tests/libclang_example_test.dart b/test/example_tests/libclang_example_test.dart
index dba380d..f047376 100644
--- a/test/example_tests/libclang_example_test.dart
+++ b/test/example_tests/libclang_example_test.dart
@@ -27,7 +27,7 @@
- '**CXString.h'
- '**Index.h'
-${strings.compilerOpts}: '-I/usr/lib/llvm-9/include/ -I/usr/lib/llvm-10/include/ -I/usr/lib/llvm-11/include/ -IC:\Progra~1\LLVM\include -I/usr/local/opt/llvm/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ -Wno-nullability-completeness'
+${strings.compilerOpts}: '-Ithird_party/libclang/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ -Wno-nullability-completeness'
${strings.functions}:
${strings.include}:
- 'clang_.*'
diff --git a/test/header_parser_tests/expected_bindings/_expected_native_func_typedef_bindings.dart b/test/header_parser_tests/expected_bindings/_expected_native_func_typedef_bindings.dart
new file mode 100644
index 0000000..22e60da
--- /dev/null
+++ b/test/header_parser_tests/expected_bindings/_expected_native_func_typedef_bindings.dart
@@ -0,0 +1,78 @@
+// AUTO GENERATED FILE, DO NOT EDIT.
+//
+// Generated by `package:ffigen`.
+import 'dart:ffi' as ffi;
+
+/// Unnamed Enums Test
+class NativeLibrary {
+ /// Holds the Dynamic library.
+ final ffi.DynamicLibrary _dylib;
+
+ /// The symbols are looked up in [dynamicLibrary].
+ NativeLibrary(ffi.DynamicLibrary dynamicLibrary) : _dylib = dynamicLibrary;
+
+ void func(
+ ffi.Pointer<ffi.NativeFunction<_typedefC_4>> unnamed1,
+ ) {
+ return (_func ??= _dylib.lookupFunction<_c_func, _dart_func>('func'))(
+ unnamed1,
+ );
+ }
+
+ _dart_func? _func;
+
+ void funcWithNativeFunc(
+ ffi.Pointer<ffi.NativeFunction<withTypedefReturnType>> named,
+ ) {
+ return (_funcWithNativeFunc ??=
+ _dylib.lookupFunction<_c_funcWithNativeFunc, _dart_funcWithNativeFunc>(
+ 'funcWithNativeFunc'))(
+ named,
+ );
+ }
+
+ _dart_funcWithNativeFunc? _funcWithNativeFunc;
+}
+
+class struc extends ffi.Struct {
+ external ffi.Pointer<ffi.NativeFunction<_typedefC_2>> unnamed1;
+}
+
+class Struc2 extends ffi.Struct {
+ external ffi.Pointer<ffi.NativeFunction<VoidFuncPointer>> constFuncPointer;
+}
+
+typedef _typedefC_3 = ffi.Void Function();
+
+typedef _typedefC_4 = ffi.Void Function(
+ ffi.Pointer<ffi.NativeFunction<_typedefC_3>>,
+);
+
+typedef _c_func = ffi.Void Function(
+ ffi.Pointer<ffi.NativeFunction<_typedefC_4>> unnamed1,
+);
+
+typedef _dart_func = void Function(
+ ffi.Pointer<ffi.NativeFunction<_typedefC_4>> unnamed1,
+);
+
+typedef insideReturnType = ffi.Void Function();
+
+typedef withTypedefReturnType
+ = ffi.Pointer<ffi.NativeFunction<insideReturnType>> Function();
+
+typedef _c_funcWithNativeFunc = ffi.Void Function(
+ ffi.Pointer<ffi.NativeFunction<withTypedefReturnType>> named,
+);
+
+typedef _dart_funcWithNativeFunc = void Function(
+ ffi.Pointer<ffi.NativeFunction<withTypedefReturnType>> named,
+);
+
+typedef _typedefC_1 = ffi.Void Function();
+
+typedef _typedefC_2 = ffi.Void Function(
+ ffi.Pointer<ffi.NativeFunction<_typedefC_1>>,
+);
+
+typedef VoidFuncPointer = ffi.Void Function();
diff --git a/test/header_parser_tests/native_func_typedef.h b/test/header_parser_tests/native_func_typedef.h
index da2f3c0..94bcba9 100644
--- a/test/header_parser_tests/native_func_typedef.h
+++ b/test/header_parser_tests/native_func_typedef.h
@@ -15,3 +15,8 @@
typedef void (*insideReturnType)();
typedef insideReturnType (*withTypedefReturnType)();
void funcWithNativeFunc(withTypedefReturnType named);
+
+typedef void (*VoidFuncPointer)();
+struct Struc2{
+ const VoidFuncPointer constFuncPointer;
+};
diff --git a/test/header_parser_tests/native_func_typedef_test.dart b/test/header_parser_tests/native_func_typedef_test.dart
index 54ef290..7a56d2b 100644
--- a/test/header_parser_tests/native_func_typedef_test.dart
+++ b/test/header_parser_tests/native_func_typedef_test.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:io';
-
import 'package:ffigen/src/code_generator.dart';
import 'package:ffigen/src/header_parser.dart' as parser;
import 'package:ffigen/src/config_provider.dart';
@@ -37,95 +35,16 @@
});
test('Expected bindings', () {
- final gen = actual.generate();
- // Writing to file for debug purpose.
- final file =
- File('test/debug_generated/native_func_typedef_test-output.dart');
-
- try {
- expect(gen, '''// AUTO GENERATED FILE, DO NOT EDIT.
-//
-// Generated by `package:ffigen`.
-import 'dart:ffi' as ffi;
-
-/// Unnamed Enums Test
-class NativeLibrary{
-/// Holds the Dynamic library.
-final ffi.DynamicLibrary _dylib;
-
-/// The symbols are looked up in [dynamicLibrary].
-NativeLibrary(ffi.DynamicLibrary dynamicLibrary): _dylib = dynamicLibrary;
-
-void func(
- ffi.Pointer<ffi.NativeFunction<_typedefC_4>> unnamed1,
-) {
-return (_func ??= _dylib.lookupFunction<_c_func,_dart_func>('func'))(
- unnamed1,
- );
-}
-_dart_func? _func;
-
-void funcWithNativeFunc(
- ffi.Pointer<ffi.NativeFunction<withTypedefReturnType>> named,
-) {
-return (_funcWithNativeFunc ??= _dylib.lookupFunction<_c_funcWithNativeFunc,_dart_funcWithNativeFunc>('funcWithNativeFunc'))(
- named,
- );
-}
-_dart_funcWithNativeFunc? _funcWithNativeFunc;
-
-}
-
-class struc extends ffi.Struct{
- external ffi.Pointer<ffi.NativeFunction<_typedefC_2>> unnamed1;
-
-}
-
-typedef _typedefC_3 = ffi.Void Function(
-);
-
-typedef _typedefC_4 = ffi.Void Function(
- ffi.Pointer<ffi.NativeFunction<_typedefC_3>> ,
-);
-
-typedef _c_func = ffi.Void Function(
- ffi.Pointer<ffi.NativeFunction<_typedefC_4>> unnamed1,
-);
-
-typedef _dart_func = void Function(
- ffi.Pointer<ffi.NativeFunction<_typedefC_4>> unnamed1,
-);
-
-typedef insideReturnType = ffi.Void Function(
-);
-
-typedef withTypedefReturnType = ffi.Pointer<ffi.NativeFunction<insideReturnType>> Function(
-);
-
-typedef _c_funcWithNativeFunc = ffi.Void Function(
- ffi.Pointer<ffi.NativeFunction<withTypedefReturnType>> named,
-);
-
-typedef _dart_funcWithNativeFunc = void Function(
- ffi.Pointer<ffi.NativeFunction<withTypedefReturnType>> named,
-);
-
-typedef _typedefC_1 = ffi.Void Function(
-);
-
-typedef _typedefC_2 = ffi.Void Function(
- ffi.Pointer<ffi.NativeFunction<_typedefC_1>> ,
-);
-
-''');
- if (file.existsSync()) {
- file.delete();
- }
- } catch (e) {
- file.writeAsStringSync(gen);
- print('Failed test, Debug output: ${file.absolute.path}');
- rethrow;
- }
+ matchLibraryWithExpected(actual, [
+ 'test',
+ 'debug_generated',
+ 'native_func_typedef_test_output.dart'
+ ], [
+ 'test',
+ 'header_parser_tests',
+ 'expected_bindings',
+ '_expected_native_func_typedef_bindings.dart'
+ ]);
});
});
}
diff --git a/test/header_parser_tests/nested_parsing.h b/test/header_parser_tests/nested_parsing.h
index 29ad832..cb21825 100644
--- a/test/header_parser_tests/nested_parsing.h
+++ b/test/header_parser_tests/nested_parsing.h
@@ -14,3 +14,29 @@
int b;
struct Struct2 *struct2;
};
+
+struct Struct3
+{
+ int a;
+ // An unnamed struct.
+ struct
+ {
+ int a;
+ int b;
+ } b;
+};
+
+struct EmptyStruct{
+};
+
+struct Struct4{
+ int a;
+ // Incomplete struct inside a struct.
+ struct EmptyStruct b;
+};
+
+struct Struct5{
+ int a;
+ // Incomplete struct array.
+ struct EmptyStruct b[3];
+};
diff --git a/test/header_parser_tests/nested_parsing_test.dart b/test/header_parser_tests/nested_parsing_test.dart
index 40937c8..978b365 100644
--- a/test/header_parser_tests/nested_parsing_test.dart
+++ b/test/header_parser_tests/nested_parsing_test.dart
@@ -23,13 +23,13 @@
${strings.name}: 'NativeLibrary'
${strings.description}: 'Nested Parsing Test'
${strings.output}: 'unused'
-
+${strings.arrayWorkaround}: true
${strings.headers}:
${strings.entryPoints}:
- 'test/header_parser_tests/nested_parsing.h'
${strings.structs}:
- ${strings.include}:
- - Struct1
+ ${strings.exclude}:
+ - Struct2
''') as yaml.YamlMap),
);
});
@@ -46,6 +46,18 @@
expect(actual.getBindingAsString('Struct2'),
expected.getBindingAsString('Struct2'));
});
+ test('Struct3', () {
+ expect(actual.getBindingAsString('Struct3'),
+ expected.getBindingAsString('Struct3'));
+ });
+ test('Struct4', () {
+ expect(actual.getBindingAsString('Struct4'),
+ expected.getBindingAsString('Struct4'));
+ });
+ test('Struct5', () {
+ expect(actual.getBindingAsString('Struct5'),
+ expected.getBindingAsString('Struct5'));
+ });
});
}
@@ -60,9 +72,20 @@
type: Type.nativeType(SupportedNativeType.Int32),
),
]);
+ final unnamedInternalStruc = Struc(name: 'unnamedStruct_1', members: [
+ Member(
+ name: 'a',
+ type: Type.nativeType(SupportedNativeType.Int32),
+ ),
+ Member(
+ name: 'b',
+ type: Type.nativeType(SupportedNativeType.Int32),
+ ),
+ ]);
return Library(
name: 'Bindings',
bindings: [
+ unnamedInternalStruc,
struc2,
Struc(name: 'Struct1', members: [
Member(
@@ -75,6 +98,19 @@
),
Member(name: 'struct2', type: Type.pointer(Type.struct(struc2))),
]),
+ Struc(name: 'Struct3', members: [
+ Member(
+ name: 'a',
+ type: Type.nativeType(SupportedNativeType.Int32),
+ ),
+ Member(
+ name: 'b',
+ type: Type.struct(unnamedInternalStruc),
+ ),
+ ]),
+ Struc(name: 'EmptyStruct'),
+ Struc(name: 'Struct4'),
+ Struc(name: 'Struct5'),
],
);
}
diff --git a/test/native_test/native_test.def b/test/native_test/native_test.def
index f6853d1..b6bf2e0 100644
--- a/test/native_test/native_test.def
+++ b/test/native_test/native_test.def
@@ -3,6 +3,7 @@
; BSD-style license that can be found in the LICENSE file.
EXPORTS
+Function1Bool
Function1Uint8
Function1Uint16
Function1Uint32
@@ -15,3 +16,5 @@
Function1Float
Function1Double
getStruct1
+Function1StructReturnByValue
+Function1StructPassByValue
diff --git a/tool/libclang_config.yaml b/tool/libclang_config.yaml
index 178aa97..a73d5cc 100644
--- a/tool/libclang_config.yaml
+++ b/tool/libclang_config.yaml
@@ -13,7 +13,7 @@
description: Holds bindings to LibClang.
output: 'lib/src/header_parser/clang_bindings/clang_bindings.dart'
sort: true
-compiler-opts: '-I/usr/lib/llvm-9/include/ -I/usr/lib/llvm-10/include/ -I/usr/lib/llvm-11/include/ -I/usr/local/opt/llvm/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ -Wno-nullability-completeness'
+compiler-opts: '-Ithird_party/libclang/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ -Wno-nullability-completeness'
headers:
entry-points:
- 'third_party/libclang/include/clang-c/Index.h'
@@ -71,6 +71,7 @@
- clang_getTypeSpelling
- clang_getTypeKindSpelling
- clang_getResultType
+ - clang_getTypedefName
- clang_getPointeeType
- clang_getCanonicalType
- clang_Type_getNamedType