brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · 333d486 Raw
63 lines · c
1// Checks that macros from transitive imports work with local submodule2// visibility. In the below test, previously a() and d() failed because3// OTHER_MACRO1 and OTHER_MACRO3 were not visible at the use site.4 5// RUN: rm -rf %t6// RUN: split-file %s %t7// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t \8// RUN:   -fmodules-local-submodule-visibility -I%t %t/tu.c -verify9 10//--- Other1.h11#define OTHER_MACRO1(...)12 13//--- Other2.h14#define OTHER_MACRO2(...)15 16//--- Other3.h17#define OTHER_MACRO3(...)18 19//--- module.modulemap20module Other {21  module O1 { header "Other1.h" }22  module O2 { header "Other2.h" }23  module O3 { header "Other3.h" }24}25 26//--- Top/A.h27#include "Other1.h"28#define MACRO_A OTHER_MACRO1(x, y)29 30//--- Top/B.h31#include "Other2.h"32#define MACRO_B OTHER_MACRO2(x, y)33 34//--- Top/C.h35#include "D.h"36 37//--- Top/D.h38#include "Other3.h"39#define MACRO_D OTHER_MACRO3(x, y)40 41//--- Top/Top.h42#include "A.h"43#include "B.h"44#include "C.h"45 46void a() MACRO_A;47void b() MACRO_B;48void d() MACRO_D;49 50//--- Top/module.modulemap51module Top {52  umbrella header "Top.h"53  module A { header "A.h" export * }54  module D { header "D.h" export * }55  module * { export * }56  export *57  export Other.O358}59 60//--- tu.c61#include "Top/Top.h"62// expected-no-diagnostics63