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 24 namespace llvm { 25 // ADT's. 26 class raw_ostream; 27 class Error; 28 class StringRef; 29 class Twine; 30 class MemoryBuffer; 31 class MemoryBufferRef; 32 template <typename T> class ArrayRef; 33 template <typename T> class MutableArrayRef; 34 template <unsigned InternalLen> class SmallString; 35 template <typename T, unsigned N> class SmallVector; 36 template <typename T> class ErrorOr; 37 template <typename T> class Expected; 38 39 namespace object { 40 class WasmObjectFile; 41 struct WasmSection; 42 struct WasmSegment; 43 class WasmSymbol; 44 } // namespace object 45 46 namespace wasm { 47 struct WasmTag; 48 struct WasmFunction; 49 struct WasmGlobal; 50 struct WasmGlobalType; 51 struct WasmInitExpr; 52 struct WasmLimits; 53 struct WasmRelocation; 54 struct WasmSignature; 55 struct WasmTable; 56 struct WasmTableType; 57 } // namespace wasm 58 } // namespace llvm 59 60 namespace lld { 61 llvm::raw_ostream &outs(); 62 llvm::raw_ostream &errs(); 63 64 // Casting operators. 65 using llvm::cast; 66 using llvm::cast_or_null; 67 using llvm::dyn_cast; 68 using llvm::dyn_cast_or_null; 69 using llvm::isa; 70 71 // ADT's. 72 using llvm::ArrayRef; 73 using llvm::MutableArrayRef; 74 using llvm::Error; 75 using llvm::ErrorOr; 76 using llvm::Expected; 77 using llvm::MemoryBuffer; 78 using llvm::MemoryBufferRef; 79 using llvm::raw_ostream; 80 using llvm::SmallString; 81 using llvm::SmallVector; 82 using llvm::StringRef; 83 using llvm::Twine; 84 85 using llvm::object::WasmObjectFile; 86 using llvm::object::WasmSection; 87 using llvm::object::WasmSegment; 88 using llvm::object::WasmSymbol; 89 using llvm::wasm::WasmFunction; 90 using llvm::wasm::WasmGlobal; 91 using llvm::wasm::WasmGlobalType; 92 using llvm::wasm::WasmInitExpr; 93 using llvm::wasm::WasmLimits; 94 using llvm::wasm::WasmRelocation; 95 using llvm::wasm::WasmSignature; 96 using llvm::wasm::WasmTable; 97 using llvm::wasm::WasmTableType; 98 using llvm::wasm::WasmTag; 99 } // end namespace lld. 100 101 namespace std { 102 template <> struct hash<llvm::StringRef> { 103 public: 104 size_t operator()(const llvm::StringRef &s) const { 105 return llvm::hash_value(s); 106 } 107 }; 108 } // namespace std 109 110 #endif 111