Douglas Gregor | 4258332 | 2011-11-16 05:16:30 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Douglas Gregor | c13a34b | 2012-01-03 19:32:59 +0000 | [diff] [blame^] | 2 | // RUN: %clang_cc1 -fmodules -x objective-c -emit-module -fmodule-cache-path %t -fmodule-name=macros %S/Inputs/module.map |
| 3 | // RUN: %clang_cc1 -fmodules -x objective-c -verify -fmodule-cache-path %t %s |
| 4 | // RUN: %clang_cc1 -E -fmodules -x objective-c -fmodule-cache-path %t %s | FileCheck -check-prefix CHECK-PREPROCESSED %s |
| 5 | // FIXME: When we have a syntax for modules in C, use that. |
Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 6 | |
Douglas Gregor | c13a34b | 2012-01-03 19:32:59 +0000 | [diff] [blame^] | 7 | @import macros; |
Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 8 | |
| 9 | #ifndef INTEGER |
| 10 | # error INTEGER macro should be visible |
| 11 | #endif |
| 12 | |
| 13 | #ifdef FLOAT |
| 14 | # error FLOAT macro should not be visible |
| 15 | #endif |
| 16 | |
| 17 | #ifdef MODULE |
| 18 | # error MODULE macro should not be visible |
| 19 | #endif |
| 20 | |
Douglas Gregor | de8a905 | 2011-09-14 23:13:09 +0000 | [diff] [blame] | 21 | // CHECK-PREPROCESSED: double d |
Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 22 | double d; |
| 23 | DOUBLE *dp = &d; |
| 24 | |
Douglas Gregor | 94ad28b | 2012-01-03 18:24:14 +0000 | [diff] [blame] | 25 | #public WIBBLE // expected-error{{no macro named 'WIBBLE'}} |
Douglas Gregor | 7143aab | 2011-09-01 17:04:32 +0000 | [diff] [blame] | 26 | |
Douglas Gregor | ce835df | 2011-09-14 22:14:14 +0000 | [diff] [blame] | 27 | void f() { |
Douglas Gregor | de8a905 | 2011-09-14 23:13:09 +0000 | [diff] [blame] | 28 | // CHECK-PREPROCESSED: int i = INTEGER; |
Douglas Gregor | ce835df | 2011-09-14 22:14:14 +0000 | [diff] [blame] | 29 | int i = INTEGER; // the value was exported, the macro was not. |
| 30 | } |