brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 81916e9 Raw
58 lines · cpp
1// Test check that processing headers as C++20 units allows #pragma once.2 3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6// RUN: cd %t7 8// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header hu-01.h \9// RUN: -Werror -o hu-01.pcm10 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.pcm13 14// RUN: %clang_cc1 -std=c++20 -fsyntax-only imports-01.cpp \15// RUN: -fmodule-file=%t/hu-01.pcm16 17// RUN: %clang_cc1 -std=c++20 -fsyntax-only imports-02.cpp \18// RUN: -fmodule-file=%t/hu-02.pcm19 20// RUN: %clang_cc1 -std=c++20 -fsyntax-only imports-03.cpp \21// RUN: -fmodule-file=%t/hu-02.pcm22 23//--- hu-01.h24#pragma once25struct HU {26  int a;27};28// expected-no-diagnostics29 30//--- hu-02.h31export import "hu-01.h";32// expected-no-diagnostics33 34//--- imports-01.cpp35import "hu-01.h";36 37HU foo(int x) {38  return {x};39}40// expected-no-diagnostics41 42//--- imports-02.cpp43import "hu-02.h";44 45HU foo(int x) {46  return {x};47}48// expected-no-diagnostics49 50//--- imports-03.cpp51import "hu-01.h";52import "hu-02.h";53 54HU foo(int x) {55  return {x};56}57// expected-no-diagnostics58