// RUN: rm -rf %t
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s -DALT
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c -verify -fmodules-cache-path=%t -I %S/Inputs %s -detailed-preprocessing-record
// RUN: not %clang_cc1 -E -fmodules -fimplicit-module-maps -x objective-c -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
//
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s -DALT
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s -detailed-preprocessing-record
// RUN: not %clang_cc1 -E -fmodules -fimplicit-module-maps -x objective-c++ -fmodules-cache-path=%t -I %S/Inputs %s | FileCheck -check-prefix CHECK-PREPROCESSED %s
//
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -DLOCAL_VISIBILITY -fmodules-local-submodule-visibility -x objective-c++ -verify -fmodules-cache-path=%t -I %S/Inputs %s
// FIXME: When we have a syntax for modules in C, use that.
// These notes come from headers in modules, and are bogus.
// FIXME: expected-note@Inputs/macros_left.h:11{{previous definition is here}}
// FIXME: expected-note@Inputs/macros_right.h:12{{previous definition is here}}
// expected-note@Inputs/macros_right.h:12{{expanding this definition of 'LEFT_RIGHT_DIFFERENT'}}
// expected-note@Inputs/macros_right.h:13{{expanding this definition of 'LEFT_RIGHT_DIFFERENT2'}}
// expected-note@Inputs/macros_left.h:14{{other definition of 'LEFT_RIGHT_DIFFERENT'}}
@import macros;
// CHECK-PREPROCESSED: double d
double d;
DOUBLE *dp = &d;
#__public_macro WIBBLE // expected-error{{no macro named 'WIBBLE'}}
void
// None of the modules we depend on have been imported, and therefore
// their macros should not be visible.
// Import left module (which also imports top)
@import macros_left;
INTEGER my_integer = 0;
void
// Import right module (which also imports top)
@import macros_right;
void
void
@import macros_bottom;
TOP_DEF_RIGHT_UNDEF *
@import macros_right.undef;
int TOP_DEF_RIGHT_UNDEF; // ok, no longer defined
// TOP_RIGHT_UNDEF should not be undefined, because macros_right.undef does
// not undefine macros_right's macro.
// When macros_right.undef is built and local submodule visibility is not
// enabled, macros_top is visible because the state from building
// macros_right leaks through, so macros_right.undef undefines macros_top's
// macro.
int tmp = TOP_OTHER_REDEF1;
@import macros_other;
int n1 = TOP_OTHER_REDEF1; // expected-warning{{ambiguous expansion of macro 'TOP_OTHER_REDEF1'}}
// expected-note@macros_other.h:4 {{expanding this definition}}
// expected-note@macros_top.h:19 {{other definition}}
int n2 = TOP_OTHER_REDEF2; // ok
int n3 = TOP_OTHER_DEF_RIGHT_UNDEF; // ok