diff --git a/flang/include/flang/ISO_Fortran_binding_wrapper.h b/flang/include/flang/Common/ISO_Fortran_binding_wrapper.h similarity index 72% rename from flang/include/flang/ISO_Fortran_binding_wrapper.h rename to flang/include/flang/Common/ISO_Fortran_binding_wrapper.h index 37289bdbabd03..890522953efe0 100644 --- a/flang/include/flang/ISO_Fortran_binding_wrapper.h +++ b/flang/include/flang/Common/ISO_Fortran_binding_wrapper.h @@ -1,14 +1,13 @@ -/*===-- include/flang/ISO_Fortran_binding_wrapper.h ---------------*- C++ -*-=== +/*===-- include/flang/Common/ISO_Fortran_binding_wrapper.h --------*- C++ -*-=== * * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. * See https://llvm.org/LICENSE.txt for license information. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception * - * ===-----------------------------------------------------------------------=== - */ + *===----------------------------------------------------------------------===*/ -#ifndef FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_ -#define FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_ +#ifndef FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_ +#define FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_ /* A thin wrapper around flang/include/ISO_Fortran_binding.h * This header file must be included when ISO_Fortran_binding.h @@ -23,17 +22,17 @@ /* clang-format off */ #include -#include "Common/api-attrs.h" +#include "api-attrs.h" #ifdef __cplusplus namespace Fortran { namespace ISO { #define FORTRAN_ISO_NAMESPACE_ ::Fortran::ISO #endif /* __cplusplus */ -#include "ISO_Fortran_binding.h" +#include "flang/ISO_Fortran_binding.h" #ifdef __cplusplus } // namespace ISO } // namespace Fortran #endif /* __cplusplus */ /* clang-format on */ -#endif /* FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_ */ +#endif /* FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_ */ diff --git a/flang/include/flang/Common/erfc-scaled.h b/flang/include/flang/Common/erfc-scaled.h index a1bf3ea0f0925..88e2183c15d03 100644 --- a/flang/include/flang/Common/erfc-scaled.h +++ b/flang/include/flang/Common/erfc-scaled.h @@ -9,6 +9,9 @@ #ifndef FORTRAN_COMMON_ERFC_SCALED_H_ #define FORTRAN_COMMON_ERFC_SCALED_H_ +#include +#include + namespace Fortran::common { template inline T ErfcScaled(T arg) { // Coefficients for approximation to erfc in the first interval. diff --git a/flang/include/flang/Common/fast-int-set.h b/flang/include/flang/Common/fast-int-set.h index d1c9c756a44a6..1214bac75a4bf 100644 --- a/flang/include/flang/Common/fast-int-set.h +++ b/flang/include/flang/Common/fast-int-set.h @@ -24,7 +24,7 @@ #ifndef FORTRAN_COMMON_FAST_INT_SET_H_ #define FORTRAN_COMMON_FAST_INT_SET_H_ -#include +#include "optional.h" namespace Fortran::common { @@ -83,9 +83,9 @@ template class FastIntSet { } } - std::optional PopValue() { + optional PopValue() { if (IsEmpty()) { - return std::nullopt; + return nullopt; } else { return value_[--size_]; } diff --git a/flang/include/flang/Common/format.h b/flang/include/flang/Common/format.h index c5e9fb06e260f..da416506ffb5d 100644 --- a/flang/include/flang/Common/format.h +++ b/flang/include/flang/Common/format.h @@ -9,8 +9,8 @@ #ifndef FORTRAN_COMMON_FORMAT_H_ #define FORTRAN_COMMON_FORMAT_H_ +#include "Fortran-consts.h" #include "enum-set.h" -#include "flang/Common/Fortran-consts.h" #include // Define a FormatValidator class template to validate a format expression diff --git a/flang/include/flang/Common/optional.h b/flang/include/flang/Common/optional.h index c0f4278009f40..c7c81f40cc8c8 100644 --- a/flang/include/flang/Common/optional.h +++ b/flang/include/flang/Common/optional.h @@ -26,7 +26,7 @@ #ifndef FORTRAN_COMMON_OPTIONAL_H #define FORTRAN_COMMON_OPTIONAL_H -#include "flang/Common/api-attrs.h" +#include "api-attrs.h" #include #include diff --git a/flang/include/flang/Common/real.h b/flang/include/flang/Common/real.h index b527deda0e3b4..b47ba46581db6 100644 --- a/flang/include/flang/Common/real.h +++ b/flang/include/flang/Common/real.h @@ -13,7 +13,7 @@ // The various representations are distinguished by their binary precisions // (number of explicit significand bits and any implicit MSB in the fraction). -#include "flang/Common/api-attrs.h" +#include "api-attrs.h" #include namespace Fortran::common { diff --git a/flang/include/flang/Common/reference-wrapper.h b/flang/include/flang/Common/reference-wrapper.h index 2983754108f95..85b2c6d5abce3 100644 --- a/flang/include/flang/Common/reference-wrapper.h +++ b/flang/include/flang/Common/reference-wrapper.h @@ -25,7 +25,7 @@ #ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H #define FORTRAN_COMMON_REFERENCE_WRAPPER_H -#include "flang/Common/api-attrs.h" +#include "api-attrs.h" #include #include diff --git a/flang/include/flang/Common/restorer.h b/flang/include/flang/Common/restorer.h index 0f1bc48620d37..c18c13e351c76 100644 --- a/flang/include/flang/Common/restorer.h +++ b/flang/include/flang/Common/restorer.h @@ -18,8 +18,8 @@ #ifndef FORTRAN_COMMON_RESTORER_H_ #define FORTRAN_COMMON_RESTORER_H_ +#include "api-attrs.h" #include "idioms.h" -#include "flang/Common/api-attrs.h" namespace Fortran::common { template class Restorer { public: diff --git a/flang/include/flang/Common/target-rounding.h b/flang/include/flang/Common/target-rounding.h index c0c9f6c49b26a..f503b22930ed4 100644 --- a/flang/include/flang/Common/target-rounding.h +++ b/flang/include/flang/Common/target-rounding.h @@ -9,8 +9,8 @@ #ifndef FORTRAN_COMMON_TARGET_ROUNDING_H_ #define FORTRAN_COMMON_TARGET_ROUNDING_H_ -#include "flang/Common/Fortran-consts.h" -#include "flang/Common/enum-set.h" +#include "Fortran-consts.h" +#include "enum-set.h" namespace Fortran::common { diff --git a/flang/include/flang/Common/template.h b/flang/include/flang/Common/template.h index 51d09fb42ce36..6501994133759 100644 --- a/flang/include/flang/Common/template.h +++ b/flang/include/flang/Common/template.h @@ -9,8 +9,8 @@ #ifndef FORTRAN_COMMON_TEMPLATE_H_ #define FORTRAN_COMMON_TEMPLATE_H_ +#include "idioms.h" #include "variant.h" -#include "flang/Common/idioms.h" #include #include #include diff --git a/flang/include/flang/Common/uint128.h b/flang/include/flang/Common/uint128.h index 821c8c3b08a52..faecb88737a0b 100644 --- a/flang/include/flang/Common/uint128.h +++ b/flang/include/flang/Common/uint128.h @@ -19,8 +19,8 @@ #define AVOID_NATIVE_UINT128_T 0 #endif +#include "api-attrs.h" #include "leading-zero-bit-count.h" -#include "flang/Common/api-attrs.h" #include #include diff --git a/flang/include/flang/Common/visit.h b/flang/include/flang/Common/visit.h index ad66297650b09..1a84102b56642 100644 --- a/flang/include/flang/Common/visit.h +++ b/flang/include/flang/Common/visit.h @@ -21,8 +21,8 @@ #ifndef FORTRAN_COMMON_VISIT_H_ #define FORTRAN_COMMON_VISIT_H_ +#include "api-attrs.h" #include "variant.h" -#include "flang/Common/api-attrs.h" #include namespace Fortran::common { diff --git a/flang/include/flang/Evaluate/call.h b/flang/include/flang/Evaluate/call.h index 63277438128eb..2a5929b873d74 100644 --- a/flang/include/flang/Evaluate/call.h +++ b/flang/include/flang/Evaluate/call.h @@ -13,11 +13,11 @@ #include "constant.h" #include "formatting.h" #include "type.h" -#include "flang/Common/Fortran.h" #include "flang/Common/indirection.h" #include "flang/Common/reference.h" #include "flang/Parser/char-block.h" #include "flang/Semantics/attr.h" +#include "flang/Support/Fortran.h" #include #include diff --git a/flang/include/flang/Evaluate/characteristics.h b/flang/include/flang/Evaluate/characteristics.h index 5cae8a68f599b..3aa980db5d931 100644 --- a/flang/include/flang/Evaluate/characteristics.h +++ b/flang/include/flang/Evaluate/characteristics.h @@ -18,13 +18,13 @@ #include "shape.h" #include "tools.h" #include "type.h" -#include "flang/Common/Fortran-features.h" -#include "flang/Common/Fortran.h" #include "flang/Common/enum-set.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" #include "flang/Parser/char-block.h" #include "flang/Semantics/symbol.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/Fortran.h" #include #include #include diff --git a/flang/include/flang/Evaluate/common.h b/flang/include/flang/Evaluate/common.h index 915e95169c7f8..993540aebca57 100644 --- a/flang/include/flang/Evaluate/common.h +++ b/flang/include/flang/Evaluate/common.h @@ -9,9 +9,6 @@ #ifndef FORTRAN_EVALUATE_COMMON_H_ #define FORTRAN_EVALUATE_COMMON_H_ -#include "flang/Common/Fortran-features.h" -#include "flang/Common/Fortran.h" -#include "flang/Common/default-kinds.h" #include "flang/Common/enum-set.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" @@ -19,6 +16,9 @@ #include "flang/Common/target-rounding.h" #include "flang/Parser/char-block.h" #include "flang/Parser/message.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/Fortran.h" +#include "flang/Support/default-kinds.h" #include #include #include diff --git a/flang/include/flang/Evaluate/constant.h b/flang/include/flang/Evaluate/constant.h index 61a814446bbfd..6fc22e3b86aa2 100644 --- a/flang/include/flang/Evaluate/constant.h +++ b/flang/include/flang/Evaluate/constant.h @@ -11,8 +11,8 @@ #include "formatting.h" #include "type.h" -#include "flang/Common/default-kinds.h" #include "flang/Common/reference.h" +#include "flang/Support/default-kinds.h" #include #include diff --git a/flang/include/flang/Evaluate/expression.h b/flang/include/flang/Evaluate/expression.h index 04f4406fc8a2c..1203fca8640a6 100644 --- a/flang/include/flang/Evaluate/expression.h +++ b/flang/include/flang/Evaluate/expression.h @@ -21,11 +21,11 @@ #include "formatting.h" #include "type.h" #include "variable.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" #include "flang/Common/template.h" #include "flang/Parser/char-block.h" +#include "flang/Support/Fortran.h" #include #include #include diff --git a/flang/include/flang/Evaluate/intrinsics.h b/flang/include/flang/Evaluate/intrinsics.h index 15afb772ae767..dbe1ba7fe7ec1 100644 --- a/flang/include/flang/Evaluate/intrinsics.h +++ b/flang/include/flang/Evaluate/intrinsics.h @@ -12,9 +12,9 @@ #include "call.h" #include "characteristics.h" #include "type.h" -#include "flang/Common/default-kinds.h" #include "flang/Parser/char-block.h" #include "flang/Parser/message.h" +#include "flang/Support/default-kinds.h" #include #include #include diff --git a/flang/include/flang/Evaluate/target.h b/flang/include/flang/Evaluate/target.h index e07f916b875e0..f4595dfe4e433 100644 --- a/flang/include/flang/Evaluate/target.h +++ b/flang/include/flang/Evaluate/target.h @@ -12,11 +12,11 @@ #ifndef FORTRAN_EVALUATE_TARGET_H_ #define FORTRAN_EVALUATE_TARGET_H_ -#include "flang/Common/Fortran.h" #include "flang/Common/enum-class.h" #include "flang/Common/enum-set.h" #include "flang/Common/target-rounding.h" #include "flang/Evaluate/common.h" +#include "flang/Support/Fortran.h" #include namespace Fortran::evaluate { diff --git a/flang/include/flang/Evaluate/type.h b/flang/include/flang/Evaluate/type.h index a4afe49d6077a..cfb162f040e8a 100644 --- a/flang/include/flang/Evaluate/type.h +++ b/flang/include/flang/Evaluate/type.h @@ -22,11 +22,11 @@ #include "integer.h" #include "logical.h" #include "real.h" -#include "flang/Common/Fortran-features.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Common/real.h" #include "flang/Common/template.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/Fortran.h" #include #include #include diff --git a/flang/include/flang/Frontend/CompilerInvocation.h b/flang/include/flang/Frontend/CompilerInvocation.h index 7d3f0bdf2e510..9e6724be33033 100644 --- a/flang/include/flang/Frontend/CompilerInvocation.h +++ b/flang/include/flang/Frontend/CompilerInvocation.h @@ -13,7 +13,6 @@ #ifndef FORTRAN_FRONTEND_COMPILERINVOCATION_H #define FORTRAN_FRONTEND_COMPILERINVOCATION_H -#include "flang/Common/LangOptions.h" #include "flang/Frontend/CodeGenOptions.h" #include "flang/Frontend/FrontendOptions.h" #include "flang/Frontend/PreprocessorOptions.h" @@ -21,6 +20,7 @@ #include "flang/Lower/LoweringOptions.h" #include "flang/Parser/parsing.h" #include "flang/Semantics/semantics.h" +#include "flang/Support/LangOptions.h" #include "mlir/Support/Timing.h" #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticOptions.h" diff --git a/flang/include/flang/Frontend/FrontendOptions.h b/flang/include/flang/Frontend/FrontendOptions.h index a4cb021e309d4..0bd2e621813ca 100644 --- a/flang/include/flang/Frontend/FrontendOptions.h +++ b/flang/include/flang/Frontend/FrontendOptions.h @@ -13,10 +13,10 @@ #ifndef FORTRAN_FRONTEND_FRONTENDOPTIONS_H #define FORTRAN_FRONTEND_FRONTENDOPTIONS_H -#include "flang/Common/Fortran-features.h" #include "flang/Lower/EnvironmentDefault.h" #include "flang/Parser/characters.h" #include "flang/Parser/unparse.h" +#include "flang/Support/Fortran-features.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/MemoryBuffer.h" #include diff --git a/flang/include/flang/ISO_Fortran_binding.h b/flang/include/flang/ISO_Fortran_binding.h index 945f8fef89f0b..f5b8d0d2ea610 100644 --- a/flang/include/flang/ISO_Fortran_binding.h +++ b/flang/include/flang/ISO_Fortran_binding.h @@ -14,7 +14,7 @@ * it does so by means of a wrapper header that establishes namespaces and * a macro for extra function attributes (RT_API_ATTRS). */ -#ifndef FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_ +#ifndef FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_ #include #define FORTRAN_ISO_NAMESPACE_ #endif diff --git a/flang/include/flang/Lower/AbstractConverter.h b/flang/include/flang/Lower/AbstractConverter.h index c24f43737df50..3d2b805da6f47 100644 --- a/flang/include/flang/Lower/AbstractConverter.h +++ b/flang/include/flang/Lower/AbstractConverter.h @@ -13,12 +13,12 @@ #ifndef FORTRAN_LOWER_ABSTRACTCONVERTER_H #define FORTRAN_LOWER_ABSTRACTCONVERTER_H -#include "flang/Common/Fortran.h" #include "flang/Lower/LoweringOptions.h" #include "flang/Lower/PFTDefs.h" #include "flang/Optimizer/Builder/BoxValue.h" #include "flang/Optimizer/Dialect/FIRAttr.h" #include "flang/Semantics/symbol.h" +#include "flang/Support/Fortran.h" #include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/Operation.h" diff --git a/flang/include/flang/Lower/Bridge.h b/flang/include/flang/Lower/Bridge.h index 6404a16f7785a..a8c2bcfda31c1 100644 --- a/flang/include/flang/Lower/Bridge.h +++ b/flang/include/flang/Lower/Bridge.h @@ -13,7 +13,6 @@ #ifndef FORTRAN_LOWER_BRIDGE_H #define FORTRAN_LOWER_BRIDGE_H -#include "flang/Common/Fortran.h" #include "flang/Frontend/CodeGenOptions.h" #include "flang/Frontend/TargetOptions.h" #include "flang/Lower/AbstractConverter.h" @@ -22,6 +21,7 @@ #include "flang/Lower/StatementContext.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Dialect/Support/KindMapping.h" +#include "flang/Support/Fortran.h" #include "mlir/IR/BuiltinOps.h" #include "mlir/IR/OwningOpRef.h" #include diff --git a/flang/include/flang/Lower/ConvertType.h b/flang/include/flang/Lower/ConvertType.h index 7a3f92649a4e4..179a682584046 100644 --- a/flang/include/flang/Lower/ConvertType.h +++ b/flang/include/flang/Lower/ConvertType.h @@ -21,8 +21,8 @@ #ifndef FORTRAN_LOWER_CONVERT_TYPE_H #define FORTRAN_LOWER_CONVERT_TYPE_H -#include "flang/Common/Fortran.h" #include "flang/Evaluate/type.h" +#include "flang/Support/Fortran.h" #include "mlir/IR/BuiltinTypes.h" namespace mlir { diff --git a/flang/include/flang/Lower/LoweringOptions.h b/flang/include/flang/Lower/LoweringOptions.h index 8105ccd7ef6b1..171510393b816 100644 --- a/flang/include/flang/Lower/LoweringOptions.h +++ b/flang/include/flang/Lower/LoweringOptions.h @@ -15,7 +15,7 @@ #ifndef FLANG_LOWER_LOWERINGOPTIONS_H #define FLANG_LOWER_LOWERINGOPTIONS_H -#include "flang/Common/MathOptionsBase.h" +#include "flang/Support/MathOptionsBase.h" namespace Fortran::lower { diff --git a/flang/include/flang/Optimizer/Builder/FIRBuilder.h b/flang/include/flang/Optimizer/Builder/FIRBuilder.h index f2252d04079cf..c8acdac6cafbe 100644 --- a/flang/include/flang/Optimizer/Builder/FIRBuilder.h +++ b/flang/include/flang/Optimizer/Builder/FIRBuilder.h @@ -16,12 +16,12 @@ #ifndef FORTRAN_OPTIMIZER_BUILDER_FIRBUILDER_H #define FORTRAN_OPTIMIZER_BUILDER_FIRBUILDER_H -#include "flang/Common/MathOptionsBase.h" #include "flang/Optimizer/Dialect/FIROps.h" #include "flang/Optimizer/Dialect/FIROpsSupport.h" #include "flang/Optimizer/Dialect/FIRType.h" #include "flang/Optimizer/Dialect/Support/FIRContext.h" #include "flang/Optimizer/Dialect/Support/KindMapping.h" +#include "flang/Support/MathOptionsBase.h" #include "mlir/IR/Builders.h" #include "mlir/IR/BuiltinOps.h" #include "llvm/ADT/DenseMap.h" diff --git a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h index 116b927a86a7a..1ffc354d6b80f 100644 --- a/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h +++ b/flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h @@ -17,12 +17,12 @@ #ifndef FORTRAN_OPTIMIZER_BUILDER_RUNTIME_RTBUILDER_H #define FORTRAN_OPTIMIZER_BUILDER_RUNTIME_RTBUILDER_H -#include "flang/Common/Fortran.h" #include "flang/Common/uint128.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Dialect/FIRDialect.h" #include "flang/Optimizer/Dialect/FIRType.h" #include "flang/Runtime/reduce.h" +#include "flang/Support/Fortran.h" #include "mlir/IR/BuiltinTypes.h" #include "mlir/IR/MLIRContext.h" #include "llvm/ADT/SmallVector.h" diff --git a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h index 9cccf8db87270..b9a8a670d0793 100644 --- a/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h +++ b/flang/include/flang/Optimizer/CodeGen/DescriptorModel.h @@ -22,7 +22,7 @@ #ifndef OPTIMIZER_DESCRIPTOR_MODEL_H #define OPTIMIZER_DESCRIPTOR_MODEL_H -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/descriptor-consts.h" #include "mlir/Dialect/LLVMIR/LLVMTypes.h" #include "mlir/IR/BuiltinTypes.h" diff --git a/flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h b/flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h index f32e39b543e3f..85615a4d69157 100644 --- a/flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h +++ b/flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h @@ -13,7 +13,7 @@ #ifndef FORTRAN_OPTIMIZER_DIALECT_CUF_CUFATTR_H #define FORTRAN_OPTIMIZER_DIALECT_CUF_CUFATTR_H -#include "flang/Common/Fortran.h" +#include "flang/Support/Fortran.h" #include "mlir/IR/BuiltinAttributes.h" namespace llvm { diff --git a/flang/include/flang/Optimizer/Support/TypeCode.h b/flang/include/flang/Optimizer/Support/TypeCode.h index 308c82118d502..ec21d672287e6 100644 --- a/flang/include/flang/Optimizer/Support/TypeCode.h +++ b/flang/include/flang/Optimizer/Support/TypeCode.h @@ -13,7 +13,7 @@ #ifndef FORTRAN_OPTIMIZER_SUPPORT_TYPECODE_H #define FORTRAN_OPTIMIZER_SUPPORT_TYPECODE_H -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "llvm/Support/ErrorHandling.h" namespace fir { diff --git a/flang/include/flang/Optimizer/Support/Utils.h b/flang/include/flang/Optimizer/Support/Utils.h index d507f4116efb7..ec73af6ec72e9 100644 --- a/flang/include/flang/Optimizer/Support/Utils.h +++ b/flang/include/flang/Optimizer/Support/Utils.h @@ -13,13 +13,13 @@ #ifndef FORTRAN_OPTIMIZER_SUPPORT_UTILS_H #define FORTRAN_OPTIMIZER_SUPPORT_UTILS_H -#include "flang/Common/default-kinds.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Builder/Todo.h" #include "flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h" #include "flang/Optimizer/Dialect/FIROps.h" #include "flang/Optimizer/Dialect/FIRType.h" #include "flang/Optimizer/Support/FatalError.h" +#include "flang/Support/default-kinds.h" #include "mlir/Dialect/Arith/IR/Arith.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/IR/BuiltinAttributes.h" diff --git a/flang/include/flang/Parser/dump-parse-tree.h b/flang/include/flang/Parser/dump-parse-tree.h index 3e4e909cdec9a..21ee1d0517840 100644 --- a/flang/include/flang/Parser/dump-parse-tree.h +++ b/flang/include/flang/Parser/dump-parse-tree.h @@ -14,9 +14,9 @@ #include "parse-tree.h" #include "tools.h" #include "unparse.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" +#include "flang/Support/Fortran.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/include/flang/Parser/message.h b/flang/include/flang/Parser/message.h index bc38f571ca3df..e19b16c23b82b 100644 --- a/flang/include/flang/Parser/message.h +++ b/flang/include/flang/Parser/message.h @@ -15,10 +15,10 @@ #include "char-block.h" #include "char-set.h" #include "provenance.h" -#include "flang/Common/Fortran-features.h" #include "flang/Common/idioms.h" #include "flang/Common/reference-counted.h" #include "flang/Common/restorer.h" +#include "flang/Support/Fortran-features.h" #include #include #include diff --git a/flang/include/flang/Parser/parse-state.h b/flang/include/flang/Parser/parse-state.h index 76cbb3470dc08..36d70b81b7923 100644 --- a/flang/include/flang/Parser/parse-state.h +++ b/flang/include/flang/Parser/parse-state.h @@ -16,11 +16,11 @@ // and recovery during parsing! #include "user-state.h" -#include "flang/Common/Fortran-features.h" #include "flang/Common/idioms.h" #include "flang/Parser/characters.h" #include "flang/Parser/message.h" #include "flang/Parser/provenance.h" +#include "flang/Support/Fortran-features.h" #include #include #include diff --git a/flang/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h index d7b1ae9893c03..c3a02fca5ade8 100644 --- a/flang/include/flang/Parser/parse-tree.h +++ b/flang/include/flang/Parser/parse-tree.h @@ -22,9 +22,9 @@ #include "format-specification.h" #include "message.h" #include "provenance.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" +#include "flang/Support/Fortran.h" #include "llvm/Frontend/OpenACC/ACC.h.inc" #include "llvm/Frontend/OpenMP/OMP.h" #include "llvm/Frontend/OpenMP/OMPConstants.h" diff --git a/flang/include/flang/Parser/parsing.h b/flang/include/flang/Parser/parsing.h index 0c774decb16d3..116b6bd6f191f 100644 --- a/flang/include/flang/Parser/parsing.h +++ b/flang/include/flang/Parser/parsing.h @@ -14,8 +14,8 @@ #include "message.h" #include "parse-tree.h" #include "provenance.h" -#include "flang/Common/Fortran-features.h" #include "flang/Parser/preprocessor.h" +#include "flang/Support/Fortran-features.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/include/flang/Parser/user-state.h b/flang/include/flang/Parser/user-state.h index 61745a833c715..129f9fb8fee05 100644 --- a/flang/include/flang/Parser/user-state.h +++ b/flang/include/flang/Parser/user-state.h @@ -14,10 +14,10 @@ // parse tree construction so as to avoid any need for representing // state in static data. -#include "flang/Common/Fortran-features.h" #include "flang/Common/idioms.h" #include "flang/Parser/char-block.h" #include "flang/Parser/parse-tree.h" +#include "flang/Support/Fortran-features.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/include/flang/Runtime/descriptor-consts.h b/flang/include/flang/Runtime/descriptor-consts.h index 3b2537579d586..abcdbc4a12002 100644 --- a/flang/include/flang/Runtime/descriptor-consts.h +++ b/flang/include/flang/Runtime/descriptor-consts.h @@ -9,8 +9,8 @@ #ifndef FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ #define FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Common/api-attrs.h" -#include "flang/ISO_Fortran_binding_wrapper.h" #include #include diff --git a/flang/include/flang/Runtime/descriptor.h b/flang/include/flang/Runtime/descriptor.h index dd36fba157ca9..628ac8c927a51 100644 --- a/flang/include/flang/Runtime/descriptor.h +++ b/flang/include/flang/Runtime/descriptor.h @@ -18,7 +18,7 @@ // User C code is welcome to depend on that ISO_Fortran_binding.h file, // but should never reference this internal header. -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/descriptor-consts.h" #include "flang/Runtime/memory.h" #include "flang/Runtime/type-code.h" diff --git a/flang/include/flang/Runtime/random.h b/flang/include/flang/Runtime/random.h index 269297dff47db..1f01be1aa9ffa 100644 --- a/flang/include/flang/Runtime/random.h +++ b/flang/include/flang/Runtime/random.h @@ -8,6 +8,9 @@ // Intrinsic subroutines RANDOM_INIT, RANDOM_NUMBER, and RANDOM_SEED. +#ifndef FORTRAN_RUNTIME_RANDOM_H_ +#define FORTRAN_RUNTIME_RANDOM_H_ + #include "flang/Runtime/entry-names.h" #include @@ -35,3 +38,5 @@ void RTNAME(RandomSeed)(const Descriptor *size, const Descriptor *put, } // extern "C" } // namespace Fortran::runtime + +#endif // FORTRAN_RUNTIME_RANDOM_H_ diff --git a/flang/include/flang/Runtime/support.h b/flang/include/flang/Runtime/support.h index ba9c2598bb0dd..4a6d4357e8710 100644 --- a/flang/include/flang/Runtime/support.h +++ b/flang/include/flang/Runtime/support.h @@ -10,7 +10,7 @@ #ifndef FORTRAN_RUNTIME_SUPPORT_H_ #define FORTRAN_RUNTIME_SUPPORT_H_ -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/entry-names.h" #include #include diff --git a/flang/include/flang/Runtime/type-code.h b/flang/include/flang/Runtime/type-code.h index dd3a9f2690ee7..ae854ed2145e4 100644 --- a/flang/include/flang/Runtime/type-code.h +++ b/flang/include/flang/Runtime/type-code.h @@ -10,8 +10,8 @@ #define FORTRAN_RUNTIME_TYPE_CODE_H_ #include "flang/Common/Fortran-consts.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Common/optional.h" -#include "flang/ISO_Fortran_binding_wrapper.h" #include namespace Fortran::runtime { diff --git a/flang/include/flang/Semantics/expression.h b/flang/include/flang/Semantics/expression.h index b95ceebc5e8e4..ce253e6f52e8f 100644 --- a/flang/include/flang/Semantics/expression.h +++ b/flang/include/flang/Semantics/expression.h @@ -10,7 +10,6 @@ #define FORTRAN_SEMANTICS_EXPRESSION_H_ #include "semantics.h" -#include "flang/Common/Fortran.h" #include "flang/Common/indirection.h" #include "flang/Common/restorer.h" #include "flang/Common/visit.h" @@ -24,6 +23,7 @@ #include "flang/Parser/parse-tree-visitor.h" #include "flang/Parser/parse-tree.h" #include "flang/Parser/tools.h" +#include "flang/Support/Fortran.h" #include #include #include diff --git a/flang/include/flang/Semantics/scope.h b/flang/include/flang/Semantics/scope.h index b3b033a5a3ae3..b4046830522b8 100644 --- a/flang/include/flang/Semantics/scope.h +++ b/flang/include/flang/Semantics/scope.h @@ -11,11 +11,11 @@ #include "attr.h" #include "symbol.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Common/reference.h" #include "flang/Parser/message.h" #include "flang/Parser/provenance.h" +#include "flang/Support/Fortran.h" #include #include #include diff --git a/flang/include/flang/Semantics/semantics.h b/flang/include/flang/Semantics/semantics.h index 821ce021b3226..730513dbe3232 100644 --- a/flang/include/flang/Semantics/semantics.h +++ b/flang/include/flang/Semantics/semantics.h @@ -13,12 +13,12 @@ #include "program-tree.h" #include "scope.h" #include "symbol.h" -#include "flang/Common/Fortran-features.h" -#include "flang/Common/LangOptions.h" #include "flang/Evaluate/common.h" #include "flang/Evaluate/intrinsics.h" #include "flang/Evaluate/target.h" #include "flang/Parser/message.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/LangOptions.h" #include #include #include diff --git a/flang/include/flang/Semantics/symbol.h b/flang/include/flang/Semantics/symbol.h index 235fade1ed937..4ae2775c0f849 100644 --- a/flang/include/flang/Semantics/symbol.h +++ b/flang/include/flang/Semantics/symbol.h @@ -10,11 +10,11 @@ #define FORTRAN_SEMANTICS_SYMBOL_H_ #include "type.h" -#include "flang/Common/Fortran.h" #include "flang/Common/enum-set.h" #include "flang/Common/reference.h" #include "flang/Common/visit.h" #include "flang/Semantics/module-dependences.h" +#include "flang/Support/Fortran.h" #include "llvm/ADT/DenseMapInfo.h" #include diff --git a/flang/include/flang/Semantics/tools.h b/flang/include/flang/Semantics/tools.h index 87ddd38e5ae65..e82446a2ba884 100644 --- a/flang/include/flang/Semantics/tools.h +++ b/flang/include/flang/Semantics/tools.h @@ -12,7 +12,6 @@ // Simple predicates and look-up functions that are best defined // canonically for use in semantic checking. -#include "flang/Common/Fortran.h" #include "flang/Common/visit.h" #include "flang/Evaluate/expression.h" #include "flang/Evaluate/shape.h" @@ -23,6 +22,7 @@ #include "flang/Semantics/attr.h" #include "flang/Semantics/expression.h" #include "flang/Semantics/semantics.h" +#include "flang/Support/Fortran.h" #include namespace Fortran::semantics { diff --git a/flang/include/flang/Semantics/type.h b/flang/include/flang/Semantics/type.h index 3522191502059..5d96f1e89bf52 100644 --- a/flang/include/flang/Semantics/type.h +++ b/flang/include/flang/Semantics/type.h @@ -9,10 +9,10 @@ #ifndef FORTRAN_SEMANTICS_TYPE_H_ #define FORTRAN_SEMANTICS_TYPE_H_ -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Evaluate/expression.h" #include "flang/Parser/char-block.h" +#include "flang/Support/Fortran.h" #include #include #include diff --git a/flang/include/flang/Common/Fortran-features.h b/flang/include/flang/Support/Fortran-features.h similarity index 96% rename from flang/include/flang/Common/Fortran-features.h rename to flang/include/flang/Support/Fortran-features.h index e2a420ae826bc..44ba6428e6c93 100644 --- a/flang/include/flang/Common/Fortran-features.h +++ b/flang/include/flang/Support/Fortran-features.h @@ -1,4 +1,4 @@ -//===-- include/flang/Common/Fortran-features.h -----------------*- C++ -*-===// +//===-- include/flang/Support/Fortran-features.h ----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_FORTRAN_FEATURES_H_ -#define FORTRAN_COMMON_FORTRAN_FEATURES_H_ +#ifndef FORTRAN_SUPPORT_FORTRAN_FEATURES_H_ +#define FORTRAN_SUPPORT_FORTRAN_FEATURES_H_ -#include "flang/Common/Fortran.h" +#include "Fortran.h" #include "flang/Common/enum-set.h" #include "flang/Common/idioms.h" #include @@ -126,4 +126,4 @@ class LanguageFeatureControl { bool warnAllUsage_{false}; }; } // namespace Fortran::common -#endif // FORTRAN_COMMON_FORTRAN_FEATURES_H_ +#endif // FORTRAN_SUPPORT_FORTRAN_FEATURES_H_ diff --git a/flang/include/flang/Common/Fortran.h b/flang/include/flang/Support/Fortran.h similarity index 94% rename from flang/include/flang/Common/Fortran.h rename to flang/include/flang/Support/Fortran.h index e1922f7654bb1..6e6e37ba594be 100644 --- a/flang/include/flang/Common/Fortran.h +++ b/flang/include/flang/Support/Fortran.h @@ -1,4 +1,4 @@ -//===-- include/flang/Common/Fortran.h --------------------------*- C++ -*-===// +//===-- include/flang/Support/Fortran.h -------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,15 +6,15 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_FORTRAN_H_ -#define FORTRAN_COMMON_FORTRAN_H_ +#ifndef FORTRAN_SUPPORT_FORTRAN_H_ +#define FORTRAN_SUPPORT_FORTRAN_H_ // Fortran language concepts that are used in many phases are defined // once here to avoid redundancy and needless translation. -#include "enum-set.h" -#include "idioms.h" #include "flang/Common/Fortran-consts.h" +#include "flang/Common/enum-set.h" +#include "flang/Common/idioms.h" #include #include #include @@ -109,4 +109,4 @@ inline std::string GetExternalAssemblyName( } } // namespace Fortran::common -#endif // FORTRAN_COMMON_FORTRAN_H_ +#endif // FORTRAN_SUPPORT_FORTRAN_H_ diff --git a/flang/include/flang/Common/LangOptions.def b/flang/include/flang/Support/LangOptions.def similarity index 100% rename from flang/include/flang/Common/LangOptions.def rename to flang/include/flang/Support/LangOptions.def diff --git a/flang/include/flang/Common/LangOptions.h b/flang/include/flang/Support/LangOptions.h similarity index 87% rename from flang/include/flang/Common/LangOptions.h rename to flang/include/flang/Support/LangOptions.h index 83f25cfbe2614..fac6fb92df85a 100644 --- a/flang/include/flang/Common/LangOptions.h +++ b/flang/include/flang/Support/LangOptions.h @@ -1,4 +1,4 @@ -//===------ LangOptions.h ---------------------------------------*- C++ -*-===// +//===-- include/flang/Support/LangOptions.h ---------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,8 +12,8 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_LANGOPTIONS_H -#define FORTRAN_COMMON_LANGOPTIONS_H +#ifndef FORTRAN_SUPPORT_LANGOPTIONS_H_ +#define FORTRAN_SUPPORT_LANGOPTIONS_H_ #include #include @@ -45,12 +45,12 @@ class LangOptionsBase { #define LANGOPT(Name, Bits, Default) unsigned Name : Bits; #define ENUM_LANGOPT(Name, Type, Bits, Default) -#include "flang/Common/LangOptions.def" +#include "LangOptions.def" protected: #define LANGOPT(Name, Bits, Default) #define ENUM_LANGOPT(Name, Type, Bits, Default) unsigned Name : Bits; -#include "flang/Common/LangOptions.def" +#include "LangOptions.def" }; /// Tracks various options which control the dialect of Fortran that is @@ -63,7 +63,7 @@ class LangOptions : public LangOptionsBase { #define ENUM_LANGOPT(Name, Type, Bits, Default) \ Type get##Name() const { return static_cast(Name); } \ void set##Name(Type Value) { Name = static_cast(Value); } -#include "flang/Common/LangOptions.def" +#include "LangOptions.def" /// Name of the IR file that contains the result of the OpenMP target /// host code generation. @@ -77,4 +77,4 @@ class LangOptions : public LangOptionsBase { } // end namespace Fortran::common -#endif // FORTRAN_COMMON_LANGOPTIONS_H +#endif // FORTRAN_SUPPORT_LANGOPTIONS_H_ diff --git a/flang/include/flang/Common/MathOptionsBase.def b/flang/include/flang/Support/MathOptionsBase.def similarity index 100% rename from flang/include/flang/Common/MathOptionsBase.def rename to flang/include/flang/Support/MathOptionsBase.def diff --git a/flang/include/flang/Common/MathOptionsBase.h b/flang/include/flang/Support/MathOptionsBase.h similarity index 77% rename from flang/include/flang/Common/MathOptionsBase.h rename to flang/include/flang/Support/MathOptionsBase.h index 7f8ebdbee1987..a2bea3c598a8c 100644 --- a/flang/include/flang/Common/MathOptionsBase.h +++ b/flang/include/flang/Support/MathOptionsBase.h @@ -1,4 +1,4 @@ -//===- MathOptionsBase.h - Math options config ------------------*- C++ -*-===// +//===-- include/flang/Support/MathOptionsBase.h -----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -14,8 +14,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_MATHOPTIONSBASE_H -#define FORTRAN_COMMON_MATHOPTIONSBASE_H +#ifndef FORTRAN_SUPPORT_MATHOPTIONSBASE_H_ +#define FORTRAN_SUPPORT_MATHOPTIONSBASE_H_ namespace Fortran::common { @@ -27,18 +27,18 @@ class MathOptionsBase { Name = static_cast(Value); \ return *this; \ } -#include "flang/Common/MathOptionsBase.def" +#include "MathOptionsBase.def" MathOptionsBase() { #define ENUM_MATHOPT(Name, Type, Bits, Default) set##Name(Default); -#include "flang/Common/MathOptionsBase.def" +#include "MathOptionsBase.def" } private: #define ENUM_MATHOPT(Name, Type, Bits, Default) unsigned Name : Bits; -#include "flang/Common/MathOptionsBase.def" +#include "MathOptionsBase.def" }; } // namespace Fortran::common -#endif // FORTRAN_COMMON_MATHOPTIONSBASE_H +#endif // FORTRAN_SUPPORT_MATHOPTIONSBASE_H_ diff --git a/flang/include/flang/Common/OpenMP-features.h b/flang/include/flang/Support/OpenMP-features.h similarity index 86% rename from flang/include/flang/Common/OpenMP-features.h rename to flang/include/flang/Support/OpenMP-features.h index 480c8b4c1013f..1dd7ea560cc96 100644 --- a/flang/include/flang/Common/OpenMP-features.h +++ b/flang/include/flang/Support/OpenMP-features.h @@ -1,4 +1,4 @@ -//===-- include/flang/Common/OpenMP-features.h -----------------*- C++ -*-====// +//===-- include/flang/Support/OpenMP-features.h -----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_OPENMP_FEATURES_H_ -#define FORTRAN_COMMON_OPENMP_FEATURES_H_ +#ifndef FORTRAN_SUPPORT_OPENMP_FEATURES_H_ +#define FORTRAN_SUPPORT_OPENMP_FEATURES_H_ namespace Fortran::common { @@ -49,4 +49,4 @@ void setOpenMPMacro(int version, FortranPredefinitions &predefinitions) { } } } // namespace Fortran::common -#endif // FORTRAN_COMMON_OPENMP_FEATURES_H_ +#endif // FORTRAN_SUPPORT_OPENMP_FEATURES_H_ diff --git a/flang/include/flang/Common/OpenMP-utils.h b/flang/include/flang/Support/OpenMP-utils.h similarity index 92% rename from flang/include/flang/Common/OpenMP-utils.h rename to flang/include/flang/Support/OpenMP-utils.h index 827f13bc4758e..d8f82e1cf94f1 100644 --- a/flang/include/flang/Common/OpenMP-utils.h +++ b/flang/include/flang/Support/OpenMP-utils.h @@ -1,4 +1,4 @@ -//===-- include/flang/Common/OpenMP-utils.h --------------------*- C++ -*-====// +//===-- include/flang/Support/OpenMP-utils.h --------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_OPENMP_UTILS_H_ -#define FORTRAN_COMMON_OPENMP_UTILS_H_ +#ifndef FORTRAN_SUPPORT_OPENMP_UTILS_H_ +#define FORTRAN_SUPPORT_OPENMP_UTILS_H_ #include "flang/Semantics/symbol.h" @@ -73,4 +73,4 @@ mlir::Block *genEntryBlock( mlir::OpBuilder &builder, const EntryBlockArgs &args, mlir::Region ®ion); } // namespace Fortran::common::openmp -#endif // FORTRAN_COMMON_OPENMP_UTILS_H_ +#endif // FORTRAN_SUPPORT_OPENMP_UTILS_H_ diff --git a/flang/include/flang/Common/Version.h b/flang/include/flang/Support/Version.h similarity index 90% rename from flang/include/flang/Common/Version.h rename to flang/include/flang/Support/Version.h index 3257d4a4f6459..fe7f7395e1eba 100644 --- a/flang/include/flang/Common/Version.h +++ b/flang/include/flang/Support/Version.h @@ -1,4 +1,4 @@ -//===- Version.h - Flang Version Number ---------------------*- Fortran -*-===// +//===-- include/flang/Support/Version.h -------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,8 +12,8 @@ /// //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_VERSION_H -#define FORTRAN_COMMON_VERSION_H +#ifndef FORTRAN_SUPPORT_VERSION_H_ +#define FORTRAN_SUPPORT_VERSION_H_ #include "flang/Version.inc" #include "llvm/ADT/StringRef.h" @@ -53,4 +53,4 @@ std::string getFlangFullVersion(); std::string getFlangToolFullVersion(llvm::StringRef ToolName); } // namespace Fortran::common -#endif // FORTRAN_COMMON_VERSION_H +#endif // FORTRAN_SUPPORT_VERSION_H_ diff --git a/flang/include/flang/Common/default-kinds.h b/flang/include/flang/Support/default-kinds.h similarity index 91% rename from flang/include/flang/Common/default-kinds.h rename to flang/include/flang/Support/default-kinds.h index 6c66b98e98a05..ab1422d63af30 100644 --- a/flang/include/flang/Common/default-kinds.h +++ b/flang/include/flang/Support/default-kinds.h @@ -1,4 +1,4 @@ -//===-- include/flang/Common/default-kinds.h --------------------*- C++ -*-===// +//===-- include/flang/Support/default-kinds.h -------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_COMMON_DEFAULT_KINDS_H_ -#define FORTRAN_COMMON_DEFAULT_KINDS_H_ +#ifndef FORTRAN_SUPPORT_DEFAULT_KINDS_H_ +#define FORTRAN_SUPPORT_DEFAULT_KINDS_H_ -#include "flang/Common/Fortran.h" +#include "Fortran.h" #include namespace Fortran::common { @@ -58,4 +58,4 @@ class IntrinsicTypeDefaultKinds { int defaultLogicalKind_{defaultIntegerKind_}; }; } // namespace Fortran::common -#endif // FORTRAN_COMMON_DEFAULT_KINDS_H_ +#endif // FORTRAN_SUPPORT_DEFAULT_KINDS_H_ diff --git a/flang/include/flang/Tools/CrossToolHelpers.h b/flang/include/flang/Tools/CrossToolHelpers.h index 0286f2aa14519..d9401e753fb79 100644 --- a/flang/include/flang/Tools/CrossToolHelpers.h +++ b/flang/include/flang/Tools/CrossToolHelpers.h @@ -13,9 +13,9 @@ #ifndef FORTRAN_TOOLS_CROSS_TOOL_HELPERS_H #define FORTRAN_TOOLS_CROSS_TOOL_HELPERS_H -#include "flang/Common/LangOptions.h" -#include "flang/Common/MathOptionsBase.h" #include "flang/Frontend/CodeGenOptions.h" +#include "flang/Support/LangOptions.h" +#include "flang/Support/MathOptionsBase.h" #include #include "mlir/Dialect/OpenMP/OpenMPDialect.h" diff --git a/flang/lib/CMakeLists.txt b/flang/lib/CMakeLists.txt index 2182e845b6a79..05c3535b09b3d 100644 --- a/flang/lib/CMakeLists.txt +++ b/flang/lib/CMakeLists.txt @@ -1,4 +1,3 @@ -add_subdirectory(Common) add_subdirectory(Evaluate) add_subdirectory(Decimal) add_subdirectory(Lower) diff --git a/flang/lib/Common/CMakeLists.txt b/flang/lib/Common/CMakeLists.txt deleted file mode 100644 index 4b5df0a49f403..0000000000000 --- a/flang/lib/Common/CMakeLists.txt +++ /dev/null @@ -1,52 +0,0 @@ -find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc) -find_first_existing_vc_file("${FLANG_SOURCE_DIR}" flang_vc) - -# The VC revision include that we want to generate. -set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc") - -set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake") - -if(llvm_vc AND LLVM_APPEND_VC_REV) - set(llvm_source_dir ${LLVM_MAIN_SRC_DIR}) -endif() -if(flang_vc AND LLVM_APPEND_VC_REV) - set(flang_source_dir ${FLANG_SOURCE_DIR}) -endif() - -# Create custom target to generate the VC revision include. -add_custom_command(OUTPUT "${version_inc}" - DEPENDS "${llvm_vc}" "${flang_vc}" "${generate_vcs_version_script}" - COMMAND ${CMAKE_COMMAND} "-DNAMES=\"LLVM;FLANG\"" - "-DLLVM_SOURCE_DIR=${llvm_source_dir}" - "-DFLANG_SOURCE_DIR=${flang_source_dir}" - "-DHEADER_FILE=${version_inc}" - "-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}" - "-DLLVM_FORCE_VC_REPOSITORY=${LLVM_FORCE_VC_REPOSITORY}" - -P "${generate_vcs_version_script}") - -# Mark the generated header as being generated. -set_source_files_properties("${version_inc}" - PROPERTIES GENERATED TRUE - HEADER_FILE_ONLY TRUE) - -if(FLANG_VENDOR) - set_source_files_properties(Version.cpp - PROPERTIES COMPILE_DEFINITIONS "FLANG_VENDOR=\"${FLANG_VENDOR} \"") -endif() - -add_flang_library(FortranCommon - Fortran.cpp - Fortran-features.cpp - default-kinds.cpp - idioms.cpp - LangOptions.cpp - OpenMP-utils.cpp - Version.cpp - ${version_inc} - - LINK_COMPONENTS - Support - - MLIR_LIBS - MLIRIR -) diff --git a/flang/lib/Decimal/CMakeLists.txt b/flang/lib/Decimal/CMakeLists.txt index 880b190f1c581..2fd2a429d7c22 100644 --- a/flang/lib/Decimal/CMakeLists.txt +++ b/flang/lib/Decimal/CMakeLists.txt @@ -1,3 +1,11 @@ +#===-- lib/Decimal/CMakeLists.txt ------------------------------------------===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===------------------------------------------------------------------------===# + if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.20.0) diff --git a/flang/lib/Evaluate/CMakeLists.txt b/flang/lib/Evaluate/CMakeLists.txt index b38f450d746ea..e0bdb6b2d24d8 100644 --- a/flang/lib/Evaluate/CMakeLists.txt +++ b/flang/lib/Evaluate/CMakeLists.txt @@ -60,7 +60,7 @@ add_flang_library(FortranEvaluate variable.cpp LINK_LIBS - FortranCommon + FortranSupport FortranDecimal FortranParser ${LIBPGMATH} diff --git a/flang/lib/Evaluate/call.cpp b/flang/lib/Evaluate/call.cpp index c5b50e806d249..f77df92a7597a 100644 --- a/flang/lib/Evaluate/call.cpp +++ b/flang/lib/Evaluate/call.cpp @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include "flang/Evaluate/call.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Evaluate/characteristics.h" #include "flang/Evaluate/check-expression.h" #include "flang/Evaluate/expression.h" #include "flang/Evaluate/tools.h" #include "flang/Semantics/symbol.h" +#include "flang/Support/Fortran.h" namespace Fortran::evaluate { diff --git a/flang/lib/Evaluate/formatting.cpp b/flang/lib/Evaluate/formatting.cpp index f3a53c1f983df..c4c3998257830 100644 --- a/flang/lib/Evaluate/formatting.cpp +++ b/flang/lib/Evaluate/formatting.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "flang/Evaluate/formatting.h" -#include "flang/Common/Fortran.h" #include "flang/Evaluate/call.h" #include "flang/Evaluate/constant.h" #include "flang/Evaluate/expression.h" @@ -16,6 +15,7 @@ #include "flang/Parser/characters.h" #include "flang/Semantics/semantics.h" #include "flang/Semantics/symbol.h" +#include "flang/Support/Fortran.h" #include "llvm/Support/raw_ostream.h" namespace Fortran::evaluate { diff --git a/flang/lib/Evaluate/intrinsics.cpp b/flang/lib/Evaluate/intrinsics.cpp index 69ae69bb35fc0..5c9527cec2f69 100644 --- a/flang/lib/Evaluate/intrinsics.cpp +++ b/flang/lib/Evaluate/intrinsics.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "flang/Evaluate/intrinsics.h" -#include "flang/Common/Fortran.h" #include "flang/Common/enum-set.h" #include "flang/Common/idioms.h" #include "flang/Evaluate/check-expression.h" @@ -19,6 +18,7 @@ #include "flang/Evaluate/type.h" #include "flang/Semantics/scope.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Fortran.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/lib/Frontend/CMakeLists.txt b/flang/lib/Frontend/CMakeLists.txt index d063ed36d00b4..81eef2d468d8c 100644 --- a/flang/lib/Frontend/CMakeLists.txt +++ b/flang/lib/Frontend/CMakeLists.txt @@ -27,7 +27,7 @@ add_flang_library(flangFrontend FortranParser FortranSemantics FortranEvaluate - FortranCommon + FortranSupport FortranLower FortranSupport FIRDialect diff --git a/flang/lib/Frontend/CompilerInstance.cpp b/flang/lib/Frontend/CompilerInstance.cpp index dfd15b9c3c39d..b1fa32ecb4cfc 100644 --- a/flang/lib/Frontend/CompilerInstance.cpp +++ b/flang/lib/Frontend/CompilerInstance.cpp @@ -11,12 +11,12 @@ //===----------------------------------------------------------------------===// #include "flang/Frontend/CompilerInstance.h" -#include "flang/Common/Fortran-features.h" #include "flang/Frontend/CompilerInvocation.h" #include "flang/Frontend/TextDiagnosticPrinter.h" #include "flang/Parser/parsing.h" #include "flang/Parser/provenance.h" #include "flang/Semantics/semantics.h" +#include "flang/Support/Fortran-features.h" #include "flang/Support/Timing.h" #include "mlir/Support/RawOstreamExtras.h" #include "clang/Basic/DiagnosticFrontend.h" diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index a2c1d3efef6cf..3eb413e8a62a9 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -11,13 +11,13 @@ //===----------------------------------------------------------------------===// #include "flang/Frontend/CompilerInvocation.h" -#include "flang/Common/Fortran-features.h" -#include "flang/Common/OpenMP-features.h" -#include "flang/Common/Version.h" #include "flang/Frontend/CodeGenOptions.h" #include "flang/Frontend/PreprocessorOptions.h" #include "flang/Frontend/TargetOptions.h" #include "flang/Semantics/semantics.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/OpenMP-features.h" +#include "flang/Support/Version.h" #include "flang/Tools/TargetSetup.h" #include "flang/Version.inc" #include "clang/Basic/AllDiagnostics.h" diff --git a/flang/lib/Frontend/FrontendActions.cpp b/flang/lib/Frontend/FrontendActions.cpp index b0545a7ac2f99..b7674bd093f68 100644 --- a/flang/lib/Frontend/FrontendActions.cpp +++ b/flang/lib/Frontend/FrontendActions.cpp @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// #include "flang/Frontend/FrontendActions.h" -#include "flang/Common/default-kinds.h" #include "flang/Frontend/CompilerInstance.h" #include "flang/Frontend/CompilerInvocation.h" #include "flang/Frontend/FrontendOptions.h" @@ -34,6 +33,7 @@ #include "flang/Semantics/runtime-type-info.h" #include "flang/Semantics/semantics.h" #include "flang/Semantics/unparse-with-symbols.h" +#include "flang/Support/default-kinds.h" #include "flang/Tools/CrossToolHelpers.h" #include "mlir/IR/Dialect.h" diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp index d6bde8ecbbb25..a31629b17cf29 100644 --- a/flang/lib/Lower/Bridge.cpp +++ b/flang/lib/Lower/Bridge.cpp @@ -12,7 +12,6 @@ #include "flang/Lower/Bridge.h" -#include "flang/Common/Version.h" #include "flang/Lower/Allocatable.h" #include "flang/Lower/CallInterface.h" #include "flang/Lower/Coarray.h" @@ -62,6 +61,7 @@ #include "flang/Semantics/runtime-type-info.h" #include "flang/Semantics/symbol.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Version.h" #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" #include "mlir/IR/Matchers.h" #include "mlir/IR/PatternMatch.h" diff --git a/flang/lib/Lower/CMakeLists.txt b/flang/lib/Lower/CMakeLists.txt index 8a4ed1c067cb2..c9b249781552e 100644 --- a/flang/lib/Lower/CMakeLists.txt +++ b/flang/lib/Lower/CMakeLists.txt @@ -56,7 +56,7 @@ add_flang_library(FortranLower FIRSupport FIRTransforms HLFIRDialect - FortranCommon + FortranSupport FortranParser FortranEvaluate FortranSemantics diff --git a/flang/lib/Lower/CallInterface.cpp b/flang/lib/Lower/CallInterface.cpp index ab421d81141f2..226ba1e52c968 100644 --- a/flang/lib/Lower/CallInterface.cpp +++ b/flang/lib/Lower/CallInterface.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "flang/Lower/CallInterface.h" -#include "flang/Common/Fortran.h" #include "flang/Evaluate/fold.h" #include "flang/Lower/Bridge.h" #include "flang/Lower/Mangler.h" @@ -23,6 +22,7 @@ #include "flang/Optimizer/Support/Utils.h" #include "flang/Semantics/symbol.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Fortran.h" #include static mlir::FunctionType diff --git a/flang/lib/Lower/ConvertExpr.cpp b/flang/lib/Lower/ConvertExpr.cpp index d9ae502edbafa..b33baf90582b8 100644 --- a/flang/lib/Lower/ConvertExpr.cpp +++ b/flang/lib/Lower/ConvertExpr.cpp @@ -11,7 +11,6 @@ //===----------------------------------------------------------------------===// #include "flang/Lower/ConvertExpr.h" -#include "flang/Common/default-kinds.h" #include "flang/Common/unwrap.h" #include "flang/Evaluate/fold.h" #include "flang/Evaluate/real.h" @@ -52,6 +51,7 @@ #include "flang/Semantics/symbol.h" #include "flang/Semantics/tools.h" #include "flang/Semantics/type.h" +#include "flang/Support/default-kinds.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "llvm/ADT/TypeSwitch.h" #include "llvm/Support/CommandLine.h" diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp index 5e1f3b0208869..0173298b5f742 100644 --- a/flang/lib/Lower/OpenMP/OpenMP.cpp +++ b/flang/lib/Lower/OpenMP/OpenMP.cpp @@ -18,7 +18,6 @@ #include "Decomposer.h" #include "ReductionProcessor.h" #include "Utils.h" -#include "flang/Common/OpenMP-utils.h" #include "flang/Common/idioms.h" #include "flang/Lower/Bridge.h" #include "flang/Lower/ConvertExpr.h" @@ -35,6 +34,7 @@ #include "flang/Parser/parse-tree.h" #include "flang/Semantics/openmp-directive-sets.h" #include "flang/Semantics/tools.h" +#include "flang/Support/OpenMP-utils.h" #include "mlir/Dialect/ControlFlow/IR/ControlFlowOps.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" #include "mlir/Transforms/RegionUtils.h" diff --git a/flang/lib/Optimizer/CodeGen/TypeConverter.cpp b/flang/lib/Optimizer/CodeGen/TypeConverter.cpp index 0eace903720f0..89f498433806e 100644 --- a/flang/lib/Optimizer/CodeGen/TypeConverter.cpp +++ b/flang/lib/Optimizer/CodeGen/TypeConverter.cpp @@ -13,7 +13,6 @@ #define DEBUG_TYPE "flang-type-conversion" #include "flang/Optimizer/CodeGen/TypeConverter.h" -#include "flang/Common/Fortran.h" #include "flang/Optimizer/Builder/Todo.h" // remove when TODO's are done #include "flang/Optimizer/CodeGen/DescriptorModel.h" #include "flang/Optimizer/CodeGen/TBAABuilder.h" @@ -22,6 +21,7 @@ #include "flang/Optimizer/Dialect/Support/FIRContext.h" #include "flang/Optimizer/Dialect/Support/KindMapping.h" #include "flang/Optimizer/Support/InternalNames.h" +#include "flang/Support/Fortran.h" #include "mlir/Conversion/LLVMCommon/TypeConverter.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/Support/Debug.h" diff --git a/flang/lib/Optimizer/Dialect/FIRType.cpp b/flang/lib/Optimizer/Dialect/FIRType.cpp index 0b57a10a6c493..67d918cc0f41c 100644 --- a/flang/lib/Optimizer/Dialect/FIRType.cpp +++ b/flang/lib/Optimizer/Dialect/FIRType.cpp @@ -11,7 +11,7 @@ //===----------------------------------------------------------------------===// #include "flang/Optimizer/Dialect/FIRType.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Optimizer/Builder/Todo.h" #include "flang/Optimizer/Dialect/FIRDialect.h" #include "flang/Optimizer/Dialect/Support/KindMapping.h" diff --git a/flang/lib/Optimizer/OpenMP/CMakeLists.txt b/flang/lib/Optimizer/OpenMP/CMakeLists.txt index c8509ccc7fea5..86ae93f3207cc 100644 --- a/flang/lib/Optimizer/OpenMP/CMakeLists.txt +++ b/flang/lib/Optimizer/OpenMP/CMakeLists.txt @@ -21,7 +21,7 @@ add_flang_library(FlangOpenMPTransforms FIRDialect FIRDialectSupport FIRSupport - FortranCommon + FortranSupport HLFIRDialect MLIR_LIBS diff --git a/flang/lib/Optimizer/OpenMP/GenericLoopConversion.cpp b/flang/lib/Optimizer/OpenMP/GenericLoopConversion.cpp index 3e742f7d60a9c..3512a537d38c3 100644 --- a/flang/lib/Optimizer/OpenMP/GenericLoopConversion.cpp +++ b/flang/lib/Optimizer/OpenMP/GenericLoopConversion.cpp @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/OpenMP-utils.h" +#include "flang/Support/OpenMP-utils.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/OpenMP/OpenMPDialect.h" diff --git a/flang/lib/Optimizer/Passes/CMakeLists.txt b/flang/lib/Optimizer/Passes/CMakeLists.txt index eb25beba309bf..1c19a5765aff1 100644 --- a/flang/lib/Optimizer/Passes/CMakeLists.txt +++ b/flang/lib/Optimizer/Passes/CMakeLists.txt @@ -5,14 +5,11 @@ add_flang_library(flangPasses CommandLineOpts.cpp Pipelines.cpp - DEPENDS - FortranCommon - LINK_LIBS FIRCodeGen FIRTransforms FlangOpenMPTransforms - FortranCommon + FortranSupport HLFIRTransforms LINK_COMPONENTS diff --git a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp index 69915741a88f6..49c9a737b2c59 100644 --- a/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp +++ b/flang/lib/Optimizer/Transforms/AddDebugInfo.cpp @@ -12,7 +12,6 @@ //===----------------------------------------------------------------------===// #include "DebugTypeGenerator.h" -#include "flang/Common/Version.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Builder/Todo.h" #include "flang/Optimizer/CodeGen/CGOps.h" @@ -23,6 +22,7 @@ #include "flang/Optimizer/Dialect/Support/FIRContext.h" #include "flang/Optimizer/Support/InternalNames.h" #include "flang/Optimizer/Transforms/Passes.h" +#include "flang/Support/Version.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/IR/Matchers.h" diff --git a/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp b/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp index eb59045a5fde7..d0bd67a236419 100644 --- a/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp +++ b/flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran.h" #include "flang/Lower/BuiltinModules.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Builder/Runtime/Support.h" @@ -17,6 +16,7 @@ #include "flang/Optimizer/Support/Utils.h" #include "flang/Optimizer/Transforms/Passes.h" #include "flang/Runtime/support.h" +#include "flang/Support/Fortran.h" #include "mlir/Dialect/Func/IR/FuncOps.h" #include "mlir/Pass/Pass.h" #include "mlir/Transforms/DialectConversion.h" diff --git a/flang/lib/Optimizer/Transforms/CMakeLists.txt b/flang/lib/Optimizer/Transforms/CMakeLists.txt index 9c550f983434a..50994fbb21700 100644 --- a/flang/lib/Optimizer/Transforms/CMakeLists.txt +++ b/flang/lib/Optimizer/Transforms/CMakeLists.txt @@ -46,7 +46,7 @@ add_flang_library(FIRTransforms FIRDialect FIRDialectSupport FIRSupport - FortranCommon + FortranSupport HLFIRDialect MLIR_LIBS diff --git a/flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp b/flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp index 7486dde0e281e..3f13a182ad0c3 100644 --- a/flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp +++ b/flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran.h" #include "flang/Optimizer/Builder/CUFCommon.h" #include "flang/Optimizer/Dialect/CUF/CUFOps.h" #include "flang/Optimizer/Dialect/FIRDialect.h" @@ -15,6 +14,7 @@ #include "flang/Optimizer/Support/InternalNames.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/allocatable.h" +#include "flang/Support/Fortran.h" #include "mlir/Dialect/LLVMIR/NVVMDialect.h" #include "mlir/IR/SymbolTable.h" #include "mlir/Pass/Pass.h" diff --git a/flang/lib/Optimizer/Transforms/CUFGPUToLLVMConversion.cpp b/flang/lib/Optimizer/Transforms/CUFGPUToLLVMConversion.cpp index 4611a18a541bc..2a95e41944f3f 100644 --- a/flang/lib/Optimizer/Transforms/CUFGPUToLLVMConversion.cpp +++ b/flang/lib/Optimizer/Transforms/CUFGPUToLLVMConversion.cpp @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "flang/Optimizer/Transforms/CUFGPUToLLVMConversion.h" -#include "flang/Common/Fortran.h" #include "flang/Optimizer/CodeGen/TypeConverter.h" #include "flang/Optimizer/Support/DataLayout.h" #include "flang/Runtime/CUDA/common.h" +#include "flang/Support/Fortran.h" #include "mlir/Conversion/LLVMCommon/Pattern.h" #include "mlir/Dialect/GPU/IR/GPUDialect.h" #include "mlir/Pass/Pass.h" diff --git a/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp index 549498f5585a6..1f0576aa82f83 100644 --- a/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp +++ b/flang/lib/Optimizer/Transforms/CUFOpConversion.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "flang/Optimizer/Transforms/CUFOpConversion.h" -#include "flang/Common/Fortran.h" #include "flang/Optimizer/Builder/CUFCommon.h" #include "flang/Optimizer/Builder/Runtime/RTBuilder.h" #include "flang/Optimizer/CodeGen/TypeConverter.h" @@ -22,6 +21,7 @@ #include "flang/Runtime/CUDA/memory.h" #include "flang/Runtime/CUDA/pointer.h" #include "flang/Runtime/allocatable.h" +#include "flang/Support/Fortran.h" #include "mlir/Conversion/LLVMCommon/Pattern.h" #include "mlir/Dialect/GPU/IR/GPUDialect.h" #include "mlir/IR/Matchers.h" diff --git a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp index 4f6974ee52695..3d84eaa4c1595 100644 --- a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp +++ b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran.h" #include "flang/Optimizer/Dialect/FIRDialect.h" #include "flang/Optimizer/Dialect/FIROps.h" #include "flang/Optimizer/Dialect/FIROpsSupport.h" #include "flang/Optimizer/Support/InternalNames.h" #include "flang/Optimizer/Transforms/Passes.h" +#include "flang/Support/Fortran.h" #include "mlir/Dialect/GPU/IR/GPUDialect.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/SymbolTable.h" diff --git a/flang/lib/Optimizer/Transforms/LoopVersioning.cpp b/flang/lib/Optimizer/Transforms/LoopVersioning.cpp index 0aa89f1f5471e..1f3495569c9dd 100644 --- a/flang/lib/Optimizer/Transforms/LoopVersioning.cpp +++ b/flang/lib/Optimizer/Transforms/LoopVersioning.cpp @@ -40,7 +40,7 @@ /// could be part of the cost analysis above. //===----------------------------------------------------------------------===// -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Optimizer/Builder/BoxValue.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Builder/Runtime/Inquiry.h" diff --git a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp index fa6a7b23624e8..df2887ff1422e 100644 --- a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp +++ b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp @@ -22,7 +22,6 @@ /// and small in size. //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran.h" #include "flang/Optimizer/Builder/BoxValue.h" #include "flang/Optimizer/Builder/CUFCommon.h" #include "flang/Optimizer/Builder/FIRBuilder.h" @@ -35,6 +34,7 @@ #include "flang/Optimizer/Transforms/Passes.h" #include "flang/Optimizer/Transforms/Utils.h" #include "flang/Runtime/entry-names.h" +#include "flang/Support/Fortran.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/IR/Matchers.h" #include "mlir/IR/Operation.h" diff --git a/flang/lib/Optimizer/Transforms/StackReclaim.cpp b/flang/lib/Optimizer/Transforms/StackReclaim.cpp index bd3e49a47bc39..acb685850d173 100644 --- a/flang/lib/Optimizer/Transforms/StackReclaim.cpp +++ b/flang/lib/Optimizer/Transforms/StackReclaim.cpp @@ -6,11 +6,11 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Dialect/FIRDialect.h" #include "flang/Optimizer/Dialect/FIROps.h" #include "flang/Optimizer/Transforms/Passes.h" +#include "flang/Support/Fortran.h" #include "mlir/Dialect/LLVMIR/LLVMDialect.h" #include "mlir/IR/Matchers.h" #include "mlir/Pass/Pass.h" diff --git a/flang/lib/Optimizer/Transforms/VScaleAttr.cpp b/flang/lib/Optimizer/Transforms/VScaleAttr.cpp index d311167c58b4d..54a2456e77366 100644 --- a/flang/lib/Optimizer/Transforms/VScaleAttr.cpp +++ b/flang/lib/Optimizer/Transforms/VScaleAttr.cpp @@ -14,7 +14,7 @@ /// likely harmless to run it on something else, but it is also not valuable]. //===----------------------------------------------------------------------===// -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Optimizer/Builder/BoxValue.h" #include "flang/Optimizer/Builder/FIRBuilder.h" #include "flang/Optimizer/Builder/Runtime/Inquiry.h" diff --git a/flang/lib/Parser/CMakeLists.txt b/flang/lib/Parser/CMakeLists.txt index d364671d7a322..76fe3d7ce6ba4 100644 --- a/flang/lib/Parser/CMakeLists.txt +++ b/flang/lib/Parser/CMakeLists.txt @@ -25,7 +25,7 @@ add_flang_library(FortranParser user-state.cpp LINK_LIBS - FortranCommon + FortranSupport LINK_COMPONENTS Support diff --git a/flang/lib/Parser/basic-parsers.h b/flang/lib/Parser/basic-parsers.h index 1a8c14e7048f6..7e69d41debfcd 100644 --- a/flang/lib/Parser/basic-parsers.h +++ b/flang/lib/Parser/basic-parsers.h @@ -22,7 +22,6 @@ // This header defines the fundamental parser class templates and helper // template functions. See parser-combinators.txt for documentation. -#include "flang/Common/Fortran-features.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" #include "flang/Parser/char-block.h" @@ -30,6 +29,7 @@ #include "flang/Parser/parse-state.h" #include "flang/Parser/provenance.h" #include "flang/Parser/user-state.h" +#include "flang/Support/Fortran-features.h" #include #include #include diff --git a/flang/lib/Parser/prescan.h b/flang/lib/Parser/prescan.h index 08041f93b14b6..e2440ad6fbc42 100644 --- a/flang/lib/Parser/prescan.h +++ b/flang/lib/Parser/prescan.h @@ -16,11 +16,11 @@ // fixed form character literals on truncated card images, file // inclusion, and driving the Fortran source preprocessor. -#include "flang/Common/Fortran-features.h" #include "flang/Parser/characters.h" #include "flang/Parser/message.h" #include "flang/Parser/provenance.h" #include "flang/Parser/token-sequence.h" +#include "flang/Support/Fortran-features.h" #include #include #include diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp index 243f586b3ca4f..cd91fbe4ea5eb 100644 --- a/flang/lib/Parser/unparse.cpp +++ b/flang/lib/Parser/unparse.cpp @@ -10,13 +10,13 @@ // traversal templates in parse-tree-visitor.h. #include "flang/Parser/unparse.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" #include "flang/Parser/characters.h" #include "flang/Parser/parse-tree-visitor.h" #include "flang/Parser/parse-tree.h" #include "flang/Parser/tools.h" +#include "flang/Support/Fortran.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/lib/Semantics/CMakeLists.txt b/flang/lib/Semantics/CMakeLists.txt index 7855ae7eed138..00108dde49dbd 100644 --- a/flang/lib/Semantics/CMakeLists.txt +++ b/flang/lib/Semantics/CMakeLists.txt @@ -53,7 +53,7 @@ add_flang_library(FortranSemantics omp_gen LINK_LIBS - FortranCommon + FortranSupport FortranParser FortranEvaluate diff --git a/flang/lib/Semantics/check-return.cpp b/flang/lib/Semantics/check-return.cpp index 22729f659ed5b..52220a566bbdc 100644 --- a/flang/lib/Semantics/check-return.cpp +++ b/flang/lib/Semantics/check-return.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "check-return.h" -#include "flang/Common/Fortran-features.h" #include "flang/Parser/message.h" #include "flang/Parser/parse-tree.h" #include "flang/Semantics/semantics.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Fortran-features.h" namespace Fortran::semantics { diff --git a/flang/lib/Semantics/check-select-rank.cpp b/flang/lib/Semantics/check-select-rank.cpp index 2e602d307013c..b227bbaaef4ba 100644 --- a/flang/lib/Semantics/check-select-rank.cpp +++ b/flang/lib/Semantics/check-select-rank.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "check-select-rank.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Parser/message.h" #include "flang/Parser/tools.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Fortran.h" #include #include #include diff --git a/flang/lib/Semantics/check-stop.cpp b/flang/lib/Semantics/check-stop.cpp index 43535b07f029e..aabd52098e63b 100644 --- a/flang/lib/Semantics/check-stop.cpp +++ b/flang/lib/Semantics/check-stop.cpp @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "check-stop.h" -#include "flang/Common/Fortran.h" #include "flang/Evaluate/expression.h" #include "flang/Parser/parse-tree.h" #include "flang/Semantics/semantics.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Fortran.h" #include namespace Fortran::semantics { diff --git a/flang/lib/Semantics/data-to-inits.h b/flang/lib/Semantics/data-to-inits.h index d8cc4601de26f..7486ac8113e90 100644 --- a/flang/lib/Semantics/data-to-inits.h +++ b/flang/lib/Semantics/data-to-inits.h @@ -9,10 +9,10 @@ #ifndef FORTRAN_SEMANTICS_DATA_TO_INITS_H_ #define FORTRAN_SEMANTICS_DATA_TO_INITS_H_ -#include "flang/Common/default-kinds.h" #include "flang/Common/interval.h" #include "flang/Evaluate/fold-designator.h" #include "flang/Evaluate/initial-image.h" +#include "flang/Support/default-kinds.h" #include #include diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp index f9fa4a554a62a..6949e5693d08f 100644 --- a/flang/lib/Semantics/expression.cpp +++ b/flang/lib/Semantics/expression.cpp @@ -11,7 +11,6 @@ #include "pointer-assignment.h" #include "resolve-names-utils.h" #include "resolve-names.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Evaluate/common.h" #include "flang/Evaluate/fold.h" @@ -24,6 +23,7 @@ #include "flang/Semantics/semantics.h" #include "flang/Semantics/symbol.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Fortran.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/lib/Semantics/resolve-names-utils.cpp b/flang/lib/Semantics/resolve-names-utils.cpp index 347f54e064070..742bb748b7ff3 100644 --- a/flang/lib/Semantics/resolve-names-utils.cpp +++ b/flang/lib/Semantics/resolve-names-utils.cpp @@ -7,8 +7,6 @@ //===----------------------------------------------------------------------===// #include "resolve-names-utils.h" -#include "flang/Common/Fortran-features.h" -#include "flang/Common/Fortran.h" #include "flang/Common/idioms.h" #include "flang/Common/indirection.h" #include "flang/Evaluate/fold.h" @@ -20,6 +18,8 @@ #include "flang/Semantics/expression.h" #include "flang/Semantics/semantics.h" #include "flang/Semantics/tools.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/Fortran.h" #include #include diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp index fbf43d4744335..e64abe6b50e78 100644 --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -13,8 +13,6 @@ #include "resolve-directives.h" #include "resolve-names-utils.h" #include "rewrite-parse-tree.h" -#include "flang/Common/Fortran.h" -#include "flang/Common/default-kinds.h" #include "flang/Common/indirection.h" #include "flang/Common/restorer.h" #include "flang/Common/visit.h" @@ -38,6 +36,8 @@ #include "flang/Semantics/symbol.h" #include "flang/Semantics/tools.h" #include "flang/Semantics/type.h" +#include "flang/Support/Fortran.h" +#include "flang/Support/default-kinds.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/lib/Semantics/semantics.cpp b/flang/lib/Semantics/semantics.cpp index 58dc1f218b56f..10a01039ea0ae 100644 --- a/flang/lib/Semantics/semantics.cpp +++ b/flang/lib/Semantics/semantics.cpp @@ -37,12 +37,12 @@ #include "resolve-labels.h" #include "resolve-names.h" #include "rewrite-parse-tree.h" -#include "flang/Common/default-kinds.h" #include "flang/Parser/parse-tree-visitor.h" #include "flang/Parser/tools.h" #include "flang/Semantics/expression.h" #include "flang/Semantics/scope.h" #include "flang/Semantics/symbol.h" +#include "flang/Support/default-kinds.h" #include "llvm/Support/raw_ostream.h" #include "llvm/TargetParser/Host.h" #include "llvm/TargetParser/Triple.h" diff --git a/flang/lib/Semantics/tools.cpp b/flang/lib/Semantics/tools.cpp index 9ebfbbb5317b6..7544731a682ec 100644 --- a/flang/lib/Semantics/tools.cpp +++ b/flang/lib/Semantics/tools.cpp @@ -7,7 +7,6 @@ //===----------------------------------------------------------------------===// #include "flang/Parser/tools.h" -#include "flang/Common/Fortran.h" #include "flang/Common/indirection.h" #include "flang/Parser/dump-parse-tree.h" #include "flang/Parser/message.h" @@ -17,6 +16,7 @@ #include "flang/Semantics/symbol.h" #include "flang/Semantics/tools.h" #include "flang/Semantics/type.h" +#include "flang/Support/Fortran.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/lib/Support/CMakeLists.txt b/flang/lib/Support/CMakeLists.txt index 12183f590316d..4ee381589a208 100644 --- a/flang/lib/Support/CMakeLists.txt +++ b/flang/lib/Support/CMakeLists.txt @@ -1,9 +1,62 @@ +#===-- lib/Support/CMakeLists.txt ------------------------------------------===# +# +# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +# See https://llvm.org/LICENSE.txt for license information. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# +#===------------------------------------------------------------------------===# + +find_first_existing_vc_file("${LLVM_MAIN_SRC_DIR}" llvm_vc) +find_first_existing_vc_file("${FLANG_SOURCE_DIR}" flang_vc) + +# The VC revision include that we want to generate. +set(version_inc "${CMAKE_CURRENT_BINARY_DIR}/VCSVersion.inc") + +set(generate_vcs_version_script "${LLVM_CMAKE_DIR}/GenerateVersionFromVCS.cmake") + +if(llvm_vc AND LLVM_APPEND_VC_REV) + set(llvm_source_dir ${LLVM_MAIN_SRC_DIR}) +endif() +if(flang_vc AND LLVM_APPEND_VC_REV) + set(flang_source_dir ${FLANG_SOURCE_DIR}) +endif() + +# Create custom target to generate the VC revision include. +add_custom_command(OUTPUT "${version_inc}" + DEPENDS "${llvm_vc}" "${flang_vc}" "${generate_vcs_version_script}" + COMMAND ${CMAKE_COMMAND} "-DNAMES=\"LLVM;FLANG\"" + "-DLLVM_SOURCE_DIR=${llvm_source_dir}" + "-DFLANG_SOURCE_DIR=${flang_source_dir}" + "-DHEADER_FILE=${version_inc}" + "-DLLVM_FORCE_VC_REVISION=${LLVM_FORCE_VC_REVISION}" + "-DLLVM_FORCE_VC_REPOSITORY=${LLVM_FORCE_VC_REPOSITORY}" + -P "${generate_vcs_version_script}") + +# Mark the generated header as being generated. +set_source_files_properties("${version_inc}" + PROPERTIES GENERATED TRUE + HEADER_FILE_ONLY TRUE) + +if(FLANG_VENDOR) + set_source_files_properties(Version.cpp + PROPERTIES COMPILE_DEFINITIONS "FLANG_VENDOR=\"${FLANG_VENDOR} \"") +endif() + add_flang_library(FortranSupport + default-kinds.cpp + Fortran.cpp + Fortran-features.cpp + idioms.cpp + LangOptions.cpp + OpenMP-utils.cpp Timing.cpp + Version.cpp + ${version_inc} LINK_COMPONENTS Support MLIR_LIBS + MLIRIR MLIRSupport ) diff --git a/flang/lib/Common/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp similarity index 97% rename from flang/lib/Common/Fortran-features.cpp rename to flang/lib/Support/Fortran-features.cpp index e2601e1af3a2f..bbeb4b15a0486 100644 --- a/flang/lib/Common/Fortran-features.cpp +++ b/flang/lib/Support/Fortran-features.cpp @@ -1,4 +1,4 @@ -//===-- lib/Common/Fortran-features.cpp -----------------------------------===// +//===-- lib/Support/Fortran-features.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran-features.h" -#include "flang/Common/Fortran.h" +#include "flang/Support/Fortran-features.h" #include "flang/Common/idioms.h" +#include "flang/Support/Fortran.h" namespace Fortran::common { diff --git a/flang/lib/Common/Fortran.cpp b/flang/lib/Support/Fortran.cpp similarity index 96% rename from flang/lib/Common/Fortran.cpp rename to flang/lib/Support/Fortran.cpp index eec83419f9eb2..746b7c9740728 100644 --- a/flang/lib/Common/Fortran.cpp +++ b/flang/lib/Support/Fortran.cpp @@ -1,4 +1,4 @@ -//===-- lib/Common/Fortran.cpp --------------------------------------------===// +//===-- lib/Support/Fortran.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran.h" -#include "flang/Common/Fortran-features.h" +#include "flang/Support/Fortran.h" +#include "flang/Support/Fortran-features.h" namespace Fortran::common { diff --git a/flang/lib/Common/LangOptions.cpp b/flang/lib/Support/LangOptions.cpp similarity index 80% rename from flang/lib/Common/LangOptions.cpp rename to flang/lib/Support/LangOptions.cpp index 415c715156e7b..273274fc07215 100644 --- a/flang/lib/Common/LangOptions.cpp +++ b/flang/lib/Support/LangOptions.cpp @@ -1,4 +1,4 @@ -//===------ LangOptions.cpp -----------------------------------------------===// +//===-- lib/Support/LangOptions.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/LangOptions.h" +#include "flang/Support/LangOptions.h" #include namespace Fortran::common { @@ -18,7 +18,7 @@ namespace Fortran::common { LangOptions::LangOptions() { #define LANGOPT(Name, Bits, Default) Name = Default; #define ENUM_LANGOPT(Name, Type, Bits, Default) set##Name(Default); -#include "flang/Common/LangOptions.def" +#include "flang/Support/LangOptions.def" } } // end namespace Fortran::common diff --git a/flang/lib/Common/OpenMP-utils.cpp b/flang/lib/Support/OpenMP-utils.cpp similarity index 93% rename from flang/lib/Common/OpenMP-utils.cpp rename to flang/lib/Support/OpenMP-utils.cpp index 47e89fe6dd1ee..178a6e38dc0f2 100644 --- a/flang/lib/Common/OpenMP-utils.cpp +++ b/flang/lib/Support/OpenMP-utils.cpp @@ -1,4 +1,4 @@ -//===-- include/flang/Common/OpenMP-utils.cpp ------------------*- C++ -*-====// +//===-- lib/Support/OpenMP-utils.cpp ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/OpenMP-utils.h" +#include "flang/Support/OpenMP-utils.h" #include "mlir/IR/OpDefinition.h" diff --git a/flang/lib/Common/Version.cpp b/flang/lib/Support/Version.cpp similarity index 95% rename from flang/lib/Common/Version.cpp rename to flang/lib/Support/Version.cpp index d67255f353dfd..8ee4908f28f62 100644 --- a/flang/lib/Common/Version.cpp +++ b/flang/lib/Support/Version.cpp @@ -1,4 +1,4 @@ -//===- Version.cpp - Flang Version Number -------------------*- Fortran -*-===// +//===-- lib/Support/Version.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,7 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/Version.h" +#include "flang/Support/Version.h" #include "llvm/Support/raw_ostream.h" #include #include diff --git a/flang/lib/Common/default-kinds.cpp b/flang/lib/Support/default-kinds.cpp similarity index 94% rename from flang/lib/Common/default-kinds.cpp rename to flang/lib/Support/default-kinds.cpp index d2ca910351361..b763f8ec19418 100644 --- a/flang/lib/Common/default-kinds.cpp +++ b/flang/lib/Support/default-kinds.cpp @@ -1,4 +1,4 @@ -//===-- lib/Common/default-kinds.cpp --------------------------------------===// +//===-- lib/Support/default-kinds.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "flang/Common/default-kinds.h" +#include "flang/Support/default-kinds.h" #include "flang/Common/idioms.h" namespace Fortran::common { diff --git a/flang/lib/Common/idioms.cpp b/flang/lib/Support/idioms.cpp similarity index 89% rename from flang/lib/Common/idioms.cpp rename to flang/lib/Support/idioms.cpp index 536a5c2e5479d..906a4c1bcd9b0 100644 --- a/flang/lib/Common/idioms.cpp +++ b/flang/lib/Support/idioms.cpp @@ -1,4 +1,4 @@ -//===-- lib/Common/idioms.cpp ---------------------------------------------===// +//===-- lib/Support/idioms.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/CUDA/allocator.cpp b/flang/runtime/CUDA/allocator.cpp index 85b3daf65a8ba..368c1124ef70a 100644 --- a/flang/runtime/CUDA/allocator.cpp +++ b/flang/runtime/CUDA/allocator.cpp @@ -11,10 +11,10 @@ #include "../stat.h" #include "../terminator.h" #include "../type-info.h" -#include "flang/Common/Fortran.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/allocator-registry.h" +#include "flang/Support/Fortran.h" #include "cuda_runtime.h" diff --git a/flang/runtime/ISO_Fortran_binding.cpp b/flang/runtime/ISO_Fortran_binding.cpp index fe22026f31f55..64e239f498230 100644 --- a/flang/runtime/ISO_Fortran_binding.cpp +++ b/flang/runtime/ISO_Fortran_binding.cpp @@ -11,7 +11,7 @@ #include "ISO_Fortran_util.h" #include "terminator.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/descriptor.h" #include "flang/Runtime/pointer.h" #include "flang/Runtime/type-code.h" diff --git a/flang/runtime/ISO_Fortran_util.h b/flang/runtime/ISO_Fortran_util.h index dd0eeef80bb89..aca9aee8c5718 100644 --- a/flang/runtime/ISO_Fortran_util.h +++ b/flang/runtime/ISO_Fortran_util.h @@ -12,7 +12,7 @@ // Internal utils for establishing CFI_cdesc_t descriptors. #include "terminator.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/descriptor.h" #include "flang/Runtime/type-code.h" #include diff --git a/flang/runtime/allocatable.cpp b/flang/runtime/allocatable.cpp index 5e065f47636a8..686114bf86eaf 100644 --- a/flang/runtime/allocatable.cpp +++ b/flang/runtime/allocatable.cpp @@ -12,7 +12,7 @@ #include "stat.h" #include "terminator.h" #include "type-info.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/assign.h" #include "flang/Runtime/descriptor.h" diff --git a/flang/runtime/stat.h b/flang/runtime/stat.h index 71faeb027d908..572cb6d10b489 100644 --- a/flang/runtime/stat.h +++ b/flang/runtime/stat.h @@ -11,8 +11,8 @@ #ifndef FORTRAN_RUNTIME_STAT_H_ #define FORTRAN_RUNTIME_STAT_H_ +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Common/api-attrs.h" -#include "flang/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/magic-numbers.h" namespace Fortran::runtime { diff --git a/flang/runtime/temporary-stack.cpp b/flang/runtime/temporary-stack.cpp index 667b10e04dbd2..93340266b1b44 100644 --- a/flang/runtime/temporary-stack.cpp +++ b/flang/runtime/temporary-stack.cpp @@ -11,7 +11,7 @@ #include "flang/Runtime/temporary-stack.h" #include "terminator.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/assign.h" #include "flang/Runtime/descriptor.h" #include "flang/Runtime/memory.h" diff --git a/flang/tools/bbc/CMakeLists.txt b/flang/tools/bbc/CMakeLists.txt index 97462be83ea43..f950f03920d3f 100644 --- a/flang/tools/bbc/CMakeLists.txt +++ b/flang/tools/bbc/CMakeLists.txt @@ -29,11 +29,6 @@ target_link_libraries(bbc PRIVATE flangFrontend flangPasses FlangOpenMPTransforms - FortranCommon - FortranParser - FortranEvaluate - FortranSemantics - FortranLower ) mlir_target_link_libraries(bbc PRIVATE @@ -41,4 +36,9 @@ mlir_target_link_libraries(bbc PRIVATE ${extension_libs} MLIRAffineToStandard MLIRSCFToControlFlow + FortranSupport + FortranParser + FortranEvaluate + FortranSemantics + FortranLower ) diff --git a/flang/tools/bbc/bbc.cpp b/flang/tools/bbc/bbc.cpp index dafbcd856389a..3b19a1c2a78d9 100644 --- a/flang/tools/bbc/bbc.cpp +++ b/flang/tools/bbc/bbc.cpp @@ -14,11 +14,6 @@ /// //===----------------------------------------------------------------------===// -#include "flang/Common/Fortran-features.h" -#include "flang/Common/LangOptions.h" -#include "flang/Common/OpenMP-features.h" -#include "flang/Common/Version.h" -#include "flang/Common/default-kinds.h" #include "flang/Frontend/CodeGenOptions.h" #include "flang/Frontend/TargetOptions.h" #include "flang/Lower/Bridge.h" @@ -42,6 +37,11 @@ #include "flang/Semantics/runtime-type-info.h" #include "flang/Semantics/semantics.h" #include "flang/Semantics/unparse-with-symbols.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/LangOptions.h" +#include "flang/Support/OpenMP-features.h" +#include "flang/Support/Version.h" +#include "flang/Support/default-kinds.h" #include "flang/Tools/CrossToolHelpers.h" #include "flang/Tools/TargetSetup.h" #include "flang/Version.inc" diff --git a/flang/tools/f18-parse-demo/CMakeLists.txt b/flang/tools/f18-parse-demo/CMakeLists.txt index df1f1d24a55e5..743a44017e8a5 100644 --- a/flang/tools/f18-parse-demo/CMakeLists.txt +++ b/flang/tools/f18-parse-demo/CMakeLists.txt @@ -11,6 +11,6 @@ add_flang_tool(f18-parse-demo target_link_libraries(f18-parse-demo PRIVATE - FortranCommon + FortranSupport FortranParser ) diff --git a/flang/tools/f18-parse-demo/f18-parse-demo.cpp b/flang/tools/f18-parse-demo/f18-parse-demo.cpp index 3025dbd4dca4a..a50c88dc84064 100644 --- a/flang/tools/f18-parse-demo/f18-parse-demo.cpp +++ b/flang/tools/f18-parse-demo/f18-parse-demo.cpp @@ -21,8 +21,6 @@ // scaffolding compiler driver that can test some semantic passes of the // F18 compiler under development. -#include "flang/Common/Fortran-features.h" -#include "flang/Common/default-kinds.h" #include "flang/Parser/characters.h" #include "flang/Parser/dump-parse-tree.h" #include "flang/Parser/message.h" @@ -31,6 +29,8 @@ #include "flang/Parser/parsing.h" #include "flang/Parser/provenance.h" #include "flang/Parser/unparse.h" +#include "flang/Support/Fortran-features.h" +#include "flang/Support/default-kinds.h" #include "llvm/Support/Errno.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Program.h" diff --git a/flang/tools/tco/CMakeLists.txt b/flang/tools/tco/CMakeLists.txt index 220f908d2f108..c277cdbf167b6 100644 --- a/flang/tools/tco/CMakeLists.txt +++ b/flang/tools/tco/CMakeLists.txt @@ -20,7 +20,7 @@ target_link_libraries(tco PRIVATE flangPasses FIROpenACCSupport FlangOpenMPTransforms - FortranCommon + FortranSupport ) mlir_target_link_libraries(tco PRIVATE diff --git a/flang/unittests/Evaluate/CMakeLists.txt b/flang/unittests/Evaluate/CMakeLists.txt index 52eb385f4763f..0ea02ad7f7115 100644 --- a/flang/unittests/Evaluate/CMakeLists.txt +++ b/flang/unittests/Evaluate/CMakeLists.txt @@ -26,7 +26,7 @@ add_flang_nongtest_unittest(uint128 ) add_flang_nongtest_unittest(expression - FortranCommon + FortranSupport FortranEvaluateTesting FortranEvaluate FortranSemantics @@ -40,7 +40,7 @@ add_flang_nongtest_unittest(integer ) add_flang_nongtest_unittest(intrinsics - FortranCommon + FortranSupport FortranEvaluateTesting FortranEvaluate FortranDecimal @@ -84,7 +84,7 @@ add_flang_nongtest_unittest(ISO-Fortran-binding ) add_flang_nongtest_unittest(folding - FortranCommon + FortranSupport FortranEvaluateTesting FortranEvaluate FortranSemantics diff --git a/flang/unittests/Evaluate/ISO-Fortran-binding.cpp b/flang/unittests/Evaluate/ISO-Fortran-binding.cpp index 3c98363f90046..38688b404876f 100644 --- a/flang/unittests/Evaluate/ISO-Fortran-binding.cpp +++ b/flang/unittests/Evaluate/ISO-Fortran-binding.cpp @@ -1,5 +1,5 @@ #include "testing.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/descriptor.h" #include "llvm/Support/raw_ostream.h" #include diff --git a/flang/unittests/Frontend/CMakeLists.txt b/flang/unittests/Frontend/CMakeLists.txt index 9177997f41f53..3cbc2cf148511 100644 --- a/flang/unittests/Frontend/CMakeLists.txt +++ b/flang/unittests/Frontend/CMakeLists.txt @@ -18,7 +18,7 @@ target_link_libraries(FlangFrontendTests FortranLower FortranParser FortranSemantics - FortranCommon + FortranSupport FortranEvaluate ) diff --git a/flang/unittests/Runtime/CUDA/Allocatable.cpp b/flang/unittests/Runtime/CUDA/Allocatable.cpp index 0f7eb27789316..bdfa8f5cc3213 100644 --- a/flang/unittests/Runtime/CUDA/Allocatable.cpp +++ b/flang/unittests/Runtime/CUDA/Allocatable.cpp @@ -9,11 +9,11 @@ #include "flang/Runtime/allocatable.h" #include "gtest/gtest.h" #include "../../../runtime/terminator.h" -#include "flang/Common/Fortran.h" #include "flang/Runtime/CUDA/allocator.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/allocator-registry.h" +#include "flang/Support/Fortran.h" #include "cuda_runtime.h" diff --git a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp index 7cb25787e7797..5ec122e4c5777 100644 --- a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp +++ b/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp @@ -8,11 +8,11 @@ #include "gtest/gtest.h" #include "../../../runtime/terminator.h" -#include "flang/Common/Fortran.h" #include "flang/Runtime/CUDA/allocator.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/allocator-registry.h" +#include "flang/Support/Fortran.h" #include "cuda_runtime.h" diff --git a/flang/unittests/Runtime/CUDA/Memory.cpp b/flang/unittests/Runtime/CUDA/Memory.cpp index 7c8b7aa5a4d78..61c9d1131ee56 100644 --- a/flang/unittests/Runtime/CUDA/Memory.cpp +++ b/flang/unittests/Runtime/CUDA/Memory.cpp @@ -10,12 +10,12 @@ #include "gtest/gtest.h" #include "../../../runtime/terminator.h" #include "../tools.h" -#include "flang/Common/Fortran.h" #include "flang/Runtime/CUDA/allocator.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/allocator-registry.h" +#include "flang/Support/Fortran.h" #include "cuda_runtime.h" diff --git a/flang/unittests/Runtime/TemporaryStack.cpp b/flang/unittests/Runtime/TemporaryStack.cpp index 0a9344969ca6b..4f701e09b2945 100644 --- a/flang/unittests/Runtime/TemporaryStack.cpp +++ b/flang/unittests/Runtime/TemporaryStack.cpp @@ -8,7 +8,7 @@ #include "gtest/gtest.h" #include "tools.h" -#include "flang/ISO_Fortran_binding_wrapper.h" +#include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/cpp-type.h" #include "flang/Runtime/descriptor.h"