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
90 lines
2.3 KiB
C++
90 lines
2.3 KiB
C++
// RUN: %check_clang_tidy -check-header %S/Inputs/duplicate-include/duplicate-include.h \
|
|
// RUN: %s readability-duplicate-include %t -- \
|
|
// RUN: -- -isystem %S/Inputs/duplicate-include/system -I %S/Inputs/duplicate-include
|
|
|
|
int a;
|
|
#include <string.h>
|
|
int b;
|
|
#include <string.h>
|
|
int c;
|
|
// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include [readability-duplicate-include]
|
|
// CHECK-FIXES: int a;
|
|
// CHECK-FIXES-NEXT: #include <string.h>
|
|
// CHECK-FIXES-NEXT: int b;
|
|
// CHECK-FIXES-NEXT: int c;
|
|
|
|
int d;
|
|
#include <iostream>
|
|
int e;
|
|
#include <iostream> // extra stuff that will also be removed
|
|
int f;
|
|
// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include
|
|
// CHECK-FIXES: int d;
|
|
// CHECK-FIXES-NEXT: #include <iostream>
|
|
// CHECK-FIXES-NEXT: int e;
|
|
// CHECK-FIXES-NEXT: int f;
|
|
|
|
int g;
|
|
#include "duplicate-include.h"
|
|
int h;
|
|
#include "duplicate-include.h"
|
|
int i;
|
|
// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include
|
|
// CHECK-FIXES: int g;
|
|
// CHECK-FIXES-NEXT: #include "duplicate-include.h"
|
|
// CHECK-FIXES-NEXT: int h;
|
|
// CHECK-FIXES-NEXT: int i;
|
|
|
|
#include <types.h>
|
|
|
|
int j;
|
|
#include <sys/types.h>
|
|
int k;
|
|
#include <sys/types.h>
|
|
int l;
|
|
// CHECK-MESSAGES: :[[@LINE-2]]:1: warning: duplicate include
|
|
// CHECK-FIXES: int j;
|
|
// CHECK-FIXES-NEXT: #include <sys/types.h>
|
|
// CHECK-FIXES-NEXT: int k;
|
|
// CHECK-FIXES-NEXT: int l;
|
|
|
|
int m;
|
|
# include <string.h> // lots of space
|
|
int n;
|
|
// CHECK-MESSAGES: :[[@LINE-2]]:9: warning: duplicate include
|
|
// CHECK-FIXES: int m;
|
|
// CHECK-FIXES-NEXT: int n;
|
|
|
|
// defining a macro in the main file resets the included file cache
|
|
#define ARBITRARY_MACRO
|
|
int o;
|
|
#include <sys/types.h>
|
|
int p;
|
|
// CHECK-FIXES: int o;
|
|
// CHECK-FIXES-NEXT: #include <sys/types.h>
|
|
// CHECK-FIXES-NEXT: int p;
|
|
|
|
// undefining a macro resets the cache
|
|
#undef ARBITRARY_MACRO
|
|
int q;
|
|
#include <sys/types.h>
|
|
int r;
|
|
// CHECK-FIXES: int q;
|
|
// CHECK-FIXES-NEXT: #include <sys/types.h>
|
|
// CHECK-FIXES-NEXT: int r;
|
|
|
|
namespace Issue_87303 {
|
|
#define RESET_INCLUDE_CACHE
|
|
// Expect no warnings
|
|
|
|
#define MACRO_FILENAME "duplicate-include.h"
|
|
#include MACRO_FILENAME
|
|
#include "duplicate-include.h"
|
|
|
|
#define MACRO_FILENAME_2 <duplicate-include2.h>
|
|
#include <duplicate-include2.h>
|
|
#include MACRO_FILENAME_2
|
|
|
|
#undef RESET_INCLUDE_CACHE
|
|
} // Issue_87303
|