Files
TheRock/compiler/amd-llvm/clang/test/Modules/cxx20-hu-01.cpp
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

105 lines
3.0 KiB
C++

// Test generation and import of simple C++20 Header Units.
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-header %t/hu-01.h \
// RUN: -o %t/hu-01.pcm
// RUN: %clang_cc1 -std=c++20 -module-file-info %t/hu-01.pcm | \
// RUN: FileCheck --check-prefix=CHECK-HU %s -DTDIR=%t
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/imp-hu-01.cpp \
// RUN: -fmodule-file=%t/hu-01.pcm -o %t/B.pcm -Rmodule-import 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-IMP %s -DTDIR=%t
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/imp-hu-02.cpp \
// RUN: -fmodule-file=%t/hu-01.pcm -o %t/C.pcm -Rmodule-import 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-GMF-IMP %s -DTDIR=%t
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-header %t/hu-02.h \
// RUN: -o %t/hu-02.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/imp-hu-03.cpp \
// RUN: -fmodule-file=%t/hu-01.pcm -fmodule-file=%t/hu-02.pcm -o %t/D.pcm \
// RUN: -Rmodule-import 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-BOTH %s -DTDIR=%t
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-header %t/hu-03.h \
// RUN: -fmodule-file=%t/hu-01.pcm -o %t/hu-03.pcm
// RUN: %clang_cc1 -std=c++20 -module-file-info %t/hu-03.pcm | \
// RUN: FileCheck --check-prefix=CHECK-HU-HU %s -DTDIR=%t
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/imp-hu-04.cpp \
// RUN: -fmodule-file=%t/hu-03.pcm -o %t/E.pcm -Rmodule-import 2>&1 | \
// RUN: FileCheck --check-prefix=CHECK-NESTED %s -DTDIR=%t
//--- hu-01.h
int foo(int);
// CHECK-HU: ====== C++20 Module structure ======
// CHECK-HU-NEXT: Header Unit '[[TDIR]]/hu-01.h' is the Primary Module at index #1
//--- imp-hu-01.cpp
export module B;
import "hu-01.h";
int bar(int x) {
return foo(x);
}
// CHECK-IMP: remark: importing module '[[TDIR]]/hu-01.h' from '[[TDIR]]/hu-01.pcm'
// expected-no-diagnostics
//--- imp-hu-02.cpp
module;
import "hu-01.h";
export module C;
int bar(int x) {
return foo(x);
}
// CHECK-GMF-IMP: remark: importing module '[[TDIR]]/hu-01.h' from '[[TDIR]]/hu-01.pcm'
// expected-no-diagnostics
//--- hu-02.h
int baz(int);
//--- imp-hu-03.cpp
module;
export import "hu-01.h";
export module D;
import "hu-02.h";
int bar(int x) {
return foo(x) + baz(x);
}
// CHECK-BOTH: remark: importing module '[[TDIR]]/hu-01.h' from '[[TDIR]]/hu-01.pcm'
// CHECK-BOTH: remark: importing module '[[TDIR]]/hu-02.h' from '[[TDIR]]/hu-02.pcm'
// expected-no-diagnostics
//--- hu-03.h
export import "hu-01.h";
int baz(int);
// CHECK-HU-HU: ====== C++20 Module structure ======
// CHECK-HU-HU-NEXT: Header Unit '[[TDIR]]/hu-03.h' is the Primary Module at index #2
// CHECK-HU-HU-NEXT: Exports:
// CHECK-HU-HU-NEXT: Header Unit '[[TDIR]]/hu-01.h' is at index #1
// expected-no-diagnostics
//--- imp-hu-04.cpp
module;
import "hu-03.h";
export module E;
int bar(int x) {
return foo(x) + baz(x);
}
// CHECK-NESTED: remark: importing module '[[TDIR]]/hu-03.h' from '[[TDIR]]/hu-03.pcm'
// expected-no-diagnostics