brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · f51eaf1 Raw
78 lines · cpp
1// Test generation and import of user and system C++20 Header Units.2 3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6// RUN: cd %t7 8// check user path9// RUN: %clang_cc1 -std=c++20 -emit-header-unit -I user \10// RUN: -xc++-user-header hu-01.h -o hu-01.pcm11 12// RUN: %clang_cc1 -std=c++20 -module-file-info hu-01.pcm | \13// RUN: FileCheck --check-prefix=CHECK-HU %s -DTDIR=%t14 15// RUN: %clang_cc1 -std=c++20 -emit-module-interface imp-hu-01.cpp \16// RUN:  -I user -fmodule-file=hu-01.pcm -o B.pcm -Rmodule-import \17// RUN: 2>&1  | FileCheck --check-prefix=CHECK-IMP %s -DTDIR=%t18 19// check system path20// RUN: %clang_cc1 -std=c++20 -emit-header-unit -isystem system \21// RUN: -xc++-system-header hu-02.h -o hu-02.pcm22 23// RUN: %clang_cc1 -std=c++20 -module-file-info hu-02.pcm | \24// RUN: FileCheck --check-prefix=CHECK-HU2 %s -DTDIR=%t25 26// RUN: %clang_cc1 -std=c++20 -emit-module-interface imp-hu-02.cpp \27// RUN:  -isystem system -fmodule-file=hu-02.pcm -o C.pcm \28// RUN: -Rmodule-import 2>&1 | \29// RUN: FileCheck --check-prefix=CHECK-SYS-IMP %s -DTDIR=%t30 31// check absolute path32// RUN: %clang_cc1 -std=c++20 -emit-header-unit  \33// RUN: -xc++-header-unit-header %t/hu-03.h -o hu-03.pcm34 35// RUN: %clang_cc1 -std=c++20 -module-file-info hu-03.pcm | \36// RUN: FileCheck --check-prefix=CHECK-HU3 %s -DTDIR=%t37 38//--- user/hu-01.h39int foo(int);40 41// CHECK-HU:  ====== C++20 Module structure ======42// CHECK-HU-NEXT:  Header Unit 'user{{[/\\]}}hu-01.h' is the Primary Module at index #143 44//--- imp-hu-01.cpp45export module B;46import "hu-01.h";47 48int bar(int x) {49  return foo(x);50}51// CHECK-IMP: remark: importing module 'user{{[/\\]}}hu-01.h' from 'hu-01.pcm'52// expected-no-diagnostics53 54//--- system/hu-02.h55int baz(int);56 57// CHECK-HU2:  ====== C++20 Module structure ======58// CHECK-HU2-NEXT:  Header Unit 'system{{[/\\]}}hu-02.h' is the Primary Module at index #159 60//--- imp-hu-02.cpp61module;62import <hu-02.h>;63 64export module C;65 66int bar(int x) {67  return baz(x);68}69// CHECK-SYS-IMP: remark: importing module 'system{{[/\\]}}hu-02.h' from 'hu-02.pcm'70// expected-no-diagnostics71 72//--- hu-03.h73int curly(int);74 75// CHECK-HU3:  ====== C++20 Module structure ======76// CHECK-HU3-NEXT:  Header Unit '[[TDIR]]/hu-03.h' is the Primary Module at index #177// expected-no-diagnostics78