diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-10-28 16:30:57 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-10-28 16:30:57 +0000 |
commit | 96261ddfa1fda29e1f0258ddd6642cff1d103222 (patch) | |
tree | dbb5bca4f47868ac2c1a4b3cea69dd4784b989e3 /clang/test/Modules/explicit-build-flags.cpp | |
parent | e003b78e37d26b20d28dd8d09ec89cc82c4adb4d (diff) | |
download | bcm5719-llvm-96261ddfa1fda29e1f0258ddd6642cff1d103222.tar.gz bcm5719-llvm-96261ddfa1fda29e1f0258ddd6642cff1d103222.zip |
Extend test to check that -D flags do not leak across module boundaries.
llvm-svn: 220782
Diffstat (limited to 'clang/test/Modules/explicit-build-flags.cpp')
-rw-r--r-- | clang/test/Modules/explicit-build-flags.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/clang/test/Modules/explicit-build-flags.cpp b/clang/test/Modules/explicit-build-flags.cpp index 67da617664b..bb5c4169765 100644 --- a/clang/test/Modules/explicit-build-flags.cpp +++ b/clang/test/Modules/explicit-build-flags.cpp @@ -16,12 +16,29 @@ // RUN: %clang_cc1 -fmodules -DFOO=1 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s // Can use the module if -D flags change. -// RUN: %clang_cc1 -fmodules -DFOO=2 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s +// RUN: %clang_cc1 -fmodules -DFOO=2 -DBAR=1 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s +// RUN: %clang_cc1 -fmodules -DBAR=2 -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s // Can use the module if -W flags change. -// RUN: %clang_cc1 -fmodules -Wextra -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s +// RUN: %clang_cc1 -fmodules -DBAR=2 -Wextra -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s // Can use the module if -I flags change. -// RUN: %clang_cc1 -fmodules -I. -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s +// RUN: %clang_cc1 -fmodules -DBAR=2 -I. -x c++ -fmodule-map-file=%t/map -fmodule-file=%t/tmp.pcm -verify -I%t %s #include "tmp.h" // expected-no-diagnostics + +#ifndef BAR +#if FOO != 1 +#error bad FOO from command line and module +#endif +#elif BAR == 1 +#if FOO != 2 +#error bad FOO from command line overriding module +#endif +#elif BAR == 2 +#ifdef FOO +#error FOO leaked from module +#endif +#else +#error bad BAR +#endif |