| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// Testing the behavior of `-fskip-odr-check-in-gmf` |
| 6 |
// RUN: %clang_cc1 -std=c++20 -DDIFFERENT -fskip-odr-check-in-gmf %t/A.cppm -emit-module-interface -o %t/A.pcm |
| 7 |
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf -x c++-header %t/foo.h -emit-pch -o %t/foo.pch |
| 8 |
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf -include-pch %t/foo.pch %t/B.cppm -emit-module-interface -o %t/B.pcm |
| 9 |
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf -fprebuilt-module-path=%t \ |
| 10 |
// RUN: %t/C.cpp -verify -fsyntax-only |
| 11 |
|
| 12 |
//--- foo.h |
| 13 |
#ifndef FOO_H |
| 14 |
#define FOO_H |
| 15 |
class A { |
| 16 |
public: |
| 17 |
#ifndef DIFFERENT |
| 18 |
void func() { |
| 19 |
|
| 20 |
} |
| 21 |
#endif |
| 22 |
}; |
| 23 |
#endif |
| 24 |
|
| 25 |
//--- A.cppm |
| 26 |
module; |
| 27 |
#include "foo.h" |
| 28 |
export module A; |
| 29 |
export using ::A; |
| 30 |
|
| 31 |
//--- B.cppm |
| 32 |
module; |
| 33 |
#include "foo.h" |
| 34 |
export module B; |
| 35 |
export using ::A; |
| 36 |
|
| 37 |
//--- C.cpp |
| 38 |
import A; |
| 39 |
import B; |
| 40 |
// expected-no-diagnostics |
| 41 |
void C() { |
| 42 |
A a; |
| 43 |
a.func(); |
| 44 |
} |