-
Notifications
You must be signed in to change notification settings - Fork 68
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
Allow passing additional clang arguments #57
Conversation
src/support.rs
Outdated
@@ -59,10 +59,10 @@ pub struct Clang { | |||
impl Clang { | |||
//- Constructors ----------------------------- | |||
|
|||
fn new(path: PathBuf) -> Clang { | |||
fn new(path: PathBuf, args: &Vec<String>) -> Clang { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Make this &[String]
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(or even I: Iterator<Item=&'a str>
or something like that).
src/support.rs
Outdated
@@ -78,9 +78,9 @@ impl Clang { | |||
/// first directory searched. Then, the directory returned by `llvm-config --bindir` is | |||
/// searched. On OS X systems, `xcodebuild -find clang` will next be queried. Last, the | |||
/// directories in the system's `PATH` are searched. | |||
pub fn find(path: Option<&Path>) -> Option<Clang> { | |||
pub fn find(path: Option<&Path>, args: &Vec<String>) -> Option<Clang> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this.
src/support.rs
Outdated
fn parse_search_paths(path: &Path, language: &str, args: &Vec<String>) -> Option<Vec<PathBuf>> { | ||
let clang_args = vec!["-E", "-x", language, "-", "-v"]; | ||
let mut clang_args_temp: Vec<String> = clang_args.into_iter().map(|s| s.to_owned()).collect(); | ||
clang_args_temp.extend(args.iter().cloned()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just:
let mut clang_args = vec!["..."];
clang_args.extend_from_slice(args);
run_clang(..);
I pushed the nits in a separate commit for ease of review. Let me know when it's good to go and I'll squash them into one. |
LGTM, but could you fix the test, thanks. |
Released as part of |
Passing additional clang arguments for Linux 32 cross compiling This is for https://bugzilla.mozilla.org/show_bug.cgi?id=1366050 But it has to wait for KyleMayes/clang-sys#57 to land and version number bumped. (I'm making up the new version numbers for now.) r? @emilio
Hi Kyle,
I'm trying to fix a linux 64 to 32 cross compiling issue for Stylo. Therefore I'm going to need to pass some additional clang argumens from
bindgen
.I'm sorry the code involves some ugly transformations between
&[&str]
toVec<String>
and back, I'll be glad to change it if there are more elegant way to do it.