21 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3typedef int kern_return_t;4typedef kern_return_t IOReturn;5#define KERN_SUCCESS 06#define kIOReturnSuccess KERN_SUCCESS7 8class MyServer {9public:10 virtual __attribute__((mig_server_routine)) IOReturn externalMethod();11 virtual __attribute__((mig_server_routine)) void anotherMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}}12 virtual __attribute__((mig_server_routine)) int yetAnotherMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}}13 [[clang::mig_server_routine]] virtual IOReturn cppAnnotatedMethod();14 [[clang::mig_server_routine("arg")]] virtual IOReturn cppAnnotatedMethodWithInvalidArgs(); // expected-error{{'clang::mig_server_routine' attribute takes no arguments}}15 [[clang::mig_server_routine]] virtual int cppInvalidAnnotatedMethod(); // expected-warning{{'mig_server_routine' attribute only applies to routines that return a kern_return_t}}16};17 18IOReturn MyServer::externalMethod() {19 return kIOReturnSuccess;20}21