| #===------------------------------------------------------------------------===# |
| # |
| # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| # See https://llvm.org/LICENSE.txt for license information. |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| # |
| #===------------------------------------------------------------------------===# |
| |
| # This clang-query test ensures that we don't place an abi_tag attribute on |
| # virtual functions. This can happen by mistakenly applying a macro like |
| # _LIBCPP_HIDE_FROM_ABI on a virtual function. |
| # |
| # The problem is that arm64e pointer authentication extensions use the mangled |
| # name of the function to sign the function pointer in the vtable, which means |
| # that the ABI tag effectively influences how the pointers are signed. |
| # |
| # This can lead to PAC failures when passing an object that holds one of these |
| # pointers in its vtable across an ABI boundary if the two sides have been compiled |
| # with different versions of libc++: one side will sign the pointer using one function |
| # mangling (with one ABI tag), and the other side will authenticate the pointer expecting |
| # it to have a different mangled name due to the ABI tag being different, which will crash. |
| # |
| # This test ensures that we don't re-introduce this issue in the code base. |
| |
| match |
| cxxMethodDecl(isVirtual(), |
| hasAttr("attr::AbiTag"), |
| unless(isExpansionInSystemHeader()) |
| ) |