148 lines · cpp
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/line.cpp -verify -o %t/line.pcm5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/gnu_line_marker.cpp -verify -o %t/gnu_line_marker.pcm6// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/include.cpp -verify -o %t/include.pcm7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/ident.cpp -verify -o %t/ident.pcm8// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_comment.cpp -verify -o %t/pragma_comment.pcm9// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_mark.cpp -verify -o %t/pragma_mark.pcm10// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_detect_mismatch.cpp -verify -o %t/pragma_detect_mismatch.pcm11// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_clang_debug.cpp -verify -o %t/pragma_clang_debug.pcm12// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_message.cpp -verify -o %t/pragma_message.pcm13// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_gcc_warn.cpp -verify -o %t/pragma_gcc_warn.pcm14// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_gcc_error.cpp -verify -o %t/pragma_gcc_error.pcm15// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_diag_push_pop.cpp -verify -o %t/pragma_diag_push_pop.pcm16// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_diag_ignore.cpp -verify -o %t/pragma_diag_ignore.pcm17// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_opencl_ext.cpp -verify -o %t/pragma_opencl_ext.pcm18// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_push_pop.cpp -verify -o %t/pragma_push_pop.pcm19// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_exec_charset.cpp -verify -o %t/pragma_exec_charset.pcm20// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/pragma_clang_assume_nonnull.cpp -verify -o %t/pragma_clang_assume_nonnull.pcm21// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/marco_expand.cpp -DMACRO="" -verify -o %t/marco_expand.pcm22// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/define.cpp -verify -o %t/define.pcm23// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/undef.cpp -verify -o %t/undef.pcm24// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/defined.cpp -verify -o %t/defined.pcm25// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/has_embed.cpp -verify -o %t/has_embed.pcm26// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/has_include.cpp -verify -o %t/has_include.pcm27 28//--- header.h29#ifndef HEADER_H30#define HEADER_H31 32#endif // HEADER_H33 34//--- line.cpp35// expected-no-diagnostics36#line 337export module M;38 39//--- gnu_line_marker.cpp40// expected-no-diagnostics41# 1 __FILE__ 1 342export module M;43 44//--- include.cpp45#include "header.h" // expected-note {{add 'module;' to the start of the file to introduce a global module fragment}}46export module M; // expected-error {{module declaration must occur at the start of the translation unit}}47 48//--- ident.cpp49// expected-no-diagnostics50#ident "$Header:$"51export module M;52 53//--- pragma_comment.cpp54// expected-no-diagnostics55#pragma comment(lib, "msvcrt.lib")56export module M;57 58//--- pragma_mark.cpp59// expected-no-diagnostics60#pragma mark LLVM's world61export module M;62 63//--- pragma_detect_mismatch.cpp64// expected-no-diagnostics65#pragma detect_mismatch("test", "1")66export module M;67 68//--- pragma_clang_debug.cpp69// expected-no-diagnostics70#pragma clang __debug dump Test71export module M;72 73//--- pragma_message.cpp74#pragma message "test" // expected-warning {{test}}75export module M;76 77//--- pragma_gcc_warn.cpp78#pragma GCC warning "Foo" // expected-warning {{Foo}}79export module M;80 81//--- pragma_gcc_error.cpp82#pragma GCC error "Foo" // expected-error {{Foo}}83export module M;84 85//--- pragma_diag_push_pop.cpp86// expected-no-diagnostics87#pragma gcc diagnostic push88#pragma gcc diagnostic pop89export module M;90 91//--- pragma_diag_ignore.cpp92// expected-no-diagnostics93#pragma GCC diagnostic ignored "-Wframe-larger-than"94export module M;95 96//--- pragma_opencl_ext.cpp97// expected-no-diagnostics98#pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable99export module M;100 101//--- pragma_push_pop.cpp102// expected-no-diagnostics103#pragma warning(push)104#pragma warning(pop)105export module M;106 107//--- pragma_exec_charset.cpp108// expected-no-diagnostics109#pragma execution_character_set(push, "UTF-8")110#pragma execution_character_set(pop)111export module M;112 113//--- pragma_clang_assume_nonnull.cpp114// expected-no-diagnostics115#pragma clang assume_nonnull begin116#pragma clang assume_nonnull end117export module M;118 119//--- marco_expand.cpp120MACRO // expected-note {{add 'module;' to the start of the file to introduce a global module fragment}}121export module M; // expected-error {{module declaration must occur at the start of the translation unit}}122 123//--- define.cpp124// This is a comment125#define I32 int // expected-note {{add 'module;' to the start of the file to introduce a global module fragment}}126export module M; // expected-error {{module declaration must occur at the start of the translation unit}}127export I32 i32;128 129//--- undef.cpp130#undef FOO // expected-note {{add 'module;' to the start of the file to introduce a global module fragment}}131export module M; // expected-error {{module declaration must occur at the start of the translation unit}}132 133//--- defined.cpp134#if defined(FOO) // expected-note {{add 'module;' to the start of the file to introduce a global module fragment}}135#endif136export module M; // expected-error {{module declaration must occur at the start of the translation unit}}137 138//--- has_embed.cpp139#if __has_embed(__FILE__ ext::token(0xB055)) // expected-note {{add 'module;' to the start of the file to introduce a global module fragment}}140#endif141export module M; // expected-error {{module declaration must occur at the start of the translation unit}}142 143//--- has_include.cpp144#if __has_include(<stdio.h>) || __has_include_next(<stdlib.h>) // expected-note {{add 'module;' to the start of the file to introduce a global module fragment}} \145 // expected-warning {{#include_next in primary source file; will search from start of include path}}146#endif147export module M; // expected-error {{module declaration must occur at the start of the translation unit}}148