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