aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Modules/var-init-side-effects-modulemap.cpp
blob: 750a6f1731405fe1cca56ca3ad87e6b5302fb4d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t

// RUN: %clang_cc1 -fsyntax-only -fmodules -fmodules-cache-path=%t -fmodule-map-file=%t/module.modulemap  %t/test.cppm -I%t
//

//--- test.cppm
#pragma clang module import Baz

//--- Foo.h
#pragma once
class foo {
  char dummy = 1;

public:
  static foo var;

};

inline foo foo::var;

//--- Bar.h
#pragma once
#include <Foo.h>

void bar() {
  (void) foo::var;
}

//--- Baz.h
#pragma once
#include <Foo.h>

void baz() {
  (void) foo::var;
}

#include <Bar.h>

//--- module.modulemap
module Foo {
  header "Foo.h"
}
module Bar {
  header "Bar.h"
}
module Baz {
  header "Baz.h"
}