Clang Project

clang_source_code/test/Modules/macro-redefinition.cpp
1// RUN: %clang_cc1 -fmodules -x c++-module-map %s -fmodule-name=__usr_include -verify
2// RUN: %clang_cc1 -fmodules -x c++-module-map %s -fmodule-name=__usr_include -verify -DIMPORT
3
4module __usr_include {
5  module stddef {}
6  module stdlib {}
7}
8
9#pragma clang module contents
10
11// expected-no-diagnostics
12
13#pragma clang module begin __usr_include.stddef
14  #define NULL 0
15#pragma clang module end
16
17#pragma clang module begin __usr_include.stdlib
18  #ifdef IMPORT
19    #pragma clang module import __usr_include.stddef
20  #else
21    #pragma clang module begin __usr_include.stddef
22      #define NULL 0
23    #pragma clang module end
24  #endif
25
26  void *f() { return NULL; } // ok, NULL is visible here
27#pragma clang module end
28