blob: 944bb412a2e629685ee857bae6d41d81dcdd2002 [file] [log] [blame]
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01001//===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===//
2//
Andrew Walbran16937d02019-10-22 13:54:20 +01003// 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
Andrew Scull5e1ddfa2018-08-14 10:06:54 +01006//
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/Support/Casting.h"
21#include <utility>
22
23namespace llvm {
Andrew Walbran16937d02019-10-22 13:54:20 +010024// ADT's.
25class raw_ostream;
26class Error;
27class StringRef;
28class Twine;
29class MemoryBuffer;
30class MemoryBufferRef;
31template <typename T> class ArrayRef;
32template <unsigned InternalLen> class SmallString;
33template <typename T, unsigned N> class SmallVector;
34template <typename T> class ErrorOr;
35template <typename T> class Expected;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010036
Andrew Walbran16937d02019-10-22 13:54:20 +010037namespace object {
38class WasmObjectFile;
39struct WasmSection;
40struct WasmSegment;
41class WasmSymbol;
42} // namespace object
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010043
Andrew Walbran16937d02019-10-22 13:54:20 +010044namespace wasm {
45struct WasmEvent;
46struct WasmEventType;
47struct WasmFunction;
48struct WasmGlobal;
49struct WasmGlobalType;
50struct WasmRelocation;
51struct WasmSignature;
52} // namespace wasm
53} // namespace llvm
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010054
55namespace lld {
Andrew Walbran16937d02019-10-22 13:54:20 +010056// Casting operators.
57using llvm::cast;
58using llvm::cast_or_null;
59using llvm::dyn_cast;
60using llvm::dyn_cast_or_null;
61using llvm::isa;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010062
Andrew Walbran16937d02019-10-22 13:54:20 +010063// ADT's.
64using llvm::ArrayRef;
65using llvm::Error;
66using llvm::ErrorOr;
67using llvm::Expected;
68using llvm::MemoryBuffer;
69using llvm::MemoryBufferRef;
70using llvm::raw_ostream;
71using llvm::SmallString;
72using llvm::SmallVector;
73using llvm::StringRef;
74using llvm::Twine;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010075
Andrew Walbran16937d02019-10-22 13:54:20 +010076using llvm::object::WasmObjectFile;
77using llvm::object::WasmSection;
78using llvm::object::WasmSegment;
79using llvm::object::WasmSymbol;
80using llvm::wasm::WasmEvent;
81using llvm::wasm::WasmEventType;
82using llvm::wasm::WasmFunction;
83using llvm::wasm::WasmGlobal;
84using llvm::wasm::WasmGlobalType;
85using llvm::wasm::WasmRelocation;
86using llvm::wasm::WasmSignature;
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010087} // end namespace lld.
88
89namespace std {
90template <> struct hash<llvm::StringRef> {
91public:
92 size_t operator()(const llvm::StringRef &s) const {
93 return llvm::hash_value(s);
94 }
95};
Andrew Walbran16937d02019-10-22 13:54:20 +010096} // namespace std
Andrew Scull5e1ddfa2018-08-14 10:06:54 +010097
98#endif