Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 1 | //===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===// |
| 2 | // |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 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 |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 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/Support/Casting.h" |
| 21 | #include <utility> |
| 22 | |
| 23 | namespace llvm { |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 24 | // ADT's. |
| 25 | class raw_ostream; |
| 26 | class Error; |
| 27 | class StringRef; |
| 28 | class Twine; |
| 29 | class MemoryBuffer; |
| 30 | class MemoryBufferRef; |
| 31 | template <typename T> class ArrayRef; |
| 32 | template <unsigned InternalLen> class SmallString; |
| 33 | template <typename T, unsigned N> class SmallVector; |
| 34 | template <typename T> class ErrorOr; |
| 35 | template <typename T> class Expected; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 36 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 37 | namespace object { |
| 38 | class WasmObjectFile; |
| 39 | struct WasmSection; |
| 40 | struct WasmSegment; |
| 41 | class WasmSymbol; |
| 42 | } // namespace object |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 43 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 44 | namespace wasm { |
| 45 | struct WasmEvent; |
| 46 | struct WasmEventType; |
| 47 | struct WasmFunction; |
| 48 | struct WasmGlobal; |
| 49 | struct WasmGlobalType; |
| 50 | struct WasmRelocation; |
| 51 | struct WasmSignature; |
| 52 | } // namespace wasm |
| 53 | } // namespace llvm |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 54 | |
| 55 | namespace lld { |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 56 | // Casting operators. |
| 57 | using llvm::cast; |
| 58 | using llvm::cast_or_null; |
| 59 | using llvm::dyn_cast; |
| 60 | using llvm::dyn_cast_or_null; |
| 61 | using llvm::isa; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 62 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 63 | // ADT's. |
| 64 | using llvm::ArrayRef; |
| 65 | using llvm::Error; |
| 66 | using llvm::ErrorOr; |
| 67 | using llvm::Expected; |
| 68 | using llvm::MemoryBuffer; |
| 69 | using llvm::MemoryBufferRef; |
| 70 | using llvm::raw_ostream; |
| 71 | using llvm::SmallString; |
| 72 | using llvm::SmallVector; |
| 73 | using llvm::StringRef; |
| 74 | using llvm::Twine; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 75 | |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 76 | using llvm::object::WasmObjectFile; |
| 77 | using llvm::object::WasmSection; |
| 78 | using llvm::object::WasmSegment; |
| 79 | using llvm::object::WasmSymbol; |
| 80 | using llvm::wasm::WasmEvent; |
| 81 | using llvm::wasm::WasmEventType; |
| 82 | using llvm::wasm::WasmFunction; |
| 83 | using llvm::wasm::WasmGlobal; |
| 84 | using llvm::wasm::WasmGlobalType; |
| 85 | using llvm::wasm::WasmRelocation; |
| 86 | using llvm::wasm::WasmSignature; |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 87 | } // end namespace lld. |
| 88 | |
| 89 | namespace std { |
| 90 | template <> struct hash<llvm::StringRef> { |
| 91 | public: |
| 92 | size_t operator()(const llvm::StringRef &s) const { |
| 93 | return llvm::hash_value(s); |
| 94 | } |
| 95 | }; |
Andrew Walbran | 16937d0 | 2019-10-22 13:54:20 +0100 | [diff] [blame] | 96 | } // namespace std |
Andrew Scull | 5e1ddfa | 2018-08-14 10:06:54 +0100 | [diff] [blame] | 97 | |
| 98 | #endif |