Nikolas Klauser 83ce139721 [libc++] Add hide_from_abi check for classes
We already have a clang-tidy check for making sure that `_LIBCPP_HIDE_FROM_ABI` is on free functions. This patch extends this to class members. The places where we don't check for `_LIBCPP_HIDE_FROM_ABI` are classes for which we have an instantiation in the library.

Reviewed By: ldionne, Mordante, #libc

Spies: jplehr, mikhail.ramalho, sstefan1, libcxx-commits, krytarowski, miyuki, smeenai

Differential Revision: https://reviews.llvm.org/D142332
2023-04-16 15:23:23 +02:00

49 lines
1.6 KiB
C++

// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
#define _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
#include <__config>
#include <__system_error/error_category.h>
#include <__system_error/error_code.h>
#include <stdexcept>
#include <string>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS system_error : public runtime_error {
error_code __ec_;
public:
system_error(error_code __ec, const string& __what_arg);
system_error(error_code __ec, const char* __what_arg);
system_error(error_code __ec);
system_error(int __ev, const error_category& __ecat, const string& __what_arg);
system_error(int __ev, const error_category& __ecat, const char* __what_arg);
system_error(int __ev, const error_category& __ecat);
_LIBCPP_HIDE_FROM_ABI system_error(const system_error&) _NOEXCEPT = default;
~system_error() _NOEXCEPT override;
_LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; }
private:
static string __init(const error_code&, string);
};
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_system_error(int __ev, const char* __what_arg);
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H