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

-ll flag prints to stderr #32

Closed
nickdesaulniers opened this issue Sep 11, 2013 · 4 comments
Closed

-ll flag prints to stderr #32

nickdesaulniers opened this issue Sep 11, 2013 · 4 comments

Comments

@nickdesaulniers
Copy link

is this intentional? I expected it to compile hello_word.cr to llvm IR and output hello_world.ll, not compile to binary and print the IR to stderr.

@asterite
Copy link
Member

We are using this function provided by llvm: http://llvm.org/docs/doxygen/html/group__LLVMCCoreModule.html#ga31c87315ba3f595d6786c47a50d9f8e7

Do you know if there is a similar function to get the dump as a string? That's why we just dump it to stderr, because that is what llvm provides. If you could get a string representation we would dump it to stdout.

@nickdesaulniers
Copy link
Author

If the compiler is passed the -ll flag, can you check that compilation was valid, then redirect stderr to a new file? That way you wouldn't miss any compilation errors being printed to stderr as expected. I don't really know much about LLVM APIs.

@nickdesaulniers
Copy link
Author

Tracing through how we do it in rust:

  1. get the command line flag, passed as sess.opts.output_type
  2. call into llvm module
  3. which is a Rust binding
  4. to a C wrapper
  5. which is what we call in LLVM

createPrintModulePass

Let me know if this helps!

@asterite
Copy link
Member

Hi Nick,

Let me know if this fixes the issue. Thanks for pushing this forward :-)

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

No branches or pull requests

2 participants