LLVM.h revision 326947
1//===--- LLVM.h - Import various common LLVM datatypes ----------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9// 10// This file forward declares and imports various common LLVM datatypes that 11// lld wants to use unqualified. 12// 13//===----------------------------------------------------------------------===// 14 15#ifndef LLD_COMMON_LLVM_H 16#define LLD_COMMON_LLVM_H 17 18// This should be the only #include, force #includes of all the others on 19// clients. 20#include "llvm/ADT/Hashing.h" 21#include "llvm/Support/Casting.h" 22#include <utility> 23 24namespace llvm { 25 // ADT's. 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 SmallVectorImpl; 35 36 template<typename T> 37 struct SaveAndRestore; 38 39 template<typename T> 40 class ErrorOr; 41 42 template<typename T> 43 class Expected; 44 45 class raw_ostream; 46 // TODO: DenseMap, ... 47} 48 49namespace lld { 50 // Casting operators. 51 using llvm::isa; 52 using llvm::cast; 53 using llvm::dyn_cast; 54 using llvm::dyn_cast_or_null; 55 using llvm::cast_or_null; 56 57 // ADT's. 58 using llvm::Error; 59 using llvm::StringRef; 60 using llvm::Twine; 61 using llvm::MemoryBuffer; 62 using llvm::MemoryBufferRef; 63 using llvm::ArrayRef; 64 using llvm::SmallString; 65 using llvm::SmallVector; 66 using llvm::SmallVectorImpl; 67 using llvm::SaveAndRestore; 68 using llvm::ErrorOr; 69 using llvm::Expected; 70 71 using llvm::raw_ostream; 72} // end namespace lld. 73 74namespace std { 75template <> struct hash<llvm::StringRef> { 76public: 77 size_t operator()(const llvm::StringRef &s) const { 78 return llvm::hash_value(s); 79 } 80}; 81} 82 83#endif 84