| 1 |
// Test check that processing headers as C++20 units allows #pragma once. |
| 2 |
|
| 3 |
// RUN: rm -rf %t |
| 4 |
// RUN: mkdir -p %t |
| 5 |
// RUN: split-file %s %t |
| 6 |
// RUN: cd %t |
| 7 |
|
| 8 |
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header hu-01.h \ |
| 9 |
// RUN: -Werror -o hu-01.pcm |
| 10 |
|
| 11 |
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header hu-02.h \ |
| 12 |
// RUN: -fmodule-file=%t/hu-01.pcm -o hu-02.pcm |
| 13 |
|
| 14 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only imports-01.cpp \ |
| 15 |
// RUN: -fmodule-file=%t/hu-01.pcm |
| 16 |
|
| 17 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only imports-02.cpp \ |
| 18 |
// RUN: -fmodule-file=%t/hu-02.pcm |
| 19 |
|
| 20 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only imports-03.cpp \ |
| 21 |
// RUN: -fmodule-file=%t/hu-02.pcm |
| 22 |
|
| 23 |
//--- hu-01.h |
| 24 |
#pragma once |
| 25 |
struct HU { |
| 26 |
int a; |
| 27 |
}; |
| 28 |
// expected-no-diagnostics |
| 29 |
|
| 30 |
//--- hu-02.h |
| 31 |
export import "hu-01.h"; |
| 32 |
// expected-no-diagnostics |
| 33 |
|
| 34 |
//--- imports-01.cpp |
| 35 |
import "hu-01.h"; |
| 36 |
|
| 37 |
HU foo(int x) { |
| 38 |
return {x}; |
| 39 |
} |
| 40 |
// expected-no-diagnostics |
| 41 |
|
| 42 |
//--- imports-02.cpp |
| 43 |
import "hu-02.h"; |
| 44 |
|
| 45 |
HU foo(int x) { |
| 46 |
return {x}; |
| 47 |
} |
| 48 |
// expected-no-diagnostics |
| 49 |
|
| 50 |
//--- imports-03.cpp |
| 51 |
import "hu-01.h"; |
| 52 |
import "hu-02.h"; |
| 53 |
|
| 54 |
HU foo(int x) { |
| 55 |
return {x}; |
| 56 |
} |
| 57 |
// expected-no-diagnostics |