diff options
author | Chris Lattner <sabre@nondot.org> | 2009-02-06 06:45:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-02-06 06:45:26 +0000 |
commit | 1630c3c4f0bd6e93cff2329b887cd3484a0b44ca (patch) | |
tree | 92b7e40618bb7ea338b99c35793f1d4a6ba82909 /clang/test/Preprocessor/dump_macros.c | |
parent | 5c7cd6043efa3ea4fca87fd316d086c1c205638b (diff) | |
download | bcm5719-llvm-1630c3c4f0bd6e93cff2329b887cd3484a0b44ca.tar.gz bcm5719-llvm-1630c3c4f0bd6e93cff2329b887cd3484a0b44ca.zip |
Add an implementation of -dM that follows GCC closely enough to permit
diffing the output of:
clang -dM -o - -E -x c foo.c | sort
llvm-svn: 63926
Diffstat (limited to 'clang/test/Preprocessor/dump_macros.c')
-rw-r--r-- | clang/test/Preprocessor/dump_macros.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/dump_macros.c b/clang/test/Preprocessor/dump_macros.c new file mode 100644 index 00000000000..348257fb519 --- /dev/null +++ b/clang/test/Preprocessor/dump_macros.c @@ -0,0 +1,31 @@ +// RUN: clang -E -dM %s -o %t && + +// Space even without expansion tokens +// RUN: grep "#define A(x) " %t && +#define A(x) + +// Space before expansion list. +// RUN: grep "#define B(x,y) x y" %t && +#define B(x,y)x y + +// No space in expansion list. +// RUN: grep "#define C(x,y) x y" %t && +#define C(x, y) x y + +// No paste avoidance. +// RUN: grep "#define X() .." %t && +#define X() .. + +// Simple test. +// RUN: grep "#define Y ." %t && +// RUN: grep "#define Z X()Y" %t && +#define Y . +#define Z X()Y + +// gcc prints macros at end of translation unit, so last one wins. +// RUN: grep "#define foo 2" %t && +// RUN: not grep "#define foo 1" %t +#define foo 1 +#undef foo +#define foo 2 + |