MLIR  19.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 this header because it cannot be practically forward
22 // declared, and are effectively language features.
23 #include "llvm/Support/Casting.h"
24 #include <vector>
25 
26 // Workaround for clang-5 (PR41549)
27 #if defined(__clang_major__)
28 #if __clang_major__ <= 5
29 #include "llvm/ADT/DenseMapInfo.h"
30 #include "llvm/ADT/SmallVector.h"
31 #endif
32 #endif
33 
34 // Forward declarations.
35 namespace llvm {
36 // String types
37 template <unsigned N>
39 class StringRef;
40 class StringLiteral;
41 class Twine;
42 
43 // Containers.
44 template <typename T>
45 class ArrayRef;
46 class BitVector;
47 namespace detail {
48 template <typename KeyT, typename ValueT>
49 struct DenseMapPair;
50 } // namespace detail
51 template <typename KeyT, typename ValueT, typename KeyInfoT, typename BucketT>
52 class DenseMap;
53 template <typename T, typename Enable>
54 struct DenseMapInfo;
55 template <typename ValueT, typename ValueInfoT>
56 class DenseSet;
57 class MallocAllocator;
58 template <typename T>
60 template <typename... PT>
62 template <typename T, typename Vector, typename Set, unsigned N>
63 class SetVector;
64 template <typename T, unsigned N>
66 template <typename T>
68 template <typename T, unsigned N>
70 template <typename T>
72 template <typename AllocatorTy>
73 class StringSet;
74 template <typename T, typename R>
76 template <typename T>
78 template <typename T, typename ResultT>
79 class TypeSwitch;
80 
81 // Other common classes.
82 class APInt;
83 class APSInt;
84 class APFloat;
85 template <typename Fn>
87 template <typename IteratorT>
89 class raw_ostream;
90 class SMLoc;
91 class SMRange;
92 } // namespace llvm
93 
94 namespace mlir {
95 // Casting operators.
96 using llvm::cast;
97 using llvm::cast_if_present;
98 using llvm::cast_or_null;
99 using llvm::dyn_cast;
100 using llvm::dyn_cast_if_present;
101 using llvm::dyn_cast_or_null;
102 using llvm::isa;
103 using llvm::isa_and_nonnull;
104 using llvm::isa_and_present;
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 = llvm::SmallVector<T, 0>,
126  typename Set = DenseSet<T>, unsigned N = 0>
128 template <typename AllocatorTy = llvm::MallocAllocator>
131 using llvm::PointerUnion;
132 using llvm::SmallPtrSet;
134 using llvm::SmallVector;
136 template <typename T, typename R = T>
138 using llvm::TinyPtrVector;
139 template <typename T, typename ResultT = void>
141 
142 // Other common classes.
143 using llvm::APFloat;
144 using llvm::APInt;
145 using llvm::APSInt;
146 template <typename Fn>
149 using llvm::raw_ostream;
150 using llvm::SMLoc;
151 using llvm::SMRange;
152 } // namespace mlir
153 
154 #endif // MLIR_SUPPORT_LLVM_H
Include the generated interface declarations.
Definition: CallGraph.h:229
Include the generated interface declarations.