Skip to content

Document the ir module #155

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

Merged
merged 1 commit into from
Oct 27, 2016
Merged

Document the ir module #155

merged 1 commit into from
Oct 27, 2016

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Oct 27, 2016

r? @emilio

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with those, thanks for doing all this :)

/// /** <div rustbindgen replaces="Bar"></div> */
/// struct Bar {
/// int x;
/// x: int,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops, thanks for fixing this :)

Can you make this x: ::std::os::raw::c_int? That way you don't have to ignore it :)

@@ -686,6 +745,8 @@ impl CompInfo {
})
}

/// Does this type's template arguments explicitly name the given type `ty`?
/// See also documentation for `ir::Item::signature_contains_named_type`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I write this more like: Do any of the type that participates in this type's "signature" use the named type ty?

#[derive(Debug)]
pub struct Enum {
/// The representation used for this enum.
/// Should be an IntKind type.
/// The representation used for this enum; it should be an IntKind type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note something like "or an alias to it".

@@ -1,3 +1,5 @@
//! Intermediate representation for C/C++ functions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth adding "and methods" here.

@@ -47,10 +51,10 @@ pub trait ItemCanonicalPath {
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ItemId(usize);

pub static NEXT_ITEM_ID: AtomicUsize = ATOMIC_USIZE_INIT;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, dunno why I made this pub.

@@ -376,6 +412,8 @@ pub enum TypeKind {
///
/// see tests/headers/typeref.hpp to see somewhere where this is a problem.
UnresolvedTypeRef(clang::Type, Option<clang::Cursor>, /* parent_id */ Option<ItemId>),

/// An indirection to another type.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to mention that we use them, at least:

  • To avoid parsing types that are forward declared too early (pointing to UnresolvedTypeRef).
  • To do type replacement without iterating the whole type graph.

@@ -16,7 +16,7 @@ pub enum ParseResult<T> {
}

pub trait ClangSubItemParser : Sized {
/// The fact that is a reference guarantees it's holded by the context, and
/// The fact that is a reference guarantees it's held by the context, and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ouch, I'm terrible at English.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Easy mistake to make :)

@emilio
Copy link
Contributor

emilio commented Oct 27, 2016

@bors-servo: delegate+

@bors-servo
Copy link

✌️ @fitzgen can now approve this pull request

@fitzgen
Copy link
Member Author

fitzgen commented Oct 27, 2016

@bors-servo r=emilio

@bors-servo
Copy link

📌 Commit c70baa8 has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit c70baa8 with merge e8aac63...

bors-servo pushed a commit that referenced this pull request Oct 27, 2016
@bors-servo
Copy link

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit c70baa8 into rust-lang:master Oct 27, 2016
@fitzgen fitzgen deleted the doc-ir-mod branch October 27, 2016 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants