| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// RUN: %clang_cc1 -std=c++20 %t/interface.cppm -emit-module-interface \ |
| 6 |
// RUN: -o %t/m.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 %t/implementation.cpp -fmodule-file=m=%t/m.pcm \ |
| 8 |
// RUN: -fsyntax-only -verify |
| 9 |
|
| 10 |
// Test again with reduced BMI. |
| 11 |
// RUN: %clang_cc1 -std=c++20 %t/interface.cppm -emit-reduced-module-interface \ |
| 12 |
// RUN: -o %t/m.pcm |
| 13 |
// RUN: %clang_cc1 -std=c++20 %t/implementation.cpp -fmodule-file=m=%t/m.pcm \ |
| 14 |
// RUN: -fsyntax-only -verify |
| 15 |
|
| 16 |
//--- invisible.h |
| 17 |
#pragma once // This breaks things. |
| 18 |
const int kInvisibleSymbol = 0; |
| 19 |
struct invisible_struct |
| 20 |
{}; |
| 21 |
#define INVISIBLE_DEFINE |
| 22 |
|
| 23 |
//--- visible.h |
| 24 |
#include "invisible.h" |
| 25 |
const int kSadlyUndeclaredSymbol = kInvisibleSymbol; |
| 26 |
using unfortunately_still_invisible_struct = invisible_struct; |
| 27 |
#ifndef INVISIBLE_DEFINE |
| 28 |
# error "Still not defined." |
| 29 |
#endif |
| 30 |
|
| 31 |
//--- interface.cppm |
| 32 |
module; |
| 33 |
#include "visible.h" |
| 34 |
export module m; |
| 35 |
|
| 36 |
//--- implementation.cpp |
| 37 |
// expected-no-diagnostics |
| 38 |
module; |
| 39 |
#include "visible.h" |
| 40 |
module m; |