None.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. namespace llvm {
  23. /// A simple null object to allow implicit construction of Optional<T>
  24. /// and similar types without having to spell out the specialization's name.
  25. // (constant value 1 in an attempt to workaround MSVC build issue... )
  26. enum class NoneType { None = 1 };
  27. const NoneType None = NoneType::None;
  28. }
  29. #endif
  30. #ifdef __GNUC__
  31. #pragma GCC diagnostic pop
  32. #endif