File tree Expand file tree Collapse file tree 2 files changed +41
-5
lines changed Expand file tree Collapse file tree 2 files changed +41
-5
lines changed Original file line number Diff line number Diff line change @@ -4022,6 +4022,11 @@ bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) {
4022
4022
return true ;
4023
4023
4024
4024
const auto *F = cast<FunctionDecl>(GD.getDecl ());
4025
+ // Inline builtins declaration must be emitted. They often are fortified
4026
+ // functions.
4027
+ if (F->isInlineBuiltinDeclaration ())
4028
+ return true ;
4029
+
4025
4030
if (CodeGenOpts.OptimizationLevel == 0 && !F->hasAttr <AlwaysInlineAttr>())
4026
4031
return false ;
4027
4032
@@ -4067,11 +4072,6 @@ bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) {
4067
4072
}
4068
4073
}
4069
4074
4070
- // Inline builtins declaration must be emitted. They often are fortified
4071
- // functions.
4072
- if (F->isInlineBuiltinDeclaration ())
4073
- return true ;
4074
-
4075
4075
// PR9614. Avoid cases where the source code is lying to us. An available
4076
4076
// externally function should have an equivalent function somewhere else,
4077
4077
// but a function that calls itself through asm label/`__builtin_` trickery is
Original file line number Diff line number Diff line change
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
12
+ typedef long unsigned int size_t ;
13
+ extern " C" void *memmove (void *__dest, const void *__src, size_t __n)
14
+ throw () __attribute__ ((__nonnull__ (1 , 2 )));
15
+ extern " 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
22
+ module ;
23
+ #include " memmove.h"
24
+ export module a;
25
+ export using ::memmove;
26
+
27
+ // --- test.cc
28
+ import a;
29
+
30
+ void test () {
31
+ int a, b;
32
+ unsigned c = 0 ;
33
+ memmove (&a, &b, c);
34
+ }
35
+
36
+ // CHECK-NOT: memmove
You can’t perform that action at this time.
0 commit comments