-
Notifications
You must be signed in to change notification settings - Fork 56
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
Linemarkers proof of concept #517
Conversation
It can be an enum since /// HandleDigitDirective - Handle a GNU line marker directive, whose syntax is
/// one of the following forms:
///
/// # 42
/// # 42 "file" ('1' | '2')?
/// # 42 "file" ('1' | '2')? '3' '4'?
/// |
Should be some improved line numbers now. I still need to figure out what causes clang/gcc to output line number directives within a file |
I was planning on doing that by replacing |
I'm going to be mostly offline for the next 5 days and might not have time to finish this up, so if you want to take what I have or rework it or take a different approach, please feel free. |
I've wanted this feature for a long time but haven't gotten around to implementing it so it's great to finally have it. |
I think the newline tracking doesn't work if a single line has multiple sources with different lines - e.g. if I have a source file with just
(because |
Nearly perfect on the test set I'm using now:
Note that I also use line directives for error message reporting, so I'm sure I'll have follow-ups regarding the correctness of the line numbers given, but that doesn't affect correctness in terms of the compiled Minimal reproduction of the problem in the one failing test case:
#include "c.h"
THIS_IS_IN_A_DOT_C
#include "b.h"
#pragma once
#include "c.h"
THIS_IS_IN_B_DOT_H
#pragma once
THIS_IS_IN_C_DOT_H Results in (via #line 1 "a.c"
#line 1 "<builtin>"
#line 1 "<command line>"
#line 1 "a.c"
#line 1 ".\c.h"
THIS_IS_IN_C_DOT_H
#line 2 "a.c"
THIS_IS_IN_A_DOT_C
#line 1 ".\b.h"
#line 1 ".\c.h"
THIS_IS_IN_B_DOT_H
#line 4 "a.c" ( Here's what clang ( #line 1 "a.c"
#line 1 "<built-in>"
#line 1 "<built-in>"
#line 368 "<built-in>"
#line 1 "<command line>"
#line 1 "<built-in>"
#line 1 "a.c"
#line 1 "./c.h"
THIS_IS_IN_C_DOT_H
#line 2 "a.c"
THIS_IS_IN_A_DOT_C
#line 1 "./b.h"
THIS_IS_IN_B_DOT_H
#line 3 "a.c" |
Are #define blank1
#define blank2
#define blank3
#define blank4
#define blank5
#define blank6
#define blank7
#if !defined(FOO)
BAR
#endif (at least 7 blank (or otherwise removed during preprocessing, like With #line 1 "scratch.rc"
#line 1 "<builtin>"
#line 0 "<scratch space>"
#line 1 "<command line>"
#line 1 "scratch.rc"
#line 0 "<scratch space>"
BAR Expected (clang) output is: #line 1 "scratch.rc"
#line 1 "<built-in>"
#line 1 "<built-in>"
#line 368 "<built-in>"
#line 1 "<command line>"
#line 1 "<built-in>"
#line 1 "scratch.rc"
BAR |
Display markers if expected line doesn't match actual
This cannot currently be tested since the error includes system dependent paths.
It was causing worse input and removing it matches clang better in most cases.
Works now: #line 1 "b.c"
#line 1 "<builtin>"
#line 184 "<builtin>"
#line 1 "<command line>"
#line 1 "b.c"
#line 9 "b.c"
BAR |
Fantastic,
|
Amazing. Does that mean everyone is on board with removing the clang dependency of resinator unconditionally? |
Yep, I'm good with that. I'm also now planning on embedding |
Tests need to be fixed and
#line
output support needs to be added. Also need to figure out how we'll handle the3
and4
flags - should those be fields inSource
that track what kind of headers they are?