1//===--- LLVM.h - Import various common LLVM datatypes ----------*- 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// lld wants to use unqualified.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLD_COMMON_LLVM_H
15#define LLD_COMMON_LLVM_H
16
17// This should be the only #include, force #includes of all the others on
18// clients.
19#include "llvm/ADT/Hashing.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/Support/Casting.h"
22#include <utility>
23
24namespace llvm {
25// ADT's.
26class raw_ostream;
27class Error;
28class StringRef;
29class Twine;
30class MemoryBuffer;
31class MemoryBufferRef;
32template <typename T> class ArrayRef;
33template <typename T> class MutableArrayRef;
34template <unsigned InternalLen> class SmallString;
35template <typename T, unsigned N> class SmallVector;
36template <typename T> class ErrorOr;
37template <typename T> class Expected;
38
39namespace object {
40class WasmObjectFile;
41struct WasmSection;
42struct WasmSegment;
43class WasmSymbol;
44} // namespace object
45
46namespace wasm {
47struct WasmEvent;
48struct WasmEventType;
49struct WasmFunction;
50struct WasmGlobal;
51struct WasmGlobalType;
52struct WasmRelocation;
53struct WasmSignature;
54} // namespace wasm
55} // namespace llvm
56
57namespace lld {
58llvm::raw_ostream &outs();
59llvm::raw_ostream &errs();
60
61// Casting operators.
62using llvm::cast;
63using llvm::cast_or_null;
64using llvm::dyn_cast;
65using llvm::dyn_cast_or_null;
66using llvm::isa;
67
68// ADT's.
69using llvm::ArrayRef;
70using llvm::MutableArrayRef;
71using llvm::Error;
72using llvm::ErrorOr;
73using llvm::Expected;
74using llvm::MemoryBuffer;
75using llvm::MemoryBufferRef;
76using llvm::raw_ostream;
77using llvm::SmallString;
78using llvm::SmallVector;
79using llvm::StringRef;
80using llvm::Twine;
81
82using llvm::object::WasmObjectFile;
83using llvm::object::WasmSection;
84using llvm::object::WasmSegment;
85using llvm::object::WasmSymbol;
86using llvm::wasm::WasmEvent;
87using llvm::wasm::WasmEventType;
88using llvm::wasm::WasmFunction;
89using llvm::wasm::WasmGlobal;
90using llvm::wasm::WasmGlobalType;
91using llvm::wasm::WasmRelocation;
92using llvm::wasm::WasmSignature;
93} // end namespace lld.
94
95namespace std {
96template <> struct hash<llvm::StringRef> {
97public:
98  size_t operator()(const llvm::StringRef &s) const {
99    return llvm::hash_value(s);
100  }
101};
102} // namespace std
103
104#endif
105