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

Feature request: Preserve diagnostic metadata #19

Open
mikesamuel opened this issue Oct 20, 2017 · 0 comments
Open

Feature request: Preserve diagnostic metadata #19

mikesamuel opened this issue Oct 20, 2017 · 0 comments

Comments

@mikesamuel
Copy link

The extractor should preserve diagnostic metadata so that stack traces point to the source markdown files instead of the extracted files.

When I run lit and look at the output I see

$ ./bin/lit --out-dir out examples/wc.lit
$ grep -n 'Header files to include' examples/wc.lit
37:@{Header files to include}
48:--- Header files to include
$ head -5 out/wc.c
/* wc.c */
/* Header files to include */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

but I would like head -6 out/wc.c to show something like

/* wc.c */
/* Header files to include */
#line 49 "examples/wc.lit"
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>

which uses the #line directive to specify the file and line for a section of generated code.

This is C preprocessor specific.
A solution that generalizes to other output languages might require a side-table of line numbers (maybe sourcemap format) that could feed into a language-specific post-processor that

  • produces a JSR 000045 input for Java files
  • fixes byte-code line mappings in .pyc files for python
  • etc.
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

1 participant