xref: /llvm-project/clang/test/Modules/inline-builtins.cppm (revision e167f753bd4679329ebcf0232f72be9c63d9b671)
1// REQUIRES: !system-windows
2//
3// RUN: rm -rf %t
4// RUN: split-file %s %t
5// RUN: cd %t
6//
7// RUN: %clang_cc1 -std=c++20 -O3 %t/a.cppm -emit-module-interface -o %t/a.pcm
8// RUN: %clang_cc1 -std=c++20 -O3 %t/test.cc -fmodule-file=a=%t/a.pcm \
9// RUN:   -emit-llvm -o - | FileCheck %t/test.cc
10
11//--- memmove.h
12typedef long unsigned int size_t;
13extern "C" void *memmove (void *__dest, const void *__src, size_t __n)
14     throw () __attribute__ ((__nonnull__ (1, 2)));
15extern "C" __inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) void *
16 memmove (void *__dest, const void *__src, size_t __len) throw ()
17{
18  return __builtin_memmove(__dest, __src, __len);
19}
20
21//--- a.cppm
22module;
23#include "memmove.h"
24export module a;
25export using ::memmove;
26
27//--- test.cc
28import a;
29
30void test() {
31  int a, b;
32  unsigned c = 0;
33  memmove(&a, &b, c);
34}
35
36// CHECK-NOT: memmove
37