summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/macro_arg_empty.c
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2014-02-04 19:18:32 +0000
committerJustin Bogner <mail@justinbogner.com>2014-02-04 19:18:32 +0000
commiteacd96d972ff18966fd16443ee1e055de69cb0ce (patch)
tree9b6275564dbc7a0bb56b61be59a127f7ed22fd5a /clang/test/Preprocessor/macro_arg_empty.c
parent502155aff9ca5477d153b5ea6232a40dcee62564 (diff)
downloadbcm5719-llvm-eacd96d972ff18966fd16443ee1e055de69cb0ce.tar.gz
bcm5719-llvm-eacd96d972ff18966fd16443ee1e055de69cb0ce.zip
Fix whitespace handling in empty macro arguments
When a function-like macro definition ends with one of the macro's parameters, and the argument is empty, any whitespace before the parameter name in the macro definition needs to be preserved. Promoting the existing NextTokGetsSpace to a preserved bit-field and checking it at the end of the macro expansion allows it to be moved to the first token following the macro expansion result. Patch by Harald van Dijk! llvm-svn: 200786
Diffstat (limited to 'clang/test/Preprocessor/macro_arg_empty.c')
-rw-r--r--clang/test/Preprocessor/macro_arg_empty.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/macro_arg_empty.c b/clang/test/Preprocessor/macro_arg_empty.c
new file mode 100644
index 00000000000..b5ecaa27ba1
--- /dev/null
+++ b/clang/test/Preprocessor/macro_arg_empty.c
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -E %s | FileCheck --strict-whitespace %s
+
+#define FOO(x) x
+#define BAR(x) x x
+#define BAZ(x) [x] [ x] [x ]
+[FOO()] [ FOO()] [FOO() ] [BAR()] [ BAR()] [BAR() ] BAZ()
+// CHECK: [] [ ] [ ] [ ] [ ] [ ] [] [ ] [ ]
OpenPOWER on IntegriCloud