None.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===-- None.h - Simple null value for implicit construction ------*- C++ -*-=//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. ///
  14. /// \file
  15. /// This file provides None, an enumerator for use in implicit constructors
  16. /// of various (usually templated) types to make such construction more
  17. /// terse.
  18. ///
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_ADT_NONE_H
  21. #define LLVM_ADT_NONE_H
  22. #include "llvm/Support/Compiler.h"
  23. #include <optional>
  24. namespace llvm {
  25. /// A simple null object to allow implicit construction of std::optional<T>
  26. /// and similar types without having to spell out the specialization's name.
  27. LLVM_DEPRECATED("Use std::nullopt_t instead", "std::nullopt_t")
  28. typedef std::nullopt_t NoneType;
  29. LLVM_DEPRECATED("Use std::nullopt instead.", "std::nullopt")
  30. inline constexpr std::nullopt_t None = std::nullopt;
  31. }
  32. #endif
  33. #ifdef __GNUC__
  34. #pragma GCC diagnostic pop
  35. #endif