[flang] Add #include <optional> (NFC)
authorKazu Hirata <kazu@google.com>
Sun, 8 Jan 2023 04:55:47 +0000 (20:55 -0800)
committerKazu Hirata <kazu@google.com>
Sun, 8 Jan 2023 04:55:47 +0000 (20:55 -0800)
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

33 files changed:
flang/include/flang/Lower/BoxAnalyzer.h
flang/include/flang/Lower/ComponentPath.h
flang/include/flang/Lower/ConvertCall.h
flang/include/flang/Lower/ConvertExpr.h
flang/include/flang/Lower/CustomIntrinsicCall.h
flang/include/flang/Lower/IntrinsicCall.h
flang/include/flang/Lower/IterationSpace.h
flang/include/flang/Lower/SymbolMap.h
flang/include/flang/Optimizer/Builder/FIRBuilder.h
flang/include/flang/Optimizer/Builder/HLFIRTools.h
flang/lib/Frontend/CompilerInvocation.cpp
flang/lib/Lower/Bridge.cpp
flang/lib/Lower/CallInterface.cpp
flang/lib/Lower/ConvertCall.cpp
flang/lib/Lower/ConvertExpr.cpp
flang/lib/Lower/ConvertExprToHLFIR.cpp
flang/lib/Lower/ConvertVariable.cpp
flang/lib/Lower/CustomIntrinsicCall.cpp
flang/lib/Lower/HostAssociations.cpp
flang/lib/Lower/IO.cpp
flang/lib/Lower/IntrinsicCall.cpp
flang/lib/Lower/IterationSpace.cpp
flang/lib/Lower/Mangler.cpp
flang/lib/Lower/Runtime.cpp
flang/lib/Lower/SymbolMap.cpp
flang/lib/Optimizer/Builder/FIRBuilder.cpp
flang/lib/Optimizer/Builder/HLFIRTools.cpp
flang/lib/Optimizer/CodeGen/TargetRewrite.cpp
flang/lib/Optimizer/HLFIR/IR/HLFIROps.cpp
flang/lib/Optimizer/Support/InternalNames.cpp
flang/lib/Optimizer/Transforms/AffinePromotion.cpp
flang/lib/Optimizer/Transforms/MemRefDataFlowOpt.cpp
flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp

index 2543c44..07588e8 100644 (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 {
 
index b95f4a3..fb8395b 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "flang/Lower/IterationSpace.h"
 #include "llvm/ADT/SmallVector.h"
+#include <optional>
 
 namespace fir {
 class ArrayLoadOp;
index c38e486..33008a1 100644 (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 {
 
index 0fa0f57..bf681e9 100644 (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;
index 673c26b..9ae84fd 100644 (file)
@@ -27,6 +27,7 @@
 #include "flang/Lower/AbstractConverter.h"
 #include "llvm/ADT/Optional.h"
 #include <functional>
+#include <optional>
 
 namespace Fortran {
 
index 0846c6d..cd7c7a6 100644 (file)
@@ -11,6 +11,7 @@
 
 #include "flang/Optimizer/Builder/FIRBuilder.h"
 #include "llvm/ADT/Optional.h"
+#include <optional>
 
 namespace fir {
 class ExtendedValue;
index 218e9e1..a7de970 100644 (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;
index 1ad0427..f3450f5 100644 (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 {
 
index 4d89e5b..b44d9fa 100644 (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;
index d83766c..cb37484 100644 (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;
index 33ec6af..b17d197 100644 (file)
@@ -36,6 +36,7 @@
 #include "llvm/Support/Process.h"
 #include "llvm/Support/raw_ostream.h"
 #include <memory>
+#include <optional>
 
 using namespace Fortran::frontend;
 
index fb94218..c5551ff 100644 (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"
 
index bc622f3..41be1b0 100644 (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
index 4b69d97..926f6ce 100644 (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"
 
index 035ccad..bbac1d8 100644 (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"
 
index 481c04f..35d4047 100644 (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 {
 
index 2279d74..b7931ae 100644 (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"
 
index 7772be4..b4fb146 100644 (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
index 1c36b26..90a43bc 100644 (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"
 
index 288878c..d1e9af5 100644 (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"
 
index cdccd45..f6bc94c 100644 (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"
 
index 0bcdae6..c41aa0e 100644 (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"
 
index 5bc8520..0aec674 100644 (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,
index cf6cf06..e0dfdf5 100644 (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"
 
index a8f59ee..ff0c75f 100644 (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"
 
index 50e28e9..a82c218 100644 (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",
index ca645cf..818347e 100644 (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.
index 87206c1..b19bb5e 100644 (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
index ba62f51..2111f50 100644 (file)
@@ -19,6 +19,7 @@
 #include "mlir/IR/OpImplementation.h"
 #include "llvm/ADT/TypeSwitch.h"
 #include <tuple>
+#include <optional>
 
 //===----------------------------------------------------------------------===//
 // DeclareOp
index 8a12bfb..3c455e1 100644 (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",
index 0762b6f..998b063 100644 (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
index 6683912..51e8561 100644 (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
index b1c1f6a..5628f0c 100644 (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