FLANG

Utils.h
1 //===-- Lower/Utils.h -- utilities ------------------------------*- 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 #ifndef FORTRAN_LOWER_UTILS_H
10 #define FORTRAN_LOWER_UTILS_H
11
12 #include "flang/Common/indirection.h"
13 #include "flang/Parser/char-block.h"
14 #include "llvm/ADT/StringRef.h"
15
17 inline llvm::StringRef toStringRef(const Fortran::parser::CharBlock &cb) {
18 return {cb.begin(), cb.size()};
19 }
20
22 template <typename A>
23 const A &removeIndirection(const A &a) {
24 return a;
25 }
26 template <typename A>
27 const A &removeIndirection(const Fortran::common::Indirection<A> &a) {
28 return a.value();
29 }
30
31 #endif // FORTRAN_LOWER_UTILS_H
Fortran::common::Indirection
Definition: indirection.h:31
Fortran::parser::CharBlock
Definition: char-block.h:28