Optional.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. //===- Optional.h - Simple variant for passing optional values --*- 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 Optional, a template class modeled in the spirit of
  16. /// OCaml's 'opt' variant. The idea is to strongly type whether or not
  17. /// a value can be optional.
  18. ///
  19. //===----------------------------------------------------------------------===//
  20. #ifndef LLVM_ADT_OPTIONAL_H
  21. #define LLVM_ADT_OPTIONAL_H
  22. #include <optional>
  23. namespace llvm {
  24. // Legacy alias of llvm::Optional to std::optional.
  25. // FIXME: Remove this after LLVM 16.
  26. template <class T> using Optional = std::optional<T>;
  27. } // namespace llvm
  28. #endif // LLVM_ADT_OPTIONAL_H
  29. #ifdef __GNUC__
  30. #pragma GCC diagnostic pop
  31. #endif