diff options
author | Jordan Rose <jordan_rose@apple.com> | 2013-02-21 18:53:19 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2013-02-21 18:53:19 +0000 |
commit | 6aad4a31b35df07fe818f193fcfd3c0197aea467 (patch) | |
tree | 45f93f98a5082636c1f7473cc06710790c618bb7 /test/Preprocessor | |
parent | 649aa6adc4d8650033508d38d3b442d355d90824 (diff) |
Preprocessor: preserve whitespace in -traditional-cpp mode.
Note that unlike GNU cpp we currently do not preserve whitespace in macros
(even in -traditional-cpp mode).
<rdar://problem/12897179>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Preprocessor')
-rw-r--r-- | test/Preprocessor/traditional-cpp.c | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/test/Preprocessor/traditional-cpp.c b/test/Preprocessor/traditional-cpp.c index 5fc9ee398e..72024546ff 100644 --- a/test/Preprocessor/traditional-cpp.c +++ b/test/Preprocessor/traditional-cpp.c @@ -4,9 +4,61 @@ /* RUN: %clang_cc1 -traditional-cpp %s -E -o %t - RUN: FileCheck < %t %s + RUN: FileCheck -strict-whitespace < %t %s */ -/* CHECK: foo // bar +/* CHECK: {{^}}foo // bar{{$}} */ foo // bar + + +/* The lines in this file contain hard tab characters and trailing whitespace; + * do not change them! */ + +/* CHECK: {{^}} indented!{{$}} + * CHECK: {{^}}tab separated values{{$}} + */ + indented! +tab separated values + +#define bracket(x) >>>x<<< +bracket(| spaces |) +/* CHECK: {{^}}>>>| spaces |<<<{{$}} + */ + +/* This is still a preprocessing directive. */ +# define foo bar +foo! +- + foo! foo! +/* CHECK: {{^}}bar!{{$}} + * CHECK: {{^}} bar! bar! {{$}} + */ + +/* Deliberately check a leading newline with spaces on that line. */ + +# define foo bar +foo! +- + foo! foo! +/* CHECK: {{^}}bar!{{$}} + * CHECK: {{^}} bar! bar! {{$}} + */ + +/* FIXME: -traditional-cpp should not consider this a preprocessing directive + * because the # isn't in the first column. + */ + #define foo2 bar +foo2! +/* If this were working, both of these checks would be on. + * CHECK-NOT: {{^}} #define foo2 bar{{$}} + * CHECK-NOT: {{^}}foo2!{{$}} + */ + +/* FIXME: -traditional-cpp should not homogenize whitespace in macros. + */ +#define bracket2(x) >>> x <<< +bracket2(spaces) +/* If this were working, this check would be on. + * CHECK-NOT: {{^}}>>> spaces <<<{{$}} + */ |