-
Notifications
You must be signed in to change notification settings - Fork 55
Initial generator: functions, structs, enums #2
Conversation
Commits till now: Prerak Mann (6): init stagehand dart package template, minor changes Updated Project Structure, Readme Reading pubspec configuration via yaml package setup tool - libclang_binding_generator restructure code setup basic classes for code_generator
simplify setup
- updated code_generator's Func, Struct, Typedef to not use const, as it makes list unmodifiable - added example from previous prototype
- print stack trace of dart functions called via C
- Updated dartdocs on clang_binding functions - Added dispose methods in cx.. ..cursor,..type, ..string - Updated parser code to handle disposing
- added new libclang example - moved old example to example/simple
…tructured filters
- Added sort method in code_generator library - Sorted generated clang_bindings - Added typedef declaration visitor for extracting typestring of typedef parameters - Added new methods to wrapper.c for getting type declarations
Merge branch 'master' of github.com:dart-lang/ffigen into v0.1
- prefer_final_fields - prefer_final_locals - prefer_final_in_for_each
User now has an option to provide a seperate folder containing the dynamic library The default is to use the dynamic libraries in the tool/wrapped_libclang folder
User can provide any file path or glob matcher. If clang can't parse a header, we print a severe log and skip that header
Test comment for cla bot |
CLA bot has been fixed (there was a mis-config) |
- Added test/native_function_test/build_test_dylib.dart - Updated comments - Added top level third_party folder - Updated examples, test with fixed comments
Preamble on generated files is now /// AUTO GENERATED FILE, DO NOT EDIT. /// /// Generated by `package:ffigen`.
@@ -0,0 +1,1447 @@ | |||
/// AUTO GENERATED FILE, DO NOT EDIT. | |||
/// | |||
/// Generated by `package:ffigen`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be kind of nice to know the relative path of the config that generated this. (As you mentioned absolute paths may not make sense and are OS specific.) It will be hard for people to figure out that they need to follow the command in tool/*.yaml
Also: please regen with the latest code. I have same changes when I run it locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a preamble
config in another branch(prefix_and_names). Using which we can add anything as the file header.
Should I do it using that? If yes, maybe I can do this in that PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do it in the PR instead then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also: please regen with the latest code. I have some changes...
Strange I don't see any changes when I re-generate bindings, can you describe the changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, I replied in the PR thread instead of this one. Looks like my version of clang/llvm is different, so it generates less constants. Probably nothing to worry about.
Do we have a minimum clang/llvm version required for this to work? (e.g. when were the methods/constants added which we use in this package?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will need to test this
- Added map of <String, Options> for storing default values for all platforms - Using Options instead of global variables
diff --git a/lib/src/header_parser/clang_bindings/clang_bindings.dart b/lib/src/header_parser/clang_bindings/clang_bindings.dart
index f701971..788ccd2 100644
--- a/lib/src/header_parser/clang_bindings/clang_bindings.dart
+++ b/lib/src/header_parser/clang_bindings/clang_bindings.dart
@@ -279,13 +279,7 @@ class CXCursorKind {
static const int CXCursor_OMPTargetTeamsDistributeParallelForSimdDirective =
278;
static const int CXCursor_OMPTargetTeamsDistributeSimdDirective = 279;
- static const int CXCursor_BuiltinBitCastExpr = 280;
- static const int CXCursor_OMPMasterTaskLoopDirective = 281;
- static const int CXCursor_OMPParallelMasterTaskLoopDirective = 282;
- static const int CXCursor_OMPMasterTaskLoopSimdDirective = 283;
- static const int CXCursor_OMPParallelMasterTaskLoopSimdDirective = 284;
- static const int CXCursor_OMPParallelMasterDirective = 285;
- static const int CXCursor_LastStmt = 285;
+ static const int CXCursor_LastStmt = 279;
static const int CXCursor_TranslationUnit = 300;
static const int CXCursor_FirstAttr = 400;
static const int CXCursor_UnexposedAttr = 400;
@@ -308,29 +302,7 @@ class CXCursorKind {
static const int CXCursor_VisibilityAttr = 417;
static const int CXCursor_DLLExport = 418;
static const int CXCursor_DLLImport = 419;
- static const int CXCursor_NSReturnsRetained = 420;
- static const int CXCursor_NSReturnsNotRetained = 421;
- static const int CXCursor_NSReturnsAutoreleased = 422;
- static const int CXCursor_NSConsumesSelf = 423;
- static const int CXCursor_NSConsumed = 424;
- static const int CXCursor_ObjCException = 425;
- static const int CXCursor_ObjCNSObject = 426;
- static const int CXCursor_ObjCIndependentClass = 427;
- static const int CXCursor_ObjCPreciseLifetime = 428;
- static const int CXCursor_ObjCReturnsInnerPointer = 429;
- static const int CXCursor_ObjCRequiresSuper = 430;
- static const int CXCursor_ObjCRootClass = 431;
- static const int CXCursor_ObjCSubclassingRestricted = 432;
- static const int CXCursor_ObjCExplicitProtocolImpl = 433;
- static const int CXCursor_ObjCDesignatedInitializer = 434;
- static const int CXCursor_ObjCRuntimeVisible = 435;
- static const int CXCursor_ObjCBoxable = 436;
- static const int CXCursor_FlagEnum = 437;
- static const int CXCursor_ConvergentAttr = 438;
- static const int CXCursor_WarnUnusedAttr = 439;
- static const int CXCursor_WarnUnusedResultAttr = 440;
- static const int CXCursor_AlignedAttr = 441;
- static const int CXCursor_LastAttr = 441;
+ static const int CXCursor_LastAttr = 419;
static const int CXCursor_PreprocessingDirective = 500;
static const int CXCursor_MacroDefinition = 501;
static const int CXCursor_MacroExpansion = 502;
@@ -443,10 +415,6 @@ class CXTranslationUnit_Flags {
static const int CXTranslationUnit_KeepGoing = 512;
static const int CXTranslationUnit_SingleFileParse = 1024;
static const int CXTranslationUnit_LimitSkipFunctionBodiesToPreamble = 2048;
- static const int CXTranslationUnit_IncludeAttributedTypes = 4096;
- static const int CXTranslationUnit_VisitImplicitAttributes = 8192;
- static const int CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 16384;
- static const int CXTranslationUnit_RetainExcludedConditionalBlocks = 32768;
}
/// The type of an element in the abstract syntax tree.
@@ -614,22 +582,6 @@ class CXTypeKind {
static const int CXType_OCLEvent = 158;
static const int CXType_OCLQueue = 159;
static const int CXType_OCLReserveID = 160;
- static const int CXType_ObjCObject = 161;
- static const int CXType_ObjCTypeParam = 162;
- static const int CXType_Attributed = 163;
- static const int CXType_OCLIntelSubgroupAVCMcePayload = 164;
- static const int CXType_OCLIntelSubgroupAVCImePayload = 165;
- static const int CXType_OCLIntelSubgroupAVCRefPayload = 166;
- static const int CXType_OCLIntelSubgroupAVCSicPayload = 167;
- static const int CXType_OCLIntelSubgroupAVCMceResult = 168;
- static const int CXType_OCLIntelSubgroupAVCImeResult = 169;
- static const int CXType_OCLIntelSubgroupAVCRefResult = 170;
- static const int CXType_OCLIntelSubgroupAVCSicResult = 171;
- static const int CXType_OCLIntelSubgroupAVCImeResultSingleRefStreamout = 172;
- static const int CXType_OCLIntelSubgroupAVCImeResultDualRefStreamout = 173;
- static const int CXType_OCLIntelSubgroupAVCImeSingleRefStreamin = 174;
- static const int CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175;
- static const int CXType_ExtVector = 176;
}
/// Provides the contents of a file that has not yet been saved to disk.
diff --git a/tool/libclang_config.yaml b/tool/libclang_config.yaml
index 144eb97..575a440 100644
--- a/tool/libclang_config.yaml
+++ b/tool/libclang_config.yaml
@@ -12,7 +12,7 @@
output: '../lib/src/header_parser/clang_bindings/clang_bindings.dart'
libclang-dylib-folder: 'wrapped_libclang'
sort: true
-compiler-opts: '-I/usr/lib/llvm-9/include/ -I/usr/lib/llvm-10/include/ -I/usr/local/opt/llvm/include/'
+compiler-opts: '-I/usr/lib/llvm-9/include/ -I/usr/lib/llvm-10/include/ -I/usr/local/opt/llvm/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/'
headers:
- 'wrapped_libclang/wrapper.c'
header-filter:
diff --git a/tool/wrapped_libclang/.gitignore b/tool/wrapped_libclang/.gitignore
index 2b64ac7..29e318c 100644
--- a/tool/wrapped_libclang/.gitignore
+++ b/tool/wrapped_libclang/.gitignore
@@ -10,3 +10,4 @@ install_manifest.txt
compile_commands.json
CTestTestfile.cmake
_deps
+libwrapped_clang.dylib (diff on Mac) |
Features
Configurations