brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · cbb466f Raw
64 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm6// RUN: %clang_cc1 -std=c++20 %t/a.cpp -fmodule-file=a=%t/a.pcm -ast-dump | FileCheck %s7 8// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm9// RUN: %clang_cc1 -std=c++20 %t/a.cpp -fmodule-file=a=%t/a.pcm -ast-dump | FileCheck %s10 11//--- a.h12namespace a {13class A {14public:15    int aaaa;16 17    int get() {18        return aaaa;19    }20};21 22 23template <class T>24class B {25public:26    B(T t): t(t) {}27    T t;28};29 30using BI = B<int>;31 32inline int get(A a, BI b) {33    return a.get() + b.t;34}35 36}37 38//--- a.cppm39module;40#include "a.h"41 42export module a;43 44namespace a {45    export using ::a::A;46    export using ::a::get;47    export using ::a::BI;48}49 50//--- a.cpp51import a;52#include "a.h"53 54int test() {55    a::A aa;56    a::BI bb(43);57    return get(aa, bb);58}59 60// CHECK-NOT: DefinitionData61// CHECK: FunctionDecl {{.*}} get 'int (A, BI)' {{.*}}62// CHECK-NOT: CompoundStmt63// CHECK: FunctionDecl {{.*}} test {{.*}}64