-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"
Description
| Bugzilla Link | 18485 |
| Version | unspecified |
| OS | Windows NT |
| Reporter | LLVM Bugzilla Contributor |
| CC | @DougGregor |
Extended Description
Empty macro expansion from inside another macro causes incorrect placement of expanded macro.
Consider the example:
#define B
#define A(type) B unsigned type
/*
empty lines
...
...
...
...*/
A(int) foo()
{}The clang preprocessor (-E option) will output the following:
#line 1 "D:/home/paul/sample.c"
#line 1 "<built-in>"
#line 1 "<built-in>"
#line 156 "<built-in>"
#line 1 "<command line>"
#line 1 "<built-in>"
#line 1 "D:/home/paul/sample.c" unsigned int
#line 10 "D:/home/paul/sample.c"
foo()
{}Take a note, that the return type of the foo function is placed before #line 10, meaning that it is placed before the whitespace, thus incorrectly pointing the start position of the foo to line 1 instead of line 10.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"