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 WasmInitExpr;
53struct WasmLimits;
54struct WasmRelocation;
55struct WasmSignature;
56struct WasmTable;
57struct WasmTableType;
58} // namespace wasm
59} // namespace llvm
60
61namespace lld {
62llvm::raw_ostream &outs();
63llvm::raw_ostream &errs();
64
65// Casting operators.
66using llvm::cast;
67using llvm::cast_or_null;
68using llvm::dyn_cast;
69using llvm::dyn_cast_or_null;
70using llvm::isa;
71
72// ADT's.
73using llvm::ArrayRef;
74using llvm::MutableArrayRef;
75using llvm::Error;
76using llvm::ErrorOr;
77using llvm::Expected;
78using llvm::MemoryBuffer;
79using llvm::MemoryBufferRef;
80using llvm::raw_ostream;
81using llvm::SmallString;
82using llvm::SmallVector;
83using llvm::StringRef;
84using llvm::Twine;
85
86using llvm::object::WasmObjectFile;
87using llvm::object::WasmSection;
88using llvm::object::WasmSegment;
89using llvm::object::WasmSymbol;
90using llvm::wasm::WasmEvent;
91using llvm::wasm::WasmEventType;
92using llvm::wasm::WasmFunction;
93using llvm::wasm::WasmGlobal;
94using llvm::wasm::WasmGlobalType;
95using llvm::wasm::WasmInitExpr;
96using llvm::wasm::WasmLimits;
97using llvm::wasm::WasmRelocation;
98using llvm::wasm::WasmSignature;
99using llvm::wasm::WasmTable;
100using llvm::wasm::WasmTableType;
101} // end namespace lld.
102
103namespace std {
104template <> struct hash<llvm::StringRef> {
105public:
106 size_t operator()(const llvm::StringRef &s) const {
107 return llvm::hash_value(s);
108 }
109};
110} // namespace std
111
112#endif
113