Skip to content

Different results for tests/headers/objc_template.h in LLVM trunk. #695

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

Open
emilio opened this issue May 10, 2017 · 1 comment
Open

Different results for tests/headers/objc_template.h in LLVM trunk. #695

emilio opened this issue May 10, 2017 · 1 comment

Comments

@emilio
Copy link
Contributor

emilio commented May 10, 2017

Running the tests on LLVM trunk with (or without) #694 yields:

diff --git a/tests/expectations/tests/objc_template.rs b/tests/expectations/tests/objc_template.rs
index e5a874c6..95d12ff6 100644
--- a/tests/expectations/tests/objc_template.rs
+++ b/tests/expectations/tests/objc_template.rs
@@ -11,8 +11,8 @@ extern crate objc;
 pub type id = *mut objc::runtime::Object;
 pub trait Foo {
     unsafe fn get(self)
-    -> id;
+    -> *mut ObjectType;
 }
 impl Foo for id {
-    unsafe fn get(self) -> id { msg_send!(self , get) }
+    unsafe fn get(self) -> *mut ObjectType { msg_send!(self , get) }
 }

cc @scoopr

@scoopr
Copy link
Contributor

scoopr commented May 10, 2017

Ah yes, I was kind of afraid of this :/

Suggestions are welcome how I should handle this, the template handling stuff is a bit harder to grok in bindgen.

So before the objc template params came up as an typedef, but now they seem to be TypeRefs, which I think aligns with, and are handled, as proper template params. And to keep things simple I'd just want the type to be replaced with the ‘id’.

I almost got it working hacking Item::named_type() to rewrite the name to "id" when location.referenced().typedef_type().kind() == CXType_ObjCId, but that made it also mut-pointer. Also I kind of feel that it should be done earlier in the parsing.

I suppose making it behave like a proper generic in rust land would also be an option, but so far I have not looked in to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants