Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various fixes from stylo #9

Open
wants to merge 28 commits into
base: sm-hacks
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d0f07f9
Spit errors and warnings to stdout.
bholley Feb 18, 2016
6be9f9f
Add the -ignore-functions argument.
bholley Feb 18, 2016
589c26e
Handle 1 << 63 as enum value.
bholley Feb 19, 2016
e0093ae
Don't try to convert standard int types in rust_type_id.
bholley Mar 3, 2016
949151a
Stop patching in placeholder names for CompInfo and EnumInfo instance…
bholley Mar 4, 2016
283d037
gen: Allow empty union members
emilio Mar 5, 2016
62ad73e
Use full paths in generation.
emilio Mar 7, 2016
6d372e0
Fix test compilation
emilio Mar 7, 2016
b2b4a28
Merge pull request #1 from ecoal95/sm-hacks
bholley Mar 7, 2016
ccdd256
parser: Add support for parsing namespaces
emilio Mar 7, 2016
7707540
Partial C++ namespaces support
emilio Mar 9, 2016
ddd02a1
Remove unnecesary return statements
emilio Mar 9, 2016
b49628c
Put namespaces behind a flag
emilio Mar 9, 2016
bbaf495
Moar refactoring
emilio Mar 9, 2016
eb44cd7
Finally take rid of all the warnings
emilio Mar 9, 2016
25a2e48
Even moar
emilio Mar 9, 2016
a397e5a
Merge pull request #2 from ecoal95/sm-hacks
bholley Mar 9, 2016
59c3345
gen: Avoid so much cloning
emilio Mar 10, 2016
e7ae3d4
parser: Refactor the way submodules are stored
emilio Mar 10, 2016
abdbc86
gen: Checkpoint before the refactoring
emilio Mar 10, 2016
14f00d0
gen: Make modules (almost) work for typedef'd types
emilio Mar 10, 2016
e90066a
gen: Document the current submodule approach and some desirable
emilio Mar 10, 2016
008978d
gen: Make it actually compilable \o/
emilio Mar 10, 2016
76506ce
gen: Make the code generation usable for every type.
emilio Mar 10, 2016
4887f42
Fix a corner case when a template was instantiated in another module.
emilio Mar 10, 2016
7dbed75
Added an example of the namespace resolution.
emilio Mar 10, 2016
87210ea
Don't panic when not finding the specialised template
emilio Mar 10, 2016
6a85e6b
Merge pull request #3 from ecoal95/sm-hacks
bholley Mar 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/bin/bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ struct StdLogger;

impl Logger for StdLogger {
fn error(&self, msg: &str) {
error!("{}", msg);
println!("{}", msg);
}

fn warn(&self, msg: &str) {
warn!("{}", msg);
println!("{}", msg);
}
}

Expand Down Expand Up @@ -99,6 +99,10 @@ fn parse_args(args: &[String]) -> ParseResult {
options.builtins = true;
ix += 1;
}
"-ignore-functions" => {
options.ignore_functions = true;
ix += 1;
}
"-allow-unknown-types" => {
options.fail_on_unknown_type = false;
ix += 1;
Expand All @@ -110,6 +114,10 @@ fn parse_args(args: &[String]) -> ParseResult {
options.override_enum_ty = args[ix + 1].clone();
ix += 2;
}
"-enable-cxx-namespaces" => {
options.enable_cxx_namespaces = true;
ix += 1;
}
_ => {
options.clang_args.push(args[ix].clone());
ix += 1;
Expand Down Expand Up @@ -138,6 +146,8 @@ Options:
matching any rule are bound to.
-builtins Output bindings for builtin definitions
(for example __builtin_va_list)
-ignore-functions Don't generate bindings for functions and methods.
This is useful when you only care about struct layouts.
-allow-unknown-types Don't fail if we encounter types we do not support,
instead treat them as void
-emit-clang-ast Output the ast (for debugging purposes)
Expand Down
10 changes: 8 additions & 2 deletions src/clang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ impl Cursor {
mangling
}

pub fn semantic_parent(&self) -> Cursor {
unsafe {
Cursor { x: clang_getCursorSemanticParent(self.x) }
}
}

pub fn kind(&self) -> Enum_CXCursorKind {
unsafe {
clang_getCursorKind(self.x)
Expand Down Expand Up @@ -246,7 +252,7 @@ pub struct Type {
impl Type {
// common
pub fn kind(&self) -> Enum_CXTypeKind {
return self.x.kind;
self.x.kind
}

pub fn declaration(&self) -> Cursor {
Expand Down Expand Up @@ -334,7 +340,7 @@ impl Type {
for i in 0..num {
args.push(Type { x: clang_getArgType(self.x, i as c_uint) });
}
return args;
args
}
}

Expand Down
1 change: 0 additions & 1 deletion src/clangll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#![allow(unused_attributes)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(raw_pointer_derive)]

pub type ptrdiff_t = ::libc::c_long;
pub type size_t = ::libc::c_ulong;
Expand Down
Loading