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

[LLVM 4.0] Fix CreateCompileUnit #39747

Merged
merged 2 commits into from
Feb 12, 2017

Conversation

mattico
Copy link
Contributor

@mattico mattico commented Feb 11, 2017

This is largely identical to @dylanmckay's patch, except that it doesn't try to use file_metadata(). I don't think that is necessary because we don't want the compile unit to be added to debug_context.created_files, though I'd like confirmation from someone who knows for sure. If that is needed, I can modify file_metadata_() so that it can be used from compile_unit_metadata().

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nrc (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@mattico
Copy link
Contributor Author

mattico commented Feb 11, 2017

cc #37609

@@ -1334,8 +1334,7 @@ extern "C" {

pub fn LLVMRustDIBuilderCreateCompileUnit(Builder: DIBuilderRef,
Lang: c_uint,
File: *const c_char,
Dir: *const c_char,
File: DIFile,
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks really nice!

let work_dir = path2cstr(&work_dir);
let producer = CString::new(producer).unwrap();
let work_dir = path2cstr(&work_dir).as_ptr();
let producer = CString::new(producer).unwrap().as_ptr();
Copy link
Contributor

@hanna-kruppe hanna-kruppe Feb 11, 2017

Choose a reason for hiding this comment

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

This line is wrong: it will drop the CString and keep a raw pointer to its now-freed buffer around.

(The line above may have the same problem depending on what path2cstr returns.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I was wondering why the .as_ptr() calls didn't match the line above.

@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Feb 11, 2017

📌 Commit aebce5b has been approved by alexcrichton

@bors
Copy link
Contributor

bors commented Feb 11, 2017

⌛ Testing commit aebce5b with merge ba7cf7c...

bors added a commit that referenced this pull request Feb 11, 2017
…chton

[LLVM 4.0] Fix CreateCompileUnit

This is largely identical to @dylanmckay's [patch](https://github.com/dylanmckay), except that it doesn't try to use `file_metadata()`. I don't think that is necessary because we don't want the compile unit to be added to  `debug_context.created_files`, though I'd like confirmation from someone who knows for sure. If that is needed, I can modify `file_metadata_()` so that it can be used from `compile_unit_metadata()`.
@bors
Copy link
Contributor

bors commented Feb 12, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: alexcrichton
Pushing ba7cf7c to master...

@bors bors merged commit aebce5b into rust-lang:master Feb 12, 2017
@mattico mattico deleted the fix-llvm4-createcompileunit branch February 12, 2017 00:56
@shepmaster shepmaster mentioned this pull request Feb 12, 2017
23 tasks
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.

None yet

7 participants