Multiline line directives produce incorrect line notes
Open
clang:frontend
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```c++
#line 6 "path\
/to\
/file"
int x;
```
`int x` is expected to be on line 6 but `clang -E` produces:
```c++
...
# 8 "path/to/file"
int x;
```
While gcc:
```c++
...
# 6 "path/to/file"
int x;
```
https://godbolt.org/z/6xEY7Y7en
The same for gnu digit directives:
```c++
#9 \
"file" \
3
int gnu_x;
```
Contributor guide
Research direction
Start by running the multiline #line and GNU digit-directive examples with clang -E, using the linked Compiler Explorer reproduction and comparing the output with GCC. Trace the Clang preprocessor handling of these directives; done means int x and int gnu_x receive the expected source line and filename notes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100