xref: /llvm-project/flang/include/flang/Lower/ConvertArrayConstructor.h (revision ffde9f17300b52c9b53311455b8991cbfc6da377)
1 //===-- ConvertArrayConstructor.h -- Array constructor lowering -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Coding style: https://mlir.llvm.org/getting_started/DeveloperGuide/
10 //
11 //===----------------------------------------------------------------------===//
12 ///
13 /// Implements the conversion from evaluate::ArrayConstructor to HLFIR.
14 ///
15 //===----------------------------------------------------------------------===//
16 #ifndef FORTRAN_LOWER_CONVERTARRAYCONSTRUCTOR_H
17 #define FORTRAN_LOWER_CONVERTARRAYCONSTRUCTOR_H
18 
19 #include "flang/Evaluate/type.h"
20 #include "flang/Optimizer/Builder/HLFIRTools.h"
21 
22 namespace Fortran::evaluate {
23 template <typename T>
24 class ArrayConstructor;
25 }
26 
27 namespace Fortran::lower {
28 class AbstractConverter;
29 class SymMap;
30 class StatementContext;
31 
32 /// Class to lower evaluate::ArrayConstructor<T> to hlfir::EntityWithAttributes.
33 template <typename T>
34 class ArrayConstructorBuilder {
35 public:
36   static hlfir::EntityWithAttributes
37   gen(mlir::Location loc, Fortran::lower::AbstractConverter &converter,
38       const Fortran::evaluate::ArrayConstructor<T> &expr,
39       Fortran::lower::SymMap &symMap,
40       Fortran::lower::StatementContext &stmtCtx);
41 };
42 using namespace evaluate;
43 FOR_EACH_SPECIFIC_TYPE(extern template class ArrayConstructorBuilder, )
44 } // namespace Fortran::lower
45 
46 #endif // FORTRAN_LOWER_CONVERTARRAYCONSTRUCTOR_H
47