Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Incorrect line numbers with -E and raw string #47202

Open Quuxplusone opened 3 years ago

Quuxplusone commented 3 years ago
Bugzilla Link PR48233
Status NEW
Importance P normal
Reported by Steve Cornett (stevecor@bullseye.com)
Reported on 2020-11-19 11:03:12 -0800
Last modified on 2020-11-19 11:26:20 -0800
Version 11.0
Hardware All All
CC blitzrakete@gmail.com, dblaikie@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
Fixed by commit(s)
Attachments bug.cpp (47 bytes, text/plain)
Blocks
Blocked by
See also
Created attachment 24187
Example source file as described

Line numbers in the preprocessor output are incorrect when a source has a raw
string literal containing newlines.

Consider this source file containing these three lines:

    const char s[] = R"(line1
        line2)";
    int line3;

Preprocess this source with -E:

    $ clang++ -E bug.cpp

The output ends like below. There is an incorrect extra blank line following
the raw string.

    # 1 "bug.cpp" 2
    const char s[] = R"(line1       <-- line 1, correct
        line2)";                    <-- line 2, correct
                                    <-- incorrect extra blank line
    int line3;                      <-- line 4, incorrect should be line 3
Quuxplusone commented 3 years ago

Attached bug.cpp (47 bytes, text/plain): Example source file as described