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