MLIR  14.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> class SmallString;
39 class StringRef;
40 class StringLiteral;
41 class Twine;
42 
43 // Containers.
44 template <typename T> class ArrayRef;
45 namespace detail {
46 template <typename KeyT, typename ValueT> struct DenseMapPair;
47 } // namespace detail
48 template <typename KeyT, typename ValueT, typename KeyInfoT, typename BucketT>
49 class DenseMap;
50 template <typename T, typename Enable> struct DenseMapInfo;
51 template <typename ValueT, typename ValueInfoT> class DenseSet;
52 class MallocAllocator;
53 template <typename T> class MutableArrayRef;
54 template <typename T> class Optional;
55 template <typename... PT> class PointerUnion;
56 template <typename T, typename Vector, typename Set> class SetVector;
57 template <typename T, unsigned N> class SmallPtrSet;
58 template <typename T> class SmallPtrSetImpl;
59 template <typename T, unsigned N> class SmallVector;
60 template <typename T> class SmallVectorImpl;
61 template <typename AllocatorTy> class StringSet;
62 template <typename T, typename R> class StringSwitch;
63 template <typename T> class TinyPtrVector;
64 template <typename T, typename ResultT> class TypeSwitch;
65 
66 // Other common classes.
67 class APInt;
68 class APSInt;
69 class APFloat;
70 template <typename Fn> class function_ref;
71 template <typename IteratorT> class iterator_range;
72 class raw_ostream;
73 } // namespace llvm
74 
75 namespace mlir {
76 // Casting operators.
77 using llvm::cast;
78 using llvm::cast_or_null;
79 using llvm::dyn_cast;
80 using llvm::dyn_cast_or_null;
81 using llvm::isa;
82 using llvm::isa_and_nonnull;
83 
84 // String types
85 using llvm::SmallString;
86 using llvm::StringLiteral;
87 using llvm::StringRef;
88 using llvm::Twine;
89 
90 // Container Related types
91 //
92 // Containers.
93 using llvm::ArrayRef;
94 template <typename T, typename Enable = void>
96 template <typename KeyT, typename ValueT,
97  typename KeyInfoT = DenseMapInfo<KeyT>,
100 template <typename ValueT, typename ValueInfoT = DenseMapInfo<ValueT>>
102 template <typename T, typename Vector = std::vector<T>,
103  typename Set = DenseSet<T>>
105 template <typename AllocatorTy = llvm::MallocAllocator>
108 using llvm::None;
109 using llvm::Optional;
110 using llvm::PointerUnion;
111 using llvm::SmallPtrSet;
113 using llvm::SmallVector;
115 template <typename T, typename R = T>
117 using llvm::TinyPtrVector;
118 template <typename T, typename ResultT = void>
120 
121 // Other common classes.
122 using llvm::APFloat;
123 using llvm::APInt;
124 using llvm::APSInt;
125 template <typename Fn> using function_ref = llvm::function_ref<Fn>;
127 using llvm::raw_ostream;
128 } // namespace mlir
129 
130 #endif // MLIR_SUPPORT_LLVM_H
Include the generated interface declarations.