MLIR  17.0.0git
LLVM.h
Go to the documentation of this file.
1 //===- LLVM.h - Import and forward declare core LLVM types ------*- 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 // This file forward declares and imports various common LLVM datatypes that
10 // MLIR wants to use unqualified.
11 //
12 // Note that most of these are forward declared and then imported into the MLIR
13 // namespace with using decls, rather than being #included. This is because we
14 // want clients to explicitly #include the files they need.
15 //
16 //===----------------------------------------------------------------------===//
17 
18 #ifndef MLIR_SUPPORT_LLVM_H
19 #define MLIR_SUPPORT_LLVM_H
20 
21 // We include these two headers because they cannot be practically forward
22 // declared, and are effectively language features.
23 #include "llvm/ADT/None.h"
24 #include "llvm/Support/Casting.h"
25 #include <vector>
26 
27 // Workaround for clang-5 (PR41549)
28 #if defined(__clang_major__)
29 #if __clang_major__ <= 5
30 #include "llvm/ADT/DenseMapInfo.h"
31 #include "llvm/ADT/SmallVector.h"
32 #endif
33 #endif
34 
35 // Forward declarations.
36 namespace llvm {
37 // String types
38 template <unsigned N>
40 class StringRef;
41 class StringLiteral;
42 class Twine;
43 
44 // Containers.
45 template <typename T>
46 class ArrayRef;
47 class BitVector;
48 namespace detail {
49 template <typename KeyT, typename ValueT>
50 struct DenseMapPair;
51 } // namespace detail
52 template <typename KeyT, typename ValueT, typename KeyInfoT, typename BucketT>
53 class DenseMap;
54 template <typename T, typename Enable>
55 struct DenseMapInfo;
56 template <typename ValueT, typename ValueInfoT>
57 class DenseSet;
58 class MallocAllocator;
59 template <typename T>
61 template <typename T> using Optional = std::optional<T>;
62 template <typename... PT>
64 template <typename T, typename Vector, typename Set>
65 class SetVector;
66 template <typename T, unsigned N>
68 template <typename T>
70 template <typename T, unsigned N>
72 template <typename T>
74 template <typename AllocatorTy>
75 class StringSet;
76 template <typename T, typename R>
78 template <typename T>
80 template <typename T, typename ResultT>
81 class TypeSwitch;
82 
83 // Other common classes.
84 class APInt;
85 class APSInt;
86 class APFloat;
87 template <typename Fn>
89 template <typename IteratorT>
91 class raw_ostream;
92 class SMLoc;
93 class SMRange;
94 } // namespace llvm
95 
96 namespace mlir {
97 // Casting operators.
98 using llvm::cast;
99 using llvm::cast_or_null;
100 using llvm::dyn_cast;
101 using llvm::dyn_cast_if_present;
102 using llvm::dyn_cast_or_null;
103 using llvm::isa;
104 using llvm::isa_and_nonnull;
105 
106 // String types
107 using llvm::SmallString;
108 using llvm::StringLiteral;
109 using llvm::StringRef;
110 using llvm::Twine;
111 
112 // Container Related types
113 //
114 // Containers.
115 using llvm::ArrayRef;
116 using llvm::BitVector;
117 template <typename T, typename Enable = void>
119 template <typename KeyT, typename ValueT,
120  typename KeyInfoT = DenseMapInfo<KeyT>,
121  typename BucketT = llvm::detail::DenseMapPair<KeyT, ValueT>>
123 template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
125 template <typename T, typename Vector = std::vector<T>,
126  typename Set = DenseSet<T>>
128 template <typename AllocatorTy = llvm::MallocAllocator>
131 using llvm::Optional;
132 using llvm::PointerUnion;
133 using llvm::SmallPtrSet;
135 using llvm::SmallVector;
137 template <typename T, typename R = T>
139 using llvm::TinyPtrVector;
140 template <typename T, typename ResultT = void>
142 
143 // Other common classes.
144 using llvm::APFloat;
145 using llvm::APInt;
146 using llvm::APSInt;
147 template <typename Fn>
150 using llvm::raw_ostream;
151 using llvm::SMLoc;
152 using llvm::SMRange;
153 } // namespace mlir
154 
155 #endif // MLIR_SUPPORT_LLVM_H
Include the generated interface declarations.
Definition: CallGraph.h:229
std::optional< T > Optional
Definition: LLVM.h:61
Include the generated interface declarations.