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
118 lines
4.7 KiB
C++
118 lines
4.7 KiB
C++
// RUN: %clang_cc1 %s -ast-dump | FileCheck %s
|
|
|
|
// Verify that we print the [[clang::lifetime_capture_by(X)]] attribute.
|
|
|
|
struct S {
|
|
void foo(int &a, int &b) [[clang::lifetime_capture_by(a, b, global)]];
|
|
};
|
|
|
|
// CHECK: CXXMethodDecl {{.*}}clang::lifetime_capture_by(a, b, global)
|
|
|
|
// ****************************************************************************
|
|
// Infer annotation for STL container methods.
|
|
// ****************************************************************************
|
|
namespace __gnu_cxx {
|
|
template <typename T>
|
|
struct basic_iterator {};
|
|
}
|
|
|
|
namespace std {
|
|
template<typename T> class allocator {};
|
|
template <typename T, typename Alloc = allocator<T>>
|
|
struct vector {
|
|
typedef __gnu_cxx::basic_iterator<T> iterator;
|
|
iterator begin();
|
|
|
|
vector();
|
|
|
|
void push_back(const T&);
|
|
void push_back(T&&);
|
|
|
|
void insert(iterator, T&&);
|
|
};
|
|
|
|
template <typename Key, typename Value>
|
|
struct map {
|
|
Value& operator[](Key&& p);
|
|
Value& operator[](const Key& p);
|
|
};
|
|
} // namespace std
|
|
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
struct [[gsl::Pointer()]] View {};
|
|
std::vector<View> views;
|
|
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct vector definition external-linkage instantiated_from 0x{{.+}} implicit_instantiation
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (const View &)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'const View &'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (View &&)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'View &&'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} insert 'void (iterator, View &&)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'iterator'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'View &&'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|
|
|
|
template <class T> struct [[gsl::Pointer()]] ViewTemplate {};
|
|
std::vector<ViewTemplate<int>> templated_views;
|
|
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct vector definition external-linkage instantiated_from 0x{{.+}} implicit_instantiation
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (const ViewTemplate<int> &)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'const ViewTemplate<int> &'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (ViewTemplate<int> &&)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'ViewTemplate<int> &&'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} insert 'void (iterator, ViewTemplate<int> &&)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'iterator'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'ViewTemplate<int> &&'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|
|
|
|
std::vector<int*> pointers;
|
|
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct vector definition external-linkage instantiated_from 0x{{.+}} implicit_instantiation
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (int *const &)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'int *const &'
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (int *&&)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'int *&&'
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} insert 'void (iterator, int *&&)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'iterator'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'int *&&'
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
std::vector<int> ints;
|
|
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct vector definition external-linkage instantiated_from 0x{{.+}} implicit_instantiation
|
|
// CHECK: TemplateArgument type 'int'
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (const int &)'
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} push_back 'void (int &&)'
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} insert 'void (iterator, int &&)'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'iterator'
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} 'int &&'
|
|
// CHECK-NOT: LifetimeCaptureByAttr
|
|
|
|
std::map<View, int> map;
|
|
// CHECK: ClassTemplateSpecializationDecl {{.*}} struct map definition external-linkage instantiated_from 0x{{.+}} implicit_instantiation
|
|
|
|
// CHECK: CXXMethodDecl {{.*}} operator[] 'int &(View &&)' implicit_instantiation
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} p 'View &&'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|
|
// CHECK: CXXMethodDecl {{.*}} operator[] 'int &(const View &)' implicit_instantiation
|
|
// CHECK-NEXT: ParmVarDecl {{.*}} p 'const View &'
|
|
// CHECK-NEXT: LifetimeCaptureByAttr {{.*}} Implicit
|