llvm-capstone/clang/test/Preprocessor/macro_space.c
Justin Bogner 79c93845f6 Fix whitespace handling in empty macro expansions
When a macro expansion does not result in any tokens, and the macro name
is preceded by whitespace, the whitespace should be passed to the first
token that follows the macro expansion. Similarly when a macro expansion
ends with a placemarker token, and that placemarker token is preceded by
whitespace. This worked already for top-level macro expansions, but is
now extended to also work for nested macro expansions.

Patch by Harald van Dijk!

llvm-svn: 200787
2014-02-04 19:18:35 +00:00

37 lines
830 B
C

// RUN: %clang_cc1 -E %s | FileCheck --strict-whitespace %s
#define FOO1()
#define FOO2(x)x
#define FOO3(x) x
#define FOO4(x)x x
#define FOO5(x) x x
#define FOO6(x) [x]
#define FOO7(x) [ x]
#define FOO8(x) [x ]
#define TEST(FOO,x) FOO <FOO()> < FOO()> <FOO ()> <FOO( )> <FOO() > <FOO()x> <FOO() x> < FOO()x>
TEST(FOO1,)
// CHECK: FOO1 <> < > <> <> < > <> < > < >
TEST(FOO2,)
// CHECK: FOO2 <> < > <> <> < > <> < > < >
TEST(FOO3,)
// CHECK: FOO3 <> < > <> <> < > <> < > < >
TEST(FOO4,)
// CHECK: FOO4 < > < > < > < > < > < > < > < >
TEST(FOO5,)
// CHECK: FOO5 < > < > < > < > < > < > < > < >
TEST(FOO6,)
// CHECK: FOO6 <[]> < []> <[]> <[]> <[] > <[]> <[] > < []>
TEST(FOO7,)
// CHECK: FOO7 <[ ]> < [ ]> <[ ]> <[ ]> <[ ] > <[ ]> <[ ] > < [ ]>
TEST(FOO8,)
// CHECK: FOO8 <[ ]> < [ ]> <[ ]> <[ ]> <[ ] > <[ ]> <[ ] > < [ ]>