diff --git a/flang-rt/.clang-format b/flang-rt/.clang-format new file mode 100644 index 0000000000000..23f4c5ae2dcf2 --- /dev/null +++ b/flang-rt/.clang-format @@ -0,0 +1,25 @@ +--- +# 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: 6 + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 5 + - Regex: '^"flang/' # Headers shared with Flang + Priority: 4 + - Regex: '^"flang-rt/' # Public Flang-RT headers + Priority: 3 + - Regex: '^[^/]*$' # Private headers from same library + Priority: 1 + - Regex: '.*' # Private headers from sibling libraries + Priority: 2 +... + +# vim:set filetype=yaml: diff --git a/flang-rt/cmake/config.h.cmake.in b/flang-rt/cmake/config.h.cmake.in new file mode 100644 index 0000000000000..8a4668b90addd --- /dev/null +++ b/flang-rt/cmake/config.h.cmake.in @@ -0,0 +1,19 @@ +/*===-- cmake/config.cmake.in ---------------------------------------*- 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_RUNTIME_CONFIG_H +#define FORTRAN_RUNTIME_CONFIG_H + +/* Define to 1 if you have the `strerror_r' function. */ +#cmakedefine01 HAVE_STRERROR_R + +/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you + don't. */ +#cmakedefine01 HAVE_DECL_STRERROR_S + +#endif diff --git a/flang/examples/ExternalHelloWorld/external-hello.cpp b/flang-rt/examples/ExternalHelloWorld/external-hello.cpp similarity index 80% rename from flang/examples/ExternalHelloWorld/external-hello.cpp rename to flang-rt/examples/ExternalHelloWorld/external-hello.cpp index 4991bf9eba999..7c8a12476295c 100644 --- a/flang/examples/ExternalHelloWorld/external-hello.cpp +++ b/flang-rt/examples/ExternalHelloWorld/external-hello.cpp @@ -1,3 +1,11 @@ +//===-- examples/ExternalHelloWorld/external-hello.cpp ----------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + #include "flang/Runtime/io-api.h" #include "flang/Runtime/main.h" #include "flang/Runtime/stop.h" diff --git a/flang/include/flang/Runtime/allocator-registry.h b/flang-rt/include/flang-rt/runtime/allocator-registry.h similarity index 87% rename from flang/include/flang/Runtime/allocator-registry.h rename to flang-rt/include/flang-rt/runtime/allocator-registry.h index 29302c5d825bc..1a59ec8b1ef5b 100644 --- a/flang/include/flang/Runtime/allocator-registry.h +++ b/flang-rt/include/flang-rt/runtime/allocator-registry.h @@ -1,4 +1,4 @@ -//===-- runtime/allocator-registry.h ----------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/allocator-registry.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_RUNTIME_ALLOCATOR_REGISTRY_H_ -#define FORTRAN_RUNTIME_ALLOCATOR_REGISTRY_H_ +#ifndef FLANG_RT_RUNTIME_ALLOCATOR_REGISTRY_H_ +#define FLANG_RT_RUNTIME_ALLOCATOR_REGISTRY_H_ #include "flang/Common/api-attrs.h" #include "flang/Runtime/allocator-registry-consts.h" @@ -55,4 +55,4 @@ RT_OFFLOAD_VAR_GROUP_END } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_ALLOCATOR_REGISTRY_H_ +#endif // FLANG_RT_RUNTIME_ALLOCATOR_REGISTRY_H_ diff --git a/flang/include/flang/Runtime/array-constructor.h b/flang-rt/include/flang-rt/runtime/array-constructor.h similarity index 89% rename from flang/include/flang/Runtime/array-constructor.h rename to flang-rt/include/flang-rt/runtime/array-constructor.h index 2f6aaae17c650..9c037177161c0 100644 --- a/flang/include/flang/Runtime/array-constructor.h +++ b/flang-rt/include/flang-rt/runtime/array-constructor.h @@ -1,4 +1,4 @@ -//===-- include/flang/Runtime/array-constructor.h ---------------*- C++ -*-===// +//===-- include/flang-rt/runtime/array-constructor.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. @@ -9,11 +9,11 @@ // External APIs to create temporary storage for array constructors when their // final extents or length parameters cannot be pre-computed. -#ifndef FORTRAN_RUNTIME_ARRAYCONSTRUCTOR_H_ -#define FORTRAN_RUNTIME_ARRAYCONSTRUCTOR_H_ +#ifndef FLANG_RT_RUNTIME_ARRAY_CONSTRUCTOR_H_ +#define FLANG_RT_RUNTIME_ARRAY_CONSTRUCTOR_H_ +#include "descriptor.h" #include "flang/Runtime/array-constructor-consts.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/entry-names.h" #include @@ -54,4 +54,4 @@ static_assert(alignof(Fortran::runtime::ArrayConstructorVector) <= "MaxArrayConstructorVectorAlignInBytes"); } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_ARRAYCONSTRUCTOR_H_ +#endif // FLANG_RT_RUNTIME_ARRAY_CONSTRUCTOR_H_ diff --git a/flang/runtime/assign-impl.h b/flang-rt/include/flang-rt/runtime/assign-impl.h similarity index 85% rename from flang/runtime/assign-impl.h rename to flang-rt/include/flang-rt/runtime/assign-impl.h index aaa320ef7f959..cc931f6713cd8 100644 --- a/flang/runtime/assign-impl.h +++ b/flang-rt/include/flang-rt/runtime/assign-impl.h @@ -1,4 +1,4 @@ -//===-- runtime/assign-impl.h -----------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/assign-impl.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_RUNTIME_ASSIGN_IMPL_H_ -#define FORTRAN_RUNTIME_ASSIGN_IMPL_H_ +#ifndef FLANG_RT_RUNTIME_ASSIGN_IMPL_H_ +#define FLANG_RT_RUNTIME_ASSIGN_IMPL_H_ #include "flang/Runtime/freestanding-tools.h" @@ -28,4 +28,4 @@ RT_API_ATTRS void DoFromSourceAssign(Descriptor &, const Descriptor &, #endif } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_ASSIGN_IMPL_H_ +#endif // FLANG_RT_RUNTIME_ASSIGN_IMPL_H_ diff --git a/flang/runtime/buffer.h b/flang-rt/include/flang-rt/runtime/buffer.h similarity index 97% rename from flang/runtime/buffer.h rename to flang-rt/include/flang-rt/runtime/buffer.h index 41a1abb1b2d90..b5a9ce9e35e91 100644 --- a/flang/runtime/buffer.h +++ b/flang-rt/include/flang-rt/runtime/buffer.h @@ -1,4 +1,4 @@ -//===-- runtime/buffer.h ----------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/buffer.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. @@ -8,12 +8,12 @@ // External file buffering -#ifndef FORTRAN_RUNTIME_BUFFER_H_ -#define FORTRAN_RUNTIME_BUFFER_H_ +#ifndef FLANG_RT_RUNTIME_BUFFER_H_ +#define FLANG_RT_RUNTIME_BUFFER_H_ #include "io-error.h" +#include "memory.h" #include "flang/Runtime/freestanding-tools.h" -#include "flang/Runtime/memory.h" #include #include #include @@ -221,4 +221,4 @@ template class FileFrame { bool dirty_{false}; }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_BUFFER_H_ +#endif // FLANG_RT_RUNTIME_BUFFER_H_ diff --git a/flang/runtime/connection.h b/flang-rt/include/flang-rt/runtime/connection.h similarity index 96% rename from flang/runtime/connection.h rename to flang-rt/include/flang-rt/runtime/connection.h index 6f1ea90a160e5..03d9658e7067b 100644 --- a/flang/runtime/connection.h +++ b/flang-rt/include/flang-rt/runtime/connection.h @@ -1,4 +1,4 @@ -//===-- runtime/connection.h ------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/connection.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. @@ -8,8 +8,8 @@ // Fortran I/O connection state (abstracted over internal & external units) -#ifndef FORTRAN_RUNTIME_IO_CONNECTION_H_ -#define FORTRAN_RUNTIME_IO_CONNECTION_H_ +#ifndef FLANG_RT_RUNTIME_CONNECTION_H_ +#define FLANG_RT_RUNTIME_CONNECTION_H_ #include "format.h" #include "flang/Common/optional.h" @@ -124,4 +124,4 @@ class SavedPosition { }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_IO_CONNECTION_H_ +#endif // FLANG_RT_RUNTIME_CONNECTION_H_ diff --git a/flang/runtime/derived.h b/flang-rt/include/flang-rt/runtime/derived.h similarity index 90% rename from flang/runtime/derived.h rename to flang-rt/include/flang-rt/runtime/derived.h index f5a1e219b848c..ac6962c57168c 100644 --- a/flang/runtime/derived.h +++ b/flang-rt/include/flang-rt/runtime/derived.h @@ -1,4 +1,4 @@ -//===-- runtime/derived.h -------------------------------------------------===// +//===-- include/flang-rt/runtime/derived.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. @@ -8,8 +8,8 @@ // Internal runtime utilities for derived type operations. -#ifndef FORTRAN_RUNTIME_DERIVED_H_ -#define FORTRAN_RUNTIME_DERIVED_H_ +#ifndef FLANG_RT_RUNTIME_DERIVED_H_ +#define FLANG_RT_RUNTIME_DERIVED_H_ #include "flang/Common/api-attrs.h" @@ -48,4 +48,4 @@ RT_API_ATTRS void Destroy(const Descriptor &, bool finalize, RT_API_ATTRS bool HasDynamicComponent(const Descriptor &); } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_DERIVED_H_ +#endif // FLANG_RT_RUNTIME_DERIVED_H_ diff --git a/flang/include/flang/Runtime/descriptor.h b/flang-rt/include/flang-rt/runtime/descriptor.h similarity index 98% rename from flang/include/flang/Runtime/descriptor.h rename to flang-rt/include/flang-rt/runtime/descriptor.h index 628ac8c927a51..19e1a0bf6a1dd 100644 --- a/flang/include/flang/Runtime/descriptor.h +++ b/flang-rt/include/flang-rt/runtime/descriptor.h @@ -1,4 +1,4 @@ -//===-- include/flang/Runtime/descriptor.h ----------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/descriptor.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_RUNTIME_DESCRIPTOR_H_ -#define FORTRAN_RUNTIME_DESCRIPTOR_H_ +#ifndef FLANG_RT_RUNTIME_DESCRIPTOR_H_ +#define FLANG_RT_RUNTIME_DESCRIPTOR_H_ // Defines data structures used during execution of a Fortran program // to implement nontrivial dummy arguments, pointers, allocatables, @@ -18,10 +18,10 @@ // User C code is welcome to depend on that ISO_Fortran_binding.h file, // but should never reference this internal header. +#include "memory.h" +#include "type-code.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/descriptor-consts.h" -#include "flang/Runtime/memory.h" -#include "flang/Runtime/type-code.h" #include #include #include @@ -482,4 +482,4 @@ class alignas(Descriptor) StaticDescriptor { }; } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_DESCRIPTOR_H_ +#endif // FLANG_RT_RUNTIME_DESCRIPTOR_H_ diff --git a/flang/runtime/emit-encoded.h b/flang-rt/include/flang-rt/runtime/emit-encoded.h similarity index 94% rename from flang/runtime/emit-encoded.h rename to flang-rt/include/flang-rt/runtime/emit-encoded.h index 4b5e390078835..d99f56b29558e 100644 --- a/flang/runtime/emit-encoded.h +++ b/flang-rt/include/flang-rt/runtime/emit-encoded.h @@ -1,4 +1,4 @@ -//===-- runtime/emit-encoded.h ----------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/emit-encoded.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. @@ -8,8 +8,8 @@ // Templates for emitting CHARACTER values with conversion -#ifndef FORTRAN_RUNTIME_EMIT_ENCODED_H_ -#define FORTRAN_RUNTIME_EMIT_ENCODED_H_ +#ifndef FLANG_RT_RUNTIME_EMIT_ENCODED_H_ +#define FLANG_RT_RUNTIME_EMIT_ENCODED_H_ #include "connection.h" #include "environment.h" @@ -114,4 +114,4 @@ RT_API_ATTRS bool EmitRepeated(CONTEXT &to, char ch, std::size_t n) { } } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_EMIT_ENCODED_H_ +#endif // FLANG_RT_RUNTIME_EMIT_ENCODED_H_ diff --git a/flang/runtime/environment.h b/flang-rt/include/flang-rt/runtime/environment.h similarity index 91% rename from flang/runtime/environment.h rename to flang-rt/include/flang-rt/runtime/environment.h index 500aa925a625b..142add432b5f7 100644 --- a/flang/runtime/environment.h +++ b/flang-rt/include/flang-rt/runtime/environment.h @@ -1,4 +1,4 @@ -//===-- runtime/environment.h -----------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/environment.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_RUNTIME_ENVIRONMENT_H_ -#define FORTRAN_RUNTIME_ENVIRONMENT_H_ +#ifndef FLANG_RT_RUNTIME_ENVIRONMENT_H_ +#define FLANG_RT_RUNTIME_ENVIRONMENT_H_ #include "flang/Common/optional.h" #include "flang/Decimal/decimal.h" @@ -67,4 +67,4 @@ RT_OFFLOAD_VAR_GROUP_END } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_ENVIRONMENT_H_ +#endif // FLANG_RT_RUNTIME_ENVIRONMENT_H_ diff --git a/flang/runtime/file.h b/flang-rt/include/flang-rt/runtime/file.h similarity index 95% rename from flang/runtime/file.h rename to flang-rt/include/flang-rt/runtime/file.h index c06acbb9904cc..3bba29722b3b8 100644 --- a/flang/runtime/file.h +++ b/flang-rt/include/flang-rt/runtime/file.h @@ -1,4 +1,4 @@ -//===-- runtime/file.h ------------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/file.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. @@ -8,12 +8,12 @@ // Raw system I/O wrappers -#ifndef FORTRAN_RUNTIME_FILE_H_ -#define FORTRAN_RUNTIME_FILE_H_ +#ifndef FLANG_RT_RUNTIME_FILE_H_ +#define FLANG_RT_RUNTIME_FILE_H_ #include "io-error.h" +#include "memory.h" #include "flang/Common/optional.h" -#include "flang/Runtime/memory.h" #include namespace Fortran::runtime::io { @@ -113,4 +113,4 @@ RT_API_ATTRS bool MayWrite(const char *path); RT_API_ATTRS bool MayReadAndWrite(const char *path); RT_API_ATTRS std::int64_t SizeInBytes(const char *path); } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_FILE_H_ +#endif // FLANG_RT_RUNTIME_FILE_H_ diff --git a/flang/runtime/format-implementation.h b/flang-rt/include/flang-rt/runtime/format-implementation.h similarity index 98% rename from flang/runtime/format-implementation.h rename to flang-rt/include/flang-rt/runtime/format-implementation.h index 46204ca927c13..8f4eb1161dd14 100644 --- a/flang/runtime/format-implementation.h +++ b/flang-rt/include/flang-rt/runtime/format-implementation.h @@ -1,4 +1,4 @@ -//===-- runtime/format-implementation.h -------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/format-implementation.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. @@ -8,8 +8,8 @@ // Implements out-of-line member functions of template class FormatControl -#ifndef FORTRAN_RUNTIME_FORMAT_IMPLEMENTATION_H_ -#define FORTRAN_RUNTIME_FORMAT_IMPLEMENTATION_H_ +#ifndef FLANG_RT_RUNTIME_FORMAT_IMPLEMENTATION_H_ +#define FLANG_RT_RUNTIME_FORMAT_IMPLEMENTATION_H_ #include "emit-encoded.h" #include "format.h" @@ -601,4 +601,4 @@ RT_API_ATTRS void FormatControl::Finish(Context &context) { } } } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_FORMAT_IMPLEMENTATION_H_ +#endif // FLANG_RT_RUNTIME_FORMAT_IMPLEMENTATION_H_ diff --git a/flang/runtime/format.h b/flang-rt/include/flang-rt/runtime/format.h similarity index 97% rename from flang/runtime/format.h rename to flang-rt/include/flang-rt/runtime/format.h index 815bf70685e64..b169d63fa4999 100644 --- a/flang/runtime/format.h +++ b/flang-rt/include/flang-rt/runtime/format.h @@ -1,4 +1,4 @@ -//===-- runtime/format.h ----------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/format.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. @@ -8,8 +8,8 @@ // FORMAT string processing -#ifndef FORTRAN_RUNTIME_FORMAT_H_ -#define FORTRAN_RUNTIME_FORMAT_H_ +#ifndef FLANG_RT_RUNTIME_FORMAT_H_ +#define FLANG_RT_RUNTIME_FORMAT_H_ #include "environment.h" #include "io-error.h" @@ -201,4 +201,4 @@ template class FormatControl { Iteration stack_[maxMaxHeight]; }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_FORMAT_H_ +#endif // FLANG_RT_RUNTIME_FORMAT_H_ diff --git a/flang/runtime/internal-unit.h b/flang-rt/include/flang-rt/runtime/internal-unit.h similarity index 89% rename from flang/runtime/internal-unit.h rename to flang-rt/include/flang-rt/runtime/internal-unit.h index a0ee6353eeda3..429d3489e0112 100644 --- a/flang/runtime/internal-unit.h +++ b/flang-rt/include/flang-rt/runtime/internal-unit.h @@ -1,4 +1,4 @@ -//===-- runtime/internal-unit.h ---------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/internal-unit.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. @@ -8,11 +8,11 @@ // Fortran internal I/O "units" -#ifndef FORTRAN_RUNTIME_IO_INTERNAL_UNIT_H_ -#define FORTRAN_RUNTIME_IO_INTERNAL_UNIT_H_ +#ifndef FLANG_RT_RUNTIME_INTERNAL_UNIT_H_ +#define FLANG_RT_RUNTIME_INTERNAL_UNIT_H_ #include "connection.h" -#include "flang/Runtime/descriptor.h" +#include "descriptor.h" #include #include @@ -56,4 +56,4 @@ template class InternalDescriptorUnit : public ConnectionState { extern template class InternalDescriptorUnit; extern template class InternalDescriptorUnit; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_IO_INTERNAL_UNIT_H_ +#endif // FLANG_RT_RUNTIME_INTERNAL_UNIT_H_ diff --git a/flang/runtime/io-error.h b/flang-rt/include/flang-rt/runtime/io-error.h similarity index 92% rename from flang/runtime/io-error.h rename to flang-rt/include/flang-rt/runtime/io-error.h index 39a343c8e0a51..1cef6a208f374 100644 --- a/flang/runtime/io-error.h +++ b/flang-rt/include/flang-rt/runtime/io-error.h @@ -1,4 +1,4 @@ -//===-- runtime/io-error.h --------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/io-error.h ---------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,12 +12,12 @@ // IOSTAT error codes are raw errno values augmented with values for // Fortran-specific errors. -#ifndef FORTRAN_RUNTIME_IO_ERROR_H_ -#define FORTRAN_RUNTIME_IO_ERROR_H_ +#ifndef FLANG_RT_RUNTIME_IO_ERROR_H_ +#define FLANG_RT_RUNTIME_IO_ERROR_H_ +#include "memory.h" #include "terminator.h" #include "flang/Runtime/iostat.h" -#include "flang/Runtime/memory.h" #include namespace Fortran::runtime::io { @@ -80,4 +80,4 @@ class IoErrorHandler : public Terminator { }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_IO_ERROR_H_ +#endif // FLANG_RT_RUNTIME_IO_ERROR_H_ diff --git a/flang/runtime/io-stmt.h b/flang-rt/include/flang-rt/runtime/io-stmt.h similarity index 99% rename from flang/runtime/io-stmt.h rename to flang-rt/include/flang-rt/runtime/io-stmt.h index 1f1419b249e5e..a364ddfd9b3c7 100644 --- a/flang/runtime/io-stmt.h +++ b/flang-rt/include/flang-rt/runtime/io-stmt.h @@ -1,4 +1,4 @@ -//===-- runtime/io-stmt.h ---------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/io-stmt.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. @@ -8,10 +8,11 @@ // Representations of the state of an I/O statement in progress -#ifndef FORTRAN_RUNTIME_IO_STMT_H_ -#define FORTRAN_RUNTIME_IO_STMT_H_ +#ifndef FLANG_RT_RUNTIME_IO_STMT_H_ +#define FLANG_RT_RUNTIME_IO_STMT_H_ #include "connection.h" +#include "descriptor.h" #include "file.h" #include "format.h" #include "internal-unit.h" @@ -19,7 +20,6 @@ #include "flang/Common/optional.h" #include "flang/Common/reference-wrapper.h" #include "flang/Common/visit.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/io-api.h" #include #include @@ -791,4 +791,4 @@ class ErroneousIoStatementState : public IoStatementBase { }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_IO_STMT_H_ +#endif // FLANG_RT_RUNTIME_IO_STMT_H_ diff --git a/flang/runtime/lock.h b/flang-rt/include/flang-rt/runtime/lock.h similarity index 94% rename from flang/runtime/lock.h rename to flang-rt/include/flang-rt/runtime/lock.h index 46ca28703a45b..7c88534245733 100644 --- a/flang/runtime/lock.h +++ b/flang-rt/include/flang-rt/runtime/lock.h @@ -1,4 +1,4 @@ -//===-- runtime/lock.h ------------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/lock.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. @@ -8,8 +8,8 @@ // Wraps a mutex -#ifndef FORTRAN_RUNTIME_LOCK_H_ -#define FORTRAN_RUNTIME_LOCK_H_ +#ifndef FLANG_RT_RUNTIME_LOCK_H_ +#define FLANG_RT_RUNTIME_LOCK_H_ #include "terminator.h" #include "tools.h" @@ -113,4 +113,4 @@ class CriticalSection { }; } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_LOCK_H_ +#endif // FLANG_RT_RUNTIME_LOCK_H_ diff --git a/flang/include/flang/Runtime/memory.h b/flang-rt/include/flang-rt/runtime/memory.h similarity index 96% rename from flang/include/flang/Runtime/memory.h rename to flang-rt/include/flang-rt/runtime/memory.h index 98412a989f890..93b477afa9814 100644 --- a/flang/include/flang/Runtime/memory.h +++ b/flang-rt/include/flang-rt/runtime/memory.h @@ -1,4 +1,4 @@ -//===-- include/flang/Runtime/memory.h --------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/memory.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. @@ -9,8 +9,8 @@ // Thin wrapper around malloc()/free() to isolate the dependency, // ease porting, and provide an owning pointer. -#ifndef FORTRAN_RUNTIME_MEMORY_H_ -#define FORTRAN_RUNTIME_MEMORY_H_ +#ifndef FLANG_RT_RUNTIME_MEMORY_H_ +#define FLANG_RT_RUNTIME_MEMORY_H_ #include "flang/Common/api-attrs.h" #include @@ -170,4 +170,4 @@ template struct Allocator { }; } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_MEMORY_H_ +#endif // FLANG_RT_RUNTIME_MEMORY_H_ diff --git a/flang/runtime/namelist.h b/flang-rt/include/flang-rt/runtime/namelist.h similarity index 91% rename from flang/runtime/namelist.h rename to flang-rt/include/flang-rt/runtime/namelist.h index 25216a75e9367..17d7bf310cc96 100644 --- a/flang/runtime/namelist.h +++ b/flang-rt/include/flang-rt/runtime/namelist.h @@ -1,4 +1,4 @@ -//===-- runtime/namelist.h --------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/namelist.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. @@ -8,8 +8,8 @@ // Defines the data structure used for NAMELIST I/O -#ifndef FORTRAN_RUNTIME_NAMELIST_H_ -#define FORTRAN_RUNTIME_NAMELIST_H_ +#ifndef FLANG_RT_RUNTIME_NAMELIST_H_ +#define FLANG_RT_RUNTIME_NAMELIST_H_ #include "non-tbp-dio.h" #include "flang/Common/api-attrs.h" @@ -51,4 +51,4 @@ class NamelistGroup { RT_API_ATTRS bool IsNamelistNameOrSlash(IoStatementState &); } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_NAMELIST_H_ +#endif // FLANG_RT_RUNTIME_NAMELIST_H_ diff --git a/flang/runtime/non-tbp-dio.h b/flang-rt/include/flang-rt/runtime/non-tbp-dio.h similarity index 91% rename from flang/runtime/non-tbp-dio.h rename to flang-rt/include/flang-rt/runtime/non-tbp-dio.h index 8429d790fea57..2bbbfa7f97f79 100644 --- a/flang/runtime/non-tbp-dio.h +++ b/flang-rt/include/flang-rt/runtime/non-tbp-dio.h @@ -1,4 +1,4 @@ -//===-- flang/runtime/non-tbp-dio.h -----------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/non-tbp-dio.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. @@ -19,8 +19,8 @@ // a containing scope has become inaccessible in a nested scope due // to the use of "IMPORT, NONE" or "IMPORT, ONLY:". -#ifndef FORTRAN_RUNTIME_NON_TBP_DIO_H_ -#define FORTRAN_RUNTIME_NON_TBP_DIO_H_ +#ifndef FLANG_RT_RUNTIME_NON_TBP_DIO_H_ +#define FLANG_RT_RUNTIME_NON_TBP_DIO_H_ #include "flang/Common/Fortran-consts.h" #include "flang/Common/api-attrs.h" @@ -53,4 +53,4 @@ struct NonTbpDefinedIoTable { }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_NON_TBP_DIO_H_ +#endif // FLANG_RT_RUNTIME_NON_TBP_DIO_H_ diff --git a/flang/runtime/numeric-templates.h b/flang-rt/include/flang-rt/runtime/numeric-templates.h similarity index 98% rename from flang/runtime/numeric-templates.h rename to flang-rt/include/flang-rt/runtime/numeric-templates.h index fbb371bffc27a..1253d56f3c0fd 100644 --- a/flang/runtime/numeric-templates.h +++ b/flang-rt/include/flang-rt/runtime/numeric-templates.h @@ -1,4 +1,4 @@ -//===-- runtime/numeric-templates.h -----------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/numeric-templates.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. @@ -15,8 +15,8 @@ // for the data type corresponding to CppTypeFor // on the target. -#ifndef FORTRAN_RUNTIME_NUMERIC_TEMPLATES_H_ -#define FORTRAN_RUNTIME_NUMERIC_TEMPLATES_H_ +#ifndef FLANG_RT_RUNTIME_NUMERIC_TEMPLATES_H_ +#define FLANG_RT_RUNTIME_NUMERIC_TEMPLATES_H_ #include "terminator.h" #include "tools.h" @@ -368,4 +368,4 @@ template inline RT_API_ATTRS T ErfcScaled(T arg) { } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_NUMERIC_TEMPLATES_H_ +#endif // FLANG_RT_RUNTIME_NUMERIC_TEMPLATES_H_ diff --git a/flang/runtime/random-templates.h b/flang-rt/include/flang-rt/runtime/random-templates.h similarity index 93% rename from flang/runtime/random-templates.h rename to flang-rt/include/flang-rt/runtime/random-templates.h index 3885941704d4a..895c5ad4fc8bb 100644 --- a/flang/runtime/random-templates.h +++ b/flang-rt/include/flang-rt/runtime/random-templates.h @@ -1,4 +1,4 @@ -//===-- runtime/random-templates.h ------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/random-templates.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,13 +6,13 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_RUNTIME_RANDOM_TEMPLATES_H_ -#define FORTRAN_RUNTIME_RANDOM_TEMPLATES_H_ +#ifndef FLANG_RT_RUNTIME_RANDOM_TEMPLATES_H_ +#define FLANG_RT_RUNTIME_RANDOM_TEMPLATES_H_ +#include "descriptor.h" #include "lock.h" #include "numeric-templates.h" #include "flang/Common/optional.h" -#include "flang/Runtime/descriptor.h" #include #include @@ -108,4 +108,4 @@ inline void GenerateUnsigned(const Descriptor &harvest) { } // namespace Fortran::runtime::random -#endif // FORTRAN_RUNTIME_RANDOM_TEMPLATES_H_ +#endif // FLANG_RT_RUNTIME_RANDOM_TEMPLATES_H_ diff --git a/flang/runtime/reduction-templates.h b/flang-rt/include/flang-rt/runtime/reduction-templates.h similarity index 98% rename from flang/runtime/reduction-templates.h rename to flang-rt/include/flang-rt/runtime/reduction-templates.h index b20b03655c3d0..8c6f838b8dadf 100644 --- a/flang/runtime/reduction-templates.h +++ b/flang-rt/include/flang-rt/runtime/reduction-templates.h @@ -1,4 +1,4 @@ -//===-- runtime/reduction-templates.h ---------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/reduction-templates.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. @@ -18,14 +18,14 @@ // * Character-valued reductions (MAXVAL & MINVAL) return arbitrary // length results, dynamically allocated in a caller-supplied descriptor -#ifndef FORTRAN_RUNTIME_REDUCTION_TEMPLATES_H_ -#define FORTRAN_RUNTIME_REDUCTION_TEMPLATES_H_ +#ifndef FLANG_RT_RUNTIME_REDUCTION_TEMPLATES_H_ +#define FLANG_RT_RUNTIME_REDUCTION_TEMPLATES_H_ +#include "descriptor.h" #include "numeric-templates.h" #include "terminator.h" #include "tools.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include namespace Fortran::runtime { @@ -416,4 +416,4 @@ template struct Norm2Helper { }; } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_REDUCTION_TEMPLATES_H_ +#endif // FLANG_RT_RUNTIME_REDUCTION_TEMPLATES_H_ diff --git a/flang/runtime/stat.h b/flang-rt/include/flang-rt/runtime/stat.h similarity index 93% rename from flang/runtime/stat.h rename to flang-rt/include/flang-rt/runtime/stat.h index 572cb6d10b489..070d0bf8673fb 100644 --- a/flang/runtime/stat.h +++ b/flang-rt/include/flang-rt/runtime/stat.h @@ -1,4 +1,4 @@ -//===-- runtime/stat.h ------------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/stat.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. @@ -9,8 +9,8 @@ // Defines the values returned by the runtime for STAT= specifiers // on executable statements. -#ifndef FORTRAN_RUNTIME_STAT_H_ -#define FORTRAN_RUNTIME_STAT_H_ +#ifndef FLANG_RT_RUNTIME_STAT_H_ +#define FLANG_RT_RUNTIME_STAT_H_ #include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Common/api-attrs.h" #include "flang/Runtime/magic-numbers.h" @@ -60,4 +60,4 @@ RT_API_ATTRS int ToErrmsg(const Descriptor *errmsg, int stat); // returns stat RT_API_ATTRS int ReturnError(Terminator &, int stat, const Descriptor *errmsg = nullptr, bool hasStat = false); } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_STAT_H +#endif // FLANG_RT_RUNTIME_STAT_H_ diff --git a/flang/runtime/terminator.h b/flang-rt/include/flang-rt/runtime/terminator.h similarity index 95% rename from flang/runtime/terminator.h rename to flang-rt/include/flang-rt/runtime/terminator.h index 609f059d6e092..4815f0674c849 100644 --- a/flang/runtime/terminator.h +++ b/flang-rt/include/flang-rt/runtime/terminator.h @@ -1,4 +1,4 @@ -//===-- runtime/terminator.h ------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/terminator.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. @@ -8,8 +8,8 @@ // Termination of the image -#ifndef FORTRAN_RUNTIME_TERMINATOR_H_ -#define FORTRAN_RUNTIME_TERMINATOR_H_ +#ifndef FLANG_RT_RUNTIME_TERMINATOR_H_ +#define FLANG_RT_RUNTIME_TERMINATOR_H_ #include "flang/Common/api-attrs.h" #include @@ -121,4 +121,4 @@ namespace Fortran::runtime::io { RT_API_ATTRS void FlushOutputOnCrash(const Terminator &); } -#endif // FORTRAN_RUNTIME_TERMINATOR_H_ +#endif // FLANG_RT_RUNTIME_TERMINATOR_H_ diff --git a/flang/runtime/tools.h b/flang-rt/include/flang-rt/runtime/tools.h similarity index 98% rename from flang/runtime/tools.h rename to flang-rt/include/flang-rt/runtime/tools.h index 75544098d47ab..91a026bf2ac14 100644 --- a/flang/runtime/tools.h +++ b/flang-rt/include/flang-rt/runtime/tools.h @@ -1,4 +1,4 @@ -//===-- runtime/tools.h -----------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/tools.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,16 +6,16 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_RUNTIME_TOOLS_H_ -#define FORTRAN_RUNTIME_TOOLS_H_ +#ifndef FLANG_RT_RUNTIME_TOOLS_H_ +#define FLANG_RT_RUNTIME_TOOLS_H_ +#include "descriptor.h" +#include "memory.h" #include "stat.h" #include "terminator.h" #include "flang/Common/optional.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/freestanding-tools.h" -#include "flang/Runtime/memory.h" #include #include #include @@ -348,7 +348,7 @@ inline RT_API_ATTRS RESULT ApplyFloatingPointKind( if constexpr (HasCppTypeFor) { // If FUNC implemenation relies on FP math functions, // then we should not be here. The compiler should have - // generated a call to an entry in flang_rt.quadmath + // generated a call to an entry in the libflang_rt.quadmath // library. if constexpr (!NEEDSMATH) { return FUNC<16>{}(std::forward(x)...); @@ -570,4 +570,4 @@ RT_API_ATTRS void CreatePartialReductionResult(Descriptor &result, const char *intrinsic, TypeCode); } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_TOOLS_H_ +#endif // FLANG_RT_RUNTIME_TOOLS_H_ diff --git a/flang/include/flang/Runtime/type-code.h b/flang-rt/include/flang-rt/runtime/type-code.h similarity index 93% rename from flang/include/flang/Runtime/type-code.h rename to flang-rt/include/flang-rt/runtime/type-code.h index ae854ed2145e4..9416a2816fd43 100644 --- a/flang/include/flang/Runtime/type-code.h +++ b/flang-rt/include/flang-rt/runtime/type-code.h @@ -1,4 +1,4 @@ -//===-- include/flang/Runtime/type-code.h -----------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/type-code.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_RUNTIME_TYPE_CODE_H_ -#define FORTRAN_RUNTIME_TYPE_CODE_H_ +#ifndef FLANG_RT_RUNTIME_TYPE_CODE_H_ +#define FLANG_RT_RUNTIME_TYPE_CODE_H_ #include "flang/Common/Fortran-consts.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" @@ -75,4 +75,4 @@ class TypeCode { ISO::CFI_type_t raw_{CFI_type_other}; }; } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_TYPE_CODE_H_ +#endif // FLANG_RT_RUNTIME_TYPE_CODE_H_ diff --git a/flang/runtime/type-info.h b/flang-rt/include/flang-rt/runtime/type-info.h similarity index 98% rename from flang/runtime/type-info.h rename to flang-rt/include/flang-rt/runtime/type-info.h index 32403b1db5169..9891fcecdcb25 100644 --- a/flang/runtime/type-info.h +++ b/flang-rt/include/flang-rt/runtime/type-info.h @@ -1,4 +1,4 @@ -//===-- runtime/type-info.h -------------------------------------*- C++ -*-===// +//===-- include/flang-rt/runtime/type-info.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,17 +6,17 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_RUNTIME_TYPE_INFO_H_ -#define FORTRAN_RUNTIME_TYPE_INFO_H_ +#ifndef FLANG_RT_RUNTIME_TYPE_INFO_H_ +#define FLANG_RT_RUNTIME_TYPE_INFO_H_ // A C++ perspective of the derived type description schemata in // flang/module/__fortran_type_info.f90. +#include "descriptor.h" #include "terminator.h" #include "flang/Common/Fortran-consts.h" #include "flang/Common/bit-population-count.h" #include "flang/Common/optional.h" -#include "flang/Runtime/descriptor.h" #include #include @@ -321,4 +321,4 @@ class DerivedType { }; } // namespace Fortran::runtime::typeInfo -#endif // FORTRAN_RUNTIME_TYPE_INFO_H_ +#endif // FLANG_RT_RUNTIME_TYPE_INFO_H_ diff --git a/flang/runtime/utf.h b/flang-rt/include/flang-rt/runtime/utf.h similarity index 94% rename from flang/runtime/utf.h rename to flang-rt/include/flang-rt/runtime/utf.h index 10c2d61484217..b5add823124fc 100644 --- a/flang/runtime/utf.h +++ b/flang-rt/include/flang-rt/runtime/utf.h @@ -1,4 +1,4 @@ -//===-- runtime/utf.h -----------------------------------------------------===// +//===-- include/flang-rt/runtime/utf.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. @@ -38,8 +38,8 @@ // standard maximum. However, we support extended forms up to 32 bits so that // CHARACTER(KIND=4) can be abused to hold arbitrary 32-bit data. -#ifndef FORTRAN_RUNTIME_UTF_H_ -#define FORTRAN_RUNTIME_UTF_H_ +#ifndef FLANG_RT_RUNTIME_UTF_H_ +#define FLANG_RT_RUNTIME_UTF_H_ #include "flang/Common/optional.h" #include @@ -70,4 +70,4 @@ RT_API_ATTRS Fortran::common::optional DecodeUTF8(const char *); RT_API_ATTRS std::size_t EncodeUTF8(char *, char32_t); } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_UTF_H_ +#endif // FLANG_RT_RUNTIME_UTF_H_ diff --git a/flang/runtime/CUDA/allocatable.cpp b/flang-rt/lib/cuda/allocatable.cpp similarity index 94% rename from flang/runtime/CUDA/allocatable.cpp rename to flang-rt/lib/cuda/allocatable.cpp index 6df3b06793b3e..b773e802c90ff 100644 --- a/flang/runtime/CUDA/allocatable.cpp +++ b/flang-rt/lib/cuda/allocatable.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/allocatable.cpp --------------------------------------===// +//===-- lib/cuda/allocatable.cpp --------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/allocatable.h" -#include "../assign-impl.h" -#include "../stat.h" -#include "../terminator.h" +#include "flang-rt/runtime/assign-impl.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/CUDA/memmove-function.h" diff --git a/flang/runtime/CUDA/allocator.cpp b/flang-rt/lib/cuda/allocator.cpp similarity index 86% rename from flang/runtime/CUDA/allocator.cpp rename to flang-rt/lib/cuda/allocator.cpp index 368c1124ef70a..4199bf04b33f0 100644 --- a/flang/runtime/CUDA/allocator.cpp +++ b/flang-rt/lib/cuda/allocator.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/allocator.cpp ----------------------------------------===// +//===-- lib/cuda/allocator.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/allocator.h" -#include "../derived.h" -#include "../stat.h" -#include "../terminator.h" -#include "../type-info.h" +#include "flang-rt/runtime/allocator-registry.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/type-info.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/CUDA/common.h" -#include "flang/Runtime/allocator-registry.h" #include "flang/Support/Fortran.h" #include "cuda_runtime.h" diff --git a/flang/runtime/CUDA/descriptor.cpp b/flang-rt/lib/cuda/descriptor.cpp similarity index 91% rename from flang/runtime/CUDA/descriptor.cpp rename to flang-rt/lib/cuda/descriptor.cpp index 947eeb66aa3d6..d44ab2e45d2a8 100644 --- a/flang/runtime/CUDA/descriptor.cpp +++ b/flang-rt/lib/cuda/descriptor.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/descriptor.cpp ---------------------------------------===// +//===-- lib/cuda/descriptor.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/descriptor.h" -#include "../terminator.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/allocator.h" #include "flang/Runtime/CUDA/common.h" -#include "flang/Runtime/descriptor.h" #include "cuda_runtime.h" diff --git a/flang/runtime/CUDA/init.cpp b/flang-rt/lib/cuda/init.cpp similarity index 81% rename from flang/runtime/CUDA/init.cpp rename to flang-rt/lib/cuda/init.cpp index 2bffce842b952..d79bffc32424d 100644 --- a/flang/runtime/CUDA/init.cpp +++ b/flang-rt/lib/cuda/init.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/init.cpp ---------------------------------------------===// +//===-- lib/cuda/init.cpp ---------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/init.h" -#include "../environment.h" -#include "../terminator.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/common.h" #include "cuda_runtime.h" diff --git a/flang/runtime/CUDA/kernel.cpp b/flang-rt/lib/cuda/kernel.cpp similarity index 98% rename from flang/runtime/CUDA/kernel.cpp rename to flang-rt/lib/cuda/kernel.cpp index 02d89fb8423a5..75eb639817b9a 100644 --- a/flang/runtime/CUDA/kernel.cpp +++ b/flang-rt/lib/cuda/kernel.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/kernel.cpp -------------------------------------------===// +//===-- lib/cuda/kernel.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/kernel.h" -#include "../terminator.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/common.h" #include "cuda_runtime.h" diff --git a/flang/runtime/CUDA/memmove-function.cpp b/flang-rt/lib/cuda/memmove-function.cpp similarity index 90% rename from flang/runtime/CUDA/memmove-function.cpp rename to flang-rt/lib/cuda/memmove-function.cpp index 3ba9fa7e0f7f7..a7eb0cf1a3e7a 100644 --- a/flang/runtime/CUDA/memmove-function.cpp +++ b/flang-rt/lib/cuda/memmove-function.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/memmove-function.cpp ---------------------------------===// +//===-- lib/cuda/memmove-function.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/memmove-function.h" -#include "../terminator.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/common.h" #include "cuda_runtime.h" diff --git a/flang/runtime/CUDA/memory.cpp b/flang-rt/lib/cuda/memory.cpp similarity index 96% rename from flang/runtime/CUDA/memory.cpp rename to flang-rt/lib/cuda/memory.cpp index 0bbb493d2db91..7ead0dd35e1d9 100644 --- a/flang/runtime/CUDA/memory.cpp +++ b/flang-rt/lib/cuda/memory.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/memory.cpp -------------------------------------------===// +//===-- lib/cuda/memory.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/memory.h" -#include "../assign-impl.h" -#include "../terminator.h" +#include "flang-rt/runtime/assign-impl.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/CUDA/memmove-function.h" diff --git a/flang/runtime/CUDA/pointer.cpp b/flang-rt/lib/cuda/pointer.cpp similarity index 92% rename from flang/runtime/CUDA/pointer.cpp rename to flang-rt/lib/cuda/pointer.cpp index d3ebe97b4e4ac..c2559ecb9a6f2 100644 --- a/flang/runtime/CUDA/pointer.cpp +++ b/flang-rt/lib/cuda/pointer.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/pointer.cpp ------------------------------------------===// +//===-- lib/cuda/pointer.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,10 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/pointer.h" -#include "../assign-impl.h" -#include "../stat.h" -#include "../terminator.h" +#include "flang-rt/runtime/assign-impl.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/CUDA/memmove-function.h" #include "flang/Runtime/pointer.h" diff --git a/flang/runtime/CUDA/registration.cpp b/flang-rt/lib/cuda/registration.cpp similarity index 92% rename from flang/runtime/CUDA/registration.cpp rename to flang-rt/lib/cuda/registration.cpp index b7b6ef389bffb..60b0e491b6ffd 100644 --- a/flang/runtime/CUDA/registration.cpp +++ b/flang-rt/lib/cuda/registration.cpp @@ -1,4 +1,4 @@ -//===-- runtime/CUDA/registration.cpp -------------------------------------===// +//===-- lib/cuda/registration.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/registration.h" -#include "../terminator.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/common.h" #include "cuda_runtime.h" diff --git a/flang/runtime/Float128Math/acos.cpp b/flang-rt/lib/quadmath/acos.cpp similarity index 87% rename from flang/runtime/Float128Math/acos.cpp rename to flang-rt/lib/quadmath/acos.cpp index d9b4950aa1e35..d094121f0f678 100644 --- a/flang/runtime/Float128Math/acos.cpp +++ b/flang-rt/lib/quadmath/acos.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/acos.cpp -------------------------------------===// +//===-- lib/quadmath/acos.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/acosh.cpp b/flang-rt/lib/quadmath/acosh.cpp similarity index 87% rename from flang/runtime/Float128Math/acosh.cpp rename to flang-rt/lib/quadmath/acosh.cpp index c572673ef55e6..968aa489d15a2 100644 --- a/flang/runtime/Float128Math/acosh.cpp +++ b/flang-rt/lib/quadmath/acosh.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/acosh.cpp ------------------------------------===// +//===-- lib/quadmath/acosh.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/asin.cpp b/flang-rt/lib/quadmath/asin.cpp similarity index 87% rename from flang/runtime/Float128Math/asin.cpp rename to flang-rt/lib/quadmath/asin.cpp index 57b6ffd967360..c3345cd3d748a 100644 --- a/flang/runtime/Float128Math/asin.cpp +++ b/flang-rt/lib/quadmath/asin.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/asin.cpp -------------------------------------===// +//===-- lib/quadmath/asin.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/asinh.cpp b/flang-rt/lib/quadmath/asinh.cpp similarity index 87% rename from flang/runtime/Float128Math/asinh.cpp rename to flang-rt/lib/quadmath/asinh.cpp index 03dded722b254..1023b678b6131 100644 --- a/flang/runtime/Float128Math/asinh.cpp +++ b/flang-rt/lib/quadmath/asinh.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/asinh.cpp ------------------------------------===// +//===-- lib/quadmath/asinh.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/atan.cpp b/flang-rt/lib/quadmath/atan.cpp similarity index 87% rename from flang/runtime/Float128Math/atan.cpp rename to flang-rt/lib/quadmath/atan.cpp index 19c86cae8867b..6379df3275c03 100644 --- a/flang/runtime/Float128Math/atan.cpp +++ b/flang-rt/lib/quadmath/atan.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/atan.cpp -------------------------------------===// +//===-- lib/quadmath/atan.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/atan2.cpp b/flang-rt/lib/quadmath/atan2.cpp similarity index 88% rename from flang/runtime/Float128Math/atan2.cpp rename to flang-rt/lib/quadmath/atan2.cpp index 09d666ae14304..7527b224cb3a5 100644 --- a/flang/runtime/Float128Math/atan2.cpp +++ b/flang-rt/lib/quadmath/atan2.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/atan2.cpp ------------------------------------===// +//===-- lib/quadmath/atan2.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/atanh.cpp b/flang-rt/lib/quadmath/atanh.cpp similarity index 87% rename from flang/runtime/Float128Math/atanh.cpp rename to flang-rt/lib/quadmath/atanh.cpp index 442d9beafae47..c7455fcb7ca67 100644 --- a/flang/runtime/Float128Math/atanh.cpp +++ b/flang-rt/lib/quadmath/atanh.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/atanh.cpp ------------------------------------===// +//===-- lib/quadmath/atanh.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/ceil.cpp b/flang-rt/lib/quadmath/ceil.cpp similarity index 87% rename from flang/runtime/Float128Math/ceil.cpp rename to flang-rt/lib/quadmath/ceil.cpp index 48e20b2b41577..03a98bedfdc03 100644 --- a/flang/runtime/Float128Math/ceil.cpp +++ b/flang-rt/lib/quadmath/ceil.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/ceil.cpp -------------------------------------===// +//===-- lib/quadmath/ceil.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/complex-math.c b/flang-rt/lib/quadmath/complex-math.c similarity index 92% rename from flang/runtime/Float128Math/complex-math.c rename to flang-rt/lib/quadmath/complex-math.c index a7e32f3ef755b..e485fd7eb5dbb 100644 --- a/flang/runtime/Float128Math/complex-math.c +++ b/flang-rt/lib/quadmath/complex-math.c @@ -1,11 +1,10 @@ -/*===-- runtime/Float128Math/complex-math.c -------------------------*- C -*-=== +/*===-- lib/quadmath/complex-math.c ---------------------------------*- 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 * - * ===-----------------------------------------------------------------------=== - */ + *===----------------------------------------------------------------------===*/ #include "complex-math.h" diff --git a/flang/runtime/Float128Math/complex-math.h b/flang-rt/lib/quadmath/complex-math.h similarity index 88% rename from flang/runtime/Float128Math/complex-math.h rename to flang-rt/lib/quadmath/complex-math.h index cf5e980a39b6b..424ed84da4e01 100644 --- a/flang/runtime/Float128Math/complex-math.h +++ b/flang-rt/lib/quadmath/complex-math.h @@ -1,4 +1,4 @@ -/*===-- runtime/Float128Math/complex-math.h -------------------------*- C -*-=== +/*===-- lib/quadmath/complex-math.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_RUNTIME_FLOAT128MATH_COMPLEX_MATH_H_ -#define FORTRAN_RUNTIME_FLOAT128MATH_COMPLEX_MATH_H_ +#ifndef FLANG_RT_QUADMATH_COMPLEX_MATH_H_ +#define FLANG_RT_QUADMATH_COMPLEX_MATH_H_ #include "flang/Common/float128.h" #include "flang/Runtime/entry-names.h" @@ -59,4 +59,4 @@ #error "Float128Math build with glibc>=2.26 is unsupported yet" #endif -#endif /* FORTRAN_RUNTIME_FLOAT128MATH_COMPLEX_MATH_H_ */ +#endif /* FLANG_RT_QUADMATH_COMPLEX_MATH_H_ */ diff --git a/flang/runtime/Float128Math/cos.cpp b/flang-rt/lib/quadmath/cos.cpp similarity index 87% rename from flang/runtime/Float128Math/cos.cpp rename to flang-rt/lib/quadmath/cos.cpp index d1b3e0e736ca3..1116080c53d2a 100644 --- a/flang/runtime/Float128Math/cos.cpp +++ b/flang-rt/lib/quadmath/cos.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/cos.cpp --------------------------------------===// +//===-- lib/quadmath/cos.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/cosh.cpp b/flang-rt/lib/quadmath/cosh.cpp similarity index 87% rename from flang/runtime/Float128Math/cosh.cpp rename to flang-rt/lib/quadmath/cosh.cpp index 9fe5b61d8f95f..dd5978e5e5f08 100644 --- a/flang/runtime/Float128Math/cosh.cpp +++ b/flang-rt/lib/quadmath/cosh.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/cosh.cpp -------------------------------------===// +//===-- lib/quadmath/cosh.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/erf.cpp b/flang-rt/lib/quadmath/erf.cpp similarity index 87% rename from flang/runtime/Float128Math/erf.cpp rename to flang-rt/lib/quadmath/erf.cpp index 2a553bd395e88..0021b7900f6a1 100644 --- a/flang/runtime/Float128Math/erf.cpp +++ b/flang-rt/lib/quadmath/erf.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/erf.cpp --------------------------------------===// +//===-- lib/quadmath/erf.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/erfc.cpp b/flang-rt/lib/quadmath/erfc.cpp similarity index 87% rename from flang/runtime/Float128Math/erfc.cpp rename to flang-rt/lib/quadmath/erfc.cpp index 2435ed2786cb3..5b80fb475b3fc 100644 --- a/flang/runtime/Float128Math/erfc.cpp +++ b/flang-rt/lib/quadmath/erfc.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/erfc.cpp -------------------------------------===// +//===-- lib/quadmath/erfc.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/exp.cpp b/flang-rt/lib/quadmath/exp.cpp similarity index 87% rename from flang/runtime/Float128Math/exp.cpp rename to flang-rt/lib/quadmath/exp.cpp index 5ca87d9dd25d2..94e444c3b00c7 100644 --- a/flang/runtime/Float128Math/exp.cpp +++ b/flang-rt/lib/quadmath/exp.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/exp.cpp --------------------------------------===// +//===-- lib/quadmath/exp.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/exponent.cpp b/flang-rt/lib/quadmath/exponent.cpp similarity index 90% rename from flang/runtime/Float128Math/exponent.cpp rename to flang-rt/lib/quadmath/exponent.cpp index 237cde34e8691..0d2fa6478cca8 100644 --- a/flang/runtime/Float128Math/exponent.cpp +++ b/flang-rt/lib/quadmath/exponent.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/exponent.cpp ---------------------------------===// +//===-- lib/quadmath/exponent.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/floor.cpp b/flang-rt/lib/quadmath/floor.cpp similarity index 87% rename from flang/runtime/Float128Math/floor.cpp rename to flang-rt/lib/quadmath/floor.cpp index 28f9c7b55dd51..e5dfb33db82ce 100644 --- a/flang/runtime/Float128Math/floor.cpp +++ b/flang-rt/lib/quadmath/floor.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/floor.cpp ------------------------------------===// +//===-- lib/quadmath/floor.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/fma.cpp b/flang-rt/lib/quadmath/fma.cpp similarity index 89% rename from flang/runtime/Float128Math/fma.cpp rename to flang-rt/lib/quadmath/fma.cpp index 87176c25dd604..910303af32339 100644 --- a/flang/runtime/Float128Math/fma.cpp +++ b/flang-rt/lib/quadmath/fma.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/fma.cpp --------------------------------------===// +//===-- lib/quadmath/fma.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/fraction.cpp b/flang-rt/lib/quadmath/fraction.cpp similarity index 87% rename from flang/runtime/Float128Math/fraction.cpp rename to flang-rt/lib/quadmath/fraction.cpp index 45ec12cd77518..a9927666a7b00 100644 --- a/flang/runtime/Float128Math/fraction.cpp +++ b/flang-rt/lib/quadmath/fraction.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/fraction.cpp ---------------------------------===// +//===-- lib/quadmath/fraction.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/hypot.cpp b/flang-rt/lib/quadmath/hypot.cpp similarity index 88% rename from flang/runtime/Float128Math/hypot.cpp rename to flang-rt/lib/quadmath/hypot.cpp index 03049b06d3a24..3090d0b2aff74 100644 --- a/flang/runtime/Float128Math/hypot.cpp +++ b/flang-rt/lib/quadmath/hypot.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/hypot.cpp ------------------------------------===// +//===-- lib/quadmath/hypot.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/j0.cpp b/flang-rt/lib/quadmath/j0.cpp similarity index 87% rename from flang/runtime/Float128Math/j0.cpp rename to flang-rt/lib/quadmath/j0.cpp index 7207cbe1a92e7..06df1c2aca452 100644 --- a/flang/runtime/Float128Math/j0.cpp +++ b/flang-rt/lib/quadmath/j0.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/j0.cpp ---------------------------------------===// +//===-- lib/quadmath/j0.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/j1.cpp b/flang-rt/lib/quadmath/j1.cpp similarity index 87% rename from flang/runtime/Float128Math/j1.cpp rename to flang-rt/lib/quadmath/j1.cpp index 9e49bcbc32ca4..d8a1f123b95e6 100644 --- a/flang/runtime/Float128Math/j1.cpp +++ b/flang-rt/lib/quadmath/j1.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/j1.cpp ---------------------------------------===// +//===-- lib/quadmath/j1.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/jn.cpp b/flang-rt/lib/quadmath/jn.cpp similarity index 87% rename from flang/runtime/Float128Math/jn.cpp rename to flang-rt/lib/quadmath/jn.cpp index 37e5f428e5e26..a53e305bb8746 100644 --- a/flang/runtime/Float128Math/jn.cpp +++ b/flang-rt/lib/quadmath/jn.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/jn.cpp ---------------------------------------===// +//===-- lib/quadmath/jn.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/lgamma.cpp b/flang-rt/lib/quadmath/lgamma.cpp similarity index 87% rename from flang/runtime/Float128Math/lgamma.cpp rename to flang-rt/lib/quadmath/lgamma.cpp index 54d0dd8083868..b96dff1d0d72a 100644 --- a/flang/runtime/Float128Math/lgamma.cpp +++ b/flang-rt/lib/quadmath/lgamma.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/lgamma.cpp -----------------------------------===// +//===-- lib/quadmath/lgamma.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/llround.cpp b/flang-rt/lib/quadmath/llround.cpp similarity index 87% rename from flang/runtime/Float128Math/llround.cpp rename to flang-rt/lib/quadmath/llround.cpp index f0c53ccdf66fd..8f2913d390431 100644 --- a/flang/runtime/Float128Math/llround.cpp +++ b/flang-rt/lib/quadmath/llround.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/llround.cpp ----------------------------------===// +//===-- lib/quadmath/llround.cpp --------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/log.cpp b/flang-rt/lib/quadmath/log.cpp similarity index 87% rename from flang/runtime/Float128Math/log.cpp rename to flang-rt/lib/quadmath/log.cpp index 28fec1958f10b..0c489c922a3fc 100644 --- a/flang/runtime/Float128Math/log.cpp +++ b/flang-rt/lib/quadmath/log.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/log.cpp --------------------------------------===// +//===-- lib/quadmath/log.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/log10.cpp b/flang-rt/lib/quadmath/log10.cpp similarity index 87% rename from flang/runtime/Float128Math/log10.cpp rename to flang-rt/lib/quadmath/log10.cpp index f844d508f8d3b..a2f222e15a147 100644 --- a/flang/runtime/Float128Math/log10.cpp +++ b/flang-rt/lib/quadmath/log10.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/log10.cpp ------------------------------------===// +//===-- lib/quadmath/log10.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/lround.cpp b/flang-rt/lib/quadmath/lround.cpp similarity index 87% rename from flang/runtime/Float128Math/lround.cpp rename to flang-rt/lib/quadmath/lround.cpp index 8c2d3315c62a7..539ee107a3881 100644 --- a/flang/runtime/Float128Math/lround.cpp +++ b/flang-rt/lib/quadmath/lround.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/lround.cpp -----------------------------------===// +//===-- lib/quadmath/lround.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/math-entries.h b/flang-rt/lib/quadmath/math-entries.h similarity index 96% rename from flang/runtime/Float128Math/math-entries.h rename to flang-rt/lib/quadmath/math-entries.h index a94503fe8e67a..6e47f32cc8a43 100644 --- a/flang/runtime/Float128Math/math-entries.h +++ b/flang-rt/lib/quadmath/math-entries.h @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/math-entries.h ---------------------*- C++ -*-===// +//===-- lib/quadmath/math-entries.h -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,11 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_RUNTIME_FLOAT128MATH_MATH_ENTRIES_H_ -#define FORTRAN_RUNTIME_FLOAT128MATH_MATH_ENTRIES_H_ -#include "terminator.h" -#include "tools.h" +#ifndef FLANG_RT_QUADMATH_MATH_ENTRIES_H_ +#define FLANG_RT_QUADMATH_MATH_ENTRIES_H_ + +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/float128.h" #include "flang/Runtime/entry-names.h" #include @@ -231,4 +232,4 @@ DEFINE_SIMPLE_ALIAS(Yn, ynl) } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_FLOAT128MATH_MATH_ENTRIES_H_ +#endif // FLANG_RT_QUADMATH_MATH_ENTRIES_H_ diff --git a/flang/runtime/Float128Math/mod-real.cpp b/flang-rt/lib/quadmath/mod-real.cpp similarity index 88% rename from flang/runtime/Float128Math/mod-real.cpp rename to flang-rt/lib/quadmath/mod-real.cpp index e831c2df4abc1..0230964e3ddc2 100644 --- a/flang/runtime/Float128Math/mod-real.cpp +++ b/flang-rt/lib/quadmath/mod-real.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/mod-real.cpp ---------------------------------===// +//===-- lib/quadmath/mod-real.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/modulo-real.cpp b/flang-rt/lib/quadmath/modulo-real.cpp similarity index 89% rename from flang/runtime/Float128Math/modulo-real.cpp rename to flang-rt/lib/quadmath/modulo-real.cpp index 88729da7e3987..0f28747b86985 100644 --- a/flang/runtime/Float128Math/modulo-real.cpp +++ b/flang-rt/lib/quadmath/modulo-real.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/modulo-real.cpp ------------------------------===// +//===-- lib/quadmath/modulo-real.cpp ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/nearbyint.cpp b/flang-rt/lib/quadmath/nearbyint.cpp similarity index 87% rename from flang/runtime/Float128Math/nearbyint.cpp rename to flang-rt/lib/quadmath/nearbyint.cpp index 9eecb0c5f3e2f..3811fc53d1d82 100644 --- a/flang/runtime/Float128Math/nearbyint.cpp +++ b/flang-rt/lib/quadmath/nearbyint.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/nearbyint.cpp --------------------------------===// +//===-- lib/quadmath/nearbyint.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/nearest.cpp b/flang-rt/lib/quadmath/nearest.cpp similarity index 88% rename from flang/runtime/Float128Math/nearest.cpp rename to flang-rt/lib/quadmath/nearest.cpp index 50f6e7ea75a60..8c1969a7b596c 100644 --- a/flang/runtime/Float128Math/nearest.cpp +++ b/flang-rt/lib/quadmath/nearest.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/nearest.cpp ----------------------------------===// +//===-- lib/quadmath/nearest.cpp --------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/norm2.cpp b/flang-rt/lib/quadmath/norm2.cpp similarity index 89% rename from flang/runtime/Float128Math/norm2.cpp rename to flang-rt/lib/quadmath/norm2.cpp index 18e9c8cc8a2b9..e98f4007737d1 100644 --- a/flang/runtime/Float128Math/norm2.cpp +++ b/flang-rt/lib/quadmath/norm2.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/norm2.cpp ------------------------------------===// +//===-- lib/quadmath/norm2.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,7 +8,7 @@ #include "math-entries.h" #include "numeric-template-specs.h" -#include "reduction-templates.h" +#include "flang-rt/runtime/reduction-templates.h" namespace Fortran::runtime { extern "C" { diff --git a/flang/runtime/Float128Math/numeric-template-specs.h b/flang-rt/lib/quadmath/numeric-template-specs.h similarity index 82% rename from flang/runtime/Float128Math/numeric-template-specs.h rename to flang-rt/lib/quadmath/numeric-template-specs.h index a0a77230c3e9e..e215ad70eca14 100644 --- a/flang/runtime/Float128Math/numeric-template-specs.h +++ b/flang-rt/lib/quadmath/numeric-template-specs.h @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/numeric-template-specs.h -----------*- C++ -*-===// +//===-- lib/quadmath/numeric-template-specs.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,11 +6,11 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_RUNTIME_FLOAT128MATH_NUMERIC_TEMPLATE_SPECS_H_ -#define FORTRAN_RUNTIME_FLOAT128MATH_NUMERIC_TEMPLATE_SPECS_H_ +#ifndef FLANG_RT_QUADMATH_NUMERIC_TEMPLATE_SPECS_H_ +#define FLANG_RT_QUADMATH_NUMERIC_TEMPLATE_SPECS_H_ #include "math-entries.h" -#include "numeric-templates.h" +#include "flang-rt/runtime/numeric-templates.h" namespace Fortran::runtime { using F128Type = CppTypeFor; @@ -52,4 +52,4 @@ template <> struct SQRTTy { }; } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_FLOAT128MATH_NUMERIC_TEMPLATE_SPECS_H_ +#endif // FLANG_RT_QUADMATH_NUMERIC_TEMPLATE_SPECS_H_ diff --git a/flang/runtime/Float128Math/pow.cpp b/flang-rt/lib/quadmath/pow.cpp similarity index 88% rename from flang/runtime/Float128Math/pow.cpp rename to flang-rt/lib/quadmath/pow.cpp index 99aae04c65ecb..29c0536254658 100644 --- a/flang/runtime/Float128Math/pow.cpp +++ b/flang-rt/lib/quadmath/pow.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/pow.cpp --------------------------------------===// +//===-- lib/quadmath/pow.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/random.cpp b/flang-rt/lib/quadmath/random.cpp similarity index 83% rename from flang/runtime/Float128Math/random.cpp rename to flang-rt/lib/quadmath/random.cpp index 93c5c14cee37d..a6d22733ebce4 100644 --- a/flang/runtime/Float128Math/random.cpp +++ b/flang-rt/lib/quadmath/random.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/random.cpp -----------------------------------===// +//===-- lib/quadmath/random.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,7 +8,7 @@ #include "math-entries.h" #include "numeric-template-specs.h" -#include "random-templates.h" +#include "flang-rt/runtime/random-templates.h" using namespace Fortran::runtime::random; extern "C" { diff --git a/flang/runtime/Float128Math/remainder.cpp b/flang-rt/lib/quadmath/remainder.cpp similarity index 88% rename from flang/runtime/Float128Math/remainder.cpp rename to flang-rt/lib/quadmath/remainder.cpp index e5c2793dab71a..4b68cdd6ac9de 100644 --- a/flang/runtime/Float128Math/remainder.cpp +++ b/flang-rt/lib/quadmath/remainder.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/remainder.cpp --------------------------------===// +//===-- lib/quadmath/remainder.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/round.cpp b/flang-rt/lib/quadmath/round.cpp similarity index 89% rename from flang/runtime/Float128Math/round.cpp rename to flang-rt/lib/quadmath/round.cpp index e79ce30536b3b..844338f5e6413 100644 --- a/flang/runtime/Float128Math/round.cpp +++ b/flang-rt/lib/quadmath/round.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/round.cpp ------------------------------------===// +//===-- lib/quadmath/round.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/rrspacing.cpp b/flang-rt/lib/quadmath/rrspacing.cpp similarity index 87% rename from flang/runtime/Float128Math/rrspacing.cpp rename to flang-rt/lib/quadmath/rrspacing.cpp index 04cefc049bbee..e8613f4d7d7e2 100644 --- a/flang/runtime/Float128Math/rrspacing.cpp +++ b/flang-rt/lib/quadmath/rrspacing.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/rrspacing.cpp --------------------------------===// +//===-- lib/quadmath/rrspacing.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/scale.cpp b/flang-rt/lib/quadmath/scale.cpp similarity index 90% rename from flang/runtime/Float128Math/scale.cpp rename to flang-rt/lib/quadmath/scale.cpp index 6b083afbdf4d1..3d919f85a4487 100644 --- a/flang/runtime/Float128Math/scale.cpp +++ b/flang-rt/lib/quadmath/scale.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/scale.cpp ------------------------------------===// +//===-- lib/quadmath/scale.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/set-exponent.cpp b/flang-rt/lib/quadmath/set-exponent.cpp similarity index 88% rename from flang/runtime/Float128Math/set-exponent.cpp rename to flang-rt/lib/quadmath/set-exponent.cpp index 63c5b325085fb..d6b582e7c4f38 100644 --- a/flang/runtime/Float128Math/set-exponent.cpp +++ b/flang-rt/lib/quadmath/set-exponent.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/set-exponent.cpp -----------------------------===// +//===-- lib/quadmath/set-exponent.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/sin.cpp b/flang-rt/lib/quadmath/sin.cpp similarity index 87% rename from flang/runtime/Float128Math/sin.cpp rename to flang-rt/lib/quadmath/sin.cpp index 99fa3e493e694..dcff2f9ce02ca 100644 --- a/flang/runtime/Float128Math/sin.cpp +++ b/flang-rt/lib/quadmath/sin.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/sin.cpp --------------------------------------===// +//===-- lib/quadmath/sin.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/sinh.cpp b/flang-rt/lib/quadmath/sinh.cpp similarity index 87% rename from flang/runtime/Float128Math/sinh.cpp rename to flang-rt/lib/quadmath/sinh.cpp index b6cd96963612e..3ab7280f705a6 100644 --- a/flang/runtime/Float128Math/sinh.cpp +++ b/flang-rt/lib/quadmath/sinh.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/sinh.cpp -------------------------------------===// +//===-- lib/quadmath/sinh.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/spacing.cpp b/flang-rt/lib/quadmath/spacing.cpp similarity index 87% rename from flang/runtime/Float128Math/spacing.cpp rename to flang-rt/lib/quadmath/spacing.cpp index fc6aa2c4ec2d8..1d7ecdb4852d2 100644 --- a/flang/runtime/Float128Math/spacing.cpp +++ b/flang-rt/lib/quadmath/spacing.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/spacing.cpp ----------------------------------===// +//===-- lib/quadmath/spacing.cpp --------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/sqrt.cpp b/flang-rt/lib/quadmath/sqrt.cpp similarity index 87% rename from flang/runtime/Float128Math/sqrt.cpp rename to flang-rt/lib/quadmath/sqrt.cpp index 871c66e007984..6e0d11a6697f0 100644 --- a/flang/runtime/Float128Math/sqrt.cpp +++ b/flang-rt/lib/quadmath/sqrt.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/sqrt.cpp -------------------------------------===// +//===-- lib/quadmath/sqrt.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/tan.cpp b/flang-rt/lib/quadmath/tan.cpp similarity index 87% rename from flang/runtime/Float128Math/tan.cpp rename to flang-rt/lib/quadmath/tan.cpp index 2d6f448ba8955..6f09b93060228 100644 --- a/flang/runtime/Float128Math/tan.cpp +++ b/flang-rt/lib/quadmath/tan.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/tan.cpp --------------------------------------===// +//===-- lib/quadmath/tan.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/tanh.cpp b/flang-rt/lib/quadmath/tanh.cpp similarity index 87% rename from flang/runtime/Float128Math/tanh.cpp rename to flang-rt/lib/quadmath/tanh.cpp index f6321f4819191..214a18d5c3778 100644 --- a/flang/runtime/Float128Math/tanh.cpp +++ b/flang-rt/lib/quadmath/tanh.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/tanh.cpp -------------------------------------===// +//===-- lib/quadmath/tanh.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/tgamma.cpp b/flang-rt/lib/quadmath/tgamma.cpp similarity index 87% rename from flang/runtime/Float128Math/tgamma.cpp rename to flang-rt/lib/quadmath/tgamma.cpp index 98fd792a63330..2b05a60dcaabb 100644 --- a/flang/runtime/Float128Math/tgamma.cpp +++ b/flang-rt/lib/quadmath/tgamma.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/tgamma.cpp -----------------------------------===// +//===-- lib/quadmath/tgamma.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/trunc.cpp b/flang-rt/lib/quadmath/trunc.cpp similarity index 89% rename from flang/runtime/Float128Math/trunc.cpp rename to flang-rt/lib/quadmath/trunc.cpp index 54fa33176813c..cd7c27b569fc3 100644 --- a/flang/runtime/Float128Math/trunc.cpp +++ b/flang-rt/lib/quadmath/trunc.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/trunc.cpp ------------------------------------===// +//===-- lib/quadmath/trunc.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/y0.cpp b/flang-rt/lib/quadmath/y0.cpp similarity index 87% rename from flang/runtime/Float128Math/y0.cpp rename to flang-rt/lib/quadmath/y0.cpp index 0b3059b4cfe25..9db04277660ad 100644 --- a/flang/runtime/Float128Math/y0.cpp +++ b/flang-rt/lib/quadmath/y0.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/y0.cpp ---------------------------------------===// +//===-- lib/quadmath/y0.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/y1.cpp b/flang-rt/lib/quadmath/y1.cpp similarity index 87% rename from flang/runtime/Float128Math/y1.cpp rename to flang-rt/lib/quadmath/y1.cpp index cb39d87034dc7..92e658195f3d9 100644 --- a/flang/runtime/Float128Math/y1.cpp +++ b/flang-rt/lib/quadmath/y1.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/y1.cpp ---------------------------------------===// +//===-- lib/quadmath/y1.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/Float128Math/yn.cpp b/flang-rt/lib/quadmath/yn.cpp similarity index 87% rename from flang/runtime/Float128Math/yn.cpp rename to flang-rt/lib/quadmath/yn.cpp index bef8f9457df2f..20c0bc9d5218e 100644 --- a/flang/runtime/Float128Math/yn.cpp +++ b/flang-rt/lib/quadmath/yn.cpp @@ -1,4 +1,4 @@ -//===-- runtime/Float128Math/yn.cpp ---------------------------------------===// +//===-- lib/quadmath/yn.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/ISO_Fortran_binding.cpp b/flang-rt/lib/runtime/ISO_Fortran_binding.cpp similarity index 97% rename from flang/runtime/ISO_Fortran_binding.cpp rename to flang-rt/lib/runtime/ISO_Fortran_binding.cpp index 64e239f498230..a5f8b357ae0b8 100644 --- a/flang/runtime/ISO_Fortran_binding.cpp +++ b/flang-rt/lib/runtime/ISO_Fortran_binding.cpp @@ -1,4 +1,4 @@ -//===-- runtime/ISO_Fortran_binding.cpp -----------------------------------===// +//===-- lib/runtime/ISO_Fortran_binding.cpp ---------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,11 +10,11 @@ // as specified in section 18.5.5 of Fortran 2018. #include "ISO_Fortran_util.h" -#include "terminator.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/pointer.h" -#include "flang/Runtime/type-code.h" #include namespace Fortran::ISO { diff --git a/flang/runtime/ISO_Fortran_util.h b/flang-rt/lib/runtime/ISO_Fortran_util.h similarity index 90% rename from flang/runtime/ISO_Fortran_util.h rename to flang-rt/lib/runtime/ISO_Fortran_util.h index aca9aee8c5718..9bbc03eefc490 100644 --- a/flang/runtime/ISO_Fortran_util.h +++ b/flang-rt/lib/runtime/ISO_Fortran_util.h @@ -1,4 +1,4 @@ -//===-- runtime/ISO_Fortran_util.h ------------------------------*- C++ -*-===// +//===-- lib/runtime/ISO_Fortran_util.h --------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,15 +6,15 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_RUNTIME_ISO_FORTRAN_UTIL_H_ -#define FORTRAN_RUNTIME_ISO_FORTRAN_UTIL_H_ +#ifndef FLANG_RT_RUNTIME_ISO_FORTRAN_UTIL_H_ +#define FLANG_RT_RUNTIME_ISO_FORTRAN_UTIL_H_ // Internal utils for establishing CFI_cdesc_t descriptors. -#include "terminator.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" -#include "flang/Runtime/descriptor.h" -#include "flang/Runtime/type-code.h" #include namespace Fortran::ISO { @@ -99,4 +99,4 @@ static inline RT_API_ATTRS void EstablishDescriptor(CFI_cdesc_t *descriptor, } } } // namespace Fortran::ISO -#endif // FORTRAN_RUNTIME_ISO_FORTRAN_UTIL_H_ +#endif // FLANG_RT_RUNTIME_ISO_FORTRAN_UTIL_H_ diff --git a/flang/runtime/allocatable.cpp b/flang-rt/lib/runtime/allocatable.cpp similarity index 96% rename from flang/runtime/allocatable.cpp rename to flang-rt/lib/runtime/allocatable.cpp index 686114bf86eaf..a51816129199a 100644 --- a/flang/runtime/allocatable.cpp +++ b/flang-rt/lib/runtime/allocatable.cpp @@ -1,4 +1,4 @@ -//===-- runtime/allocatable.cpp -------------------------------------------===// +//===-- lib/runtime/allocatable.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,14 +7,14 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/allocatable.h" -#include "assign-impl.h" -#include "derived.h" -#include "stat.h" -#include "terminator.h" -#include "type-info.h" +#include "flang-rt/runtime/assign-impl.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/type-info.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/assign.h" -#include "flang/Runtime/descriptor.h" namespace Fortran::runtime { extern "C" { diff --git a/flang/runtime/allocator-registry.cpp b/flang-rt/lib/runtime/allocator-registry.cpp similarity index 87% rename from flang/runtime/allocator-registry.cpp rename to flang-rt/lib/runtime/allocator-registry.cpp index f5670331d6dbe..f8a8daaf8e748 100644 --- a/flang/runtime/allocator-registry.cpp +++ b/flang-rt/lib/runtime/allocator-registry.cpp @@ -1,4 +1,4 @@ -//===-- runtime/allocator-registry.cpp ------------------------------------===// +//===-- lib/runtime/allocator-registry.cpp ----------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "flang/Runtime/allocator-registry.h" -#include "terminator.h" +#include "flang-rt/runtime/allocator-registry.h" +#include "flang-rt/runtime/terminator.h" namespace Fortran::runtime { diff --git a/flang/runtime/array-constructor.cpp b/flang-rt/lib/runtime/array-constructor.cpp similarity index 96% rename from flang/runtime/array-constructor.cpp rename to flang-rt/lib/runtime/array-constructor.cpp index c6953167f5fb2..7e267e714927f 100644 --- a/flang/runtime/array-constructor.cpp +++ b/flang-rt/lib/runtime/array-constructor.cpp @@ -1,4 +1,4 @@ -//===-- runtime/array-constructor.cpp -------------------------------------===// +//===-- lib/runtime/array-constructor.cpp -----------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#include "flang/Runtime/array-constructor.h" -#include "derived.h" -#include "terminator.h" -#include "tools.h" -#include "type-info.h" +#include "flang-rt/runtime/array-constructor.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/type-info.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/assign.h" -#include "flang/Runtime/descriptor.h" namespace Fortran::runtime { diff --git a/flang/runtime/assign.cpp b/flang-rt/lib/runtime/assign.cpp similarity index 98% rename from flang/runtime/assign.cpp rename to flang-rt/lib/runtime/assign.cpp index 8f0efaa376c19..a1f3715f278c1 100644 --- a/flang/runtime/assign.cpp +++ b/flang-rt/lib/runtime/assign.cpp @@ -1,4 +1,4 @@ -//===-- runtime/assign.cpp ------------------------------------------------===// +//===-- lib/runtime/assign.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/assign.h" -#include "assign-impl.h" -#include "derived.h" -#include "stat.h" -#include "terminator.h" -#include "tools.h" -#include "type-info.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/assign-impl.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/type-info.h" namespace Fortran::runtime { diff --git a/flang/runtime/buffer.cpp b/flang-rt/lib/runtime/buffer.cpp similarity index 88% rename from flang/runtime/buffer.cpp rename to flang-rt/lib/runtime/buffer.cpp index 7b4869d69c2e5..4cf85e13b6d36 100644 --- a/flang/runtime/buffer.cpp +++ b/flang-rt/lib/runtime/buffer.cpp @@ -1,4 +1,4 @@ -//===-- runtime/buffer.cpp ------------------------------------------------===// +//===-- lib/runtime/buffer.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "buffer.h" +#include "flang-rt/runtime/buffer.h" #include namespace Fortran::runtime::io { diff --git a/flang/runtime/character.cpp b/flang-rt/lib/runtime/character.cpp similarity index 99% rename from flang/runtime/character.cpp rename to flang-rt/lib/runtime/character.cpp index 5049247397eb3..10cf27c37c4d8 100644 --- a/flang/runtime/character.cpp +++ b/flang-rt/lib/runtime/character.cpp @@ -1,4 +1,4 @@ -//===-- runtime/character.cpp ---------------------------------------------===// +//===-- lib/runtime/character.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/character.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/bit-population-count.h" #include "flang/Common/uint128.h" #include "flang/Runtime/character.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include #include diff --git a/flang/runtime/command.cpp b/flang-rt/lib/runtime/command.cpp similarity index 96% rename from flang/runtime/command.cpp rename to flang-rt/lib/runtime/command.cpp index a555e26f96a66..8a5a61ac1ad44 100644 --- a/flang/runtime/command.cpp +++ b/flang-rt/lib/runtime/command.cpp @@ -1,4 +1,4 @@ -//===-- runtime/command.cpp -----------------------------------------------===// +//===-- lib/runtime/command.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/command.h" -#include "environment.h" -#include "stat.h" -#include "terminator.h" -#include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include #include diff --git a/flang/runtime/complex-powi.cpp b/flang-rt/lib/runtime/complex-powi.cpp similarity index 92% rename from flang/runtime/complex-powi.cpp rename to flang-rt/lib/runtime/complex-powi.cpp index 62f73e037b76f..a561d114591cf 100644 --- a/flang/runtime/complex-powi.cpp +++ b/flang-rt/lib/runtime/complex-powi.cpp @@ -1,11 +1,11 @@ -/*===-- flang/runtime/complex-powi.cpp ----------------------------*- C++ -*-=== - * - * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. - * See https://llvm.org/LICENSE.txt for license information. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - * - * ===-----------------------------------------------------------------------=== - */ +//===-- lib/runtime/complex-powi.cpp ----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + #include "flang/Common/float128.h" #include "flang/Runtime/cpp-type.h" #include "flang/Runtime/entry-names.h" diff --git a/flang/runtime/complex-reduction.c b/flang-rt/lib/runtime/complex-reduction.c similarity index 97% rename from flang/runtime/complex-reduction.c rename to flang-rt/lib/runtime/complex-reduction.c index de1ff3d683084..967f26c05e702 100644 --- a/flang/runtime/complex-reduction.c +++ b/flang-rt/lib/runtime/complex-reduction.c @@ -1,11 +1,10 @@ -/*===-- flang/runtime/complex-reduction.c ---------------------------*- C -*-=== +/*===-- lib/flang_rt/complex-reduction.c ----------------------------*- 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 * - * ===-----------------------------------------------------------------------=== - */ + *===----------------------------------------------------------------------===*/ #include "complex-reduction.h" #include diff --git a/flang/runtime/complex-reduction.h b/flang-rt/lib/runtime/complex-reduction.h similarity index 96% rename from flang/runtime/complex-reduction.h rename to flang-rt/lib/runtime/complex-reduction.h index 5ff2a828fb3ec..44c52fb02fa43 100644 --- a/flang/runtime/complex-reduction.h +++ b/flang-rt/lib/runtime/complex-reduction.h @@ -1,19 +1,18 @@ -/*===-- flang/runtime/complex-reduction.h ---------------------------*- C -*-=== +/*===-- lib/runtime/complex-reduction.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 * - * ===-----------------------------------------------------------------------=== - */ + *===----------------------------------------------------------------------===*/ /* Wraps the C++-coded complex-valued SUM and PRODUCT reductions with * C-coded wrapper functions returning _Complex values, to avoid problems * with C++ build compilers that don't support C's _Complex. */ -#ifndef FORTRAN_RUNTIME_COMPLEX_REDUCTION_H_ -#define FORTRAN_RUNTIME_COMPLEX_REDUCTION_H_ +#ifndef FLANG_RT_RUNTIME_COMPLEX_REDUCTION_H_ +#define FLANG_RT_RUNTIME_COMPLEX_REDUCTION_H_ #include "flang/Common/float128.h" #include "flang/Runtime/entry-names.h" @@ -156,4 +155,4 @@ void RTNAME(ReduceComplex16DimValue)( REDUCE_DIM_ARGS(CFloat128ComplexType, CFloat128ComplexType_value_op)); #endif -#endif // FORTRAN_RUNTIME_COMPLEX_REDUCTION_H_ +#endif // FLANG_RT_RUNTIME_COMPLEX_REDUCTION_H_ diff --git a/flang/runtime/connection.cpp b/flang-rt/lib/runtime/connection.cpp similarity index 90% rename from flang/runtime/connection.cpp rename to flang-rt/lib/runtime/connection.cpp index f24f0e832eb48..2f01dbbb95920 100644 --- a/flang/runtime/connection.cpp +++ b/flang-rt/lib/runtime/connection.cpp @@ -1,4 +1,4 @@ -//===-- runtime/connection.cpp --------------------------------------------===// +//===-- lib/runtime/connection.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "connection.h" -#include "environment.h" -#include "io-stmt.h" +#include "flang-rt/runtime/connection.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/io-stmt.h" #include namespace Fortran::runtime::io { diff --git a/flang/runtime/copy.cpp b/flang-rt/lib/runtime/copy.cpp similarity index 97% rename from flang/runtime/copy.cpp rename to flang-rt/lib/runtime/copy.cpp index b20f68f019498..5956642dd7258 100644 --- a/flang/runtime/copy.cpp +++ b/flang-rt/lib/runtime/copy.cpp @@ -1,4 +1,4 @@ -//===-- runtime/copy.cpp -------------------------------------------------===// +//===-- lib/runtime/copy.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,10 +8,10 @@ #include "copy.h" #include "stack.h" -#include "terminator.h" -#include "type-info.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/type-info.h" #include "flang/Runtime/allocatable.h" -#include "flang/Runtime/descriptor.h" #include namespace Fortran::runtime { diff --git a/flang/runtime/copy.h b/flang-rt/lib/runtime/copy.h similarity index 78% rename from flang/runtime/copy.h rename to flang-rt/lib/runtime/copy.h index 542660530bfb6..836c9d4a1ef89 100644 --- a/flang/runtime/copy.h +++ b/flang-rt/lib/runtime/copy.h @@ -1,4 +1,4 @@ -//===-- runtime/copy.h ------------------------------------------*- C++ -*-===// +//===-- lib/runtime/copy.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. @@ -9,10 +9,10 @@ // Utilities that copy data in a type-aware fashion, allocating & duplicating // allocatable/automatic components of derived types along the way. -#ifndef FORTRAN_RUNTIME_COPY_H_ -#define FORTRAN_RUNTIME_COPY_H_ +#ifndef FLANG_RT_RUNTIME_COPY_H_ +#define FLANG_RT_RUNTIME_COPY_H_ -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" namespace Fortran::runtime { @@ -22,4 +22,4 @@ RT_API_ATTRS void CopyElement(const Descriptor &to, const SubscriptValue toAt[], const Descriptor &from, const SubscriptValue fromAt[], Terminator &); } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_COPY_H_ +#endif // FLANG_RT_RUNTIME_COPY_H_ diff --git a/flang/runtime/derived-api.cpp b/flang-rt/lib/runtime/derived-api.cpp similarity index 95% rename from flang/runtime/derived-api.cpp rename to flang-rt/lib/runtime/derived-api.cpp index c8ffd8e3bb67c..884fa8ee7d095 100644 --- a/flang/runtime/derived-api.cpp +++ b/flang-rt/lib/runtime/derived-api.cpp @@ -1,5 +1,4 @@ -//===-- runtime/derived-api.cpp -//-----------------------------------------------===// +//===-- lib/runtime/derived-api.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/derived-api.h" -#include "derived.h" -#include "terminator.h" -#include "tools.h" -#include "type-info.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/type-info.h" namespace Fortran::runtime { diff --git a/flang/runtime/derived.cpp b/flang-rt/lib/runtime/derived.cpp similarity index 98% rename from flang/runtime/derived.cpp rename to flang-rt/lib/runtime/derived.cpp index 10813c62e5da1..87e4b29d08c28 100644 --- a/flang/runtime/derived.cpp +++ b/flang-rt/lib/runtime/derived.cpp @@ -1,4 +1,4 @@ -//===-- runtime/derived.cpp -----------------------------------------------===// +//===-- lib/runtime/derived.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "derived.h" -#include "stat.h" -#include "terminator.h" -#include "tools.h" -#include "type-info.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/type-info.h" namespace Fortran::runtime { diff --git a/flang/runtime/descriptor-io.cpp b/flang-rt/lib/runtime/descriptor-io.cpp similarity index 98% rename from flang/runtime/descriptor-io.cpp rename to flang-rt/lib/runtime/descriptor-io.cpp index 380ad425d925f..3db1455af52fe 100644 --- a/flang/runtime/descriptor-io.cpp +++ b/flang-rt/lib/runtime/descriptor-io.cpp @@ -1,4 +1,4 @@ -//===-- runtime/descriptor-io.cpp -----------------------------------------===// +//===-- lib/runtime/descriptor-io.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/descriptor-io.h b/flang-rt/lib/runtime/descriptor-io.h similarity index 98% rename from flang/runtime/descriptor-io.h rename to flang-rt/lib/runtime/descriptor-io.h index 1034958bf654a..dd399164325cb 100644 --- a/flang/runtime/descriptor-io.h +++ b/flang-rt/lib/runtime/descriptor-io.h @@ -1,4 +1,4 @@ -//===-- runtime/descriptor-io.h ---------------------------------*- C++ -*-===// +//===-- lib/runtime/descriptor-io.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_RUNTIME_DESCRIPTOR_IO_H_ -#define FORTRAN_RUNTIME_DESCRIPTOR_IO_H_ +#ifndef FLANG_RT_RUNTIME_DESCRIPTOR_IO_H_ +#define FLANG_RT_RUNTIME_DESCRIPTOR_IO_H_ // Implementation of I/O data list item transfers based on descriptors. // (All I/O items come through here so that the code is exercised for test; @@ -16,15 +16,15 @@ #include "edit-input.h" #include "edit-output.h" -#include "io-stmt.h" -#include "namelist.h" -#include "terminator.h" -#include "type-info.h" #include "unit.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/io-stmt.h" +#include "flang-rt/runtime/namelist.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/type-info.h" #include "flang/Common/optional.h" #include "flang/Common/uint128.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" namespace Fortran::runtime::io::descr { template @@ -626,4 +626,4 @@ static RT_API_ATTRS bool DescriptorIO(IoStatementState &io, return false; } } // namespace Fortran::runtime::io::descr -#endif // FORTRAN_RUNTIME_DESCRIPTOR_IO_H_ +#endif // FLANG_RT_RUNTIME_DESCRIPTOR_IO_H_ diff --git a/flang/runtime/descriptor.cpp b/flang-rt/lib/runtime/descriptor.cpp similarity index 94% rename from flang/runtime/descriptor.cpp rename to flang-rt/lib/runtime/descriptor.cpp index 32f43e89dc7a3..8241a34a4990c 100644 --- a/flang/runtime/descriptor.cpp +++ b/flang-rt/lib/runtime/descriptor.cpp @@ -1,4 +1,4 @@ -//===-- runtime/descriptor.cpp --------------------------------------------===// +//===-- lib/runtime/descriptor.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,15 +6,15 @@ // //===----------------------------------------------------------------------===// -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" #include "ISO_Fortran_util.h" -#include "derived.h" #include "memory.h" -#include "stat.h" -#include "terminator.h" -#include "tools.h" -#include "type-info.h" -#include "flang/Runtime/allocator-registry.h" +#include "flang-rt/runtime/allocator-registry.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/type-info.h" #include #include #include @@ -141,8 +141,10 @@ RT_API_ATTRS OwningPtr Descriptor::Create( RT_API_ATTRS std::size_t Descriptor::SizeInBytes() const { const DescriptorAddendum *addendum{Addendum()}; - return sizeof *this - sizeof(Dimension) + raw_.rank * sizeof(Dimension) + - (addendum ? addendum->SizeInBytes() : 0); + 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; } RT_API_ATTRS std::size_t Descriptor::Elements() const { diff --git a/flang/runtime/dot-product.cpp b/flang-rt/lib/runtime/dot-product.cpp similarity index 98% rename from flang/runtime/dot-product.cpp rename to flang-rt/lib/runtime/dot-product.cpp index 712497a3a50ac..20612f1876c15 100644 --- a/flang/runtime/dot-product.cpp +++ b/flang-rt/lib/runtime/dot-product.cpp @@ -1,4 +1,4 @@ -//===-- runtime/dot-product.cpp -------------------------------------------===// +//===-- lib/runtime/dot-product.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "float.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/float128.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/reduction.h" #include #include diff --git a/flang/runtime/edit-input.cpp b/flang-rt/lib/runtime/edit-input.cpp similarity index 99% rename from flang/runtime/edit-input.cpp rename to flang-rt/lib/runtime/edit-input.cpp index 317f0b676bd21..99a266648f95c 100644 --- a/flang/runtime/edit-input.cpp +++ b/flang-rt/lib/runtime/edit-input.cpp @@ -1,4 +1,4 @@ -//===-- runtime/edit-input.cpp --------------------------------------------===// +//===-- lib/runtime/edit-input.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "edit-input.h" -#include "namelist.h" -#include "utf.h" +#include "flang-rt/runtime/namelist.h" +#include "flang-rt/runtime/utf.h" #include "flang/Common/optional.h" #include "flang/Common/real.h" #include "flang/Common/uint128.h" diff --git a/flang/runtime/edit-input.h b/flang-rt/lib/runtime/edit-input.h similarity index 87% rename from flang/runtime/edit-input.h rename to flang-rt/lib/runtime/edit-input.h index 55a7a45578171..686cd461b3e34 100644 --- a/flang/runtime/edit-input.h +++ b/flang-rt/lib/runtime/edit-input.h @@ -1,4 +1,4 @@ -//===-- runtime/edit-input.h ------------------------------------*- C++ -*-===// +//===-- lib/runtime/edit-input.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,11 +6,11 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_RUNTIME_EDIT_INPUT_H_ -#define FORTRAN_RUNTIME_EDIT_INPUT_H_ +#ifndef FLANG_RT_RUNTIME_EDIT_INPUT_H_ +#define FLANG_RT_RUNTIME_EDIT_INPUT_H_ -#include "format.h" -#include "io-stmt.h" +#include "flang-rt/runtime/format.h" +#include "flang-rt/runtime/io-stmt.h" #include "flang/Decimal/decimal.h" namespace Fortran::runtime::io { @@ -50,4 +50,4 @@ extern template RT_API_ATTRS bool EditCharacterInput( IoStatementState &, const DataEdit &, char32_t *, std::size_t); } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_EDIT_INPUT_H_ +#endif // FLANG_RT_RUNTIME_EDIT_INPUT_H_ diff --git a/flang/runtime/edit-output.cpp b/flang-rt/lib/runtime/edit-output.cpp similarity index 99% rename from flang/runtime/edit-output.cpp rename to flang-rt/lib/runtime/edit-output.cpp index 9db9a3d4a511b..36bbc638ff5fc 100644 --- a/flang/runtime/edit-output.cpp +++ b/flang-rt/lib/runtime/edit-output.cpp @@ -1,4 +1,4 @@ -//===-- runtime/edit-output.cpp -------------------------------------------===// +//===-- lib/runtime/edit-output.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "edit-output.h" -#include "emit-encoded.h" -#include "utf.h" +#include "flang-rt/runtime/emit-encoded.h" +#include "flang-rt/runtime/utf.h" #include "flang/Common/real.h" #include "flang/Common/uint128.h" #include diff --git a/flang/runtime/edit-output.h b/flang-rt/lib/runtime/edit-output.h similarity index 95% rename from flang/runtime/edit-output.h rename to flang-rt/lib/runtime/edit-output.h index 42cc993f98cc1..51a47405e49e4 100644 --- a/flang/runtime/edit-output.h +++ b/flang-rt/lib/runtime/edit-output.h @@ -1,4 +1,4 @@ -//===-- runtime/edit-output.h -----------------------------------*- C++ -*-===// +//===-- lib/runtime/edit-output.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_RUNTIME_EDIT_OUTPUT_H_ -#define FORTRAN_RUNTIME_EDIT_OUTPUT_H_ +#ifndef FLANG_RT_RUNTIME_EDIT_OUTPUT_H_ +#define FLANG_RT_RUNTIME_EDIT_OUTPUT_H_ // Output data editing templates implementing the FORMAT data editing // descriptors E, EN, ES, EX, D, F, and G for REAL data (and COMPLEX @@ -18,8 +18,8 @@ // Drives the same fast binary-to-decimal formatting templates used // in the f18 front-end. -#include "format.h" -#include "io-stmt.h" +#include "flang-rt/runtime/format.h" +#include "flang-rt/runtime/io-stmt.h" #include "flang/Common/uint128.h" #include "flang/Decimal/decimal.h" @@ -138,4 +138,4 @@ extern template class RealOutputEditing<10>; extern template class RealOutputEditing<16>; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_EDIT_OUTPUT_H_ +#endif // FLANG_RT_RUNTIME_EDIT_OUTPUT_H_ diff --git a/flang/runtime/environment-default-list.h b/flang-rt/lib/runtime/environment-default-list.h similarity index 70% rename from flang/runtime/environment-default-list.h rename to flang-rt/lib/runtime/environment-default-list.h index 4da261b10b9a8..76c0955bcce6d 100644 --- a/flang/runtime/environment-default-list.h +++ b/flang-rt/lib/runtime/environment-default-list.h @@ -1,14 +1,13 @@ -/*===-- runtime/environment-default-list.h --------------------------*- C -*-=== +/*===-- lib/flang_rt/environment-default-list.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_RUNTIME_ENVIRONMENT_DEFAULT_LIST_H_ -#define FORTRAN_RUNTIME_ENVIRONMENT_DEFAULT_LIST_H_ +#ifndef FLANG_RT_ENVIRONMENT_DEFAULT_LIST_H_ +#define FLANG_RT_ENVIRONMENT_DEFAULT_LIST_H_ /* Try to maintain C compatibility to make it easier to both define environment * defaults in non-Fortran main programs as well as pass through the environment @@ -28,4 +27,4 @@ struct EnvironmentDefaultList { const struct EnvironmentDefaultItem *item; }; -#endif /* FORTRAN_RUNTIME_ENVIRONMENT_DEFAULT_LIST_H_ */ +#endif /* FLANG_RT_ENVIRONMENT_DEFAULT_LIST_H_ */ diff --git a/flang/runtime/environment.cpp b/flang-rt/lib/runtime/environment.cpp similarity index 96% rename from flang/runtime/environment.cpp rename to flang-rt/lib/runtime/environment.cpp index 678d8745c9fd7..15380ba148df5 100644 --- a/flang/runtime/environment.cpp +++ b/flang-rt/lib/runtime/environment.cpp @@ -1,4 +1,4 @@ -//===-- runtime/environment.cpp -------------------------------------------===// +//===-- lib/runtime/environment.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "environment.h" +#include "flang-rt/runtime/environment.h" #include "environment-default-list.h" #include "memory.h" -#include "tools.h" +#include "flang-rt/runtime/tools.h" #include #include #include diff --git a/flang/runtime/exceptions.cpp b/flang-rt/lib/runtime/exceptions.cpp similarity index 97% rename from flang/runtime/exceptions.cpp rename to flang-rt/lib/runtime/exceptions.cpp index 344e7216cfaae..d25a67c8e9cb5 100644 --- a/flang/runtime/exceptions.cpp +++ b/flang-rt/lib/runtime/exceptions.cpp @@ -1,4 +1,4 @@ -//===-- runtime/exceptions.cpp --------------------------------------===// +//===-- lib/runtime/exceptions.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,7 +9,7 @@ // Runtime exception support. #include "flang/Runtime/exceptions.h" -#include "terminator.h" +#include "flang-rt/runtime/terminator.h" #include #if defined(__aarch64__) && defined(__GLIBC__) #include diff --git a/flang/runtime/execute.cpp b/flang-rt/lib/runtime/execute.cpp similarity index 97% rename from flang/runtime/execute.cpp rename to flang-rt/lib/runtime/execute.cpp index c7f8f386d81f4..f180da846a32c 100644 --- a/flang/runtime/execute.cpp +++ b/flang-rt/lib/runtime/execute.cpp @@ -1,4 +1,4 @@ -//===-- runtime/execute.cpp -----------------------------------------------===// +//===-- lib/runtime/execute.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,11 +7,11 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/execute.h" -#include "environment.h" -#include "stat.h" -#include "terminator.h" -#include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include #include #include diff --git a/flang/runtime/extensions.cpp b/flang-rt/lib/runtime/extensions.cpp similarity index 97% rename from flang/runtime/extensions.cpp rename to flang-rt/lib/runtime/extensions.cpp index ac19ba7b31d4c..75195c33a6c21 100644 --- a/flang/runtime/extensions.cpp +++ b/flang-rt/lib/runtime/extensions.cpp @@ -1,4 +1,4 @@ -//===-- runtime/extensions.cpp --------------------------------------------===// +//===-- lib/runtime/extensions.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,10 +10,10 @@ // extensions that will eventually be implemented in Fortran. #include "flang/Runtime/extensions.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Runtime/command.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/entry-names.h" #include "flang/Runtime/io-api.h" #include diff --git a/flang/runtime/external-unit.cpp b/flang-rt/lib/runtime/external-unit.cpp similarity index 98% rename from flang/runtime/external-unit.cpp rename to flang-rt/lib/runtime/external-unit.cpp index d17a92622f844..b8004d6315994 100644 --- a/flang/runtime/external-unit.cpp +++ b/flang-rt/lib/runtime/external-unit.cpp @@ -1,4 +1,4 @@ -//===-- runtime/external-unit.cpp -----------------------------------------===// +//===-- lib/runtime/external-unit.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,11 +10,11 @@ // //===----------------------------------------------------------------------===// -#include "io-error.h" -#include "lock.h" -#include "tools.h" #include "unit-map.h" #include "unit.h" +#include "flang-rt/runtime/io-error.h" +#include "flang-rt/runtime/lock.h" +#include "flang-rt/runtime/tools.h" // NOTE: the header files above may define OpenMP declare target // variables, so they have to be included unconditionally diff --git a/flang/runtime/extrema.cpp b/flang-rt/lib/runtime/extrema.cpp similarity index 99% rename from flang/runtime/extrema.cpp rename to flang-rt/lib/runtime/extrema.cpp index 7ecdf4b91702e..3d84daa380441 100644 --- a/flang/runtime/extrema.cpp +++ b/flang-rt/lib/runtime/extrema.cpp @@ -1,4 +1,4 @@ -//===-- runtime/extrema.cpp -----------------------------------------------===// +//===-- lib/runtime/extrema.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,7 +10,7 @@ // and shapes and (for MAXLOC & MINLOC) result integer kinds. Also implements // NORM2 using common infrastructure. -#include "reduction-templates.h" +#include "flang-rt/runtime/reduction-templates.h" #include "flang/Common/float128.h" #include "flang/Runtime/character.h" #include "flang/Runtime/reduction.h" diff --git a/flang/runtime/file.cpp b/flang-rt/lib/runtime/file.cpp similarity index 98% rename from flang/runtime/file.cpp rename to flang-rt/lib/runtime/file.cpp index 9e077b8cea44b..16e73db488727 100644 --- a/flang/runtime/file.cpp +++ b/flang-rt/lib/runtime/file.cpp @@ -1,4 +1,4 @@ -//===-- runtime/file.cpp --------------------------------------------------===// +//===-- lib/runtime/file.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "file.h" -#include "tools.h" +#include "flang-rt/runtime/file.h" +#include "flang-rt/runtime/memory.h" +#include "flang-rt/runtime/tools.h" #include "flang/Runtime/magic-numbers.h" -#include "flang/Runtime/memory.h" #include #include #include diff --git a/flang/runtime/findloc.cpp b/flang-rt/lib/runtime/findloc.cpp similarity index 99% rename from flang/runtime/findloc.cpp rename to flang-rt/lib/runtime/findloc.cpp index b9b1d7f7ab689..95986aefb86a4 100644 --- a/flang/runtime/findloc.cpp +++ b/flang-rt/lib/runtime/findloc.cpp @@ -1,4 +1,4 @@ -//===-- runtime/findloc.cpp -----------------------------------------------===// +//===-- lib/runtime/findloc.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,7 +9,7 @@ // Implements FINDLOC for all required operand types and shapes and result // integer kinds. -#include "reduction-templates.h" +#include "flang-rt/runtime/reduction-templates.h" #include "flang/Runtime/character.h" #include "flang/Runtime/reduction.h" #include diff --git a/flang/runtime/format.cpp b/flang-rt/lib/runtime/format.cpp similarity index 87% rename from flang/runtime/format.cpp rename to flang-rt/lib/runtime/format.cpp index 433acce4b7373..ee0059f5f0729 100644 --- a/flang/runtime/format.cpp +++ b/flang-rt/lib/runtime/format.cpp @@ -1,4 +1,4 @@ -//===-- runtime/format.cpp ------------------------------------------------===// +//===-- lib/runtime/format.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "format-implementation.h" +#include "flang-rt/runtime/format-implementation.h" namespace Fortran::runtime::io { RT_OFFLOAD_API_GROUP_BEGIN diff --git a/flang/runtime/inquiry.cpp b/flang-rt/lib/runtime/inquiry.cpp similarity index 94% rename from flang/runtime/inquiry.cpp rename to flang-rt/lib/runtime/inquiry.cpp index 9fbcaa96fa3c4..b6a7fce7a1e78 100644 --- a/flang/runtime/inquiry.cpp +++ b/flang-rt/lib/runtime/inquiry.cpp @@ -1,4 +1,4 @@ -//===-- runtime/inquiry.cpp --------------------------------------===// +//===-- lib/runtime/inquiry.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,9 +11,9 @@ #include "flang/Runtime/inquiry.h" #include "copy.h" -#include "terminator.h" -#include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include namespace Fortran::runtime { diff --git a/flang/runtime/internal-unit.cpp b/flang-rt/lib/runtime/internal-unit.cpp similarity index 96% rename from flang/runtime/internal-unit.cpp rename to flang-rt/lib/runtime/internal-unit.cpp index f8f3877efb20e..e344b01e8b34e 100644 --- a/flang/runtime/internal-unit.cpp +++ b/flang-rt/lib/runtime/internal-unit.cpp @@ -1,4 +1,4 @@ -//===-- runtime/internal-unit.cpp -----------------------------------------===// +//===-- lib/runtime/internal-unit.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "internal-unit.h" -#include "io-error.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/internal-unit.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/io-error.h" #include "flang/Runtime/freestanding-tools.h" #include #include diff --git a/flang/runtime/io-api-common.h b/flang-rt/lib/runtime/io-api-common.h similarity index 92% rename from flang/runtime/io-api-common.h rename to flang-rt/lib/runtime/io-api-common.h index c7b86cab73a52..b91ff9ff16863 100644 --- a/flang/runtime/io-api-common.h +++ b/flang-rt/lib/runtime/io-api-common.h @@ -1,4 +1,4 @@ -//===-- runtime/io-api-common.h ---------------------------------*- C++ -*-===// +//===-- lib/runtime/io-api-common.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,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#ifndef FLANG_RUNTIME_IO_API_COMMON_H_ -#define FLANG_RUNTIME_IO_API_COMMON_H_ +#ifndef FLANG_RT_RUNTIME_IO_API_COMMON_H_ +#define FLANG_RT_RUNTIME_IO_API_COMMON_H_ -#include "io-stmt.h" -#include "terminator.h" #include "unit.h" +#include "flang-rt/runtime/io-stmt.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Common/api-attrs.h" #include "flang/Common/optional.h" #include "flang/Runtime/io-api.h" @@ -94,4 +94,4 @@ RT_API_ATTRS Cookie BeginExternalListIO( } } // namespace Fortran::runtime::io -#endif // FLANG_RUNTIME_IO_API_COMMON_H_ +#endif // FLANG_RT_RUNTIME_IO_API_COMMON_H_ diff --git a/flang/runtime/io-api-minimal.cpp b/flang-rt/lib/runtime/io-api-minimal.cpp similarity index 94% rename from flang/runtime/io-api-minimal.cpp rename to flang-rt/lib/runtime/io-api-minimal.cpp index 68768427be0c2..c706a3aa239a5 100644 --- a/flang/runtime/io-api-minimal.cpp +++ b/flang-rt/lib/runtime/io-api-minimal.cpp @@ -1,4 +1,4 @@ -//===-- runtime/io-api-minimal.cpp ----------------------------------------===// +//===-- lib/runtime/io-api-minimal.cpp --------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,12 +10,12 @@ // list-directed output (PRINT *) of intrinsic types. #include "edit-output.h" -#include "format.h" #include "io-api-common.h" -#include "io-stmt.h" -#include "terminator.h" -#include "tools.h" #include "unit.h" +#include "flang-rt/runtime/format.h" +#include "flang-rt/runtime/io-stmt.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Runtime/io-api.h" namespace Fortran::runtime::io { @@ -150,7 +150,7 @@ bool IODEF(OutputLogical)(Cookie cookie, bool truth) { // Provide own definition for `std::__libcpp_verbose_abort` to avoid dependency // on the version provided by libc++. -void std::__libcpp_verbose_abort(char const *format, ...) { +void std::__libcpp_verbose_abort(char const *format, ...) noexcept { va_list list; va_start(list, format); std::vfprintf(stderr, format, list); diff --git a/flang/runtime/io-api.cpp b/flang-rt/lib/runtime/io-api.cpp similarity index 99% rename from flang/runtime/io-api.cpp rename to flang-rt/lib/runtime/io-api.cpp index dc3f6f87fc21b..0355734c67fcd 100644 --- a/flang/runtime/io-api.cpp +++ b/flang-rt/lib/runtime/io-api.cpp @@ -1,4 +1,4 @@ -//===-- runtime/io-api.cpp ------------------------------------------------===// +//===-- lib/runtime/io-api.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -17,16 +17,16 @@ #include "descriptor-io.h" #include "edit-input.h" #include "edit-output.h" -#include "environment.h" -#include "format.h" #include "io-api-common.h" -#include "io-stmt.h" -#include "terminator.h" -#include "tools.h" #include "unit.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/format.h" +#include "flang-rt/runtime/io-stmt.h" +#include "flang-rt/runtime/memory.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/optional.h" -#include "flang/Runtime/descriptor.h" -#include "flang/Runtime/memory.h" #include #include diff --git a/flang/runtime/io-error.cpp b/flang-rt/lib/runtime/io-error.cpp similarity index 96% rename from flang/runtime/io-error.cpp rename to flang-rt/lib/runtime/io-error.cpp index 37909e8e6dad2..b350fb66fc25b 100644 --- a/flang/runtime/io-error.cpp +++ b/flang-rt/lib/runtime/io-error.cpp @@ -1,4 +1,4 @@ -//===-- runtime/io-error.cpp ----------------------------------------------===// +//===-- lib/runtime/io-error.cpp --------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "io-error.h" +#include "flang-rt/runtime/io-error.h" #include "config.h" -#include "tools.h" +#include "flang-rt/runtime/tools.h" #include "flang/Runtime/magic-numbers.h" #include #include diff --git a/flang/runtime/io-stmt.cpp b/flang-rt/lib/runtime/io-stmt.cpp similarity index 99% rename from flang/runtime/io-stmt.cpp rename to flang-rt/lib/runtime/io-stmt.cpp index f24eb929ce748..b0823ffd9e703 100644 --- a/flang/runtime/io-stmt.cpp +++ b/flang-rt/lib/runtime/io-stmt.cpp @@ -1,4 +1,4 @@ -//===-- runtime/io-stmt.cpp -----------------------------------------------===// +//===-- lib/runtime/io-stmt.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#include "io-stmt.h" -#include "connection.h" -#include "emit-encoded.h" -#include "format.h" -#include "tools.h" +#include "flang-rt/runtime/io-stmt.h" #include "unit.h" -#include "utf.h" -#include "flang/Runtime/memory.h" +#include "flang-rt/runtime/connection.h" +#include "flang-rt/runtime/emit-encoded.h" +#include "flang-rt/runtime/format.h" +#include "flang-rt/runtime/memory.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/utf.h" #include #include #include diff --git a/flang/runtime/iostat.cpp b/flang-rt/lib/runtime/iostat.cpp similarity index 98% rename from flang/runtime/iostat.cpp rename to flang-rt/lib/runtime/iostat.cpp index 39e224cb01286..0f8bfb884e544 100644 --- a/flang/runtime/iostat.cpp +++ b/flang-rt/lib/runtime/iostat.cpp @@ -1,4 +1,4 @@ -//===-- runtime/iostat.cpp ------------------------------------------------===// +//===-- lib/runtime/iostat.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/main.cpp b/flang-rt/lib/runtime/main.cpp similarity index 89% rename from flang/runtime/main.cpp rename to flang-rt/lib/runtime/main.cpp index 96454989581b7..b3f066cda3732 100644 --- a/flang/runtime/main.cpp +++ b/flang-rt/lib/runtime/main.cpp @@ -1,4 +1,4 @@ -//===-- runtime/main.cpp --------------------------------------------------===// +//===-- lib/runtime/main.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/main.h" -#include "environment.h" -#include "terminator.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/terminator.h" #include #include #include diff --git a/flang/runtime/matmul-transpose.cpp b/flang-rt/lib/runtime/matmul-transpose.cpp similarity index 98% rename from flang/runtime/matmul-transpose.cpp rename to flang-rt/lib/runtime/matmul-transpose.cpp index bafa05056bebc..e20abbdddcd30 100644 --- a/flang/runtime/matmul-transpose.cpp +++ b/flang-rt/lib/runtime/matmul-transpose.cpp @@ -1,4 +1,4 @@ -//===-- runtime/matmul-transpose.cpp --------------------------------------===// +//===-- lib/runtime/matmul-transpose.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -21,12 +21,12 @@ // to use the faster BLAS routines. #include "flang/Runtime/matmul-transpose.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/optional.h" #include "flang/Runtime/c-or-cpp.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include namespace { diff --git a/flang/runtime/matmul.cpp b/flang-rt/lib/runtime/matmul.cpp similarity index 98% rename from flang/runtime/matmul.cpp rename to flang-rt/lib/runtime/matmul.cpp index f72601073a600..f14cea922d21e 100644 --- a/flang/runtime/matmul.cpp +++ b/flang-rt/lib/runtime/matmul.cpp @@ -1,4 +1,4 @@ -//===-- runtime/matmul.cpp ------------------------------------------------===// +//===-- lib/runtime/matmul.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -20,12 +20,12 @@ // Places where BLAS routines could be called are marked as TODO items. #include "flang/Runtime/matmul.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/optional.h" #include "flang/Runtime/c-or-cpp.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include namespace { diff --git a/flang/runtime/memory.cpp b/flang-rt/lib/runtime/memory.cpp similarity index 85% rename from flang/runtime/memory.cpp rename to flang-rt/lib/runtime/memory.cpp index c7068ad6479a1..79c7e33777569 100644 --- a/flang/runtime/memory.cpp +++ b/flang-rt/lib/runtime/memory.cpp @@ -1,4 +1,4 @@ -//===-- runtime/memory.cpp ------------------------------------------------===// +//===-- lib/runtime/memory.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "flang/Runtime/memory.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/memory.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Runtime/freestanding-tools.h" #include diff --git a/flang/runtime/misc-intrinsic.cpp b/flang-rt/lib/runtime/misc-intrinsic.cpp similarity index 95% rename from flang/runtime/misc-intrinsic.cpp rename to flang-rt/lib/runtime/misc-intrinsic.cpp index f7d893829fc0d..b7335e9f6799e 100644 --- a/flang/runtime/misc-intrinsic.cpp +++ b/flang-rt/lib/runtime/misc-intrinsic.cpp @@ -1,4 +1,4 @@ -//===-- runtime/misc-intrinsic.cpp ----------------------------------------===// +//===-- lib/runtime/misc-intrinsic.cpp --------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/misc-intrinsic.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/optional.h" -#include "flang/Runtime/descriptor.h" #include #include #include diff --git a/flang/runtime/namelist.cpp b/flang-rt/lib/runtime/namelist.cpp similarity index 99% rename from flang/runtime/namelist.cpp rename to flang-rt/lib/runtime/namelist.cpp index af092de70f781..b0cf2180fc6d4 100644 --- a/flang/runtime/namelist.cpp +++ b/flang-rt/lib/runtime/namelist.cpp @@ -1,4 +1,4 @@ -//===-- runtime/namelist.cpp ----------------------------------------------===// +//===-- lib/runtime/namelist.cpp --------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "namelist.h" +#include "flang-rt/runtime/namelist.h" #include "descriptor-io.h" -#include "emit-encoded.h" -#include "io-stmt.h" +#include "flang-rt/runtime/emit-encoded.h" +#include "flang-rt/runtime/io-stmt.h" #include "flang/Runtime/io-api.h" #include #include diff --git a/flang/runtime/non-tbp-dio.cpp b/flang-rt/lib/runtime/non-tbp-dio.cpp similarity index 86% rename from flang/runtime/non-tbp-dio.cpp rename to flang-rt/lib/runtime/non-tbp-dio.cpp index 9419adb7631cc..72101b06e0c6e 100644 --- a/flang/runtime/non-tbp-dio.cpp +++ b/flang-rt/lib/runtime/non-tbp-dio.cpp @@ -1,4 +1,4 @@ -//===-- flang/runtime/non-tbp-dio.cpp ---------------------------*- C++ -*-===// +//===-- lib/runtime/non-tbp-dio.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "non-tbp-dio.h" -#include "type-info.h" +#include "flang-rt/runtime/non-tbp-dio.h" +#include "flang-rt/runtime/type-info.h" namespace Fortran::runtime::io { diff --git a/flang/runtime/numeric.cpp b/flang-rt/lib/runtime/numeric.cpp similarity index 99% rename from flang/runtime/numeric.cpp rename to flang-rt/lib/runtime/numeric.cpp index 45fb56348fd44..37638765dc650 100644 --- a/flang/runtime/numeric.cpp +++ b/flang-rt/lib/runtime/numeric.cpp @@ -1,4 +1,4 @@ -//===-- runtime/numeric.cpp -----------------------------------------------===// +//===-- lib/runtime/numeric.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/numeric.h" -#include "numeric-templates.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/numeric-templates.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/float128.h" #include #include diff --git a/flang/runtime/pointer.cpp b/flang-rt/lib/runtime/pointer.cpp similarity index 96% rename from flang/runtime/pointer.cpp rename to flang-rt/lib/runtime/pointer.cpp index 3b0babe3d852f..ecca86bfe73cd 100644 --- a/flang/runtime/pointer.cpp +++ b/flang-rt/lib/runtime/pointer.cpp @@ -1,4 +1,4 @@ -//===-- runtime/pointer.cpp -----------------------------------------------===// +//===-- lib/runtime/pointer.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/pointer.h" -#include "assign-impl.h" -#include "derived.h" -#include "environment.h" -#include "stat.h" -#include "terminator.h" -#include "tools.h" -#include "type-info.h" +#include "flang-rt/runtime/assign-impl.h" +#include "flang-rt/runtime/derived.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/type-info.h" namespace Fortran::runtime { extern "C" { diff --git a/flang/runtime/product.cpp b/flang-rt/lib/runtime/product.cpp similarity index 98% rename from flang/runtime/product.cpp rename to flang-rt/lib/runtime/product.cpp index 293ffd301ba2e..02fdc2bfcd576 100644 --- a/flang/runtime/product.cpp +++ b/flang-rt/lib/runtime/product.cpp @@ -1,4 +1,4 @@ -//===-- runtime/product.cpp -----------------------------------------------===// +//===-- lib/runtime/product.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,7 +8,7 @@ // Implements PRODUCT for all required operand types and shapes. -#include "reduction-templates.h" +#include "flang-rt/runtime/reduction-templates.h" #include "flang/Common/float128.h" #include "flang/Runtime/reduction.h" #include diff --git a/flang/runtime/pseudo-unit.cpp b/flang-rt/lib/runtime/pseudo-unit.cpp similarity index 97% rename from flang/runtime/pseudo-unit.cpp rename to flang-rt/lib/runtime/pseudo-unit.cpp index 526afd11d916e..7e1f3bc86b294 100644 --- a/flang/runtime/pseudo-unit.cpp +++ b/flang-rt/lib/runtime/pseudo-unit.cpp @@ -1,4 +1,4 @@ -//===-- runtime/pseudo-unit.cpp -------------------------------------------===// +//===-- lib/runtime/pseudo-unit.cpp -----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,9 +11,9 @@ // //===----------------------------------------------------------------------===// -#include "io-error.h" -#include "tools.h" #include "unit.h" +#include "flang-rt/runtime/io-error.h" +#include "flang-rt/runtime/tools.h" // NOTE: the header files above may define OpenMP declare target // variables, so they have to be included unconditionally diff --git a/flang/runtime/ragged.cpp b/flang-rt/lib/runtime/ragged.cpp similarity index 96% rename from flang/runtime/ragged.cpp rename to flang-rt/lib/runtime/ragged.cpp index a4d9e541ba531..dddc3ccdfd858 100644 --- a/flang/runtime/ragged.cpp +++ b/flang-rt/lib/runtime/ragged.cpp @@ -1,4 +1,4 @@ -//===-- runtime/ragged.cpp ------------------------------------------------===// +//===-- lib/runtime/ragged.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/ragged.h" -#include "tools.h" +#include "flang-rt/runtime/tools.h" #include namespace Fortran::runtime { diff --git a/flang/runtime/random.cpp b/flang-rt/lib/runtime/random.cpp similarity index 96% rename from flang/runtime/random.cpp rename to flang-rt/lib/runtime/random.cpp index 8f158007a5a65..dc74f2725ed51 100644 --- a/flang/runtime/random.cpp +++ b/flang-rt/lib/runtime/random.cpp @@ -1,4 +1,4 @@ -//===-- runtime/random.cpp ------------------------------------------------===// +//===-- lib/runtime/random.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,14 +10,14 @@ // RANDOM_SEED. #include "flang/Runtime/random.h" -#include "lock.h" -#include "random-templates.h" -#include "terminator.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/lock.h" +#include "flang-rt/runtime/random-templates.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Common/float128.h" #include "flang/Common/leading-zero-bit-count.h" #include "flang/Common/uint128.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include #include #include diff --git a/flang/runtime/reduce.cpp b/flang-rt/lib/runtime/reduce.cpp similarity index 99% rename from flang/runtime/reduce.cpp rename to flang-rt/lib/runtime/reduce.cpp index 6c42c5ef50e4f..3c5e815e32d2b 100644 --- a/flang/runtime/reduce.cpp +++ b/flang-rt/lib/runtime/reduce.cpp @@ -1,4 +1,4 @@ -//===-- runtime/reduce.cpp ------------------------------------------------===// +//===-- lib/runtime/reduce.cpp ----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,10 +9,10 @@ // REDUCE() implementation #include "flang/Runtime/reduce.h" -#include "reduction-templates.h" -#include "terminator.h" -#include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/reduction-templates.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" namespace Fortran::runtime { diff --git a/flang/runtime/reduction.cpp b/flang-rt/lib/runtime/reduction.cpp similarity index 98% rename from flang/runtime/reduction.cpp rename to flang-rt/lib/runtime/reduction.cpp index a8fcde7b3a166..5e45870489479 100644 --- a/flang/runtime/reduction.cpp +++ b/flang-rt/lib/runtime/reduction.cpp @@ -1,4 +1,4 @@ -//===-- runtime/reduction.cpp ---------------------------------------------===// +//===-- lib/runtime/reduction.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -14,8 +14,8 @@ // NORM2, MAXLOC, MINLOC, MAXVAL, and MINVAL are in extrema.cpp. #include "flang/Runtime/reduction.h" -#include "reduction-templates.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/reduction-templates.h" #include namespace Fortran::runtime { diff --git a/flang/runtime/stack.h b/flang-rt/lib/runtime/stack.h similarity index 93% rename from flang/runtime/stack.h rename to flang-rt/lib/runtime/stack.h index b6e6edb595e9a..38364ff541f16 100644 --- a/flang/runtime/stack.h +++ b/flang-rt/lib/runtime/stack.h @@ -1,4 +1,4 @@ -//===-- runtime/stack.h -----------------------------------------*- C++ -*-===// +//===-- lib/runtime/stack.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. @@ -10,11 +10,11 @@ // It is a list based stack with dynamic allocation/deallocation // of the list nodes. -#ifndef FORTRAN_RUNTIME_STACK_H -#define FORTRAN_RUNTIME_STACK_H +#ifndef FLANG_RT_RUNTIME_STACK_H_ +#define FLANG_RT_RUNTIME_STACK_H_ -#include "terminator.h" -#include "flang/Runtime/memory.h" +#include "flang-rt/runtime/memory.h" +#include "flang-rt/runtime/terminator.h" namespace Fortran::runtime { // Storage for the Stack elements of type T. @@ -133,4 +133,4 @@ template class Stack : public StackStorage { Terminator &terminator_; }; } // namespace Fortran::runtime -#endif // FORTRAN_RUNTIME_STACK_H +#endif // FLANG_RT_RUNTIME_STACK_H_ diff --git a/flang/runtime/stat.cpp b/flang-rt/lib/runtime/stat.cpp similarity index 92% rename from flang/runtime/stat.cpp rename to flang-rt/lib/runtime/stat.cpp index 525a4e36cdc77..322b7282b7024 100644 --- a/flang/runtime/stat.cpp +++ b/flang-rt/lib/runtime/stat.cpp @@ -1,4 +1,4 @@ -//===-- runtime/stat.cpp --------------------------------------------------===// +//===-- lib/runtime/stat.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "stat.h" -#include "terminator.h" -#include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/stat.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" namespace Fortran::runtime { RT_OFFLOAD_API_GROUP_BEGIN diff --git a/flang/runtime/stop.cpp b/flang-rt/lib/runtime/stop.cpp similarity index 95% rename from flang/runtime/stop.cpp rename to flang-rt/lib/runtime/stop.cpp index f8c180e0aaffa..1d70a137377aa 100644 --- a/flang/runtime/stop.cpp +++ b/flang-rt/lib/runtime/stop.cpp @@ -1,4 +1,4 @@ -//===-- runtime/stop.cpp --------------------------------------------------===// +//===-- lib/runtime/stop.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,11 +8,11 @@ #include "flang/Runtime/stop.h" #include "config.h" -#include "environment.h" -#include "file.h" -#include "io-error.h" -#include "terminator.h" #include "unit.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/file.h" +#include "flang-rt/runtime/io-error.h" +#include "flang-rt/runtime/terminator.h" #include #include #include diff --git a/flang/runtime/sum.cpp b/flang-rt/lib/runtime/sum.cpp similarity index 98% rename from flang/runtime/sum.cpp rename to flang-rt/lib/runtime/sum.cpp index 3cb7a2b285779..a76e228f18a4e 100644 --- a/flang/runtime/sum.cpp +++ b/flang-rt/lib/runtime/sum.cpp @@ -1,4 +1,4 @@ -//===-- runtime/sum.cpp ---------------------------------------------------===// +//===-- lib/runtime/sum.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,7 +12,7 @@ // cancellation on intermediate results by using "Kahan summation" // (basically the same as manual "double-double"). -#include "reduction-templates.h" +#include "flang-rt/runtime/reduction-templates.h" #include "flang/Common/float128.h" #include "flang/Runtime/reduction.h" #include diff --git a/flang/runtime/support.cpp b/flang-rt/lib/runtime/support.cpp similarity index 90% rename from flang/runtime/support.cpp rename to flang-rt/lib/runtime/support.cpp index a607120256d9d..5a2b0c920aa80 100644 --- a/flang/runtime/support.cpp +++ b/flang-rt/lib/runtime/support.cpp @@ -1,4 +1,4 @@ -//===-- runtime/support.cpp -----------------------------------------------===// +//===-- lib/runtime/support.cpp ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,8 +8,8 @@ #include "flang/Runtime/support.h" #include "ISO_Fortran_util.h" -#include "type-info.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/type-info.h" namespace Fortran::runtime { extern "C" { diff --git a/flang/runtime/temporary-stack.cpp b/flang-rt/lib/runtime/temporary-stack.cpp similarity index 97% rename from flang/runtime/temporary-stack.cpp rename to flang-rt/lib/runtime/temporary-stack.cpp index 93340266b1b44..ea89d0c17bb6b 100644 --- a/flang/runtime/temporary-stack.cpp +++ b/flang-rt/lib/runtime/temporary-stack.cpp @@ -1,4 +1,4 @@ -//===-- runtime/temporary-stack.cpp ---------------------------------------===// +//===-- lib/runtime/temporary-stack.cpp -------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -10,11 +10,11 @@ // temporaries. For use in HLFIR lowering. #include "flang/Runtime/temporary-stack.h" -#include "terminator.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/memory.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/assign.h" -#include "flang/Runtime/descriptor.h" -#include "flang/Runtime/memory.h" namespace { diff --git a/flang/runtime/terminator.cpp b/flang-rt/lib/runtime/terminator.cpp similarity index 95% rename from flang/runtime/terminator.cpp rename to flang-rt/lib/runtime/terminator.cpp index bab9edc64fa35..8a57ba06b1304 100644 --- a/flang/runtime/terminator.cpp +++ b/flang-rt/lib/runtime/terminator.cpp @@ -1,4 +1,4 @@ -//===-- runtime/terminate.cpp ---------------------------------------------===// +//===-- lib/runtime/terminator.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "terminator.h" +#include "flang-rt/runtime/terminator.h" #include #include diff --git a/flang/runtime/time-intrinsic.cpp b/flang-rt/lib/runtime/time-intrinsic.cpp similarity index 98% rename from flang/runtime/time-intrinsic.cpp rename to flang-rt/lib/runtime/time-intrinsic.cpp index 942604a92aaad..69c344f5d24bc 100644 --- a/flang/runtime/time-intrinsic.cpp +++ b/flang-rt/lib/runtime/time-intrinsic.cpp @@ -1,4 +1,4 @@ -//===-- runtime/time-intrinsic.cpp ----------------------------------------===// +//===-- lib/runtime/time-intrinsic.cpp --------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,10 +9,10 @@ // Implements time-related intrinsic subroutines. #include "flang/Runtime/time-intrinsic.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include #include #include diff --git a/flang/runtime/tools.cpp b/flang-rt/lib/runtime/tools.cpp similarity index 98% rename from flang/runtime/tools.cpp rename to flang-rt/lib/runtime/tools.cpp index 73d6c2cf7e1d2..b9d9ca4fc378c 100644 --- a/flang/runtime/tools.cpp +++ b/flang-rt/lib/runtime/tools.cpp @@ -1,4 +1,4 @@ -//===-- runtime/tools.cpp -------------------------------------------------===// +//===-- lib/runtime/tools.cpp -----------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include "tools.h" -#include "terminator.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/terminator.h" #include #include #include diff --git a/flang/runtime/transformational.cpp b/flang-rt/lib/runtime/transformational.cpp similarity index 99% rename from flang/runtime/transformational.cpp rename to flang-rt/lib/runtime/transformational.cpp index ab303bdef9b1d..eb694a9f2c833 100644 --- a/flang/runtime/transformational.cpp +++ b/flang-rt/lib/runtime/transformational.cpp @@ -1,4 +1,4 @@ -//===-- runtime/transformational.cpp --------------------------------------===// +//===-- lib/runtime/transformational.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -18,10 +18,10 @@ #include "flang/Runtime/transformational.h" #include "copy.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include "flang/Common/float128.h" -#include "flang/Runtime/descriptor.h" namespace Fortran::runtime { diff --git a/flang/runtime/type-code.cpp b/flang-rt/lib/runtime/type-code.cpp similarity index 98% rename from flang/runtime/type-code.cpp rename to flang-rt/lib/runtime/type-code.cpp index d6948983bfe9f..8cfec9a4ec2fb 100644 --- a/flang/runtime/type-code.cpp +++ b/flang-rt/lib/runtime/type-code.cpp @@ -1,4 +1,4 @@ -//===-- runtime/type-code.cpp ---------------------------------------------===// +//===-- lib/runtime/type-code.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "flang/Runtime/type-code.h" +#include "flang-rt/runtime/type-code.h" namespace Fortran::runtime { diff --git a/flang/runtime/type-info.cpp b/flang-rt/lib/runtime/type-info.cpp similarity index 97% rename from flang/runtime/type-info.cpp rename to flang-rt/lib/runtime/type-info.cpp index d4daa72aee6a1..82182696d70c6 100644 --- a/flang/runtime/type-info.cpp +++ b/flang-rt/lib/runtime/type-info.cpp @@ -1,4 +1,4 @@ -//===-- runtime/type-info.cpp ---------------------------------------------===// +//===-- lib/runtime/type-info.cpp -------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "type-info.h" -#include "terminator.h" -#include "tools.h" +#include "flang-rt/runtime/type-info.h" +#include "flang-rt/runtime/terminator.h" +#include "flang-rt/runtime/tools.h" #include namespace Fortran::runtime::typeInfo { @@ -86,7 +86,7 @@ RT_API_ATTRS std::size_t Component::SizeInBytes( } else if (category() == TypeCategory::Derived) { const DerivedType *type{derivedType()}; return Descriptor::SizeInBytes( - rank_, true, type ? type->LenParameters() : 0); + rank_, true, type ? type->LenParameters() : 0); } else { return Descriptor::SizeInBytes(rank_); } diff --git a/flang/runtime/unit-map.cpp b/flang-rt/lib/runtime/unit-map.cpp similarity index 97% rename from flang/runtime/unit-map.cpp rename to flang-rt/lib/runtime/unit-map.cpp index 684a9b9e20b97..41a03f3319d64 100644 --- a/flang/runtime/unit-map.cpp +++ b/flang-rt/lib/runtime/unit-map.cpp @@ -1,4 +1,4 @@ -//===-- runtime/unit-map.cpp ----------------------------------------------===// +//===-- lib/runtime/unit-map.cpp --------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/runtime/unit-map.h b/flang-rt/lib/runtime/unit-map.h similarity index 92% rename from flang/runtime/unit-map.h rename to flang-rt/lib/runtime/unit-map.h index 6f1e01bb1e64a..fa61288a1e18d 100644 --- a/flang/runtime/unit-map.h +++ b/flang-rt/lib/runtime/unit-map.h @@ -1,4 +1,4 @@ -//===-- runtime/unit-map.h --------------------------------------*- C++ -*-===// +//===-- lib/runtime/unit-map.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. @@ -9,13 +9,13 @@ // Maps Fortran unit numbers to their ExternalFileUnit instances. // A simple hash table with forward-linked chains per bucket. -#ifndef FORTRAN_RUNTIME_UNIT_MAP_H_ -#define FORTRAN_RUNTIME_UNIT_MAP_H_ +#ifndef FLANG_RT_RUNTIME_UNIT_MAP_H_ +#define FLANG_RT_RUNTIME_UNIT_MAP_H_ -#include "lock.h" #include "unit.h" +#include "flang-rt/runtime/lock.h" +#include "flang-rt/runtime/memory.h" #include "flang/Common/fast-int-set.h" -#include "flang/Runtime/memory.h" #include #include @@ -100,4 +100,4 @@ class UnitMap { int emergencyNewUnit_{maxNewUnits_}; // not recycled }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_UNIT_MAP_H_ +#endif // FLANG_RT_RUNTIME_UNIT_MAP_H_ diff --git a/flang/runtime/unit.cpp b/flang-rt/lib/runtime/unit.cpp similarity index 99% rename from flang/runtime/unit.cpp rename to flang-rt/lib/runtime/unit.cpp index 4aee8397d477e..1d4d54ae01956 100644 --- a/flang/runtime/unit.cpp +++ b/flang-rt/lib/runtime/unit.cpp @@ -1,4 +1,4 @@ -//===-- runtime/unit.cpp --------------------------------------------------===// +//===-- lib/runtime/unit.cpp ------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,9 +11,9 @@ // //===----------------------------------------------------------------------===// #include "unit.h" -#include "io-error.h" -#include "lock.h" -#include "tools.h" +#include "flang-rt/runtime/io-error.h" +#include "flang-rt/runtime/lock.h" +#include "flang-rt/runtime/tools.h" #include #include diff --git a/flang/runtime/unit.h b/flang-rt/lib/runtime/unit.h similarity index 95% rename from flang/runtime/unit.h rename to flang-rt/lib/runtime/unit.h index a3ea268681680..eb762a2d3b235 100644 --- a/flang/runtime/unit.h +++ b/flang-rt/lib/runtime/unit.h @@ -1,4 +1,4 @@ -//===-- runtime/unit.h ------------------------------------------*- C++ -*-===// +//===-- lib/runtime/unit.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. @@ -8,21 +8,21 @@ // Fortran external I/O units -#ifndef FORTRAN_RUNTIME_IO_UNIT_H_ -#define FORTRAN_RUNTIME_IO_UNIT_H_ - -#include "buffer.h" -#include "connection.h" -#include "environment.h" -#include "file.h" -#include "format.h" -#include "io-error.h" -#include "io-stmt.h" -#include "lock.h" -#include "terminator.h" +#ifndef FLANG_RT_RUNTIME_UNIT_H_ +#define FLANG_RT_RUNTIME_UNIT_H_ + +#include "flang-rt/runtime/buffer.h" +#include "flang-rt/runtime/connection.h" +#include "flang-rt/runtime/environment.h" +#include "flang-rt/runtime/file.h" +#include "flang-rt/runtime/format.h" +#include "flang-rt/runtime/io-error.h" +#include "flang-rt/runtime/io-stmt.h" +#include "flang-rt/runtime/lock.h" +#include "flang-rt/runtime/memory.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Common/constexpr-bitset.h" #include "flang/Common/optional.h" -#include "flang/Runtime/memory.h" #include #include #include @@ -291,4 +291,4 @@ class ChildIo { }; } // namespace Fortran::runtime::io -#endif // FORTRAN_RUNTIME_IO_UNIT_H_ +#endif // FLANG_RT_RUNTIME_UNIT_H_ diff --git a/flang/runtime/utf.cpp b/flang-rt/lib/runtime/utf.cpp similarity index 97% rename from flang/runtime/utf.cpp rename to flang-rt/lib/runtime/utf.cpp index b09819cb2f736..ef9df49f24f66 100644 --- a/flang/runtime/utf.cpp +++ b/flang-rt/lib/runtime/utf.cpp @@ -1,4 +1,4 @@ -//===-- runtime/utf.cpp ---------------------------------------------------===// +//===-- lib/runtime/utf.cpp -------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "utf.h" +#include "flang-rt/runtime/utf.h" namespace Fortran::runtime { diff --git a/flang/test/Driver/ctofortran.f90 b/flang-rt/test/Driver/ctofortran.f90 similarity index 100% rename from flang/test/Driver/ctofortran.f90 rename to flang-rt/test/Driver/ctofortran.f90 diff --git a/flang/test/Driver/exec.f90 b/flang-rt/test/Driver/exec.f90 similarity index 100% rename from flang/test/Driver/exec.f90 rename to flang-rt/test/Driver/exec.f90 diff --git a/flang/test/Runtime/no-cpp-dep.c b/flang-rt/test/Runtime/no-cpp-dep.c similarity index 100% rename from flang/test/Runtime/no-cpp-dep.c rename to flang-rt/test/Runtime/no-cpp-dep.c diff --git a/flang/unittests/Evaluate/ISO-Fortran-binding.cpp b/flang-rt/unittests/Evaluate/ISO-Fortran-binding.cpp similarity index 98% rename from flang/unittests/Evaluate/ISO-Fortran-binding.cpp rename to flang-rt/unittests/Evaluate/ISO-Fortran-binding.cpp index 2884686b3f26e..8c0a6f29b6967 100644 --- a/flang/unittests/Evaluate/ISO-Fortran-binding.cpp +++ b/flang-rt/unittests/Evaluate/ISO-Fortran-binding.cpp @@ -1,5 +1,13 @@ +//===-- unittests/Evaluate/ISO-Fortran-binding.cpp --------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "flang-rt/runtime/descriptor.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" -#include "flang/Runtime/descriptor.h" #include "flang/Testing/testing.h" #include "llvm/Support/raw_ostream.h" #include diff --git a/flang/unittests/Evaluate/reshape.cpp b/flang-rt/unittests/Evaluate/reshape.cpp similarity index 88% rename from flang/unittests/Evaluate/reshape.cpp rename to flang-rt/unittests/Evaluate/reshape.cpp index 16cba15dcef60..2abe46c0969fb 100644 --- a/flang/unittests/Evaluate/reshape.cpp +++ b/flang-rt/unittests/Evaluate/reshape.cpp @@ -1,4 +1,12 @@ -#include "flang/Runtime/descriptor.h" +//===-- unittests/Evaluate/reshape.cpp --------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#include "flang-rt/runtime/descriptor.h" #include "flang/Runtime/transformational.h" #include "flang/Testing/testing.h" #include diff --git a/flang/unittests/Runtime/AccessTest.cpp b/flang-rt/unittests/Runtime/AccessTest.cpp similarity index 99% rename from flang/unittests/Runtime/AccessTest.cpp rename to flang-rt/unittests/Runtime/AccessTest.cpp index c2a2d7d398220..d431d0d19bd61 100644 --- a/flang/unittests/Runtime/AccessTest.cpp +++ b/flang-rt/unittests/Runtime/AccessTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/AccessTest.cpp ----------------------------===// +//===-- unittests/Runtime/AccessTest.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/unittests/Runtime/Allocatable.cpp b/flang-rt/unittests/Runtime/Allocatable.cpp similarity index 97% rename from flang/unittests/Runtime/Allocatable.cpp rename to flang-rt/unittests/Runtime/Allocatable.cpp index f15f26bfd9c57..4702f48e0f440 100644 --- a/flang/unittests/Runtime/Allocatable.cpp +++ b/flang-rt/unittests/Runtime/Allocatable.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Allocatable.cpp--------- ---------*- C++-*-===// +//===-- unittests/Runtime/Allocatable.cpp -----------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -8,7 +8,7 @@ #include "flang/Runtime/allocatable.h" #include "gtest/gtest.h" -#include "tools.h" +#include "flang-rt/runtime/tools.h" using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/ArrayConstructor.cpp b/flang-rt/unittests/Runtime/ArrayConstructor.cpp similarity index 96% rename from flang/unittests/Runtime/ArrayConstructor.cpp rename to flang-rt/unittests/Runtime/ArrayConstructor.cpp index 53774a0eea07d..5f791e7f4a7c3 100644 --- a/flang/unittests/Runtime/ArrayConstructor.cpp +++ b/flang-rt/unittests/Runtime/ArrayConstructor.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/ArrayConstructor.cpp-------------*- C++ -*-===// +//===-- unittests/Runtime/ArrayConstructor.cpp ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,13 +6,13 @@ // //===----------------------------------------------------------------------===// -#include "gtest/gtest.h" #include "tools.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/array-constructor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Runtime/allocatable.h" -#include "flang/Runtime/array-constructor.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" -#include "flang/Runtime/type-code.h" #include diff --git a/flang/unittests/Runtime/BufferTest.cpp b/flang-rt/unittests/Runtime/BufferTest.cpp similarity index 97% rename from flang/unittests/Runtime/BufferTest.cpp rename to flang-rt/unittests/Runtime/BufferTest.cpp index 0632324b25d22..f4b9e901d6fcb 100644 --- a/flang/unittests/Runtime/BufferTest.cpp +++ b/flang-rt/unittests/Runtime/BufferTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/BufferTest.cpp ------------------*- C++ -*-===// +//===-- unittests/Runtime/BufferTest.cpp ------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,7 +6,7 @@ // //===----------------------------------------------------------------------===// -#include "../../runtime/buffer.h" +#include "flang-rt/runtime/buffer.h" #include "CrashHandlerFixture.h" #include "gtest/gtest.h" #include diff --git a/flang/unittests/Runtime/CUDA/Allocatable.cpp b/flang-rt/unittests/Runtime/CUDA/Allocatable.cpp similarity index 90% rename from flang/unittests/Runtime/CUDA/Allocatable.cpp rename to flang-rt/unittests/Runtime/CUDA/Allocatable.cpp index bdfa8f5cc3213..3f759a69c0388 100644 --- a/flang/unittests/Runtime/CUDA/Allocatable.cpp +++ b/flang-rt/unittests/Runtime/CUDA/Allocatable.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Allocatable.cpp ------------------*- C++-*-===// +//===-- unittests/Runtime/CUDA/Allocatable.cpp ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,16 +7,16 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/allocatable.h" +#include "cuda_runtime.h" #include "gtest/gtest.h" -#include "../../../runtime/terminator.h" +#include "flang-rt/runtime/allocator-registry.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/allocator.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/CUDA/descriptor.h" -#include "flang/Runtime/allocator-registry.h" #include "flang/Support/Fortran.h" -#include "cuda_runtime.h" - using namespace Fortran::runtime; using namespace Fortran::runtime::cuda; diff --git a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp b/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp similarity index 92% rename from flang/unittests/Runtime/CUDA/AllocatorCUF.cpp rename to flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp index 5ec122e4c5777..9bda3270fe8a1 100644 --- a/flang/unittests/Runtime/CUDA/AllocatorCUF.cpp +++ b/flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/AllocatableCUF.cpp ---------------*- C++-*-===// +//===-- unittests/Runtime/CUDA/AllocatorCUF.cpp -----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,16 +6,16 @@ // //===----------------------------------------------------------------------===// +#include "cuda_runtime.h" #include "gtest/gtest.h" -#include "../../../runtime/terminator.h" +#include "flang-rt/runtime/allocator-registry.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/allocator.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/allocatable.h" -#include "flang/Runtime/allocator-registry.h" #include "flang/Support/Fortran.h" -#include "cuda_runtime.h" - using namespace Fortran::runtime; using namespace Fortran::runtime::cuda; diff --git a/flang/unittests/Runtime/CUDA/Memory.cpp b/flang-rt/unittests/Runtime/CUDA/Memory.cpp similarity index 93% rename from flang/unittests/Runtime/CUDA/Memory.cpp rename to flang-rt/unittests/Runtime/CUDA/Memory.cpp index 61c9d1131ee56..37ae59ec238c8 100644 --- a/flang/unittests/Runtime/CUDA/Memory.cpp +++ b/flang-rt/unittests/Runtime/CUDA/Memory.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Memory.cpp -----------------------*- C++-*-===// +//===-- unittests/Runtime/CUDA/Memory.cpp -----------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,18 +7,17 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/CUDA/memory.h" -#include "gtest/gtest.h" -#include "../../../runtime/terminator.h" +#include "cuda_runtime.h" #include "../tools.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/allocator-registry.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/CUDA/allocator.h" #include "flang/Runtime/CUDA/common.h" #include "flang/Runtime/CUDA/descriptor.h" #include "flang/Runtime/allocatable.h" -#include "flang/Runtime/allocator-registry.h" #include "flang/Support/Fortran.h" -#include "cuda_runtime.h" - using namespace Fortran::runtime; using namespace Fortran::runtime::cuda; diff --git a/flang/unittests/Runtime/CharacterTest.cpp b/flang-rt/unittests/Runtime/CharacterTest.cpp similarity index 99% rename from flang/unittests/Runtime/CharacterTest.cpp rename to flang-rt/unittests/Runtime/CharacterTest.cpp index d462c9120fd8c..83ec9b36d9b0c 100644 --- a/flang/unittests/Runtime/CharacterTest.cpp +++ b/flang-rt/unittests/Runtime/CharacterTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/CharacterTest.cpp ---------------*- C++ -*-===// +//===-- unittests/Runtime/CharacterTest.cpp ---------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -11,7 +11,7 @@ #include "flang/Runtime/character.h" #include "gtest/gtest.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" #include #include #include diff --git a/flang/unittests/Runtime/CommandTest.cpp b/flang-rt/unittests/Runtime/CommandTest.cpp similarity index 99% rename from flang/unittests/Runtime/CommandTest.cpp rename to flang-rt/unittests/Runtime/CommandTest.cpp index ecb325330f1ad..72fe7629dbbb8 100644 --- a/flang/unittests/Runtime/CommandTest.cpp +++ b/flang-rt/unittests/Runtime/CommandTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/CommandTest.cpp ---------------------------===// +//===-- unittests/Runtime/CommandTest.cpp -----------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,7 +9,7 @@ #include "flang/Runtime/command.h" #include "gmock/gmock.h" #include "gtest/gtest.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" #include "flang/Runtime/execute.h" #include "flang/Runtime/extensions.h" #include "flang/Runtime/main.h" diff --git a/flang/unittests/Runtime/Complex.cpp b/flang-rt/unittests/Runtime/Complex.cpp similarity index 98% rename from flang/unittests/Runtime/Complex.cpp rename to flang-rt/unittests/Runtime/Complex.cpp index d714da24dc4e5..d7e5f55414fe2 100644 --- a/flang/unittests/Runtime/Complex.cpp +++ b/flang-rt/unittests/Runtime/Complex.cpp @@ -1,10 +1,11 @@ -//===-- flang/unittests/Runtime/Complex.cpp ---------------------*- C++ -*-===// +//===-- unittests/Runtime/Complex.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// + #include "gmock/gmock.h" #include "gtest/gtest-matchers.h" #include diff --git a/flang/unittests/Runtime/CrashHandlerFixture.cpp b/flang-rt/unittests/Runtime/CrashHandlerFixture.cpp similarity index 92% rename from flang/unittests/Runtime/CrashHandlerFixture.cpp rename to flang-rt/unittests/Runtime/CrashHandlerFixture.cpp index 811603337e660..8213edd1f9225 100644 --- a/flang/unittests/Runtime/CrashHandlerFixture.cpp +++ b/flang-rt/unittests/Runtime/CrashHandlerFixture.cpp @@ -1,12 +1,13 @@ -//===-- flang/unittests/Runtime/CrashHandlerFixture.cpp ---------*- C++ -*-===// +//===-- unittests/Runtime/CrashHandlerFixture.cpp ---------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// + #include "CrashHandlerFixture.h" -#include "../../runtime/terminator.h" +#include "flang-rt/runtime/terminator.h" #include #include diff --git a/flang/unittests/Runtime/CrashHandlerFixture.h b/flang-rt/unittests/Runtime/CrashHandlerFixture.h similarity index 70% rename from flang/unittests/Runtime/CrashHandlerFixture.h rename to flang-rt/unittests/Runtime/CrashHandlerFixture.h index fe0ee0da5204e..74531d1e728f4 100644 --- a/flang/unittests/Runtime/CrashHandlerFixture.h +++ b/flang-rt/unittests/Runtime/CrashHandlerFixture.h @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/CrashHandlerFixture.h -----------*- C++ -*-===// +//===-- unittests/Runtime/CrashHandlerFixture.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. @@ -10,12 +10,13 @@ /// with expected message. // //===----------------------------------------------------------------------===// -#ifndef LLVM_FLANG_UNITTESTS_RUNTIMEGTEST_CRASHHANDLERFIXTURE_H -#define LLVM_FLANG_UNITTESTS_RUNTIMEGTEST_CRASHHANDLERFIXTURE_H + +#ifndef FLANG_RT_UNITTESTS_RUNTIME_CRASHHANDLERFIXTURE_H_ +#define FLANG_RT_UNITTESTS_RUNTIME_CRASHHANDLERFIXTURE_H_ #include struct CrashHandlerFixture : testing::Test { void SetUp(); }; -#endif +#endif /* FLANG_RT_UNITTESTS_RUNTIME_CRASHHANDLERFIXTURE_H_ */ diff --git a/flang/unittests/Runtime/Derived.cpp b/flang-rt/unittests/Runtime/Derived.cpp similarity index 93% rename from flang/unittests/Runtime/Derived.cpp rename to flang-rt/unittests/Runtime/Derived.cpp index 019d5e8309e4a..3196ba796ad19 100644 --- a/flang/unittests/Runtime/Derived.cpp +++ b/flang-rt/unittests/Runtime/Derived.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Pointer.cpp--------- -------------*- C++-*-===// +//===-- unittests/Runtime/Derived.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "gtest/gtest.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/tools.h" #include "flang/Runtime/derived-api.h" -#include "flang/Runtime/descriptor.h" using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/ExternalIOTest.cpp b/flang-rt/unittests/Runtime/ExternalIOTest.cpp similarity index 99% rename from flang/unittests/Runtime/ExternalIOTest.cpp rename to flang-rt/unittests/Runtime/ExternalIOTest.cpp index b9407b5e7a591..c83535ca82bd3 100644 --- a/flang/unittests/Runtime/ExternalIOTest.cpp +++ b/flang-rt/unittests/Runtime/ExternalIOTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/RuntimeGTest/ExternalIOTest.cpp ---------*- C++ -*-===// +//===-- unittests/Runtime/ExternalIOTest.cpp --------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,7 +12,7 @@ #include "CrashHandlerFixture.h" #include "gtest/gtest.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" #include "flang/Runtime/io-api-consts.h" #include "flang/Runtime/main.h" #include "flang/Runtime/stop.h" diff --git a/flang/unittests/Runtime/Format.cpp b/flang-rt/unittests/Runtime/Format.cpp similarity index 96% rename from flang/unittests/Runtime/Format.cpp rename to flang-rt/unittests/Runtime/Format.cpp index 01803c628de26..fe7403f26700b 100644 --- a/flang/unittests/Runtime/Format.cpp +++ b/flang-rt/unittests/Runtime/Format.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Format.cpp ----------------------*- C++ -*-===// +//===-- unittests/Runtime/Format.cpp ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "CrashHandlerFixture.h" -#include "../runtime/connection.h" -#include "../runtime/format-implementation.h" -#include "../runtime/io-error.h" +#include "flang-rt/runtime/connection.h" +#include "flang-rt/runtime/format-implementation.h" +#include "flang-rt/runtime/io-error.h" #include #include #include diff --git a/flang/unittests/Runtime/Inquiry.cpp b/flang-rt/unittests/Runtime/Inquiry.cpp similarity index 97% rename from flang/unittests/Runtime/Inquiry.cpp rename to flang-rt/unittests/Runtime/Inquiry.cpp index 3b523e992a317..e79c037864d9c 100644 --- a/flang/unittests/Runtime/Inquiry.cpp +++ b/flang-rt/unittests/Runtime/Inquiry.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Inquiry.cpp -------------------------------===// +//===-- unittests/Runtime/Inquiry.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/inquiry.h" -#include "gtest/gtest.h" #include "tools.h" -#include "flang/Runtime/type-code.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/type-code.h" using namespace Fortran::runtime; using Fortran::common::TypeCategory; diff --git a/flang/unittests/Runtime/ListInputTest.cpp b/flang-rt/unittests/Runtime/ListInputTest.cpp similarity index 98% rename from flang/unittests/Runtime/ListInputTest.cpp rename to flang-rt/unittests/Runtime/ListInputTest.cpp index 38c758b7ef966..310c41a5c3fa5 100644 --- a/flang/unittests/Runtime/ListInputTest.cpp +++ b/flang-rt/unittests/Runtime/ListInputTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/ListInputTest.cpp ---------------*- C++ -*-===// +//===-- unittests/Runtime/ListInputTest.cpp ---------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,8 +7,8 @@ //===----------------------------------------------------------------------===// #include "CrashHandlerFixture.h" -#include "../../runtime/io-error.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/io-error.h" #include "flang/Runtime/io-api-consts.h" using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/LogicalFormatTest.cpp b/flang-rt/unittests/Runtime/LogicalFormatTest.cpp similarity index 94% rename from flang/unittests/Runtime/LogicalFormatTest.cpp rename to flang-rt/unittests/Runtime/LogicalFormatTest.cpp index 26c9374be1338..bc933292181c1 100644 --- a/flang/unittests/Runtime/LogicalFormatTest.cpp +++ b/flang-rt/unittests/Runtime/LogicalFormatTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/LogicalFormatTest.cpp -----------*- C++ -*-===// +//===-- unittests/Runtime/LogicalFormatTest.cpp -----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "CrashHandlerFixture.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" #include "flang/Runtime/io-api-consts.h" #include #include diff --git a/flang/unittests/Runtime/Matmul.cpp b/flang-rt/unittests/Runtime/Matmul.cpp similarity index 98% rename from flang/unittests/Runtime/Matmul.cpp rename to flang-rt/unittests/Runtime/Matmul.cpp index c3fed9b972df2..1b716fd01fd42 100644 --- a/flang/unittests/Runtime/Matmul.cpp +++ b/flang-rt/unittests/Runtime/Matmul.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Matmul.cpp--------- -------------*- C++ -*-===// +//===-- unittests/Runtime/Matmul.cpp ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,12 +7,12 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/matmul.h" -#include "gtest/gtest.h" #include "tools.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" -#include "flang/Runtime/type-code.h" using namespace Fortran::runtime; using Fortran::common::TypeCategory; diff --git a/flang/unittests/Runtime/MatmulTranspose.cpp b/flang-rt/unittests/Runtime/MatmulTranspose.cpp similarity index 98% rename from flang/unittests/Runtime/MatmulTranspose.cpp rename to flang-rt/unittests/Runtime/MatmulTranspose.cpp index c582e945dc7c9..cc14ab755505a 100644 --- a/flang/unittests/Runtime/MatmulTranspose.cpp +++ b/flang-rt/unittests/Runtime/MatmulTranspose.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/MatmulTranspose.cpp -------------*- C++ -*-===// +//===-- unittests/Runtime/MatmulTranspose.cpp -------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,13 +6,13 @@ // //===----------------------------------------------------------------------===// -#include "gtest/gtest.h" #include "tools.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/matmul-transpose.h" -#include "flang/Runtime/type-code.h" using namespace Fortran::runtime; using Fortran::common::TypeCategory; diff --git a/flang/unittests/Runtime/MiscIntrinsic.cpp b/flang-rt/unittests/Runtime/MiscIntrinsic.cpp similarity index 96% rename from flang/unittests/Runtime/MiscIntrinsic.cpp rename to flang-rt/unittests/Runtime/MiscIntrinsic.cpp index 7e19ed250bdc0..c6783381bfc35 100644 --- a/flang/unittests/Runtime/MiscIntrinsic.cpp +++ b/flang-rt/unittests/Runtime/MiscIntrinsic.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/MiscIntrinsic.cpp ---------------*- C++ -*-===// +//===-- unittests/Runtime/MiscIntrinsic.cpp ---------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,12 +6,12 @@ // //===----------------------------------------------------------------------===// -#include "gtest/gtest.h" #include "tools.h" -#include "flang/Runtime//misc-intrinsic.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/descriptor.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/misc-intrinsic.h" using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/Namelist.cpp b/flang-rt/unittests/Runtime/Namelist.cpp similarity index 99% rename from flang/unittests/Runtime/Namelist.cpp rename to flang-rt/unittests/Runtime/Namelist.cpp index 0a28f3590b86e..040dedb8cd47c 100644 --- a/flang/unittests/Runtime/Namelist.cpp +++ b/flang-rt/unittests/Runtime/Namelist.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Namelist.cpp --------------------*- C++ -*-===// +//===-- unittests/Runtime/Namelist.cpp --------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "../../runtime/namelist.h" +#include "flang-rt/runtime/namelist.h" #include "CrashHandlerFixture.h" #include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" #include "flang/Runtime/io-api-consts.h" #include #include diff --git a/flang/unittests/Runtime/Numeric.cpp b/flang-rt/unittests/Runtime/Numeric.cpp similarity index 99% rename from flang/unittests/Runtime/Numeric.cpp rename to flang-rt/unittests/Runtime/Numeric.cpp index 29ebbc8ad7aa7..4baad3fc9ad0e 100644 --- a/flang/unittests/Runtime/Numeric.cpp +++ b/flang-rt/unittests/Runtime/Numeric.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Numeric.cpp ---------------------*- C++ -*-===// +//===-- unittests/Runtime/Numeric.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/unittests/Runtime/NumericalFormatTest.cpp b/flang-rt/unittests/Runtime/NumericalFormatTest.cpp similarity index 99% rename from flang/unittests/Runtime/NumericalFormatTest.cpp rename to flang-rt/unittests/Runtime/NumericalFormatTest.cpp index 274498b8e8695..5a8ead48dcef9 100644 --- a/flang/unittests/Runtime/NumericalFormatTest.cpp +++ b/flang-rt/unittests/Runtime/NumericalFormatTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/NumericalFormatTest.cpp ---------*- C++ -*-===// +//===-- unittests/Runtime/NumericalFormatTest.cpp ---------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,7 +7,7 @@ //===----------------------------------------------------------------------===// #include "CrashHandlerFixture.h" -#include "flang/Runtime/descriptor.h" +#include "flang-rt/runtime/descriptor.h" #include "flang/Runtime/io-api-consts.h" #include #include diff --git a/flang/unittests/Runtime/Pointer.cpp b/flang-rt/unittests/Runtime/Pointer.cpp similarity index 97% rename from flang/unittests/Runtime/Pointer.cpp rename to flang-rt/unittests/Runtime/Pointer.cpp index 54720afab8d8a..6e8861d374889 100644 --- a/flang/unittests/Runtime/Pointer.cpp +++ b/flang-rt/unittests/Runtime/Pointer.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Pointer.cpp--------- -------------*- C++-*-===// +//===-- unittests/Runtime/Pointer.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/pointer.h" -#include "gtest/gtest.h" #include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/descriptor.h" using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/Ragged.cpp b/flang-rt/unittests/Runtime/Ragged.cpp similarity index 94% rename from flang/unittests/Runtime/Ragged.cpp rename to flang-rt/unittests/Runtime/Ragged.cpp index 5049bc83405f1..feadd032f59bd 100644 --- a/flang/unittests/Runtime/Ragged.cpp +++ b/flang-rt/unittests/Runtime/Ragged.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Ragged.cpp ----------------------*- C++ -*-===// +//===-- unittests/Runtime/Ragged.cpp ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/unittests/Runtime/Random.cpp b/flang-rt/unittests/Runtime/Random.cpp similarity index 92% rename from flang/unittests/Runtime/Random.cpp rename to flang-rt/unittests/Runtime/Random.cpp index cb739b9451429..bf4b540e768fd 100644 --- a/flang/unittests/Runtime/Random.cpp +++ b/flang-rt/unittests/Runtime/Random.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Random.cpp ----------------------*- C++ -*-===// +//===-- unittests/Runtime/Random.cpp ----------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,10 +6,10 @@ // //===----------------------------------------------------------------------===// -#include "flang/Runtime//random.h" +#include "flang/Runtime/random.h" #include "gtest/gtest.h" -#include "flang/Runtime/descriptor.h" -#include "flang/Runtime/type-code.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/type-code.h" #include using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/Reduction.cpp b/flang-rt/unittests/Runtime/Reduction.cpp similarity index 99% rename from flang/unittests/Runtime/Reduction.cpp rename to flang-rt/unittests/Runtime/Reduction.cpp index 29675399abf5c..3701a32042c58 100644 --- a/flang/unittests/Runtime/Reduction.cpp +++ b/flang-rt/unittests/Runtime/Reduction.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Reductions.cpp ----------------------------===// +//===-- unittests/Runtime/Reduction.cpp -------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,14 +7,14 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/reduction.h" -#include "gtest/gtest.h" #include "tools.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Common/float128.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/reduce.h" -#include "flang/Runtime/type-code.h" #include #include #include diff --git a/flang/unittests/Runtime/RuntimeCrashTest.cpp b/flang-rt/unittests/Runtime/RuntimeCrashTest.cpp similarity index 98% rename from flang/unittests/Runtime/RuntimeCrashTest.cpp rename to flang-rt/unittests/Runtime/RuntimeCrashTest.cpp index 72a0b290cf864..e716dac2d1203 100644 --- a/flang/unittests/Runtime/RuntimeCrashTest.cpp +++ b/flang-rt/unittests/Runtime/RuntimeCrashTest.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/CrashHandlerFixture.cpp ---------*- C++ -*-===// +//===-- unittests/Runtime/RuntimeCrashTest.cpp ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -12,7 +12,7 @@ //===----------------------------------------------------------------------===// #include "CrashHandlerFixture.h" #include "tools.h" -#include "../../runtime/terminator.h" +#include "flang-rt/runtime/terminator.h" #include "flang/Runtime/io-api-consts.h" #include "flang/Runtime/transformational.h" #include diff --git a/flang/unittests/Runtime/Stop.cpp b/flang-rt/unittests/Runtime/Stop.cpp similarity index 96% rename from flang/unittests/Runtime/Stop.cpp rename to flang-rt/unittests/Runtime/Stop.cpp index b13602eaee5ea..5d1af20e77de7 100644 --- a/flang/unittests/Runtime/Stop.cpp +++ b/flang-rt/unittests/Runtime/Stop.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Stop.cpp ----------------------------------===// +//===-- unittests/Runtime/Stop.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -9,9 +9,10 @@ /// Test runtime API for STOP statement and runtime API to kill the program. // //===----------------------------------------------------------------------===// + #include "flang/Runtime/stop.h" #include "CrashHandlerFixture.h" -#include "../../runtime/environment.h" +#include "flang-rt/runtime/environment.h" #include #include diff --git a/flang/unittests/Runtime/Support.cpp b/flang-rt/unittests/Runtime/Support.cpp similarity index 96% rename from flang/unittests/Runtime/Support.cpp rename to flang-rt/unittests/Runtime/Support.cpp index 8c8de73b5b979..c97a6eae3a155 100644 --- a/flang/unittests/Runtime/Support.cpp +++ b/flang-rt/unittests/Runtime/Support.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Support.cpp ----------------------*- C++-*-===// +//===-- unittests/Runtime/Support.cpp ---------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,9 +7,9 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/support.h" -#include "gtest/gtest.h" #include "tools.h" -#include "flang/Runtime/descriptor.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/descriptor.h" using namespace Fortran::runtime; using Fortran::common::TypeCategory; diff --git a/flang/unittests/Runtime/TemporaryStack.cpp b/flang-rt/unittests/Runtime/TemporaryStack.cpp similarity index 98% rename from flang/unittests/Runtime/TemporaryStack.cpp rename to flang-rt/unittests/Runtime/TemporaryStack.cpp index 4f701e09b2945..ff8efe123d7cc 100644 --- a/flang/unittests/Runtime/TemporaryStack.cpp +++ b/flang-rt/unittests/Runtime/TemporaryStack.cpp @@ -1,4 +1,4 @@ -//===--- flang/unittests/Runtime/TemporaryStack.cpp -------------*- C++ -*-===// +//===-- unittests/Runtime/TemporaryStack.cpp --------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,13 +7,13 @@ //===----------------------------------------------------------------------===// #include "gtest/gtest.h" -#include "tools.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/tools.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" #include "flang/Runtime/temporary-stack.h" -#include "flang/Runtime/type-code.h" #include using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/Time.cpp b/flang-rt/unittests/Runtime/Time.cpp similarity index 98% rename from flang/unittests/Runtime/Time.cpp rename to flang-rt/unittests/Runtime/Time.cpp index 9309d7b1ceffa..548c0834e34a3 100644 --- a/flang/unittests/Runtime/Time.cpp +++ b/flang-rt/unittests/Runtime/Time.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Time.cpp ----------------------------===// +//===-- unittests/Runtime/Time.cpp ------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. diff --git a/flang/unittests/Runtime/Transformational.cpp b/flang-rt/unittests/Runtime/Transformational.cpp similarity index 99% rename from flang/unittests/Runtime/Transformational.cpp rename to flang-rt/unittests/Runtime/Transformational.cpp index 1d84b7e23779a..06df96a3cc45a 100644 --- a/flang/unittests/Runtime/Transformational.cpp +++ b/flang-rt/unittests/Runtime/Transformational.cpp @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/Transformational.cpp ----------------------===// +//===-- unittests/Runtime/Transformational.cpp ------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -7,10 +7,10 @@ //===----------------------------------------------------------------------===// #include "flang/Runtime/transformational.h" -#include "gtest/gtest.h" #include "tools.h" +#include "gtest/gtest.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Common/float128.h" -#include "flang/Runtime/type-code.h" #include using namespace Fortran::runtime; diff --git a/flang/unittests/Runtime/tools.h b/flang-rt/unittests/Runtime/tools.h similarity index 85% rename from flang/unittests/Runtime/tools.h rename to flang-rt/unittests/Runtime/tools.h index 0347edace5c05..36a4c2bd9c8b7 100644 --- a/flang/unittests/Runtime/tools.h +++ b/flang-rt/unittests/Runtime/tools.h @@ -1,4 +1,4 @@ -//===-- flang/unittests/Runtime/tools.h -------------------------*- C++ -*-===// +//===-- unittests/Runtime/tools.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,14 +6,14 @@ // //===----------------------------------------------------------------------===// -#ifndef FORTRAN_UNITTESTS_RUNTIME_TOOLS_H_ -#define FORTRAN_UNITTESTS_RUNTIME_TOOLS_H_ +#ifndef FLANG_RT_UNITTESTS_RUNTIME_TOOLS_H_ +#define FLANG_RT_UNITTESTS_RUNTIME_TOOLS_H_ #include "gtest/gtest.h" +#include "flang-rt/runtime/descriptor.h" +#include "flang-rt/runtime/type-code.h" #include "flang/Runtime/allocatable.h" #include "flang/Runtime/cpp-type.h" -#include "flang/Runtime/descriptor.h" -#include "flang/Runtime/type-code.h" #include #include #include @@ -54,4 +54,4 @@ static OwningPtr MakeArray(const std::vector &shape, } } // namespace Fortran::runtime -#endif // FORTRAN_UNITTESTS_RUNTIME_TOOLS_H_ +#endif // FLANG_RT_UNITTESTS_RUNTIME_TOOLS_H_ diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt index c012b884ae3be..dc0b7a7748196 100644 --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -23,6 +23,7 @@ if (LLVM_ENABLE_EH) endif() set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +set(FLANG_RT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../flang-rt") if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE) message(FATAL_ERROR "In-source builds are not allowed. \ diff --git a/flang/examples/ExternalHelloWorld/CMakeLists.txt b/flang/examples/ExternalHelloWorld/CMakeLists.txt index b61948718a5e3..dbb69475976dd 100644 --- a/flang/examples/ExternalHelloWorld/CMakeLists.txt +++ b/flang/examples/ExternalHelloWorld/CMakeLists.txt @@ -1,6 +1,6 @@ # This test is not run by default as it requires input. add_llvm_example(external-hello-world - external-hello.cpp + ${FLANG_RT_SOURCE_DIR}/examples/ExternalHelloWorld/external-hello.cpp ) target_link_libraries(external-hello-world diff --git a/flang/include/flang/Runtime/allocatable.h b/flang/include/flang/Runtime/allocatable.h index 58061d9862095..714d85ec073c6 100644 --- a/flang/include/flang/Runtime/allocatable.h +++ b/flang/include/flang/Runtime/allocatable.h @@ -11,7 +11,7 @@ #ifndef FORTRAN_RUNTIME_ALLOCATABLE_H_ #define FORTRAN_RUNTIME_ALLOCATABLE_H_ -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/descriptor-consts.h" #include "flang/Runtime/entry-names.h" namespace Fortran::runtime { diff --git a/flang/include/flang/Runtime/descriptor-consts.h b/flang/include/flang/Runtime/descriptor-consts.h index abcdbc4a12002..acd7bc5ddbdef 100644 --- a/flang/include/flang/Runtime/descriptor-consts.h +++ b/flang/include/flang/Runtime/descriptor-consts.h @@ -9,6 +9,7 @@ #ifndef FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ #define FORTRAN_RUNTIME_DESCRIPTOR_CONSTS_H_ +#include "flang/Common/Fortran-consts.h" #include "flang/Common/ISO_Fortran_binding_wrapper.h" #include "flang/Common/api-attrs.h" #include @@ -29,6 +30,7 @@ class DerivedType; namespace Fortran::runtime { class Descriptor; using SubscriptValue = ISO::CFI_index_t; +using common::TypeCategory; /// Returns size in bytes of the descriptor (not the data) /// This must be at least as large as the largest descriptor of any target diff --git a/flang/include/flang/Runtime/pointer.h b/flang/include/flang/Runtime/pointer.h index 704144f08114f..67c4fe266f55c 100644 --- a/flang/include/flang/Runtime/pointer.h +++ b/flang/include/flang/Runtime/pointer.h @@ -12,7 +12,7 @@ #ifndef FORTRAN_RUNTIME_POINTER_H_ #define FORTRAN_RUNTIME_POINTER_H_ -#include "flang/Runtime/descriptor.h" +#include "flang/Runtime/descriptor-consts.h" #include "flang/Runtime/entry-names.h" namespace Fortran::runtime { diff --git a/flang/runtime/CMakeLists.txt b/flang/runtime/CMakeLists.txt index 1f4ee69598918..fbd1e1e2cc56e 100644 --- a/flang/runtime/CMakeLists.txt +++ b/flang/runtime/CMakeLists.txt @@ -16,6 +16,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(CMAKE_CXX_EXTENSIONS OFF) set(FLANG_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/..") + set(FLANG_RT_SOURCE_DIR "${FLANG_SOURCE_DIR}/../flang-rt") set(LLVM_COMMON_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../cmake") set(LLVM_CMAKE_UTILS "${FLANG_SOURCE_DIR}/../llvm/cmake") @@ -57,8 +58,31 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) REAL(16) is mapped to __float128, or libm for targets where REAL(16) \ is mapped to long double, etc." ) + + option(FLANG_CUF_RUNTIME + "Compile CUDA Fortran runtime sources" OFF) + if (FLANG_CUF_RUNTIME) + find_package(CUDAToolkit REQUIRED) + endif() endif() +# Runtime files are in Flang-RT's source dir. +function (runtime_source_files outvar) + cmake_parse_arguments(ARG "" "SUBDIR" "" ${ARGN}) + + set(new_sources "") + foreach (source IN LISTS "${outvar}") + set(new_source "${FLANG_RT_SOURCE_DIR}/lib") + cmake_path(APPEND new_source "${ARG_SUBDIR}") + cmake_path(APPEND new_source "${source}") + list(APPEND new_sources "${new_source}") + endforeach () + set("${outvar}" ${new_sources} PARENT_SCOPE) +endfunction () + +# Runtime includes are in Flang-RT's source dir. +include_directories(BEFORE "${FLANG_RT_SOURCE_DIR}/include") + set(linked_libraries "") # function checks @@ -108,7 +132,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "XL") set(NO_RTTI_FLAGS "-qnoeh -qnortti") endif () -configure_file(config.h.cmake config.h) +configure_file("${FLANG_RT_SOURCE_DIR}/cmake/config.h.cmake.in" config.h) # include_directories is used here instead of target_include_directories # because add_flang_library creates multiple objects (STATIC/SHARED, OBJECT) # with different names @@ -252,6 +276,7 @@ set(supported_files unit.cpp utf.cpp ) +runtime_source_files(supported_files SUBDIR "runtime") enable_cuda_compilation(flang_rt "${supported_files}") enable_omp_offload_compilation("${supported_files}") @@ -285,6 +310,8 @@ if (NOT TARGET flang_rt.quadmath) list(APPEND sources ${f128_sources}) endif() endif() +runtime_source_files(sources SUBDIR "runtime") + if (NOT DEFINED MSVC) add_flang_library(flang_rt.runtime diff --git a/flang/runtime/CUDA/CMakeLists.txt b/flang/runtime/CUDA/CMakeLists.txt index 1fd3bf22a83cf..aac1f62661810 100644 --- a/flang/runtime/CUDA/CMakeLists.txt +++ b/flang/runtime/CUDA/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories(${CUDAToolkit_INCLUDE_DIRS}) # added to the library name. set(CUFRT_LIBNAME flang_rt.cuda_${CUDAToolkit_VERSION_MAJOR}) -add_flang_library(${CUFRT_LIBNAME} +set(sources allocator.cpp allocatable.cpp descriptor.cpp @@ -24,6 +24,11 @@ add_flang_library(${CUFRT_LIBNAME} pointer.cpp registration.cpp ) +runtime_source_files(sources SUBDIR "cuda") + +add_flang_library(${CUFRT_LIBNAME} + ${sources} +) if (BUILD_SHARED_LIBS) set(CUDA_RT_TARGET CUDA::cudart) diff --git a/flang/runtime/Float128Math/CMakeLists.txt b/flang/runtime/Float128Math/CMakeLists.txt index 3c382d16a21cd..cdac5f893cf91 100644 --- a/flang/runtime/Float128Math/CMakeLists.txt +++ b/flang/runtime/Float128Math/CMakeLists.txt @@ -68,6 +68,7 @@ set(sources y1.cpp yn.cpp ) +runtime_source_files(sources SUBDIR "quadmath") include_directories(AFTER "${CMAKE_CURRENT_SOURCE_DIR}/..") add_library(FortranFloat128MathILib INTERFACE) diff --git a/flang/runtime/config.h.cmake b/flang/runtime/config.h.cmake deleted file mode 100644 index a2271be77b8c6..0000000000000 --- a/flang/runtime/config.h.cmake +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef FORTRAN_RUNTIME_CONFIG_H -#define FORTRAN_RUNTIME_CONFIG_H - -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine01 HAVE_STRERROR_R - -/* Define to 1 if you have the declaration of `strerror_s', and to 0 if you - don't. */ -#cmakedefine01 HAVE_DECL_STRERROR_S - -/* Define to 1 if you have the `backtrace' function. */ -#cmakedefine HAVE_BACKTRACE ${HAVE_BACKTRACE} - -#define BACKTRACE_HEADER <${BACKTRACE_HEADER}> - -#endif diff --git a/flang/unittests/CMakeLists.txt b/flang/unittests/CMakeLists.txt index c54ceb3332abf..a02f791135f1f 100644 --- a/flang/unittests/CMakeLists.txt +++ b/flang/unittests/CMakeLists.txt @@ -12,6 +12,8 @@ endif() add_custom_target(FlangUnitTests) set_target_properties(FlangUnitTests PROPERTIES FOLDER "Flang/Tests") +include_directories("${FLANG_RT_SOURCE_DIR}/include") + function(add_flang_unittest_offload_properties target) # Do not apply runtime properties if not even compiling the runtime. if (NOT FLANG_INCLUDE_RUNTIME) @@ -61,7 +63,13 @@ function(add_flang_nongtest_unittest test_name) set(suffix .test) endif() - add_executable(${test_name}${suffix} ${test_name}.cpp) + # Sources for runtime tests are in Flang-RT. + set(test_filepath "${FLANG_RT_SOURCE_DIR}/unittests/Evaluate/${test_name}.cpp") + if (NOT EXISTS "${test_filepath}") + set(test_filepath "${test_name}.cpp") + endif () + + add_executable(${test_name}${suffix} "${test_filepath}") set_target_properties(${test_name}${suffix} PROPERTIES FOLDER "Flang/Tests/Unit") if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB) diff --git a/flang/unittests/Runtime/CMakeLists.txt b/flang/unittests/Runtime/CMakeLists.txt index f3743be49b015..40afec3e113f3 100644 --- a/flang/unittests/Runtime/CMakeLists.txt +++ b/flang/unittests/Runtime/CMakeLists.txt @@ -1,34 +1,34 @@ add_flang_unittest(FlangRuntimeTests - AccessTest.cpp - Allocatable.cpp - ArrayConstructor.cpp - BufferTest.cpp - CharacterTest.cpp - CommandTest.cpp - Complex.cpp - CrashHandlerFixture.cpp - Derived.cpp - ExternalIOTest.cpp - Format.cpp - Inquiry.cpp - ListInputTest.cpp - LogicalFormatTest.cpp - Matmul.cpp - MatmulTranspose.cpp - MiscIntrinsic.cpp - Namelist.cpp - Numeric.cpp - NumericalFormatTest.cpp - Pointer.cpp - Ragged.cpp - Random.cpp - Reduction.cpp - RuntimeCrashTest.cpp - Stop.cpp - Support.cpp - Time.cpp - TemporaryStack.cpp - Transformational.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/AccessTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Allocatable.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/ArrayConstructor.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/BufferTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/CharacterTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/CommandTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Complex.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/CrashHandlerFixture.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Derived.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/ExternalIOTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Format.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Inquiry.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/ListInputTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/LogicalFormatTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Matmul.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/MatmulTranspose.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/MiscIntrinsic.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Namelist.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Numeric.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/NumericalFormatTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Pointer.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Ragged.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Random.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Reduction.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/RuntimeCrashTest.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Stop.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Support.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Time.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/TemporaryStack.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/Transformational.cpp ) target_link_libraries(FlangRuntimeTests diff --git a/flang/unittests/Runtime/CUDA/CMakeLists.txt b/flang/unittests/Runtime/CUDA/CMakeLists.txt index 860b2664d623b..6901da3920a46 100644 --- a/flang/unittests/Runtime/CUDA/CMakeLists.txt +++ b/flang/unittests/Runtime/CUDA/CMakeLists.txt @@ -1,9 +1,9 @@ if (FLANG_CUF_RUNTIME) add_flang_unittest(FlangCufRuntimeTests - Allocatable.cpp - AllocatorCUF.cpp - Memory.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/CUDA/Allocatable.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/CUDA/AllocatorCUF.cpp + ${FLANG_RT_SOURCE_DIR}/unittests/Runtime/CUDA/Memory.cpp ) if (BUILD_SHARED_LIBS)