| 1 |
// RUN: %clang_cc1 -triple x86_64 -emit-llvm -disable-llvm-passes -o - %s | FileCheck %s |
| 2 |
// |
| 3 |
// Verifies that clang-generated *.inline are flagged as internal. |
| 4 |
|
| 5 |
typedef unsigned long size_t; |
| 6 |
|
| 7 |
#define AVAILABLE_EXTERNALLY extern inline __attribute__((always_inline)) __attribute__((gnu_inline)) |
| 8 |
// Clang recognizes an inline builtin and renames it to memcmp.inline to prevent conflict with builtins. |
| 9 |
AVAILABLE_EXTERNALLY int memcmp(const void *a, const void *b, size_t c) { |
| 10 |
return __builtin_memcmp(a, b, c); |
| 11 |
} |
| 12 |
|
| 13 |
// CHECK: internal{{.*}}memcmp.inline |
| 14 |
int bar(const void *a, const void *b, size_t c) { |
| 15 |
return memcmp(a, b, c); |
| 16 |
} |
| 17 |
|
| 18 |
// Note that extern has been omitted here. |
| 19 |
#define TRIPLE_INLINE inline __attribute__((always_inline)) __attribute__((gnu_inline)) |
| 20 |
|
| 21 |
// Clang recognizes an inline builtin and renames it to memcpy.inline to prevent conflict with builtins. |
| 22 |
TRIPLE_INLINE void *memcpy(void *a, const void *b, size_t c) { |
| 23 |
return __builtin_memcpy(a, b, c); |
| 24 |
} |
| 25 |
|
| 26 |
// CHECK: internal{{.*}}memcpy.inline |
| 27 |
void *foo(void *a, const void *b, size_t c) { |
| 28 |
return memcpy(a, b, c); |
| 29 |
} |