// RUN: %clang_cc1 < %s -triple %itanium_abi_triple -fms-extensions -O2 -disable-llvm-passes -emit-llvm -x c++ | FileCheck %s
// Test attribute 'optnone' on methods:
// -- member functions;
// -- static member functions.
// Verify that all methods of struct A are associated to the same attribute set.
// The attribute set shall contain attributes 'noinline' and 'optnone'.
;
void
// No attribute here, should still be on the definition.
int
// CHECK: @_ZN1A19optnone_decl_methodEi({{.*}}) [[OPTNONE]]
// optnone implies noinline; therefore attribute noinline is added to
// the set of function attributes.
// forceinline is instead translated as 'always_inline'.
// However 'noinline' wins over 'always_inline' and therefore
// the resulting attributes for this method are: noinline + optnone
int
// CHECK: @_ZN1A25static_forceinline_methodEi({{.*}}) [[OPTNONE]]
int
// CHECK: @_ZN1A19alwaysinline_methodEi({{.*}}) [[OPTNONE]]
// 'noinline' + 'noinline and optnone' = 'noinline and optnone'
int
// CHECK: @_ZN1A15noinline_methodEi({{.*}}) [[OPTNONE]]
// 'optnone' wins over 'minsize'
int
// CHECK: @_ZN1A14minsize_methodEi({{.*}}) [[OPTNONE]]
// Test attribute 'optnone' on methods:
// -- pure virtual functions
// -- base virtual and derived virtual
// -- base virtual but not derived virtual
// -- optnone methods redefined in override
// A method defined in override doesn't inherit the function attributes of the
// superclass method.
;
;
int
// CHECK: @_ZN1C12pure_virtualEi({{.*}}) {{.*}} [[OPTNONE]]
// CHECK: @_ZN1C25pure_virtual_with_optnoneEi({{.*}}) {{.*}} [[NORMAL:#[0-9]+]]
// CHECK: @_ZN1C4baseEi({{.*}}) {{.*}} [[OPTNONE]]
// CHECK: @_ZN1C12optnone_baseEi({{.*}}) {{.*}} [[NORMAL]]
// CHECK: @_ZN1C17only_base_virtualEi({{.*}}) {{.*}} [[NORMAL]]
// CHECK: @_ZN1B4baseEi({{.*}}) {{.*}} [[NORMAL]]
// CHECK: @_ZN1B12optnone_baseEi({{.*}}) {{.*}} [[OPTNONE]]
// CHECK: @_ZN1B17only_base_virtualEi({{.*}}) {{.*}} [[OPTNONE]]
// CHECK: attributes [[NORMAL]] =
// CHECK-NOT: noinline
// CHECK-NOT: optnone
// CHECK: attributes [[OPTNONE]] = {{.*}} noinline {{.*}} optnone