Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Lex] Use line markers in preprocessed assembly predefines file
GNU line marker directives are not recognised when preprocessing assembly files, meaning they can't be used in the predefines file meaning macros defined on the command line are reported as being built-in. Change this to permit line markers but only in the predefines file, so we can correctly report command line macros as coming from the command line. Differential Revision: https://reviews.llvm.org/D145397
- Loading branch information
1 parent
7019624
commit 128f7da
Showing
5 changed files
with
50 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: %clang -c %s -o /dev/null 2>&1 | FileCheck %s | ||
|
||
// Check that preprocessor directives are recognised as such, but lines starting | ||
// with a # that aren't directives are instead treated as comments. | ||
|
||
#define MACRO .warning "This is a macro" | ||
MACRO | ||
|
||
// CHECK: directives_asm.S:7:9: warning: This is a macro | ||
|
||
#not a preprocessing directive | ||
|
||
// CHECK-NOT: error: invalid preprocessing directive | ||
|
||
# 100 | ||
|
||
.warning "line number should not change" | ||
|
||
// CHECK: directives_asm.S:17:9: warning: line number should not change | ||
|
||
#line 100 | ||
|
||
.warning "line number should change" | ||
|
||
// CHECK: directives_asm.S:101:9: warning: line number should change |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// RUN: %clang %s -E -DCLI_MACRO=1 2>&1 | FileCheck %s | ||
|
||
#define CLI_MACRO | ||
// CHECK: macro_redefined.S{{.+}}: warning: 'CLI_MACRO' macro redefined | ||
// CHECK: <command line>{{.+}}: note: previous definition is here | ||
|
||
#define REGULAR_MACRO | ||
#define REGULAR_MACRO 1 | ||
// CHECK: macro_redefined.S{{.+}}: warning: 'REGULAR_MACRO' macro redefined | ||
// CHECK: macro_redefined.S{{.+}}: note: previous definition is here |