None.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. // This file provides None, an enumerator for use in implicit constructors
  15. // of various (usually templated) types to make such construction more
  16. // terse.
  17. //
  18. //===----------------------------------------------------------------------===//
  19. #ifndef LLVM_ADT_NONE_H
  20. #define LLVM_ADT_NONE_H
  21. namespace llvm {
  22. /// A simple null object to allow implicit construction of Optional<T>
  23. /// and similar types without having to spell out the specialization's name.
  24. // (constant value 1 in an attempt to workaround MSVC build issue... )
  25. enum class NoneType { None = 1 };
  26. const NoneType None = NoneType::None;
  27. }
  28. #endif
  29. #ifdef __GNUC__
  30. #pragma GCC diagnostic pop
  31. #endif