-
Notifications
You must be signed in to change notification settings - Fork 12.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Flang][NFC] Move runtime library files to flang-rt. #110298
base: main
Are you sure you want to change the base?
Conversation
You can test this locally with the following command:git-clang-format --diff 3c464d23682b0f9e6f70965e8f8f3861c9ba5417 d65a4bcf0d76932e2f6078a7fc7db6ab922fd3fb --extensions cpp,c,h -- flang/include/flang/Evaluate/call.h flang/include/flang/Evaluate/characteristics.h flang/include/flang/Evaluate/common.h flang/include/flang/Evaluate/constant.h flang/include/flang/Evaluate/expression.h flang/include/flang/Evaluate/formatting.h flang/include/flang/Evaluate/intrinsics.h flang/include/flang/Evaluate/shape.h flang/include/flang/Evaluate/target.h flang/include/flang/Evaluate/tools.h flang/include/flang/Evaluate/traverse.h flang/include/flang/Evaluate/type.h flang/include/flang/Evaluate/variable.h flang/include/flang/Frontend/CompilerInvocation.h flang/include/flang/Frontend/FrontendOptions.h flang/include/flang/ISO_Fortran_binding.h flang/include/flang/Lower/AbstractConverter.h flang/include/flang/Lower/Bridge.h flang/include/flang/Lower/CallInterface.h flang/include/flang/Lower/ConvertType.h flang/include/flang/Lower/LoweringOptions.h flang/include/flang/Lower/PFTBuilder.h flang/include/flang/Lower/Support/Utils.h flang/include/flang/Lower/SymbolMap.h flang/include/flang/Optimizer/Builder/FIRBuilder.h flang/include/flang/Optimizer/Builder/PPCIntrinsicCall.h flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h flang/include/flang/Optimizer/CodeGen/DescriptorModel.h flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h flang/include/flang/Optimizer/Support/TypeCode.h flang/include/flang/Optimizer/Support/Utils.h flang/include/flang/Parser/char-block.h flang/include/flang/Parser/dump-parse-tree.h flang/include/flang/Parser/message.h flang/include/flang/Parser/parse-state.h flang/include/flang/Parser/parse-tree.h flang/include/flang/Parser/parsing.h flang/include/flang/Parser/provenance.h flang/include/flang/Parser/source.h flang/include/flang/Parser/user-state.h flang/include/flang/Runtime/allocatable.h flang/include/flang/Runtime/descriptor-consts.h flang/include/flang/Runtime/io-api.h flang/include/flang/Runtime/pointer.h flang/include/flang/Runtime/random.h flang/include/flang/Runtime/support.h flang/include/flang/Semantics/expression.h flang/include/flang/Semantics/runtime-type-info.h flang/include/flang/Semantics/scope.h flang/include/flang/Semantics/semantics.h flang/include/flang/Semantics/symbol.h flang/include/flang/Semantics/tools.h flang/include/flang/Semantics/type.h flang/include/flang/Tools/CrossToolHelpers.h flang/lib/Evaluate/call.cpp flang/lib/Evaluate/characteristics.cpp flang/lib/Evaluate/fold-implementation.h flang/lib/Evaluate/formatting.cpp flang/lib/Evaluate/intrinsics-library.cpp flang/lib/Evaluate/intrinsics.cpp flang/lib/Evaluate/real.cpp flang/lib/Evaluate/shape.cpp flang/lib/Evaluate/target.cpp flang/lib/Frontend/CompilerInstance.cpp flang/lib/Frontend/CompilerInvocation.cpp flang/lib/Frontend/FrontendActions.cpp flang/lib/Lower/Bridge.cpp flang/lib/Lower/CallInterface.cpp flang/lib/Lower/ConvertExpr.cpp flang/lib/Lower/Mangler.cpp flang/lib/Optimizer/Builder/IntrinsicCall.cpp flang/lib/Optimizer/CodeGen/TypeConverter.cpp flang/lib/Optimizer/Dialect/FIRType.cpp flang/lib/Optimizer/Transforms/AddDebugInfo.cpp flang/lib/Optimizer/Transforms/AssumedRankOpConversion.cpp flang/lib/Optimizer/Transforms/CUFDeviceGlobal.cpp flang/lib/Optimizer/Transforms/CUFGPUToLLVMConversion.cpp flang/lib/Optimizer/Transforms/CUFOpConversion.cpp flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp flang/lib/Optimizer/Transforms/LoopVersioning.cpp flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp flang/lib/Optimizer/Transforms/StackReclaim.cpp flang/lib/Optimizer/Transforms/VScaleAttr.cpp flang/lib/Parser/basic-parsers.h flang/lib/Parser/parse-tree.cpp flang/lib/Parser/prescan.h flang/lib/Parser/unparse.cpp flang/lib/Semantics/assignment.h flang/lib/Semantics/check-case.cpp flang/lib/Semantics/check-coarray.cpp flang/lib/Semantics/check-cuda.cpp flang/lib/Semantics/check-data.h flang/lib/Semantics/check-do-forall.cpp flang/lib/Semantics/check-return.cpp flang/lib/Semantics/check-select-rank.cpp flang/lib/Semantics/check-select-type.cpp flang/lib/Semantics/check-stop.cpp flang/lib/Semantics/data-to-inits.h flang/lib/Semantics/expression.cpp flang/lib/Semantics/pointer-assignment.cpp flang/lib/Semantics/resolve-labels.cpp flang/lib/Semantics/resolve-names-utils.cpp flang/lib/Semantics/resolve-names.cpp flang/lib/Semantics/rewrite-parse-tree.cpp flang/lib/Semantics/semantics.cpp flang/lib/Semantics/tools.cpp flang/tools/bbc/bbc.cpp flang/tools/f18-parse-demo/f18-parse-demo.cpp flang/unittests/Decimal/quick-sanity-test.cpp flang/unittests/Decimal/thorough-test.cpp flang/unittests/Evaluate/bit-population-count.cpp flang/unittests/Evaluate/expression.cpp flang/unittests/Evaluate/folding.cpp flang/unittests/Evaluate/integer.cpp flang/unittests/Evaluate/intrinsics.cpp flang/unittests/Evaluate/leading-zero-bit-count.cpp flang/unittests/Evaluate/logical.cpp flang/unittests/Evaluate/real.cpp flang/unittests/Evaluate/uint128.cpp flang-rt/include/flang-rt/CUDA/allocator.h flang-rt/include/flang-rt/allocator-registry.h flang-rt/include/flang-rt/array-constructor.h flang-rt/include/flang-rt/descriptor.h flang-rt/include/flang-rt/memory.h flang-rt/include/flang-rt/type-code.h flang-rt/lib/CufRuntime/allocatable.cpp flang-rt/lib/CufRuntime/allocator.cpp flang-rt/lib/CufRuntime/descriptor.cpp flang-rt/lib/CufRuntime/kernel.cpp flang-rt/lib/CufRuntime/memory.cpp flang-rt/lib/CufRuntime/registration.cpp flang-rt/lib/FortranFloat128Math/acos.cpp flang-rt/lib/FortranFloat128Math/acosh.cpp flang-rt/lib/FortranFloat128Math/asin.cpp flang-rt/lib/FortranFloat128Math/asinh.cpp flang-rt/lib/FortranFloat128Math/atan.cpp flang-rt/lib/FortranFloat128Math/atan2.cpp flang-rt/lib/FortranFloat128Math/atanh.cpp flang-rt/lib/FortranFloat128Math/ceil.cpp flang-rt/lib/FortranFloat128Math/complex-math.c flang-rt/lib/FortranFloat128Math/complex-math.h flang-rt/lib/FortranFloat128Math/cos.cpp flang-rt/lib/FortranFloat128Math/cosh.cpp flang-rt/lib/FortranFloat128Math/erf.cpp flang-rt/lib/FortranFloat128Math/erfc.cpp flang-rt/lib/FortranFloat128Math/exp.cpp flang-rt/lib/FortranFloat128Math/exponent.cpp flang-rt/lib/FortranFloat128Math/floor.cpp flang-rt/lib/FortranFloat128Math/fma.cpp flang-rt/lib/FortranFloat128Math/fraction.cpp flang-rt/lib/FortranFloat128Math/hypot.cpp flang-rt/lib/FortranFloat128Math/j0.cpp flang-rt/lib/FortranFloat128Math/j1.cpp flang-rt/lib/FortranFloat128Math/jn.cpp flang-rt/lib/FortranFloat128Math/lgamma.cpp flang-rt/lib/FortranFloat128Math/llround.cpp flang-rt/lib/FortranFloat128Math/log.cpp flang-rt/lib/FortranFloat128Math/log10.cpp flang-rt/lib/FortranFloat128Math/lround.cpp flang-rt/lib/FortranFloat128Math/math-entries.h flang-rt/lib/FortranFloat128Math/mod-real.cpp flang-rt/lib/FortranFloat128Math/modulo-real.cpp flang-rt/lib/FortranFloat128Math/nearbyint.cpp flang-rt/lib/FortranFloat128Math/nearest.cpp flang-rt/lib/FortranFloat128Math/norm2.cpp flang-rt/lib/FortranFloat128Math/numeric-template-specs.h flang-rt/lib/FortranFloat128Math/pow.cpp flang-rt/lib/FortranFloat128Math/random.cpp flang-rt/lib/FortranFloat128Math/remainder.cpp flang-rt/lib/FortranFloat128Math/round.cpp flang-rt/lib/FortranFloat128Math/rrspacing.cpp flang-rt/lib/FortranFloat128Math/scale.cpp flang-rt/lib/FortranFloat128Math/set-exponent.cpp flang-rt/lib/FortranFloat128Math/sin.cpp flang-rt/lib/FortranFloat128Math/sinh.cpp flang-rt/lib/FortranFloat128Math/spacing.cpp flang-rt/lib/FortranFloat128Math/sqrt.cpp flang-rt/lib/FortranFloat128Math/tan.cpp flang-rt/lib/FortranFloat128Math/tanh.cpp flang-rt/lib/FortranFloat128Math/tgamma.cpp flang-rt/lib/FortranFloat128Math/trunc.cpp flang-rt/lib/FortranFloat128Math/y0.cpp flang-rt/lib/FortranFloat128Math/y1.cpp flang-rt/lib/FortranFloat128Math/yn.cpp flang-rt/lib/flang_rt/ISO_Fortran_binding.cpp flang-rt/lib/flang_rt/ISO_Fortran_util.h flang-rt/lib/flang_rt/allocatable.cpp flang-rt/lib/flang_rt/allocator-registry.cpp flang-rt/lib/flang_rt/array-constructor.cpp flang-rt/lib/flang_rt/assign-impl.h flang-rt/lib/flang_rt/assign.cpp flang-rt/lib/flang_rt/buffer.cpp flang-rt/lib/flang_rt/buffer.h flang-rt/lib/flang_rt/character.cpp flang-rt/lib/flang_rt/command.cpp flang-rt/lib/flang_rt/complex-powi.cpp flang-rt/lib/flang_rt/complex-reduction.c flang-rt/lib/flang_rt/complex-reduction.h flang-rt/lib/flang_rt/connection.cpp flang-rt/lib/flang_rt/connection.h flang-rt/lib/flang_rt/copy.cpp flang-rt/lib/flang_rt/copy.h flang-rt/lib/flang_rt/derived-api.cpp flang-rt/lib/flang_rt/derived.cpp flang-rt/lib/flang_rt/derived.h flang-rt/lib/flang_rt/descriptor-io.cpp flang-rt/lib/flang_rt/descriptor-io.h flang-rt/lib/flang_rt/descriptor.cpp flang-rt/lib/flang_rt/dot-product.cpp flang-rt/lib/flang_rt/edit-input.cpp flang-rt/lib/flang_rt/edit-input.h flang-rt/lib/flang_rt/edit-output.cpp flang-rt/lib/flang_rt/edit-output.h flang-rt/lib/flang_rt/emit-encoded.h flang-rt/lib/flang_rt/environment-default-list.h flang-rt/lib/flang_rt/environment.cpp flang-rt/lib/flang_rt/environment.h flang-rt/lib/flang_rt/exceptions.cpp flang-rt/lib/flang_rt/execute.cpp flang-rt/lib/flang_rt/extensions.cpp flang-rt/lib/flang_rt/external-unit.cpp flang-rt/lib/flang_rt/extrema.cpp flang-rt/lib/flang_rt/file.cpp flang-rt/lib/flang_rt/file.h flang-rt/lib/flang_rt/findloc.cpp flang-rt/lib/flang_rt/format-implementation.h flang-rt/lib/flang_rt/format.cpp flang-rt/lib/flang_rt/format.h flang-rt/lib/flang_rt/inquiry.cpp flang-rt/lib/flang_rt/internal-unit.cpp flang-rt/lib/flang_rt/internal-unit.h flang-rt/lib/flang_rt/io-api-common.h flang-rt/lib/flang_rt/io-api-minimal.cpp flang-rt/lib/flang_rt/io-api.cpp flang-rt/lib/flang_rt/io-error.cpp flang-rt/lib/flang_rt/io-error.h flang-rt/lib/flang_rt/io-stmt.cpp flang-rt/lib/flang_rt/io-stmt.h flang-rt/lib/flang_rt/iostat.cpp flang-rt/lib/flang_rt/lock.h flang-rt/lib/flang_rt/main.cpp flang-rt/lib/flang_rt/matmul-transpose.cpp flang-rt/lib/flang_rt/matmul.cpp flang-rt/lib/flang_rt/memory.cpp flang-rt/lib/flang_rt/misc-intrinsic.cpp flang-rt/lib/flang_rt/namelist.cpp flang-rt/lib/flang_rt/namelist.h flang-rt/lib/flang_rt/non-tbp-dio.cpp flang-rt/lib/flang_rt/non-tbp-dio.h flang-rt/lib/flang_rt/numeric-templates.h flang-rt/lib/flang_rt/numeric.cpp flang-rt/lib/flang_rt/pointer.cpp flang-rt/lib/flang_rt/product.cpp flang-rt/lib/flang_rt/pseudo-unit.cpp flang-rt/lib/flang_rt/ragged.cpp flang-rt/lib/flang_rt/random-templates.h flang-rt/lib/flang_rt/random.cpp flang-rt/lib/flang_rt/reduce.cpp flang-rt/lib/flang_rt/reduction-templates.h flang-rt/lib/flang_rt/reduction.cpp flang-rt/lib/flang_rt/stack.h flang-rt/lib/flang_rt/stat.cpp flang-rt/lib/flang_rt/stat.h flang-rt/lib/flang_rt/stop.cpp flang-rt/lib/flang_rt/sum.cpp flang-rt/lib/flang_rt/support.cpp flang-rt/lib/flang_rt/temporary-stack.cpp flang-rt/lib/flang_rt/terminator.cpp flang-rt/lib/flang_rt/terminator.h flang-rt/lib/flang_rt/time-intrinsic.cpp flang-rt/lib/flang_rt/tools.cpp flang-rt/lib/flang_rt/tools.h flang-rt/lib/flang_rt/transformational.cpp flang-rt/lib/flang_rt/type-code.cpp flang-rt/lib/flang_rt/type-info.cpp flang-rt/lib/flang_rt/type-info.h flang-rt/lib/flang_rt/unit-map.cpp flang-rt/lib/flang_rt/unit-map.h flang-rt/lib/flang_rt/unit.cpp flang-rt/lib/flang_rt/unit.h flang-rt/lib/flang_rt/utf.cpp flang-rt/lib/flang_rt/utf.h flang-rt/test/Runtime/no-cpp-dep.c flang-rt/unittests/Evaluate/ISO-Fortran-binding.cpp flang-rt/unittests/Evaluate/reshape.cpp flang-rt/unittests/Runtime/AccessTest.cpp flang-rt/unittests/Runtime/Allocatable.cpp flang-rt/unittests/Runtime/ArrayConstructor.cpp flang-rt/unittests/Runtime/BufferTest.cpp flang-rt/unittests/Runtime/CUDA/Allocatable.cpp flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp flang-rt/unittests/Runtime/CharacterTest.cpp flang-rt/unittests/Runtime/CommandTest.cpp flang-rt/unittests/Runtime/Complex.cpp flang-rt/unittests/Runtime/CrashHandlerFixture.cpp flang-rt/unittests/Runtime/CrashHandlerFixture.h flang-rt/unittests/Runtime/Derived.cpp flang-rt/unittests/Runtime/ExternalIOTest.cpp flang-rt/unittests/Runtime/Format.cpp flang-rt/unittests/Runtime/Inquiry.cpp flang-rt/unittests/Runtime/ListInputTest.cpp flang-rt/unittests/Runtime/LogicalFormatTest.cpp flang-rt/unittests/Runtime/Matmul.cpp flang-rt/unittests/Runtime/MatmulTranspose.cpp flang-rt/unittests/Runtime/MiscIntrinsic.cpp flang-rt/unittests/Runtime/Namelist.cpp flang-rt/unittests/Runtime/Numeric.cpp flang-rt/unittests/Runtime/NumericalFormatTest.cpp flang-rt/unittests/Runtime/Pointer.cpp flang-rt/unittests/Runtime/Ragged.cpp flang-rt/unittests/Runtime/Random.cpp flang-rt/unittests/Runtime/Reduction.cpp flang-rt/unittests/Runtime/RuntimeCrashTest.cpp flang-rt/unittests/Runtime/Stop.cpp flang-rt/unittests/Runtime/Support.cpp flang-rt/unittests/Runtime/TemporaryStack.cpp flang-rt/unittests/Runtime/Time.cpp flang-rt/unittests/Runtime/Transformational.cpp flang-rt/unittests/Runtime/tools.h flang/include/flang/Common/ISO_Fortran_binding_wrapper.h flang/include/flang/Common/binary-floating-point.h flang/include/flang/Common/decimal.h flang/include/flang/Support/Fortran-features.h flang/include/flang/Support/Fortran.h flang/include/flang/Support/LangOptions.h flang/include/flang/Support/MathOptionsBase.h flang/include/flang/Support/OpenMP-features.h flang/include/flang/Support/Version.h flang/include/flang/Support/default-kinds.h flang/include/flang/Support/indirection.h flang/include/flang/Support/interval.h flang/include/flang/Support/reference-counted.h flang/include/flang/Support/reference.h flang/include/flang/Support/static-multimap-view.h flang/include/flang/Support/template.h flang/include/flang/Support/unwrap.h flang/include/flang/Testing/fp-testing.h flang/include/flang/Testing/testing.h flang/lib/Common/big-radix-floating-point.h flang/lib/Common/binary-to-decimal.cpp flang/lib/Common/decimal-to-binary.cpp flang/lib/Support/Fortran-features.cpp flang/lib/Support/Fortran.cpp flang/lib/Support/LangOptions.cpp flang/lib/Support/OpenMP-utils.cpp flang/lib/Support/Version.cpp flang/lib/Support/default-kinds.cpp flang/lib/Support/idioms.cpp flang/lib/Testing/fp-testing.cpp flang/lib/Testing/testing.cpp View the diff from clang-format here.diff --git a/flang-rt/include/flang-rt/array-constructor.h b/flang-rt/include/flang-rt/array-constructor.h
index 5691cfc355..a0aee59bea 100644
--- a/flang-rt/include/flang-rt/array-constructor.h
+++ b/flang-rt/include/flang-rt/array-constructor.h
@@ -44,6 +44,5 @@ private:
unsigned char useValueLengthParameters_ : 1;
};
-
} // namespace Fortran::runtime
#endif /* FLANG_RT_ARRAY_CONSTRUCTOR_H_ */
diff --git a/flang-rt/lib/flang_rt/allocatable.cpp b/flang-rt/lib/flang_rt/allocatable.cpp
index 393f1ecd44..1294cc326c 100644
--- a/flang-rt/lib/flang_rt/allocatable.cpp
+++ b/flang-rt/lib/flang_rt/allocatable.cpp
@@ -18,8 +18,6 @@
using Fortran::common::TypeCategory;
-
-
namespace Fortran::runtime {
extern "C" {
RT_EXT_API_GROUP_BEGIN
diff --git a/flang-rt/lib/flang_rt/descriptor.cpp b/flang-rt/lib/flang_rt/descriptor.cpp
index 39192d6c79..1655fa1df2 100644
--- a/flang-rt/lib/flang_rt/descriptor.cpp
+++ b/flang-rt/lib/flang_rt/descriptor.cpp
@@ -141,9 +141,10 @@ RT_API_ATTRS OwningPtr<Descriptor> Descriptor::Create(
RT_API_ATTRS std::size_t Descriptor::SizeInBytes() const {
const DescriptorAddendum *addendum{Addendum()};
- std::size_t bytes{ sizeof *this - sizeof(Dimension) + raw_.rank * sizeof(Dimension) +
- (addendum ? addendum->SizeInBytes() : 0)};
- assert (bytes <= MaxDescriptorSizeInBytes(raw_.rank,addendum) && "Descriptor must fit compiler-allocated space");
+ std::size_t bytes{sizeof *this - sizeof(Dimension) +
+ raw_.rank * sizeof(Dimension) + (addendum ? addendum->SizeInBytes() : 0)};
+ assert(bytes <= MaxDescriptorSizeInBytes(raw_.rank, addendum) &&
+ "Descriptor must fit compiler-allocated space");
return bytes;
}
diff --git a/flang-rt/lib/flang_rt/environment.h b/flang-rt/lib/flang_rt/environment.h
index 7e6d3d1d76..3ab411b7d0 100644
--- a/flang-rt/lib/flang_rt/environment.h
+++ b/flang-rt/lib/flang_rt/environment.h
@@ -39,7 +39,7 @@ struct ExecutionEnvironment {
// FIXME: https://github.com/llvm/llvm-project/issues/84942
constexpr
#endif
- ExecutionEnvironment(){};
+ ExecutionEnvironment() {};
void Configure(int argc, const char *argv[], const char *envp[],
const EnvironmentDefaultList *envDefaults);
const char *GetEnv(
diff --git a/flang-rt/lib/flang_rt/extensions.cpp b/flang-rt/lib/flang_rt/extensions.cpp
index 0658ddcc10..304ec48fa9 100644
--- a/flang-rt/lib/flang_rt/extensions.cpp
+++ b/flang-rt/lib/flang_rt/extensions.cpp
@@ -51,7 +51,7 @@ inline void CtimeBuffer(char *buffer, size_t bufsize, const time_t cur_time,
#ifndef _WIN32
// posix-compliant and has getlogin_r and F_OK
-#include <unistd.h>
+#include <unistd.h>
#endif
extern "C" {
diff --git a/flang-rt/lib/flang_rt/io-stmt.cpp b/flang-rt/lib/flang_rt/io-stmt.cpp
index 1d4cd3a557..0c9fc3c98f 100644
--- a/flang-rt/lib/flang_rt/io-stmt.cpp
+++ b/flang-rt/lib/flang_rt/io-stmt.cpp
@@ -370,8 +370,8 @@ int NoUnitIoStatementState::EndIoStatement() {
template <Direction DIR>
ExternalIoStatementState<DIR>::ExternalIoStatementState(
ExternalFileUnit &unit, const char *sourceFile, int sourceLine)
- : ExternalIoStatementBase{unit, sourceFile, sourceLine}, mutableModes_{
- unit.modes} {
+ : ExternalIoStatementBase{unit, sourceFile, sourceLine},
+ mutableModes_{unit.modes} {
if constexpr (DIR == Direction::Output) {
// If the last statement was a non-advancing IO input statement, the unit
// furthestPositionInRecord was not advanced, but the positionInRecord may
@@ -990,9 +990,8 @@ ChildFormattedIoStatementState<DIR, CHAR>::ChildFormattedIoStatementState(
ChildIo &child, const CHAR *format, std::size_t formatLength,
const Descriptor *formatDescriptor, const char *sourceFile, int sourceLine)
: ChildIoStatementState<DIR>{child, sourceFile, sourceLine},
- mutableModes_{child.parent().mutableModes()}, format_{*this, format,
- formatLength,
- formatDescriptor} {}
+ mutableModes_{child.parent().mutableModes()},
+ format_{*this, format, formatLength, formatDescriptor} {}
template <Direction DIR, typename CHAR>
void ChildFormattedIoStatementState<DIR, CHAR>::CompleteOperation() {
@@ -1448,8 +1447,8 @@ bool InquireNoUnitState::Inquire(
InquireUnconnectedFileState::InquireUnconnectedFileState(
OwningPtr<char> &&path, const char *sourceFile, int sourceLine)
- : NoUnitIoStatementState{*this, sourceFile, sourceLine}, path_{std::move(
- path)} {}
+ : NoUnitIoStatementState{*this, sourceFile, sourceLine},
+ path_{std::move(path)} {}
bool InquireUnconnectedFileState::Inquire(
InquiryKeywordHash inquiry, char *result, std::size_t length) {
diff --git a/flang-rt/lib/flang_rt/type-info.cpp b/flang-rt/lib/flang_rt/type-info.cpp
index 031721833d..7bafe6763e 100644
--- a/flang-rt/lib/flang_rt/type-info.cpp
+++ b/flang-rt/lib/flang_rt/type-info.cpp
@@ -84,14 +84,15 @@ RT_API_ATTRS std::size_t Component::SizeInBytes(
return GetElementByteSize(instance) * GetElements(instance);
} else if (category() == TypeCategory::Derived) {
const DerivedType *type{derivedType()};
- auto bytes {Descriptor::SizeInBytes(
- rank_, true, type ? type->LenParameters() : 0)};
- assert(bytes <= MaxDescriptorSizeInBytes( rank_, true, type ? type->LenParameters() : 0));
+ auto bytes{
+ Descriptor::SizeInBytes(rank_, true, type ? type->LenParameters() : 0)};
+ assert(bytes <= MaxDescriptorSizeInBytes(
+ rank_, true, type ? type->LenParameters() : 0));
return bytes;
} else {
- auto bytes{ Descriptor::SizeInBytes(rank_)};
- assert(bytes <= MaxDescriptorSizeInBytes( rank_));
- return bytes;
+ auto bytes{Descriptor::SizeInBytes(rank_)};
+ assert(bytes <= MaxDescriptorSizeInBytes(rank_));
+ return bytes;
}
}
diff --git a/flang-rt/unittests/Runtime/Transformational.cpp b/flang-rt/unittests/Runtime/Transformational.cpp
index c14f228c39..1d97db123d 100644
--- a/flang-rt/unittests/Runtime/Transformational.cpp
+++ b/flang-rt/unittests/Runtime/Transformational.cpp
@@ -26,8 +26,8 @@ using BesselX0FuncType =
std::function<void(Descriptor &, int32_t, int32_t, const char *, int)>;
template <int KIND>
-constexpr CppTypeFor<TypeCategory::Real, KIND>
- besselEpsilon = CppTypeFor<TypeCategory::Real, KIND>(1e-4);
+constexpr CppTypeFor<TypeCategory::Real, KIND> besselEpsilon =
+ CppTypeFor<TypeCategory::Real, KIND>(1e-4);
template <int KIND>
static void testBesselJn(BesselFuncType<KIND> rtFunc, int32_t n1, int32_t n2,
diff --git a/flang/include/flang/Parser/message.h b/flang/include/flang/Parser/message.h
index 70c6264aa1..bfbc985b8b 100644
--- a/flang/include/flang/Parser/message.h
+++ b/flang/include/flang/Parser/message.h
@@ -15,9 +15,9 @@
#include "char-block.h"
#include "char-set.h"
#include "provenance.h"
-#include "flang/Support/Fortran-features.h"
#include "flang/Common/idioms.h"
#include "flang/Common/restorer.h"
+#include "flang/Support/Fortran-features.h"
#include "flang/Support/reference-counted.h"
#include <cstddef>
#include <cstring>
diff --git a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
index 8380527a69..3d84eaa4c1 100644
--- a/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
+++ b/flang/lib/Optimizer/Transforms/ExternalNameConversion.cpp
@@ -11,8 +11,8 @@
#include "flang/Optimizer/Dialect/FIROpsSupport.h"
#include "flang/Optimizer/Support/InternalNames.h"
#include "flang/Optimizer/Transforms/Passes.h"
-#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "flang/Support/Fortran.h"
+#include "mlir/Dialect/GPU/IR/GPUDialect.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/SymbolTable.h"
#include "mlir/Pass/Pass.h"
diff --git a/flang/lib/Testing/fp-testing.cpp b/flang/lib/Testing/fp-testing.cpp
index 8541b14063..5e1728e8df 100644
--- a/flang/lib/Testing/fp-testing.cpp
+++ b/flang/lib/Testing/fp-testing.cpp
@@ -15,8 +15,8 @@
#include <xmmintrin.h>
#endif
-using Fortran::common::RoundingMode;
using Fortran::common::RealFlag;
+using Fortran::common::RoundingMode;
ScopedHostFloatingPointEnvironment::ScopedHostFloatingPointEnvironment(
#if __x86_64__
|
Build fix f90 relative paths update copyright headers Test experimental CUDA build
Due to missing lit.cfg, will only be executing again after #110217.
The formatting violations in #110298 (comment) are those already present in the current trunk. |
@llvm/pr-subscribers-flang-driver @llvm/pr-subscribers-flang-fir-hlfir Author: Michael Kruse (Meinersbur) ChangesMostly mechanical changes in preparation of extracting the FortranRuntime "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change.
Some cosmetic changes and files paths were necessary:
Patch is 334.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110298.diff 418 Files Affected:
diff --git a/FortranRuntime/.clang-format b/FortranRuntime/.clang-format
new file mode 100644
index 00000000000000..c1dfe06fdf5782
--- /dev/null
+++ b/FortranRuntime/.clang-format
@@ -0,0 +1,21 @@
+---
+# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+BasedOnStyle: LLVM
+AlignAfterOpenBracket: DontAlign
+AlignEscapedNewlines: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignOperands: false
+AlignTrailingComments: false
+IncludeCategories:
+ - Regex: '^<'
+ Priority: 4
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 3
+ - Regex: '^"(flang|\.\.)/'
+ Priority: 2
+ - Regex: '.*'
+ Priority: 1
+...
+
+# vim:set filetype=yaml:
diff --git a/flang/runtime/config.h.cmake b/FortranRuntime/cmake/config.h.cmake.in
similarity index 100%
rename from flang/runtime/config.h.cmake
rename to FortranRuntime/cmake/config.h.cmake.in
diff --git a/flang/include/flang/Common/Fortran-consts.h b/FortranRuntime/include/flang/Common/Fortran-consts.h
similarity index 100%
rename from flang/include/flang/Common/Fortran-consts.h
rename to FortranRuntime/include/flang/Common/Fortran-consts.h
diff --git a/flang/include/flang/ISO_Fortran_binding_wrapper.h b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
similarity index 70%
rename from flang/include/flang/ISO_Fortran_binding_wrapper.h
rename to FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
index 37289bdbabd03c..2c0fdc123c8759 100644
--- a/flang/include/flang/ISO_Fortran_binding_wrapper.h
+++ b/FortranRuntime/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 <stddef.h>
-#include "Common/api-attrs.h"
+#include "flang/Common/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/api-attrs.h b/FortranRuntime/include/flang/Common/api-attrs.h
similarity index 97%
rename from flang/include/flang/Common/api-attrs.h
rename to FortranRuntime/include/flang/Common/api-attrs.h
index d73e60996bc81f..9a3001fb255c11 100644
--- a/flang/include/flang/Common/api-attrs.h
+++ b/FortranRuntime/include/flang/Common/api-attrs.h
@@ -1,11 +1,10 @@
-/*===-- include/flang/Common/api-attrs.h ---------------------------*- C -*-=//
+/*===-- include/flang/Common/api-attrs.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
*
- *===------------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
/*
* The file defines a set macros that can be used to apply
@@ -13,8 +12,8 @@
* declared/defined/used in Flang runtime library.
*/
-#ifndef FORTRAN_RUNTIME_API_ATTRS_H_
-#define FORTRAN_RUNTIME_API_ATTRS_H_
+#ifndef FORTRAN_COMMON_API_ATTRS_H_
+#define FORTRAN_COMMON_API_ATTRS_H_
/*
* RT_EXT_API_GROUP_BEGIN/END pair is placed around definitions
@@ -178,4 +177,4 @@
#define RT_DEVICE_NOINLINE_HOST_INLINE inline
#endif
-#endif /* !FORTRAN_RUNTIME_API_ATTRS_H_ */
+#endif /* FORTRAN_COMMON_API_ATTRS_H_ */
diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/FortranRuntime/include/flang/Common/binary-floating-point.h
similarity index 96%
rename from flang/include/flang/Decimal/binary-floating-point.h
rename to FortranRuntime/include/flang/Common/binary-floating-point.h
index 1e0cde97d98e61..705acc31bdfb21 100644
--- a/flang/include/flang/Decimal/binary-floating-point.h
+++ b/FortranRuntime/include/flang/Common/binary-floating-point.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===//
+//===-- include/flang/Common/binary-floating-point.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_DECIMAL_BINARY_FLOATING_POINT_H_
-#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
+#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
+#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
// Access and manipulate the fields of an IEEE-754 binary
// floating-point value via a generalized template.
@@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
RawType raw_{0};
};
} // namespace Fortran::decimal
-#endif
+#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */
diff --git a/flang/include/flang/Common/bit-population-count.h b/FortranRuntime/include/flang/Common/bit-population-count.h
similarity index 98%
rename from flang/include/flang/Common/bit-population-count.h
rename to FortranRuntime/include/flang/Common/bit-population-count.h
index e1aeb78f9a3765..59ade914d14d85 100644
--- a/flang/include/flang/Common/bit-population-count.h
+++ b/FortranRuntime/include/flang/Common/bit-population-count.h
@@ -93,4 +93,4 @@ template <typename INT> inline constexpr int TrailingZeroBitCount(INT x) {
}
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_BIT_POPULATION_COUNT_H_
+#endif /* FORTRAN_COMMON_BIT_POPULATION_COUNT_H_ */
diff --git a/flang/include/flang/Common/constexpr-bitset.h b/FortranRuntime/include/flang/Common/constexpr-bitset.h
similarity index 98%
rename from flang/include/flang/Common/constexpr-bitset.h
rename to FortranRuntime/include/flang/Common/constexpr-bitset.h
index 1aafb6eff84c61..093b247b5f4eff 100644
--- a/flang/include/flang/Common/constexpr-bitset.h
+++ b/FortranRuntime/include/flang/Common/constexpr-bitset.h
@@ -144,4 +144,4 @@ template <int BITS> class BitSet {
Word bits_{0};
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_CONSTEXPR_BITSET_H_
+#endif /* FORTRAN_COMMON_CONSTEXPR_BITSET_H_ */
diff --git a/flang/include/flang/Decimal/decimal.h b/FortranRuntime/include/flang/Common/decimal.h
similarity index 95%
rename from flang/include/flang/Decimal/decimal.h
rename to FortranRuntime/include/flang/Common/decimal.h
index 443163d058e28b..c086f97129f6a5 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/FortranRuntime/include/flang/Common/decimal.h
@@ -1,16 +1,15 @@
-/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-===
+/*===-- include/flang/Common/decimal.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
*
- * ===-----------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
/* C and C++ API for binary-to/from-decimal conversion package. */
-#ifndef FORTRAN_DECIMAL_DECIMAL_H_
-#define FORTRAN_DECIMAL_DECIMAL_H_
+#ifndef FORTRAN_COMMON_DECIMAL_H_
+#define FORTRAN_COMMON_DECIMAL_H_
#include "flang/Common/api-attrs.h"
#include <stddef.h>
@@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
#ifdef __cplusplus
} // extern "C"
#endif
-#endif
+#endif /* FORTRAN_COMMON_DECIMAL_H_ */
diff --git a/flang/include/flang/Common/enum-class.h b/FortranRuntime/include/flang/Common/enum-class.h
similarity index 98%
rename from flang/include/flang/Common/enum-class.h
rename to FortranRuntime/include/flang/Common/enum-class.h
index 41575d45091a8d..787648ffec48e8 100644
--- a/flang/include/flang/Common/enum-class.h
+++ b/FortranRuntime/include/flang/Common/enum-class.h
@@ -69,4 +69,4 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_ENUM_CLASS_H_
+#endif /* FORTRAN_COMMON_ENUM_CLASS_H_ */
diff --git a/flang/include/flang/Common/enum-set.h b/FortranRuntime/include/flang/Common/enum-set.h
similarity index 99%
rename from flang/include/flang/Common/enum-set.h
rename to FortranRuntime/include/flang/Common/enum-set.h
index 5290b76debee88..6100fc5e2e31c5 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/FortranRuntime/include/flang/Common/enum-set.h
@@ -228,4 +228,4 @@ struct std::hash<Fortran::common::EnumSet<ENUM, values>> {
return std::hash(x.bitset());
}
};
-#endif // FORTRAN_COMMON_ENUM_SET_H_
+#endif /* FORTRAN_COMMON_ENUM_SET_H_ */
diff --git a/flang/include/flang/Common/fast-int-set.h b/FortranRuntime/include/flang/Common/fast-int-set.h
similarity index 97%
rename from flang/include/flang/Common/fast-int-set.h
rename to FortranRuntime/include/flang/Common/fast-int-set.h
index d1c9c756a44a65..323ee4dc7e94d9 100644
--- a/flang/include/flang/Common/fast-int-set.h
+++ b/FortranRuntime/include/flang/Common/fast-int-set.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Common/fast-int-set.h --------------------*- C++ -*-===//
+//===-- include/flang/Common/fast-int-set.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.
@@ -103,4 +103,4 @@ template <int N> class FastIntSet {
bool isFullyInitialized_{false}; // memory was cleared
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_FAST_INT_SET_H_
+#endif /* FORTRAN_COMMON_FAST_INT_SET_H_ */
diff --git a/flang/include/flang/Common/float128.h b/FortranRuntime/include/flang/Common/float128.h
similarity index 96%
rename from flang/include/flang/Common/float128.h
rename to FortranRuntime/include/flang/Common/float128.h
index 2e76bc0a162e61..a7036bf679e5ae 100644
--- a/flang/include/flang/Common/float128.h
+++ b/FortranRuntime/include/flang/Common/float128.h
@@ -1,4 +1,4 @@
-/*===-- flang/Common/float128.h ----------------------------------*- C -*-===
+/*===-- include/flang/Common/float128.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.
diff --git a/flang/include/flang/Common/format.h b/FortranRuntime/include/flang/Common/format.h
similarity index 99%
rename from flang/include/flang/Common/format.h
rename to FortranRuntime/include/flang/Common/format.h
index 138e84b72b733d..6f4dfc8d2376b7 100644
--- a/flang/include/flang/Common/format.h
+++ b/FortranRuntime/include/flang/Common/format.h
@@ -901,4 +901,4 @@ template <typename CHAR> bool FormatValidator<CHAR>::Check() {
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_FORMAT_H_
+#endif /* FORTRAN_COMMON_FORMAT_H_ */
diff --git a/flang/include/flang/Common/idioms.h b/FortranRuntime/include/flang/Common/idioms.h
similarity index 99%
rename from flang/include/flang/Common/idioms.h
rename to FortranRuntime/include/flang/Common/idioms.h
index 99f383ec75b999..1ae0c0b35112e9 100644
--- a/flang/include/flang/Common/idioms.h
+++ b/FortranRuntime/include/flang/Common/idioms.h
@@ -150,4 +150,4 @@ template <typename A, typename... B>
using IfNoLvalue = std::enable_if_t<(... && !std::is_lvalue_reference_v<B>), A>;
template <typename... RVREF> using NoLvalue = IfNoLvalue<void, RVREF...>;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_IDIOMS_H_
+#endif /* FORTRAN_COMMON_IDIOMS_H_ */
diff --git a/flang/include/flang/Common/leading-zero-bit-count.h b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
similarity index 98%
rename from flang/include/flang/Common/leading-zero-bit-count.h
rename to FortranRuntime/include/flang/Common/leading-zero-bit-count.h
index a296e0b446917f..e788bfa9bcfd08 100644
--- a/flang/include/flang/Common/leading-zero-bit-count.h
+++ b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
@@ -93,4 +93,4 @@ template <typename A> inline constexpr int BitsNeededFor(A x) {
return 8 * sizeof x - LeadingZeroBitCount(x);
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_
+#endif /* FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_ */
diff --git a/flang/include/flang/Runtime/magic-numbers.h b/FortranRuntime/include/flang/Common/magic-numbers.h
similarity index 98%
rename from flang/include/flang/Runtime/magic-numbers.h
rename to FortranRuntime/include/flang/Common/magic-numbers.h
index bab0e9ae05299a..931df690766219 100644
--- a/flang/include/flang/Runtime/magic-numbers.h
+++ b/FortranRuntime/include/flang/Common/magic-numbers.h
@@ -1,10 +1,10 @@
-#if 0 /*===-- include/flang/Runtime/magic-numbers.h -----------------------===*/
-/*
+#if 0 /*===-- include/flang/Runtime/magic-numbers.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
*
- *===----------------------------------------------------------------------===*/
+/*===----------------------------------------------------------------------===*/
#endif
#if 0
This header can be included into both Fortran and C.
diff --git a/flang/include/flang/Common/optional.h b/FortranRuntime/include/flang/Common/optional.h
similarity index 98%
rename from flang/include/flang/Common/optional.h
rename to FortranRuntime/include/flang/Common/optional.h
index c0f4278009f40a..c3db3b1329a2fd 100644
--- a/flang/include/flang/Common/optional.h
+++ b/FortranRuntime/include/flang/Common/optional.h
@@ -23,8 +23,8 @@
// * cuda:: namespace need to be forced for all std:: references.
//
//===----------------------------------------------------------------------===//
-#ifndef FORTRAN_COMMON_OPTIONAL_H
-#define FORTRAN_COMMON_OPTIONAL_H
+#ifndef FORTRAN_COMMON_OPTIONAL_H_
+#define FORTRAN_COMMON_OPTIONAL_H_
#include "flang/Common/api-attrs.h"
#include <optional>
@@ -240,4 +240,4 @@ using std::optional;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_OPTIONAL_H
+#endif /* FORTRAN_COMMON_OPTIONAL_H_ */
diff --git a/flang/include/flang/Common/real.h b/FortranRuntime/include/flang/Common/real.h
similarity index 99%
rename from flang/include/flang/Common/real.h
rename to FortranRuntime/include/flang/Common/real.h
index b527deda0e3b4f..dc9a2404731e70 100644
--- a/flang/include/flang/Common/real.h
+++ b/FortranRuntime/include/flang/Common/real.h
@@ -141,4 +141,4 @@ class RealCharacteristics {
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_REAL_H_
+#endif /* FORTRAN_COMMON_REAL_H_ */
diff --git a/flang/include/flang/Common/reference-wrapper.h b/FortranRuntime/include/flang/Common/reference-wrapper.h
similarity index 96%
rename from flang/include/flang/Common/reference-wrapper.h
rename to FortranRuntime/include/flang/Common/reference-wrapper.h
index 2983754108f95a..6822fb335f398c 100644
--- a/flang/include/flang/Common/reference-wrapper.h
+++ b/FortranRuntime/include/flang/Common/reference-wrapper.h
@@ -22,8 +22,8 @@
//
// clang-format on
-#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H
-#define FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H_
+#define FORTRAN_COMMON_REFERENCE_WRAPPER_H_
#include "flang/Common/api-attrs.h"
#include <functional>
@@ -111,4 +111,4 @@ using std::reference_wrapper;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#endif /* FORTRAN_COMMON_REFERENCE_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/restorer.h b/FortranRuntime/include/flang/Common/restorer.h
similarity index 97%
rename from flang/include/flang/Common/restorer.h
rename to FortranRuntime/include/flang/Common/restorer.h
index 0f1bc48620d37e..a5c5ebe7344a1b 100644
--- a/flang/include/flang/Common/restorer.h
+++ b/FortranRuntime/include/flang/Common/restorer.h
@@ -18,8 +18,8 @@
#ifndef FORTRAN_COMMON_RESTORER_H_
#define FORTRAN_COMMON_RESTORER_H_
-#include "idioms.h"
#include "flang/Common/api-attrs.h"
+#include "idioms.h"
namespace Fortran::common {
template <typename A> class Restorer {
public:
@@ -53,4 +53,4 @@ RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(
return Restorer<A>{to, std::move(original)};
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_RESTORER_H_
+#endif /* FORTRAN_COMMON_RESTORER_H_ */
diff --git a/flang/include/flang/Common/target-rounding.h b/FortranRuntime/include/flang/Common/target-rounding.h
similarity index 100%
rename from flang/include/flang/Common/target-rounding.h
rename to FortranRuntime/include/flang/Common/target-rounding.h
diff --git a/flang/include/flang/Common/uint128.h b/FortranRuntime/include/flang/Common/uint128.h
similarity index 99%
rename from flang/include/flang/Common/uint128.h
rename to FortranRuntime/include/flang/Common/uint128.h
index 821c8c3b08a52f..1b2ee6a2c14b87 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/FortranRuntime/include/flang/Common/uint128.h
@@ -19,8 +19,8 @@
#define AVOID_NATIVE_UINT128_T 0
#endif
-#include "leading-zero-bit-count.h"
#include "flang/Common/api-attrs.h"
+#include "leading-zero-bit-count.h"
#include <cstdint>
#include <type_traits>
@@ -303,4 +303,4 @@ template <int BITS>
using HostSignedIntType = typename HostSignedIntTypeHelper<BITS>::type;
} // namespace Fortran::common
-#endif
+#endif /* FORTRAN_COMMON_UINT128_H_ */
diff --git a/flang/include/flang/Common/variant.h b/FortranRuntime/include/flang/Common/variant.h
similarity index 89%
rename from flang/include/flang/Common/variant.h
rename to FortranRuntime/include/flang/Common/variant.h
index 1af85876afac00..ff9b1aed4eba91 100644
--- a/flang/include/flang/Common/variant.h
+++ b/FortranRuntime/include/flang/Common/variant.h
@@ -11,8 +11,8 @@
// and the related names become available, though, they may correspond
// to alternative definitions (e.g. from cuda::std namespace).
-#ifndef FORTRAN_COMMON_VARIANT_H
-#define FORTRAN_COMMON_VARIANT_H
+#ifndef FORTRAN_COMMON_VARIANT_H_
+#define FORTRAN_COMMON_VARIANT_H_
#if RT_USE_LIBCUDACXX
#include <cuda/std/variant>
@@ -27,4 +27,4 @@ using cuda::std::visit;
#include <variant>
#endif // !RT_USE_LIBCUDACXX
-#endif // FORTRAN_COMMON_VARIANT_H
+#endif /* FORTRAN_COMMON_VARIANT_H_ */
diff --git a/flang/include/flang/Common/visit.h b/FortranRuntime/include/flang/Common/visit.h
similarity index 98%
rename from flang/include/flang/Common/visit.h
rename to FortranRuntime/include/flang/Common/visit.h
index ad66297650b093..8030ac9be173c3 100644
--- a/flang/include/flang/Common/visit.h
+++ b/FortranRuntime/include/flang/Common/visit.h
@@ -21,8 +21,8 @@
#ifndef FORTRAN_COMMON_VISIT_H_
#define FORTRAN_COMMON_VISIT_H_
-#include "variant.h"
#include "flang/Common/api-attrs.h"
+#include "variant.h"
#include <type_traits>
namespace Fortran::common {
@@ -100,4 +100,4 @@ using Fortran::common::log2visit::visit;
#endif
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_VISIT_H_
+#endif /* FORTRAN_COMMON_VISIT_H_ */
diff --git a/flang/include/flang/Common/windows-include.h b/FortranRuntime/include/flang/Common/windows-include.h
similarity index 93%
rename from flang/includ...
[truncated]
|
@llvm/pr-subscribers-flang-parser Author: Michael Kruse (Meinersbur) ChangesMostly mechanical changes in preparation of extracting the FortranRuntime "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change.
Some cosmetic changes and files paths were necessary:
Patch is 334.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110298.diff 418 Files Affected:
diff --git a/FortranRuntime/.clang-format b/FortranRuntime/.clang-format
new file mode 100644
index 00000000000000..c1dfe06fdf5782
--- /dev/null
+++ b/FortranRuntime/.clang-format
@@ -0,0 +1,21 @@
+---
+# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+BasedOnStyle: LLVM
+AlignAfterOpenBracket: DontAlign
+AlignEscapedNewlines: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignOperands: false
+AlignTrailingComments: false
+IncludeCategories:
+ - Regex: '^<'
+ Priority: 4
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 3
+ - Regex: '^"(flang|\.\.)/'
+ Priority: 2
+ - Regex: '.*'
+ Priority: 1
+...
+
+# vim:set filetype=yaml:
diff --git a/flang/runtime/config.h.cmake b/FortranRuntime/cmake/config.h.cmake.in
similarity index 100%
rename from flang/runtime/config.h.cmake
rename to FortranRuntime/cmake/config.h.cmake.in
diff --git a/flang/include/flang/Common/Fortran-consts.h b/FortranRuntime/include/flang/Common/Fortran-consts.h
similarity index 100%
rename from flang/include/flang/Common/Fortran-consts.h
rename to FortranRuntime/include/flang/Common/Fortran-consts.h
diff --git a/flang/include/flang/ISO_Fortran_binding_wrapper.h b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
similarity index 70%
rename from flang/include/flang/ISO_Fortran_binding_wrapper.h
rename to FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
index 37289bdbabd03c..2c0fdc123c8759 100644
--- a/flang/include/flang/ISO_Fortran_binding_wrapper.h
+++ b/FortranRuntime/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 <stddef.h>
-#include "Common/api-attrs.h"
+#include "flang/Common/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/api-attrs.h b/FortranRuntime/include/flang/Common/api-attrs.h
similarity index 97%
rename from flang/include/flang/Common/api-attrs.h
rename to FortranRuntime/include/flang/Common/api-attrs.h
index d73e60996bc81f..9a3001fb255c11 100644
--- a/flang/include/flang/Common/api-attrs.h
+++ b/FortranRuntime/include/flang/Common/api-attrs.h
@@ -1,11 +1,10 @@
-/*===-- include/flang/Common/api-attrs.h ---------------------------*- C -*-=//
+/*===-- include/flang/Common/api-attrs.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
*
- *===------------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
/*
* The file defines a set macros that can be used to apply
@@ -13,8 +12,8 @@
* declared/defined/used in Flang runtime library.
*/
-#ifndef FORTRAN_RUNTIME_API_ATTRS_H_
-#define FORTRAN_RUNTIME_API_ATTRS_H_
+#ifndef FORTRAN_COMMON_API_ATTRS_H_
+#define FORTRAN_COMMON_API_ATTRS_H_
/*
* RT_EXT_API_GROUP_BEGIN/END pair is placed around definitions
@@ -178,4 +177,4 @@
#define RT_DEVICE_NOINLINE_HOST_INLINE inline
#endif
-#endif /* !FORTRAN_RUNTIME_API_ATTRS_H_ */
+#endif /* FORTRAN_COMMON_API_ATTRS_H_ */
diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/FortranRuntime/include/flang/Common/binary-floating-point.h
similarity index 96%
rename from flang/include/flang/Decimal/binary-floating-point.h
rename to FortranRuntime/include/flang/Common/binary-floating-point.h
index 1e0cde97d98e61..705acc31bdfb21 100644
--- a/flang/include/flang/Decimal/binary-floating-point.h
+++ b/FortranRuntime/include/flang/Common/binary-floating-point.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===//
+//===-- include/flang/Common/binary-floating-point.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_DECIMAL_BINARY_FLOATING_POINT_H_
-#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
+#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
+#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
// Access and manipulate the fields of an IEEE-754 binary
// floating-point value via a generalized template.
@@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
RawType raw_{0};
};
} // namespace Fortran::decimal
-#endif
+#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */
diff --git a/flang/include/flang/Common/bit-population-count.h b/FortranRuntime/include/flang/Common/bit-population-count.h
similarity index 98%
rename from flang/include/flang/Common/bit-population-count.h
rename to FortranRuntime/include/flang/Common/bit-population-count.h
index e1aeb78f9a3765..59ade914d14d85 100644
--- a/flang/include/flang/Common/bit-population-count.h
+++ b/FortranRuntime/include/flang/Common/bit-population-count.h
@@ -93,4 +93,4 @@ template <typename INT> inline constexpr int TrailingZeroBitCount(INT x) {
}
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_BIT_POPULATION_COUNT_H_
+#endif /* FORTRAN_COMMON_BIT_POPULATION_COUNT_H_ */
diff --git a/flang/include/flang/Common/constexpr-bitset.h b/FortranRuntime/include/flang/Common/constexpr-bitset.h
similarity index 98%
rename from flang/include/flang/Common/constexpr-bitset.h
rename to FortranRuntime/include/flang/Common/constexpr-bitset.h
index 1aafb6eff84c61..093b247b5f4eff 100644
--- a/flang/include/flang/Common/constexpr-bitset.h
+++ b/FortranRuntime/include/flang/Common/constexpr-bitset.h
@@ -144,4 +144,4 @@ template <int BITS> class BitSet {
Word bits_{0};
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_CONSTEXPR_BITSET_H_
+#endif /* FORTRAN_COMMON_CONSTEXPR_BITSET_H_ */
diff --git a/flang/include/flang/Decimal/decimal.h b/FortranRuntime/include/flang/Common/decimal.h
similarity index 95%
rename from flang/include/flang/Decimal/decimal.h
rename to FortranRuntime/include/flang/Common/decimal.h
index 443163d058e28b..c086f97129f6a5 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/FortranRuntime/include/flang/Common/decimal.h
@@ -1,16 +1,15 @@
-/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-===
+/*===-- include/flang/Common/decimal.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
*
- * ===-----------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
/* C and C++ API for binary-to/from-decimal conversion package. */
-#ifndef FORTRAN_DECIMAL_DECIMAL_H_
-#define FORTRAN_DECIMAL_DECIMAL_H_
+#ifndef FORTRAN_COMMON_DECIMAL_H_
+#define FORTRAN_COMMON_DECIMAL_H_
#include "flang/Common/api-attrs.h"
#include <stddef.h>
@@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
#ifdef __cplusplus
} // extern "C"
#endif
-#endif
+#endif /* FORTRAN_COMMON_DECIMAL_H_ */
diff --git a/flang/include/flang/Common/enum-class.h b/FortranRuntime/include/flang/Common/enum-class.h
similarity index 98%
rename from flang/include/flang/Common/enum-class.h
rename to FortranRuntime/include/flang/Common/enum-class.h
index 41575d45091a8d..787648ffec48e8 100644
--- a/flang/include/flang/Common/enum-class.h
+++ b/FortranRuntime/include/flang/Common/enum-class.h
@@ -69,4 +69,4 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_ENUM_CLASS_H_
+#endif /* FORTRAN_COMMON_ENUM_CLASS_H_ */
diff --git a/flang/include/flang/Common/enum-set.h b/FortranRuntime/include/flang/Common/enum-set.h
similarity index 99%
rename from flang/include/flang/Common/enum-set.h
rename to FortranRuntime/include/flang/Common/enum-set.h
index 5290b76debee88..6100fc5e2e31c5 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/FortranRuntime/include/flang/Common/enum-set.h
@@ -228,4 +228,4 @@ struct std::hash<Fortran::common::EnumSet<ENUM, values>> {
return std::hash(x.bitset());
}
};
-#endif // FORTRAN_COMMON_ENUM_SET_H_
+#endif /* FORTRAN_COMMON_ENUM_SET_H_ */
diff --git a/flang/include/flang/Common/fast-int-set.h b/FortranRuntime/include/flang/Common/fast-int-set.h
similarity index 97%
rename from flang/include/flang/Common/fast-int-set.h
rename to FortranRuntime/include/flang/Common/fast-int-set.h
index d1c9c756a44a65..323ee4dc7e94d9 100644
--- a/flang/include/flang/Common/fast-int-set.h
+++ b/FortranRuntime/include/flang/Common/fast-int-set.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Common/fast-int-set.h --------------------*- C++ -*-===//
+//===-- include/flang/Common/fast-int-set.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.
@@ -103,4 +103,4 @@ template <int N> class FastIntSet {
bool isFullyInitialized_{false}; // memory was cleared
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_FAST_INT_SET_H_
+#endif /* FORTRAN_COMMON_FAST_INT_SET_H_ */
diff --git a/flang/include/flang/Common/float128.h b/FortranRuntime/include/flang/Common/float128.h
similarity index 96%
rename from flang/include/flang/Common/float128.h
rename to FortranRuntime/include/flang/Common/float128.h
index 2e76bc0a162e61..a7036bf679e5ae 100644
--- a/flang/include/flang/Common/float128.h
+++ b/FortranRuntime/include/flang/Common/float128.h
@@ -1,4 +1,4 @@
-/*===-- flang/Common/float128.h ----------------------------------*- C -*-===
+/*===-- include/flang/Common/float128.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.
diff --git a/flang/include/flang/Common/format.h b/FortranRuntime/include/flang/Common/format.h
similarity index 99%
rename from flang/include/flang/Common/format.h
rename to FortranRuntime/include/flang/Common/format.h
index 138e84b72b733d..6f4dfc8d2376b7 100644
--- a/flang/include/flang/Common/format.h
+++ b/FortranRuntime/include/flang/Common/format.h
@@ -901,4 +901,4 @@ template <typename CHAR> bool FormatValidator<CHAR>::Check() {
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_FORMAT_H_
+#endif /* FORTRAN_COMMON_FORMAT_H_ */
diff --git a/flang/include/flang/Common/idioms.h b/FortranRuntime/include/flang/Common/idioms.h
similarity index 99%
rename from flang/include/flang/Common/idioms.h
rename to FortranRuntime/include/flang/Common/idioms.h
index 99f383ec75b999..1ae0c0b35112e9 100644
--- a/flang/include/flang/Common/idioms.h
+++ b/FortranRuntime/include/flang/Common/idioms.h
@@ -150,4 +150,4 @@ template <typename A, typename... B>
using IfNoLvalue = std::enable_if_t<(... && !std::is_lvalue_reference_v<B>), A>;
template <typename... RVREF> using NoLvalue = IfNoLvalue<void, RVREF...>;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_IDIOMS_H_
+#endif /* FORTRAN_COMMON_IDIOMS_H_ */
diff --git a/flang/include/flang/Common/leading-zero-bit-count.h b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
similarity index 98%
rename from flang/include/flang/Common/leading-zero-bit-count.h
rename to FortranRuntime/include/flang/Common/leading-zero-bit-count.h
index a296e0b446917f..e788bfa9bcfd08 100644
--- a/flang/include/flang/Common/leading-zero-bit-count.h
+++ b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
@@ -93,4 +93,4 @@ template <typename A> inline constexpr int BitsNeededFor(A x) {
return 8 * sizeof x - LeadingZeroBitCount(x);
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_
+#endif /* FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_ */
diff --git a/flang/include/flang/Runtime/magic-numbers.h b/FortranRuntime/include/flang/Common/magic-numbers.h
similarity index 98%
rename from flang/include/flang/Runtime/magic-numbers.h
rename to FortranRuntime/include/flang/Common/magic-numbers.h
index bab0e9ae05299a..931df690766219 100644
--- a/flang/include/flang/Runtime/magic-numbers.h
+++ b/FortranRuntime/include/flang/Common/magic-numbers.h
@@ -1,10 +1,10 @@
-#if 0 /*===-- include/flang/Runtime/magic-numbers.h -----------------------===*/
-/*
+#if 0 /*===-- include/flang/Runtime/magic-numbers.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
*
- *===----------------------------------------------------------------------===*/
+/*===----------------------------------------------------------------------===*/
#endif
#if 0
This header can be included into both Fortran and C.
diff --git a/flang/include/flang/Common/optional.h b/FortranRuntime/include/flang/Common/optional.h
similarity index 98%
rename from flang/include/flang/Common/optional.h
rename to FortranRuntime/include/flang/Common/optional.h
index c0f4278009f40a..c3db3b1329a2fd 100644
--- a/flang/include/flang/Common/optional.h
+++ b/FortranRuntime/include/flang/Common/optional.h
@@ -23,8 +23,8 @@
// * cuda:: namespace need to be forced for all std:: references.
//
//===----------------------------------------------------------------------===//
-#ifndef FORTRAN_COMMON_OPTIONAL_H
-#define FORTRAN_COMMON_OPTIONAL_H
+#ifndef FORTRAN_COMMON_OPTIONAL_H_
+#define FORTRAN_COMMON_OPTIONAL_H_
#include "flang/Common/api-attrs.h"
#include <optional>
@@ -240,4 +240,4 @@ using std::optional;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_OPTIONAL_H
+#endif /* FORTRAN_COMMON_OPTIONAL_H_ */
diff --git a/flang/include/flang/Common/real.h b/FortranRuntime/include/flang/Common/real.h
similarity index 99%
rename from flang/include/flang/Common/real.h
rename to FortranRuntime/include/flang/Common/real.h
index b527deda0e3b4f..dc9a2404731e70 100644
--- a/flang/include/flang/Common/real.h
+++ b/FortranRuntime/include/flang/Common/real.h
@@ -141,4 +141,4 @@ class RealCharacteristics {
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_REAL_H_
+#endif /* FORTRAN_COMMON_REAL_H_ */
diff --git a/flang/include/flang/Common/reference-wrapper.h b/FortranRuntime/include/flang/Common/reference-wrapper.h
similarity index 96%
rename from flang/include/flang/Common/reference-wrapper.h
rename to FortranRuntime/include/flang/Common/reference-wrapper.h
index 2983754108f95a..6822fb335f398c 100644
--- a/flang/include/flang/Common/reference-wrapper.h
+++ b/FortranRuntime/include/flang/Common/reference-wrapper.h
@@ -22,8 +22,8 @@
//
// clang-format on
-#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H
-#define FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H_
+#define FORTRAN_COMMON_REFERENCE_WRAPPER_H_
#include "flang/Common/api-attrs.h"
#include <functional>
@@ -111,4 +111,4 @@ using std::reference_wrapper;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#endif /* FORTRAN_COMMON_REFERENCE_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/restorer.h b/FortranRuntime/include/flang/Common/restorer.h
similarity index 97%
rename from flang/include/flang/Common/restorer.h
rename to FortranRuntime/include/flang/Common/restorer.h
index 0f1bc48620d37e..a5c5ebe7344a1b 100644
--- a/flang/include/flang/Common/restorer.h
+++ b/FortranRuntime/include/flang/Common/restorer.h
@@ -18,8 +18,8 @@
#ifndef FORTRAN_COMMON_RESTORER_H_
#define FORTRAN_COMMON_RESTORER_H_
-#include "idioms.h"
#include "flang/Common/api-attrs.h"
+#include "idioms.h"
namespace Fortran::common {
template <typename A> class Restorer {
public:
@@ -53,4 +53,4 @@ RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(
return Restorer<A>{to, std::move(original)};
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_RESTORER_H_
+#endif /* FORTRAN_COMMON_RESTORER_H_ */
diff --git a/flang/include/flang/Common/target-rounding.h b/FortranRuntime/include/flang/Common/target-rounding.h
similarity index 100%
rename from flang/include/flang/Common/target-rounding.h
rename to FortranRuntime/include/flang/Common/target-rounding.h
diff --git a/flang/include/flang/Common/uint128.h b/FortranRuntime/include/flang/Common/uint128.h
similarity index 99%
rename from flang/include/flang/Common/uint128.h
rename to FortranRuntime/include/flang/Common/uint128.h
index 821c8c3b08a52f..1b2ee6a2c14b87 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/FortranRuntime/include/flang/Common/uint128.h
@@ -19,8 +19,8 @@
#define AVOID_NATIVE_UINT128_T 0
#endif
-#include "leading-zero-bit-count.h"
#include "flang/Common/api-attrs.h"
+#include "leading-zero-bit-count.h"
#include <cstdint>
#include <type_traits>
@@ -303,4 +303,4 @@ template <int BITS>
using HostSignedIntType = typename HostSignedIntTypeHelper<BITS>::type;
} // namespace Fortran::common
-#endif
+#endif /* FORTRAN_COMMON_UINT128_H_ */
diff --git a/flang/include/flang/Common/variant.h b/FortranRuntime/include/flang/Common/variant.h
similarity index 89%
rename from flang/include/flang/Common/variant.h
rename to FortranRuntime/include/flang/Common/variant.h
index 1af85876afac00..ff9b1aed4eba91 100644
--- a/flang/include/flang/Common/variant.h
+++ b/FortranRuntime/include/flang/Common/variant.h
@@ -11,8 +11,8 @@
// and the related names become available, though, they may correspond
// to alternative definitions (e.g. from cuda::std namespace).
-#ifndef FORTRAN_COMMON_VARIANT_H
-#define FORTRAN_COMMON_VARIANT_H
+#ifndef FORTRAN_COMMON_VARIANT_H_
+#define FORTRAN_COMMON_VARIANT_H_
#if RT_USE_LIBCUDACXX
#include <cuda/std/variant>
@@ -27,4 +27,4 @@ using cuda::std::visit;
#include <variant>
#endif // !RT_USE_LIBCUDACXX
-#endif // FORTRAN_COMMON_VARIANT_H
+#endif /* FORTRAN_COMMON_VARIANT_H_ */
diff --git a/flang/include/flang/Common/visit.h b/FortranRuntime/include/flang/Common/visit.h
similarity index 98%
rename from flang/include/flang/Common/visit.h
rename to FortranRuntime/include/flang/Common/visit.h
index ad66297650b093..8030ac9be173c3 100644
--- a/flang/include/flang/Common/visit.h
+++ b/FortranRuntime/include/flang/Common/visit.h
@@ -21,8 +21,8 @@
#ifndef FORTRAN_COMMON_VISIT_H_
#define FORTRAN_COMMON_VISIT_H_
-#include "variant.h"
#include "flang/Common/api-attrs.h"
+#include "variant.h"
#include <type_traits>
namespace Fortran::common {
@@ -100,4 +100,4 @@ using Fortran::common::log2visit::visit;
#endif
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_VISIT_H_
+#endif /* FORTRAN_COMMON_VISIT_H_ */
diff --git a/flang/include/flang/Common/windows-include.h b/FortranRuntime/include/flang/Common/windows-include.h
similarity index 93%
rename from flang/includ...
[truncated]
|
@llvm/pr-subscribers-flang-semantics Author: Michael Kruse (Meinersbur) ChangesMostly mechanical changes in preparation of extracting the FortranRuntime "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change.
Some cosmetic changes and files paths were necessary:
Patch is 334.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110298.diff 418 Files Affected:
diff --git a/FortranRuntime/.clang-format b/FortranRuntime/.clang-format
new file mode 100644
index 00000000000000..c1dfe06fdf5782
--- /dev/null
+++ b/FortranRuntime/.clang-format
@@ -0,0 +1,21 @@
+---
+# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+BasedOnStyle: LLVM
+AlignAfterOpenBracket: DontAlign
+AlignEscapedNewlines: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignOperands: false
+AlignTrailingComments: false
+IncludeCategories:
+ - Regex: '^<'
+ Priority: 4
+ - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
+ Priority: 3
+ - Regex: '^"(flang|\.\.)/'
+ Priority: 2
+ - Regex: '.*'
+ Priority: 1
+...
+
+# vim:set filetype=yaml:
diff --git a/flang/runtime/config.h.cmake b/FortranRuntime/cmake/config.h.cmake.in
similarity index 100%
rename from flang/runtime/config.h.cmake
rename to FortranRuntime/cmake/config.h.cmake.in
diff --git a/flang/include/flang/Common/Fortran-consts.h b/FortranRuntime/include/flang/Common/Fortran-consts.h
similarity index 100%
rename from flang/include/flang/Common/Fortran-consts.h
rename to FortranRuntime/include/flang/Common/Fortran-consts.h
diff --git a/flang/include/flang/ISO_Fortran_binding_wrapper.h b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
similarity index 70%
rename from flang/include/flang/ISO_Fortran_binding_wrapper.h
rename to FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
index 37289bdbabd03c..2c0fdc123c8759 100644
--- a/flang/include/flang/ISO_Fortran_binding_wrapper.h
+++ b/FortranRuntime/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 <stddef.h>
-#include "Common/api-attrs.h"
+#include "flang/Common/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/api-attrs.h b/FortranRuntime/include/flang/Common/api-attrs.h
similarity index 97%
rename from flang/include/flang/Common/api-attrs.h
rename to FortranRuntime/include/flang/Common/api-attrs.h
index d73e60996bc81f..9a3001fb255c11 100644
--- a/flang/include/flang/Common/api-attrs.h
+++ b/FortranRuntime/include/flang/Common/api-attrs.h
@@ -1,11 +1,10 @@
-/*===-- include/flang/Common/api-attrs.h ---------------------------*- C -*-=//
+/*===-- include/flang/Common/api-attrs.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
*
- *===------------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
/*
* The file defines a set macros that can be used to apply
@@ -13,8 +12,8 @@
* declared/defined/used in Flang runtime library.
*/
-#ifndef FORTRAN_RUNTIME_API_ATTRS_H_
-#define FORTRAN_RUNTIME_API_ATTRS_H_
+#ifndef FORTRAN_COMMON_API_ATTRS_H_
+#define FORTRAN_COMMON_API_ATTRS_H_
/*
* RT_EXT_API_GROUP_BEGIN/END pair is placed around definitions
@@ -178,4 +177,4 @@
#define RT_DEVICE_NOINLINE_HOST_INLINE inline
#endif
-#endif /* !FORTRAN_RUNTIME_API_ATTRS_H_ */
+#endif /* FORTRAN_COMMON_API_ATTRS_H_ */
diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/FortranRuntime/include/flang/Common/binary-floating-point.h
similarity index 96%
rename from flang/include/flang/Decimal/binary-floating-point.h
rename to FortranRuntime/include/flang/Common/binary-floating-point.h
index 1e0cde97d98e61..705acc31bdfb21 100644
--- a/flang/include/flang/Decimal/binary-floating-point.h
+++ b/FortranRuntime/include/flang/Common/binary-floating-point.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===//
+//===-- include/flang/Common/binary-floating-point.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_DECIMAL_BINARY_FLOATING_POINT_H_
-#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
+#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
+#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
// Access and manipulate the fields of an IEEE-754 binary
// floating-point value via a generalized template.
@@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
RawType raw_{0};
};
} // namespace Fortran::decimal
-#endif
+#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */
diff --git a/flang/include/flang/Common/bit-population-count.h b/FortranRuntime/include/flang/Common/bit-population-count.h
similarity index 98%
rename from flang/include/flang/Common/bit-population-count.h
rename to FortranRuntime/include/flang/Common/bit-population-count.h
index e1aeb78f9a3765..59ade914d14d85 100644
--- a/flang/include/flang/Common/bit-population-count.h
+++ b/FortranRuntime/include/flang/Common/bit-population-count.h
@@ -93,4 +93,4 @@ template <typename INT> inline constexpr int TrailingZeroBitCount(INT x) {
}
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_BIT_POPULATION_COUNT_H_
+#endif /* FORTRAN_COMMON_BIT_POPULATION_COUNT_H_ */
diff --git a/flang/include/flang/Common/constexpr-bitset.h b/FortranRuntime/include/flang/Common/constexpr-bitset.h
similarity index 98%
rename from flang/include/flang/Common/constexpr-bitset.h
rename to FortranRuntime/include/flang/Common/constexpr-bitset.h
index 1aafb6eff84c61..093b247b5f4eff 100644
--- a/flang/include/flang/Common/constexpr-bitset.h
+++ b/FortranRuntime/include/flang/Common/constexpr-bitset.h
@@ -144,4 +144,4 @@ template <int BITS> class BitSet {
Word bits_{0};
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_CONSTEXPR_BITSET_H_
+#endif /* FORTRAN_COMMON_CONSTEXPR_BITSET_H_ */
diff --git a/flang/include/flang/Decimal/decimal.h b/FortranRuntime/include/flang/Common/decimal.h
similarity index 95%
rename from flang/include/flang/Decimal/decimal.h
rename to FortranRuntime/include/flang/Common/decimal.h
index 443163d058e28b..c086f97129f6a5 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/FortranRuntime/include/flang/Common/decimal.h
@@ -1,16 +1,15 @@
-/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-===
+/*===-- include/flang/Common/decimal.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
*
- * ===-----------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
/* C and C++ API for binary-to/from-decimal conversion package. */
-#ifndef FORTRAN_DECIMAL_DECIMAL_H_
-#define FORTRAN_DECIMAL_DECIMAL_H_
+#ifndef FORTRAN_COMMON_DECIMAL_H_
+#define FORTRAN_COMMON_DECIMAL_H_
#include "flang/Common/api-attrs.h"
#include <stddef.h>
@@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
#ifdef __cplusplus
} // extern "C"
#endif
-#endif
+#endif /* FORTRAN_COMMON_DECIMAL_H_ */
diff --git a/flang/include/flang/Common/enum-class.h b/FortranRuntime/include/flang/Common/enum-class.h
similarity index 98%
rename from flang/include/flang/Common/enum-class.h
rename to FortranRuntime/include/flang/Common/enum-class.h
index 41575d45091a8d..787648ffec48e8 100644
--- a/flang/include/flang/Common/enum-class.h
+++ b/FortranRuntime/include/flang/Common/enum-class.h
@@ -69,4 +69,4 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_ENUM_CLASS_H_
+#endif /* FORTRAN_COMMON_ENUM_CLASS_H_ */
diff --git a/flang/include/flang/Common/enum-set.h b/FortranRuntime/include/flang/Common/enum-set.h
similarity index 99%
rename from flang/include/flang/Common/enum-set.h
rename to FortranRuntime/include/flang/Common/enum-set.h
index 5290b76debee88..6100fc5e2e31c5 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/FortranRuntime/include/flang/Common/enum-set.h
@@ -228,4 +228,4 @@ struct std::hash<Fortran::common::EnumSet<ENUM, values>> {
return std::hash(x.bitset());
}
};
-#endif // FORTRAN_COMMON_ENUM_SET_H_
+#endif /* FORTRAN_COMMON_ENUM_SET_H_ */
diff --git a/flang/include/flang/Common/fast-int-set.h b/FortranRuntime/include/flang/Common/fast-int-set.h
similarity index 97%
rename from flang/include/flang/Common/fast-int-set.h
rename to FortranRuntime/include/flang/Common/fast-int-set.h
index d1c9c756a44a65..323ee4dc7e94d9 100644
--- a/flang/include/flang/Common/fast-int-set.h
+++ b/FortranRuntime/include/flang/Common/fast-int-set.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Common/fast-int-set.h --------------------*- C++ -*-===//
+//===-- include/flang/Common/fast-int-set.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.
@@ -103,4 +103,4 @@ template <int N> class FastIntSet {
bool isFullyInitialized_{false}; // memory was cleared
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_FAST_INT_SET_H_
+#endif /* FORTRAN_COMMON_FAST_INT_SET_H_ */
diff --git a/flang/include/flang/Common/float128.h b/FortranRuntime/include/flang/Common/float128.h
similarity index 96%
rename from flang/include/flang/Common/float128.h
rename to FortranRuntime/include/flang/Common/float128.h
index 2e76bc0a162e61..a7036bf679e5ae 100644
--- a/flang/include/flang/Common/float128.h
+++ b/FortranRuntime/include/flang/Common/float128.h
@@ -1,4 +1,4 @@
-/*===-- flang/Common/float128.h ----------------------------------*- C -*-===
+/*===-- include/flang/Common/float128.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.
diff --git a/flang/include/flang/Common/format.h b/FortranRuntime/include/flang/Common/format.h
similarity index 99%
rename from flang/include/flang/Common/format.h
rename to FortranRuntime/include/flang/Common/format.h
index 138e84b72b733d..6f4dfc8d2376b7 100644
--- a/flang/include/flang/Common/format.h
+++ b/FortranRuntime/include/flang/Common/format.h
@@ -901,4 +901,4 @@ template <typename CHAR> bool FormatValidator<CHAR>::Check() {
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_FORMAT_H_
+#endif /* FORTRAN_COMMON_FORMAT_H_ */
diff --git a/flang/include/flang/Common/idioms.h b/FortranRuntime/include/flang/Common/idioms.h
similarity index 99%
rename from flang/include/flang/Common/idioms.h
rename to FortranRuntime/include/flang/Common/idioms.h
index 99f383ec75b999..1ae0c0b35112e9 100644
--- a/flang/include/flang/Common/idioms.h
+++ b/FortranRuntime/include/flang/Common/idioms.h
@@ -150,4 +150,4 @@ template <typename A, typename... B>
using IfNoLvalue = std::enable_if_t<(... && !std::is_lvalue_reference_v<B>), A>;
template <typename... RVREF> using NoLvalue = IfNoLvalue<void, RVREF...>;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_IDIOMS_H_
+#endif /* FORTRAN_COMMON_IDIOMS_H_ */
diff --git a/flang/include/flang/Common/leading-zero-bit-count.h b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
similarity index 98%
rename from flang/include/flang/Common/leading-zero-bit-count.h
rename to FortranRuntime/include/flang/Common/leading-zero-bit-count.h
index a296e0b446917f..e788bfa9bcfd08 100644
--- a/flang/include/flang/Common/leading-zero-bit-count.h
+++ b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
@@ -93,4 +93,4 @@ template <typename A> inline constexpr int BitsNeededFor(A x) {
return 8 * sizeof x - LeadingZeroBitCount(x);
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_
+#endif /* FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_ */
diff --git a/flang/include/flang/Runtime/magic-numbers.h b/FortranRuntime/include/flang/Common/magic-numbers.h
similarity index 98%
rename from flang/include/flang/Runtime/magic-numbers.h
rename to FortranRuntime/include/flang/Common/magic-numbers.h
index bab0e9ae05299a..931df690766219 100644
--- a/flang/include/flang/Runtime/magic-numbers.h
+++ b/FortranRuntime/include/flang/Common/magic-numbers.h
@@ -1,10 +1,10 @@
-#if 0 /*===-- include/flang/Runtime/magic-numbers.h -----------------------===*/
-/*
+#if 0 /*===-- include/flang/Runtime/magic-numbers.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
*
- *===----------------------------------------------------------------------===*/
+/*===----------------------------------------------------------------------===*/
#endif
#if 0
This header can be included into both Fortran and C.
diff --git a/flang/include/flang/Common/optional.h b/FortranRuntime/include/flang/Common/optional.h
similarity index 98%
rename from flang/include/flang/Common/optional.h
rename to FortranRuntime/include/flang/Common/optional.h
index c0f4278009f40a..c3db3b1329a2fd 100644
--- a/flang/include/flang/Common/optional.h
+++ b/FortranRuntime/include/flang/Common/optional.h
@@ -23,8 +23,8 @@
// * cuda:: namespace need to be forced for all std:: references.
//
//===----------------------------------------------------------------------===//
-#ifndef FORTRAN_COMMON_OPTIONAL_H
-#define FORTRAN_COMMON_OPTIONAL_H
+#ifndef FORTRAN_COMMON_OPTIONAL_H_
+#define FORTRAN_COMMON_OPTIONAL_H_
#include "flang/Common/api-attrs.h"
#include <optional>
@@ -240,4 +240,4 @@ using std::optional;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_OPTIONAL_H
+#endif /* FORTRAN_COMMON_OPTIONAL_H_ */
diff --git a/flang/include/flang/Common/real.h b/FortranRuntime/include/flang/Common/real.h
similarity index 99%
rename from flang/include/flang/Common/real.h
rename to FortranRuntime/include/flang/Common/real.h
index b527deda0e3b4f..dc9a2404731e70 100644
--- a/flang/include/flang/Common/real.h
+++ b/FortranRuntime/include/flang/Common/real.h
@@ -141,4 +141,4 @@ class RealCharacteristics {
};
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_REAL_H_
+#endif /* FORTRAN_COMMON_REAL_H_ */
diff --git a/flang/include/flang/Common/reference-wrapper.h b/FortranRuntime/include/flang/Common/reference-wrapper.h
similarity index 96%
rename from flang/include/flang/Common/reference-wrapper.h
rename to FortranRuntime/include/flang/Common/reference-wrapper.h
index 2983754108f95a..6822fb335f398c 100644
--- a/flang/include/flang/Common/reference-wrapper.h
+++ b/FortranRuntime/include/flang/Common/reference-wrapper.h
@@ -22,8 +22,8 @@
//
// clang-format on
-#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H
-#define FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H_
+#define FORTRAN_COMMON_REFERENCE_WRAPPER_H_
#include "flang/Common/api-attrs.h"
#include <functional>
@@ -111,4 +111,4 @@ using std::reference_wrapper;
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#endif /* FORTRAN_COMMON_REFERENCE_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/restorer.h b/FortranRuntime/include/flang/Common/restorer.h
similarity index 97%
rename from flang/include/flang/Common/restorer.h
rename to FortranRuntime/include/flang/Common/restorer.h
index 0f1bc48620d37e..a5c5ebe7344a1b 100644
--- a/flang/include/flang/Common/restorer.h
+++ b/FortranRuntime/include/flang/Common/restorer.h
@@ -18,8 +18,8 @@
#ifndef FORTRAN_COMMON_RESTORER_H_
#define FORTRAN_COMMON_RESTORER_H_
-#include "idioms.h"
#include "flang/Common/api-attrs.h"
+#include "idioms.h"
namespace Fortran::common {
template <typename A> class Restorer {
public:
@@ -53,4 +53,4 @@ RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(
return Restorer<A>{to, std::move(original)};
}
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_RESTORER_H_
+#endif /* FORTRAN_COMMON_RESTORER_H_ */
diff --git a/flang/include/flang/Common/target-rounding.h b/FortranRuntime/include/flang/Common/target-rounding.h
similarity index 100%
rename from flang/include/flang/Common/target-rounding.h
rename to FortranRuntime/include/flang/Common/target-rounding.h
diff --git a/flang/include/flang/Common/uint128.h b/FortranRuntime/include/flang/Common/uint128.h
similarity index 99%
rename from flang/include/flang/Common/uint128.h
rename to FortranRuntime/include/flang/Common/uint128.h
index 821c8c3b08a52f..1b2ee6a2c14b87 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/FortranRuntime/include/flang/Common/uint128.h
@@ -19,8 +19,8 @@
#define AVOID_NATIVE_UINT128_T 0
#endif
-#include "leading-zero-bit-count.h"
#include "flang/Common/api-attrs.h"
+#include "leading-zero-bit-count.h"
#include <cstdint>
#include <type_traits>
@@ -303,4 +303,4 @@ template <int BITS>
using HostSignedIntType = typename HostSignedIntTypeHelper<BITS>::type;
} // namespace Fortran::common
-#endif
+#endif /* FORTRAN_COMMON_UINT128_H_ */
diff --git a/flang/include/flang/Common/variant.h b/FortranRuntime/include/flang/Common/variant.h
similarity index 89%
rename from flang/include/flang/Common/variant.h
rename to FortranRuntime/include/flang/Common/variant.h
index 1af85876afac00..ff9b1aed4eba91 100644
--- a/flang/include/flang/Common/variant.h
+++ b/FortranRuntime/include/flang/Common/variant.h
@@ -11,8 +11,8 @@
// and the related names become available, though, they may correspond
// to alternative definitions (e.g. from cuda::std namespace).
-#ifndef FORTRAN_COMMON_VARIANT_H
-#define FORTRAN_COMMON_VARIANT_H
+#ifndef FORTRAN_COMMON_VARIANT_H_
+#define FORTRAN_COMMON_VARIANT_H_
#if RT_USE_LIBCUDACXX
#include <cuda/std/variant>
@@ -27,4 +27,4 @@ using cuda::std::visit;
#include <variant>
#endif // !RT_USE_LIBCUDACXX
-#endif // FORTRAN_COMMON_VARIANT_H
+#endif /* FORTRAN_COMMON_VARIANT_H_ */
diff --git a/flang/include/flang/Common/visit.h b/FortranRuntime/include/flang/Common/visit.h
similarity index 98%
rename from flang/include/flang/Common/visit.h
rename to FortranRuntime/include/flang/Common/visit.h
index ad66297650b093..8030ac9be173c3 100644
--- a/flang/include/flang/Common/visit.h
+++ b/FortranRuntime/include/flang/Common/visit.h
@@ -21,8 +21,8 @@
#ifndef FORTRAN_COMMON_VISIT_H_
#define FORTRAN_COMMON_VISIT_H_
-#include "variant.h"
#include "flang/Common/api-attrs.h"
+#include "variant.h"
#include <type_traits>
namespace Fortran::common {
@@ -100,4 +100,4 @@ using Fortran::common::log2visit::visit;
#endif
} // namespace Fortran::common
-#endif // FORTRAN_COMMON_VISIT_H_
+#endif /* FORTRAN_COMMON_VISIT_H_ */
diff --git a/flang/include/flang/Common/windows-include.h b/FortranRuntime/include/flang/Common/windows-include.h
similarity index 93%
rename from flang/includ...
[truncated]
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a gigantic change and I don't understand why it's being made. Why is so much code moving out of flang/ ?
How recent is your latest rebase? They are missing files in this PR. |
As explained in the summary, this is in preparation of #110217. #110217 changes the libFortranRuntime build to use the The While it would be possible to only have a |
I did not do a rebase since I started working on this PR, maybe 3 weeks ago. With new files added/removed upstream and at the same time reviewers probably asking to change the move location, keeping the PR stack current all the time, and also ensure that every change is part of the correct PR, is a bit of a hassle. I intend to start updating to In the past I also often forgot that I should only merge |
Ok, just wanted to make sure you are aware of new files. |
A Fortran compiler and its runtime are tightly coupled; the compiler can only work with this runtime, this runtime can only be used by this compiler, and they share common API definitions and data structures. I don't mind if you move the sources and headers that are used only by the runtime into a new top-level directory, if you must. But moving common headers and sources used by both the compiler and the runtime builds out of the compiler tree makes no sense to me. |
…inersbur/flang_runtime_move-files
…inersbur/flang_runtime_move-files
…inersbur/flang_runtime_move-files
…inersbur/flang_runtime_move-files
…rs/meinersbur/flang_runtime_move-files
…on. (#112188) Split some headers into headers for public and private declarations in preparation for #110217. Moving the runtime-private headers in runtime-private include directory will occur in #110298. * Do not use `sizeof(Descriptor)` in the compiler. The size of the descriptor is target-dependent while `sizeof(Descriptor)` is the size of the Descriptor for the host platform which might be too small when cross-compiling to a different platform. Another problem is that the emitted assembly ((cross-)compiling to the same target) is not identical between Flang's running on different systems. Moving the declaration of `class Descriptor` out of the included header will also reduce the amount of #included sources. * Do not use `sizeof(ArrayConstructorVector)` and `alignof(ArrayConstructorVector)` in the compiler. Same reason as with `Descriptor`. * Compute the descriptor's extra flags without instantiating a Descriptor. `Fortran::runtime::Descriptor` is defined in the runtime source, but not the compiler source. * Move `InquiryKeywordHashDecode` into runtime-private header. The function is defined in the runtime sources and trying to call it in the compiler would lead to a link-error. * Move allocator-kind magic numbers into common header. They are the only declarations out of `allocator-registry.h` in the compiler as well. This does not make Flang cross-compile ready yet, the main goal is to avoid transitive header dependencies from Flang to clang-rt. There are more assumptions that host platform is the same as the target platform.
…rs/meinersbur/flang_runtime_move-files
…inersbur/flang_runtime_move-files
…einersbur/flang_runtime_move-files
…inersbur/flang_runtime_move-files
…on. (llvm#112188) Split some headers into headers for public and private declarations in preparation for llvm#110217. Moving the runtime-private headers in runtime-private include directory will occur in llvm#110298. * Do not use `sizeof(Descriptor)` in the compiler. The size of the descriptor is target-dependent while `sizeof(Descriptor)` is the size of the Descriptor for the host platform which might be too small when cross-compiling to a different platform. Another problem is that the emitted assembly ((cross-)compiling to the same target) is not identical between Flang's running on different systems. Moving the declaration of `class Descriptor` out of the included header will also reduce the amount of #included sources. * Do not use `sizeof(ArrayConstructorVector)` and `alignof(ArrayConstructorVector)` in the compiler. Same reason as with `Descriptor`. * Compute the descriptor's extra flags without instantiating a Descriptor. `Fortran::runtime::Descriptor` is defined in the runtime source, but not the compiler source. * Move `InquiryKeywordHashDecode` into runtime-private header. The function is defined in the runtime sources and trying to call it in the compiler would lead to a link-error. * Move allocator-kind magic numbers into common header. They are the only declarations out of `allocator-registry.h` in the compiler as well. This does not make Flang cross-compile ready yet, the main goal is to avoid transitive header dependencies from Flang to clang-rt. There are more assumptions that host platform is the same as the target platform.
@@ -1,35 +0,0 @@ | |||
//===-- runtime/CUDA/memmove-function.cpp ---------------------------------===// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this may have been deleted by accident. This file is still needed.
@@ -1,4 +1,4 @@ | |||
#===-- runtime/CUDA/CMakeLists.txt -----------------------------------------===# | |||
#===-- lib/CufRuntime/CMakeLists.txt ---------------------------------------===# |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep CUDA
as it is done for the include dir.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still see the wrong directory name here. include is include/flang-rt/CUDA
so like should be lib/CUDA
…on. (llvm#112188) Split some headers into headers for public and private declarations in preparation for llvm#110217. Moving the runtime-private headers in runtime-private include directory will occur in llvm#110298. * Do not use `sizeof(Descriptor)` in the compiler. The size of the descriptor is target-dependent while `sizeof(Descriptor)` is the size of the Descriptor for the host platform which might be too small when cross-compiling to a different platform. Another problem is that the emitted assembly ((cross-)compiling to the same target) is not identical between Flang's running on different systems. Moving the declaration of `class Descriptor` out of the included header will also reduce the amount of #included sources. * Do not use `sizeof(ArrayConstructorVector)` and `alignof(ArrayConstructorVector)` in the compiler. Same reason as with `Descriptor`. * Compute the descriptor's extra flags without instantiating a Descriptor. `Fortran::runtime::Descriptor` is defined in the runtime source, but not the compiler source. * Move `InquiryKeywordHashDecode` into runtime-private header. The function is defined in the runtime sources and trying to call it in the compiler would lead to a link-error. * Move allocator-kind magic numbers into common header. They are the only declarations out of `allocator-registry.h` in the compiler as well. This does not make Flang cross-compile ready yet, the main goal is to avoid transitive header dependencies from Flang to clang-rt. There are more assumptions that host platform is the same as the target platform.
…on. (llvm#112188) Split some headers into headers for public and private declarations in preparation for llvm#110217. Moving the runtime-private headers in runtime-private include directory will occur in llvm#110298. * Do not use `sizeof(Descriptor)` in the compiler. The size of the descriptor is target-dependent while `sizeof(Descriptor)` is the size of the Descriptor for the host platform which might be too small when cross-compiling to a different platform. Another problem is that the emitted assembly ((cross-)compiling to the same target) is not identical between Flang's running on different systems. Moving the declaration of `class Descriptor` out of the included header will also reduce the amount of #included sources. * Do not use `sizeof(ArrayConstructorVector)` and `alignof(ArrayConstructorVector)` in the compiler. Same reason as with `Descriptor`. * Compute the descriptor's extra flags without instantiating a Descriptor. `Fortran::runtime::Descriptor` is defined in the runtime source, but not the compiler source. * Move `InquiryKeywordHashDecode` into runtime-private header. The function is defined in the runtime sources and trying to call it in the compiler would lead to a link-error. * Move allocator-kind magic numbers into common header. They are the only declarations out of `allocator-registry.h` in the compiler as well. This does not make Flang cross-compile ready yet, the main goal is to avoid transitive header dependencies from Flang to clang-rt. There are more assumptions that host platform is the same as the target platform.
Mostly mechanical changes in preparation of extracting the Flang-RT "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change. Common files (headers, testing, cmake) shared by Flang-RT and Flang remain in
flang/
.flang-rt
follows the convention of subproject, e.g.compiler-rt
flang_rt
follows the convention of Compiler-RT libraries, e.g.libclang_rt.builtins.a
.Some cosmetic changes and files paths were necessary:
add_subdirectory
.include_directories
CMakeLists.txt
was introduced for the flang-rt tests.#include
paths relative to the include directive#include
directivestest/Runtime
and runtime tests intest/Driver
are moved, but the lit.cfg.py mechanism to execute the will only be added in [Flang] LLVM_ENABLE_RUNTIMES=flang-rt #110217.