[ObjC] Add a command line flag that disables recognition of objc_direct for testability
authorErik Pilkington <erik.pilkington@gmail.com>
Mon, 5 Apr 2021 23:23:27 +0000 (19:23 -0400)
committerErik Pilkington <erik.pilkington@gmail.com>
Tue, 6 Apr 2021 15:17:01 +0000 (11:17 -0400)
commitb660abc80d0d0943c54e9440636ddfa89c2d626d
tree5177eb0f3687e5e1d83227eb1875aee21f055df5
parent844012940e177cea9d4deb49c2d79d808adf815e
[ObjC] Add a command line flag that disables recognition of objc_direct for testability

Programmers would like to be able to test direct methods by calling them from a
different linkage unit or mocking them, both of which are impossible. This
patch adds a flag that effectively disables the attribute, which will fix this
when enabled in testable builds. rdar://71190891

Differential revision: https://reviews.llvm.org/D95845
clang/include/clang/AST/DeclObjC.h
clang/include/clang/Basic/LangOptions.def
clang/include/clang/Driver/Options.td
clang/lib/AST/DeclObjC.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Sema/SemaDeclObjC.cpp
clang/test/CodeGenObjC/disable-direct-method.m [new file with mode: 0644]
clang/test/Driver/clang_f_opts.c
clang/test/SemaObjC/disable-direct-method.m [new file with mode: 0644]