Commit Graph

47 Commits

Author SHA1 Message Date
Andrew Kelley 06f6acb4b1 inline is a keyword instead of a directive 2016-02-01 17:25:38 -07:00
Andrew Kelley 179443bd61 add ?? prefix operator 2016-02-01 02:11:46 -07:00
Andrew Kelley b3459f64e7 parseh understands macros which alias global fn ptr vars 2016-02-01 02:00:25 -07:00
Andrew Kelley 6b2e29c6ac parseh: do not create macro alias for extern vars 2016-02-01 00:01:30 -07:00
Andrew Kelley 41b95cc237 parseh: correct debug for forward decls
also C typedefs emit simply `const Foo = Bar;`
since in C you can implicitly cast from a typedef
child to parent but in zig you can't.
2016-01-31 17:48:19 -07:00
Andrew Kelley 1053172854 parseh handles typedef void better
and introduce c_long_double type
2016-01-31 15:44:02 -07:00
Andrew Kelley c77637d172 parseh understands forward struct definitions
See #88
2016-01-31 14:54:28 -07:00
Andrew Kelley c1640a9246 parseh: use the decayed type not original type 2016-01-31 13:20:44 -07:00
Andrew Kelley 4c1f0f02d0 fix some parseh crashes 2016-01-31 02:17:08 -07:00
Andrew Kelley 3c2093fec6 parseh understands types better and handles some situations better
See #88

Also, includes partial implementation of typedef top level declaration.
See #95

Also, fix function types. Previously the way we were deduping function type
pointers was incorrect.
2016-01-31 01:20:47 -07:00
Andrew Kelley 436e35516a parseh properly ignores anonymous structs
and nodes get valid create_index values
2016-01-29 17:02:51 -07:00
Andrew Kelley e4b0435946 parseh understands variable declarations
and some initializers such as integers
2016-01-29 16:06:17 -07:00
Andrew Kelley 2e39d9881a parseh fix crash 2016-01-29 02:38:12 -07:00
Andrew Kelley a94ad9e89c parseh defines can reference other defines 2016-01-29 02:17:51 -07:00
Andrew Kelley c1691afdd9 parseh understands number literal defines 2016-01-29 01:31:40 -07:00
Andrew Kelley 9b2ed1fac5 parseh understands simple character literal macro 2016-01-29 00:28:52 -07:00
Andrew Kelley 923e78785d attempt to get preprocessor entities from libclang
I'm pretty sure it's impossible, the API does not
expose the macro expansion value

and the source location points to the macro's name,
not its value.
2016-01-28 23:18:39 -07:00
Andrew Kelley 53c14da220 parseh understands bodyless struct used in fn 2016-01-28 21:53:46 -07:00
Andrew Kelley c3516b8004 parseh handles self referential structs and fn pointers 2016-01-28 21:38:01 -07:00
Andrew Kelley 13220ccb51 parsh understands constant sized arrays 2016-01-28 16:09:06 -07:00
Andrew Kelley ed3117a77f parseh understands elaborated structs and enums 2016-01-28 15:41:12 -07:00
Andrew Kelley 47c3a30310 parseh understands simple structs 2016-01-28 14:49:34 -07:00
Andrew Kelley a09b505558 null pointer optimization for ?&T
this is necessary for the parseh change where all
pointers from .h files are maybe pointers.
2016-01-28 14:04:22 -07:00
Andrew Kelley f1c5d3d3a1 add parseh tests 2016-01-28 11:54:34 -07:00
Andrew Kelley 474340a003 parseh recognizes C enums 2016-01-28 11:03:44 -07:00
Andrew Kelley 137bb51e20 parseh: add --c-import-warnings option 2016-01-28 00:25:10 -07:00
Andrew Kelley 97c61313da c_import of stdio.h works for some functions
See #88
2016-01-27 23:23:02 -07:00
Andrew Kelley b6354ddd5a move AST rendering code to separate file 2016-01-27 21:10:38 -07:00
Andrew Kelley c281533638 build command supports -isystem argument 2016-01-27 19:22:58 -07:00
Andrew Kelley 69d4f55fbf parseh: still produce output when not all types are known 2016-01-27 19:07:01 -07:00
Andrew Kelley d1ac1abd34 parseh correctly handles C's void type 2016-01-27 16:30:52 -07:00
Andrew Kelley 75cab48c1e parseh: recognize typedef types
and fix const qualifier on pointers
2016-01-27 16:00:43 -07:00
Andrew Kelley fa1ea6062b parseh works for simple functions 2016-01-27 03:12:06 -07:00
Andrew Kelley 0278468479 upgrade to the libclang C++ API
c_import creates a tmp .h file and parses it with libclang,
reporting any errors found.

See #88
2016-01-27 00:01:49 -07:00
Andrew Kelley 890714b8ca Revert "delete parseh"
This reverts commit 18374ea8f1.
2016-01-18 21:28:54 -07:00
Andrew Kelley 18374ea8f1 delete parseh
we'll have to switch to the clang C++ api anyway
we'll revive this code later
2016-01-15 14:16:07 -07:00
Andrew Kelley f17e20d5fe instead of *mut and *const, & and &const
closes #33
2015-12-14 18:10:25 -07:00
Andrew Kelley e411467e1d add number literal type
it gets implicitly casted to whatever is needed.

closes #24
2015-12-14 02:46:37 -07:00
Andrew Kelley 7b181b51ad parseh: cleanup types 2015-12-09 01:23:58 -07:00
Andrew Kelley dfda85e870 ability to call external variadic functions 2015-12-09 01:03:04 -07:00
Andrew Kelley 4eff5f114b parseh: better results for stdio.h 2015-12-08 23:22:25 -07:00
Andrew Kelley face8d65a8 parseh: add c header files 2015-12-08 17:51:59 -07:00
Andrew Kelley cd6283e8c4 parseh: fix wrong fn parameters in some cases 2015-12-04 11:45:11 -07:00
Andrew Kelley 5144c4fa37 exporting .h file supports void 2015-12-03 17:30:44 -07:00
Andrew Kelley a398afa7cc more C header interoperability 2015-12-03 17:06:33 -07:00
Andrew Kelley 96d4d0d674 parseh: detect fixed size integer types 2015-12-03 16:12:10 -07:00
Andrew Kelley ad3f98c615 parseh command, parses a C .h file and produces extern decls 2015-12-03 16:00:14 -07:00