blob: ffebf90e475e7941ba351846cd4f8e3f8d7a09bc [file] [edit]
// A declaration annotated by two API notes readers at once, which is what makes
// the slice group observable. ExportAsCore is `export_as ExportAs`, so
// tryAPINotes loads ExportAsCore.apinotes and then ExportAs.apinotes from the
// same directory. Both are public readers.
//
// Clang selects one slice per group and applies every group's winner, so the
// two readers are two groups. The group number is what tells a consumer which
// slices were candidates against each other; pooling them would let one
// reader's slice suppress the other's. Every other test in this directory has a
// single reader, so this is the only one where a wrong or swapped group is
// visible at all.
//
// This is the sibling of versioned-version-independent.m, which covers the
// keyless-slice case on a single reader, and of slice-groups-order.c, which
// covers two readers and a parameter selector at once.
// RUN: rm -rf %t && mkdir -p %t
// RUN: %clang_cc1 -fswift-version-independent-apinotes -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/ModulesCache -fdisable-module-hash -fapinotes-modules -I %S/Inputs/Headers %s -ast-dump -ast-dump-filter sliceGroupProbe -x c | FileCheck %s
#include "ExportAs.h"
// CHECK: Dumping sliceGroupProbe:
// CHECK: VarDecl {{.+}} imported in ExportAsCore sliceGroupProbe 'int'
// Group 0 is ExportAsCore.apinotes: an unversioned slice and a 3.0 slice.
// CHECK: SwiftVersionedSliceAttr {{.+}} Implicit 0 0{{$}}
// CHECK-NEXT: SwiftVersionedAdditionAttr {{.+}} Implicit 0 0{{$}}
// CHECK-NEXT: SwiftNameAttr {{.+}} "fromCoreUnversioned"
// CHECK-NEXT: SwiftVersionedSliceAttr {{.+}} Implicit 3.0 0{{$}}
// CHECK-NEXT: SwiftVersionedAdditionAttr {{.+}} Implicit 3.0 0{{$}}
// CHECK-NEXT: SwiftNameAttr {{.+}} "fromCoreV3"
// Group 1 is ExportAs.apinotes, reached through export_as. The nonzero group is
// the whole point of this test: nothing else in the suite produces one, so a
// bug that collapsed the two readers onto one group, or swapped them, would pass
// everywhere else.
// CHECK-NEXT: SwiftVersionedSliceAttr {{.+}} Implicit 0 1{{$}}
// CHECK-NEXT: SwiftVersionedAdditionAttr {{.+}} Implicit 0 1{{$}}
// CHECK-NEXT: SwiftPrivateAttr
// CHECK-NEXT: SwiftVersionedSliceAttr {{.+}} Implicit 4.0 1{{$}}
// CHECK-NEXT: SwiftVersionedRemovalAttr {{.+}} Implicit 4.0 {{[0-9]+}} 1{{$}}