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 /// \file 10 /// Forward-declares and imports various common LLVM datatypes that 11 /// clang wants to use unqualified. 12 /// 13 //===----------------------------------------------------------------------===// 14 15 #ifndef LLVM_CLANG_BASIC_LLVM_H 16 #define LLVM_CLANG_BASIC_LLVM_H 17 18 // Do not proliferate #includes here, require clients to #include their 19 // dependencies. 20 // Casting.h has complex templates that cannot be easily forward declared. 21 #include "llvm/Support/Casting.h" 22 // None.h includes an enumerator that is desired & cannot be forward declared 23 // without a definition of NoneType. 24 #include "llvm/ADT/None.h" 25 // Add this header as a workaround to prevent `too few template arguments for 26 // class template 'SmallVector'` building error with build compilers like XL. 27 #include "llvm/ADT/SmallVector.h" 28 29 namespace llvm { 30 // ADT's. 31 class StringRef; 32 class Twine; 33 class VersionTuple; 34 template<typename T> class ArrayRef; 35 template<typename T> class MutableArrayRef; 36 template<typename T> class OwningArrayRef; 37 template<unsigned InternalLen> class SmallString; 38 template<typename T, unsigned N> class SmallVector; 39 template<typename T> class SmallVectorImpl; 40 template<typename T> class Optional; 41 template <class T> class Expected; 42 43 template<typename T> 44 struct SaveAndRestore; 45 46 // Reference counting. 47 template <typename T> class IntrusiveRefCntPtr; 48 template <typename T> struct IntrusiveRefCntPtrInfo; 49 template <class Derived> class RefCountedBase; 50 51 class raw_ostream; 52 class raw_pwrite_stream; 53 // TODO: DenseMap, ... 54 } 55 56 57 namespace clang { 58 // Casting operators. 59 using llvm::isa; 60 using llvm::isa_and_nonnull; 61 using llvm::cast; 62 using llvm::dyn_cast; 63 using llvm::dyn_cast_or_null; 64 using llvm::cast_or_null; 65 66 // ADT's. 67 using llvm::ArrayRef; 68 using llvm::MutableArrayRef; 69 using llvm::None; 70 using llvm::Optional; 71 using llvm::OwningArrayRef; 72 using llvm::SaveAndRestore; 73 using llvm::SmallString; 74 using llvm::SmallVector; 75 using llvm::SmallVectorImpl; 76 using llvm::StringRef; 77 using llvm::Twine; 78 using llvm::VersionTuple; 79 80 // Error handling. 81 using llvm::Expected; 82 83 // Reference counting. 84 using llvm::IntrusiveRefCntPtr; 85 using llvm::IntrusiveRefCntPtrInfo; 86 using llvm::RefCountedBase; 87 88 using llvm::raw_ostream; 89 using llvm::raw_pwrite_stream; 90 } // end namespace clang. 91 92 #endif 93