[flang] Add #include <optional> (NFC)

This patch adds #include <optional> to those files containing
llvm::Optional<...> or Optional<...>.

I'll post a separate patch to actually replace llvm::Optional with
std::optional.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
This commit is contained in:
Kazu Hirata 2023-01-07 20:55:47 -08:00
parent 29ffafb575
commit 4d4d4785e0
33 changed files with 33 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "flang/Lower/Support/Utils.h"
#include "flang/Optimizer/Dialect/FIRType.h"
#include "flang/Optimizer/Support/Matcher.h"
#include <optional>
namespace Fortran::lower {

View File

@ -11,6 +11,7 @@
#include "flang/Lower/IterationSpace.h"
#include "llvm/ADT/SmallVector.h"
#include <optional>
namespace fir {
class ArrayLoadOp;

View File

@ -20,6 +20,7 @@
#include "flang/Lower/AbstractConverter.h"
#include "flang/Lower/CallInterface.h"
#include "flang/Optimizer/Builder/HLFIRTools.h"
#include <optional>
namespace Fortran::lower {

View File

@ -20,6 +20,7 @@
#include "flang/Lower/Support/Utils.h"
#include "flang/Optimizer/Builder/BoxValue.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include <optional>
namespace mlir {
class Location;

View File

@ -27,6 +27,7 @@
#include "flang/Lower/AbstractConverter.h"
#include "llvm/ADT/Optional.h"
#include <functional>
#include <optional>
namespace Fortran {

View File

@ -11,6 +11,7 @@
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include "llvm/ADT/Optional.h"
#include <optional>
namespace fir {
class ExtendedValue;

View File

@ -17,6 +17,7 @@
#include "flang/Lower/StatementContext.h"
#include "flang/Lower/SymbolMap.h"
#include "flang/Optimizer/Builder/FIRBuilder.h"
#include <optional>
namespace llvm {
class raw_ostream;

View File

@ -25,6 +25,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Compiler.h"
#include <optional>
namespace Fortran::lower {

View File

@ -25,6 +25,7 @@
#include "mlir/IR/BuiltinOps.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
#include <optional>
namespace fir {
class AbstractArrayBox;

View File

@ -17,6 +17,7 @@
#include "flang/Optimizer/Dialect/FIROps.h"
#include "flang/Optimizer/Dialect/FortranVariableInterface.h"
#include "flang/Optimizer/HLFIR/HLFIRDialect.h"
#include <optional>
namespace fir {
class FirOpBuilder;

View File

@ -36,6 +36,7 @@
#include "llvm/Support/Process.h"
#include "llvm/Support/raw_ostream.h"
#include <memory>
#include <optional>
using namespace Fortran::frontend;

View File

@ -58,6 +58,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-bridge"

View File

@ -21,6 +21,7 @@
#include "flang/Optimizer/Support/InternalNames.h"
#include "flang/Semantics/symbol.h"
#include "flang/Semantics/tools.h"
#include <optional>
//===----------------------------------------------------------------------===//
// BIND(C) mangling helpers

View File

@ -26,6 +26,7 @@
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
#include "flang/Optimizer/HLFIR/HLFIROps.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-expr"

View File

@ -57,6 +57,7 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <optional>
#define DEBUG_TYPE "flang-lower-expr"

View File

@ -25,6 +25,7 @@
#include "flang/Optimizer/Builder/Todo.h"
#include "flang/Optimizer/HLFIR/HLFIROps.h"
#include "llvm/ADT/TypeSwitch.h"
#include <optional>
namespace {

View File

@ -38,6 +38,7 @@
#include "flang/Semantics/runtime-type-info.h"
#include "flang/Semantics/tools.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-variable"

View File

@ -16,6 +16,7 @@
#include "flang/Evaluate/tools.h"
#include "flang/Lower/IntrinsicCall.h"
#include "flang/Optimizer/Builder/Todo.h"
#include <optional>
/// Is this a call to MIN or MAX intrinsic with arguments that may be absent at
/// runtime? This is a special case because MIN and MAX can have any number of

View File

@ -23,6 +23,7 @@
#include "flang/Semantics/tools.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-host-assoc"

View File

@ -34,6 +34,7 @@
#include "flang/Semantics/tools.h"
#include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-io"

View File

@ -40,6 +40,7 @@
#include "mlir/Dialect/Math/IR/Math.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-intrinsic"

View File

@ -15,6 +15,7 @@
#include "flang/Lower/AbstractConverter.h"
#include "flang/Lower/Support/Utils.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-iteration-space"

View File

@ -19,6 +19,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/Support/MD5.h"
#include <optional>
// recursively build the vector of module scopes
static void moduleNames(const Fortran::semantics::Scope &scope,

View File

@ -21,6 +21,7 @@
#include "flang/Runtime/time-intrinsic.h"
#include "flang/Semantics/tools.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-runtime"

View File

@ -14,6 +14,7 @@
#include "flang/Optimizer/Builder/Todo.h"
#include "mlir/IR/BuiltinTypes.h"
#include "llvm/Support/Debug.h"
#include <optional>
#define DEBUG_TYPE "flang-lower-symbol-map"

View File

@ -23,6 +23,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
#include <optional>
static llvm::cl::opt<std::size_t>
nameLengthHashSize("length-to-hash-string-literal",

View File

@ -16,6 +16,7 @@
#include "flang/Optimizer/Builder/Todo.h"
#include "flang/Optimizer/HLFIR/HLFIROps.h"
#include "mlir/IR/BlockAndValueMapping.h"
#include <optional>
// Return explicit extents. If the base is a fir.box, this won't read it to
// return the extents and will instead return an empty vector.

View File

@ -29,6 +29,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"
#include <optional>
namespace fir {
#define GEN_PASS_DEF_TARGETREWRITEPASS

View File

@ -19,6 +19,7 @@
#include "mlir/IR/OpImplementation.h"
#include "llvm/ADT/TypeSwitch.h"
#include <tuple>
#include <optional>
//===----------------------------------------------------------------------===//
// DeclareOp

View File

@ -15,6 +15,7 @@
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/Diagnostics.h"
#include "llvm/Support/CommandLine.h"
#include <optional>
static llvm::cl::opt<std::string> mainEntryName(
"main-entry-name",

View File

@ -29,6 +29,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/Debug.h"
#include <optional>
namespace fir {
#define GEN_PASS_DEF_AFFINEDIALECTPROMOTION

View File

@ -17,6 +17,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include <optional>
namespace fir {
#define GEN_PASS_DEF_MEMREFDATAFLOWOPT

View File

@ -40,6 +40,7 @@
#include "llvm/ADT/Optional.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
namespace fir {
#define GEN_PASS_DEF_SIMPLIFYINTRINSICS