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
129 lines
4.9 KiB
C++
129 lines
4.9 KiB
C++
struct S {
|
|
int field;
|
|
int other;
|
|
void method();
|
|
};
|
|
|
|
struct Inner {
|
|
int leaf;
|
|
int otherLeaf;
|
|
void method();
|
|
};
|
|
|
|
struct Outer {
|
|
Inner inner;
|
|
Inner array[2];
|
|
};
|
|
|
|
struct Base {
|
|
int inherited;
|
|
};
|
|
|
|
struct Derived : Base {
|
|
int direct;
|
|
};
|
|
|
|
struct RefOuter {
|
|
Inner &ref;
|
|
};
|
|
|
|
struct WithAnon {
|
|
int outer;
|
|
union {
|
|
int anonInt;
|
|
Inner anonInner;
|
|
};
|
|
};
|
|
|
|
struct ShadowBase {
|
|
Inner shadowed;
|
|
};
|
|
|
|
struct ShadowDerived : ShadowBase {
|
|
using ShadowBase::shadowed;
|
|
};
|
|
|
|
struct WithBitField {
|
|
int regular;
|
|
int bit : 4;
|
|
int : 4;
|
|
int otherRegular;
|
|
};
|
|
|
|
struct WithAnonBitField {
|
|
int outer;
|
|
struct {
|
|
int anonRegular;
|
|
int anonBit : 4;
|
|
};
|
|
};
|
|
|
|
#define offsetof(type, member) __builtin_offsetof(type, member)
|
|
|
|
// Cursor immediately after the comma: empty designator path.
|
|
int empty = __builtin_offsetof(S, field);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):35 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-S --implicit-check-not=method %s
|
|
|
|
// Cursor after a dot: completion in the nested record's type.
|
|
int after_dot = __builtin_offsetof(Outer, inner.leaf);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):49 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-INNER --implicit-check-not=method %s
|
|
|
|
// Cursor after a dot following an array subscript.
|
|
int array = __builtin_offsetof(Outer, array[0].leaf);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):48 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-INNER --implicit-check-not=method %s
|
|
|
|
// Inherited fields participate in offsetof completion.
|
|
int inherited = __builtin_offsetof(Derived, inherited);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):45 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-DERIVED %s
|
|
|
|
// Reference field: dereferenced before continuing the path.
|
|
int ref = __builtin_offsetof(RefOuter, ref.leaf);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):44 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-INNER --implicit-check-not=method %s
|
|
|
|
// Empty path on a record with anonymous-member indirect fields.
|
|
int anon_empty = __builtin_offsetof(WithAnon, anonInt);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):47 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-ANON %s
|
|
|
|
// Designator that starts with an indirect field from an anonymous member.
|
|
int anon_nested = __builtin_offsetof(WithAnon, anonInner.leaf);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):58 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-INNER --implicit-check-not=method %s
|
|
|
|
// Field exposed via `using Base::...` resolves through its UsingShadowDecl.
|
|
int shadowed = __builtin_offsetof(ShadowDerived, shadowed.leaf);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):59 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-INNER --implicit-check-not=method %s
|
|
|
|
// Macro form expands to __builtin_offsetof with the same completion behavior.
|
|
int macro = offsetof(S, field);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):25 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-S --implicit-check-not=method %s
|
|
|
|
// Bit-fields are not valid as the offsetof member designator
|
|
// (err_offsetof_bitfield), so they should not be offered as completions.
|
|
// Unnamed bit-fields have no identifier and are filtered out of lookup
|
|
// independently.
|
|
int bf = __builtin_offsetof(WithBitField, regular);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):43 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-BF --implicit-check-not=bit %s
|
|
|
|
// Bit-fields exposed via an anonymous struct's IndirectFieldDecl are also
|
|
// filtered: the leaf field is what offsetof would name.
|
|
int abf = __builtin_offsetof(WithAnonBitField, outer);
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-patterns -code-completion-at=%s:%(line-1):48 %s -o - -std=c++17 | FileCheck -check-prefix=CHECK-ABF --implicit-check-not=anonBit %s
|
|
|
|
// CHECK-S-DAG: COMPLETION: field : [#int#]field
|
|
// CHECK-S-DAG: COMPLETION: other : [#int#]other
|
|
|
|
// CHECK-INNER-DAG: COMPLETION: leaf : [#int#]leaf
|
|
// CHECK-INNER-DAG: COMPLETION: otherLeaf : [#int#]otherLeaf
|
|
|
|
// CHECK-DERIVED-DAG: COMPLETION: direct : [#int#]direct
|
|
// CHECK-DERIVED-DAG: COMPLETION: inherited (InBase) : [#int#]inherited
|
|
|
|
// CHECK-ANON-DAG: COMPLETION: anonInner : [#Inner#]anonInner
|
|
// CHECK-ANON-DAG: COMPLETION: anonInt : [#int#]anonInt
|
|
// CHECK-ANON-DAG: COMPLETION: outer : [#int#]outer
|
|
|
|
// CHECK-BF-DAG: COMPLETION: regular : [#int#]regular
|
|
// CHECK-BF-DAG: COMPLETION: otherRegular : [#int#]otherRegular
|
|
|
|
// CHECK-ABF-DAG: COMPLETION: outer : [#int#]outer
|
|
// CHECK-ABF-DAG: COMPLETION: anonRegular : [#int#]anonRegular
|