llvm-project/clang/test/SemaObjC/attr-noinstrument.m
Aditya Kumar 0f00aa502d Add no_instrument_function attribute to Objective C methods as well
There are functions where we do not want function instrumentation which is why we have `__attribute__((no_instrument_function))`. Extending this functionality to disable instrumentation for Objective-C methods as well. Objective C methods like `+load` run premain and having instrumentation on them causes runtime errors depending on the implementation of `__cyg_profile_func_enter` etc. functions

Reviewed By: rjmccall, aaron.ballman

Differential Revision: https://reviews.llvm.org/D111286
2021-10-08 17:54:44 -07:00

23 lines
529 B
Objective-C

// RUN: %clang_cc1 -fsyntax-only -triple x86_64-apple-darwin10.4 -verify -Wno-objc-root-class %s
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -triple x86_64-apple-darwin10.4 -verify -Wno-objc-root-class %s
// expected-no-diagnostics
@interface A
+ (void)F __attribute__((no_instrument_function)); // no warning
- (void)f __attribute__((objc_direct, no_instrument_function));
- (void)g;
@end
@implementation A
+ (void)F __attribute__((no_instrument_function)) {
[self F];
}
- (void)f {
[self g];
}
- (void)g {
}
@end