brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · d064cdf Raw
58 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/mod2.cppm -emit-module-interface -o %t/mod2.pcm6// RUN: %clang_cc1 -std=c++20 %t/mod1.cppm -emit-module-interface -o %t/mod1.pcm \7// RUN:     -fmodule-file=Mod2=%t/mod2.pcm8// RUN: %clang_cc1 -std=c++20 %t/test.cc -fmodule-file=Mod2=%t/mod2.pcm -fmodule-file=Mod=%t/mod1.pcm \9// RUN:     -fsyntax-only -verify10 11// RUN: %clang_cc1 -std=c++20 %t/mod2.cppm -emit-module-interface -o %t/mod2.pcm12// RUN: %clang_cc1 -std=c++20 %t/mod1.cppm -emit-module-interface -o %t/mod1.pcm \13// RUN:     -fmodule-file=Mod2=%t/mod2.pcm14// RUN: %clang_cc1 -std=c++20 %t/mod1.pcm  -fmodule-file=Mod2=%t/mod2.pcm -emit-llvm -o - \15// RUN:     | FileCheck %t/mod1.cppm16 17//--- hello.h18template <typename V> int get() noexcept {return 0;};19 20template <typename T>21class List22{23    template <typename V> friend int get() noexcept;24};25 26//--- mod2.cppm27module;28#include "hello.h"29export module Mod2;30export const char *modFn2() {31    List<int> a;32    return "hello";33}34 35//--- mod1.cppm36module;37#include "hello.h"38export module Mod;39import Mod2;40export extern "C" const char *modFn() {41    List<int> a;42    List<double> b;43    return modFn2();44}45 46// Fine enough to check it won't crash.47// CHECK: define {{.*}}@modFn48 49//--- test.cc50// expected-no-diagnostics51import Mod;52import Mod2;53 54void test() {55    modFn();56    modFn2();57}58