CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
110 lines
4.6 KiB
C++
110 lines
4.6 KiB
C++
// RUN: %check_clang_tidy %s misc-use-internal-linkage %t -- \
|
|
// RUN: -config="{CheckOptions: { \
|
|
// RUN: misc-use-internal-linkage.AnalyzeVariables: false, \
|
|
// RUN: misc-use-internal-linkage.AnalyzeTypes: false \
|
|
// RUN: }}" -- -I%S/Inputs/use-internal-linkage
|
|
|
|
// RUN: %check_clang_tidy %s misc-use-internal-linkage %t -- \
|
|
// RUN: -config="{CheckOptions: { \
|
|
// RUN: misc-use-internal-linkage.FixMode: 'UseStatic', \
|
|
// RUN: misc-use-internal-linkage.AnalyzeVariables: false, \
|
|
// RUN: misc-use-internal-linkage.AnalyzeTypes: false \
|
|
// RUN: }}" -- -I%S/Inputs/use-internal-linkage
|
|
|
|
#include "func.h"
|
|
|
|
void func() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static void func() {}
|
|
|
|
template<class T>
|
|
void func_template() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_template' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static void func_template() {}
|
|
|
|
void func_cpp_inc() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_cpp_inc' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static void func_cpp_inc() {}
|
|
|
|
int* func_cpp_inc_return_ptr() { return nullptr; }
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_cpp_inc_return_ptr' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static int* func_cpp_inc_return_ptr() { return nullptr; }
|
|
|
|
const int* func_cpp_inc_return_const_ptr() { return nullptr; }
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: function 'func_cpp_inc_return_const_ptr' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static const int* func_cpp_inc_return_const_ptr() { return nullptr; }
|
|
|
|
int const* func_cpp_inc_return_ptr_const() { return nullptr; }
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: function 'func_cpp_inc_return_ptr_const' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static int const* func_cpp_inc_return_ptr_const() { return nullptr; }
|
|
|
|
int * const func_cpp_inc_return_const() { return nullptr; }
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: function 'func_cpp_inc_return_const' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static int * const func_cpp_inc_return_const() { return nullptr; }
|
|
|
|
volatile const int* func_cpp_inc_return_volatile_const_ptr() { return nullptr; }
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: function 'func_cpp_inc_return_volatile_const_ptr' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static volatile const int* func_cpp_inc_return_volatile_const_ptr() { return nullptr; }
|
|
|
|
[[nodiscard]] void func_nodiscard() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:20: warning: function 'func_nodiscard' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: {{\[\[nodiscard\]\]}} static void func_nodiscard() {}
|
|
|
|
#define NDS [[nodiscard]]
|
|
#define NNDS
|
|
|
|
NDS void func_nds() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:10: warning: function 'func_nds' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: NDS static void func_nds() {}
|
|
|
|
NNDS void func_nnds() {}
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: function 'func_nnds' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: NNDS static void func_nnds() {}
|
|
|
|
#include "func_cpp.inc"
|
|
|
|
void func_h_inc() {}
|
|
|
|
struct S {
|
|
void method();
|
|
};
|
|
void S::method() {}
|
|
|
|
void func_header() {}
|
|
extern void func_extern() {}
|
|
static void func_static() {}
|
|
namespace {
|
|
void func_anonymous_ns() {}
|
|
} // namespace
|
|
|
|
int main(int argc, const char*argv[]) {}
|
|
|
|
extern "C" {
|
|
void func_extern_c_1() {}
|
|
}
|
|
|
|
extern "C" void func_extern_c_2() {}
|
|
|
|
namespace gh117488 {
|
|
void func_with_body();
|
|
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: function 'func_with_body' can be made static or moved into an anonymous namespace to enforce internal linkage
|
|
// CHECK-FIXES: static void func_with_body();
|
|
void func_with_body() {}
|
|
|
|
void func_without_body();
|
|
void func_without_body();
|
|
}
|
|
|
|
// gh117489 start
|
|
namespace std {
|
|
using size_t = decltype(sizeof(int));
|
|
}
|
|
void * operator new(std::size_t) { return nullptr; }
|
|
void * operator new[](std::size_t) { return nullptr; }
|
|
void operator delete(void*) noexcept {}
|
|
void operator delete[](void*) noexcept {}
|
|
// gh117489 end
|
|
|
|
int ignored_global = 0; // AnalyzeVariables is false.
|
|
struct IgnoredStruct {}; // AnalyzeTypes is false.
|