diff options
Diffstat (limited to 'llvm/include/llvm/Support')
37 files changed, 114 insertions, 116 deletions
diff --git a/llvm/include/llvm/Support/Allocator.h b/llvm/include/llvm/Support/Allocator.h index bc02659..fffcbd9 100644 --- a/llvm/include/llvm/Support/Allocator.h +++ b/llvm/include/llvm/Support/Allocator.h @@ -380,7 +380,7 @@ private: /// The standard BumpPtrAllocator which just uses the default template /// parameters. -typedef BumpPtrAllocatorImpl<> BumpPtrAllocator; +using BumpPtrAllocator = BumpPtrAllocatorImpl<>; /// A BumpPtrAllocator that allows only elements of a specific type to be /// allocated. diff --git a/llvm/include/llvm/Support/Atomic.h b/llvm/include/llvm/Support/Atomic.h index c2d9ae2..3c62672 100644 --- a/llvm/include/llvm/Support/Atomic.h +++ b/llvm/include/llvm/Support/Atomic.h @@ -30,9 +30,9 @@ namespace llvm { LLVM_ABI void MemoryFence(); #ifdef _MSC_VER - typedef long cas_flag; + using cas_flag = long; #else - typedef uint32_t cas_flag; + using cas_flag = uint32_t; #endif LLVM_ABI cas_flag CompareAndSwap(volatile cas_flag *ptr, cas_flag new_value, cas_flag old_value); diff --git a/llvm/include/llvm/Support/BinaryStreamArray.h b/llvm/include/llvm/Support/BinaryStreamArray.h index ef2233c..a7d03f6 100644 --- a/llvm/include/llvm/Support/BinaryStreamArray.h +++ b/llvm/include/llvm/Support/BinaryStreamArray.h @@ -93,7 +93,7 @@ class VarStreamArray { friend class VarStreamArrayIterator<ValueType, Extractor>; public: - typedef VarStreamArrayIterator<ValueType, Extractor> Iterator; + using Iterator = VarStreamArrayIterator<ValueType, Extractor>; VarStreamArray() = default; @@ -156,8 +156,8 @@ template <typename ValueType, typename Extractor> class VarStreamArrayIterator : public iterator_facade_base<VarStreamArrayIterator<ValueType, Extractor>, std::forward_iterator_tag, const ValueType> { - typedef VarStreamArrayIterator<ValueType, Extractor> IterType; - typedef VarStreamArray<ValueType, Extractor> ArrayType; + using IterType = VarStreamArrayIterator<ValueType, Extractor>; + using ArrayType = VarStreamArray<ValueType, Extractor>; public: VarStreamArrayIterator(const ArrayType &Array, const Extractor &E, @@ -260,7 +260,7 @@ template <typename T> class FixedStreamArray { friend class FixedStreamArrayIterator<T>; public: - typedef FixedStreamArrayIterator<T> Iterator; + using Iterator = FixedStreamArrayIterator<T>; FixedStreamArray() = default; explicit FixedStreamArray(BinaryStreamRef Stream) : Stream(Stream) { diff --git a/llvm/include/llvm/Support/Chrono.h b/llvm/include/llvm/Support/Chrono.h index 5b8102d..e5f98249 100644 --- a/llvm/include/llvm/Support/Chrono.h +++ b/llvm/include/llvm/Support/Chrono.h @@ -150,10 +150,10 @@ template <> struct unit<std::nano> { template <typename Rep, typename Period> struct format_provider<std::chrono::duration<Rep, Period>> { private: - typedef std::chrono::duration<Rep, Period> Dur; - typedef std::conditional_t<std::chrono::treat_as_floating_point<Rep>::value, - double, intmax_t> - InternalRep; + using Dur = std::chrono::duration<Rep, Period>; + using InternalRep = + std::conditional_t<std::chrono::treat_as_floating_point<Rep>::value, + double, intmax_t>; template <typename AsPeriod> static InternalRep getAs(const Dur &D) { using namespace std::chrono; diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h index 5a5f00e..d737fbc 100644 --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -2099,7 +2099,7 @@ getRegisteredOptions(SubCommand &Sub = SubCommand::getTopLevel()); /// /// This interface is useful for defining subcommands in libraries and /// the dispatch from a single point (like in the main function). -LLVM_ABI iterator_range<typename SmallPtrSet<SubCommand *, 4>::iterator> +LLVM_ABI iterator_range<SmallPtrSet<SubCommand *, 4>::iterator> getRegisteredSubcommands(); //===----------------------------------------------------------------------===// diff --git a/llvm/include/llvm/Support/ConvertUTF.h b/llvm/include/llvm/Support/ConvertUTF.h index bb17235..ddf7057 100644 --- a/llvm/include/llvm/Support/ConvertUTF.h +++ b/llvm/include/llvm/Support/ConvertUTF.h @@ -126,10 +126,10 @@ namespace llvm { bit mask & shift operations. ------------------------------------------------------------------------ */ -typedef unsigned int UTF32; /* at least 32 bits */ -typedef unsigned short UTF16; /* at least 16 bits */ -typedef unsigned char UTF8; /* typically 8 bits */ -typedef unsigned char Boolean; /* 0 or 1 */ +using UTF32 = unsigned int; /* at least 32 bits */ +using UTF16 = unsigned short; /* at least 16 bits */ +using UTF8 = unsigned char; /* typically 8 bits */ +using Boolean = unsigned char; /* 0 or 1 */ /* Some fundamental constants */ #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD @@ -146,17 +146,14 @@ typedef unsigned char Boolean; /* 0 or 1 */ #define UNI_UTF32_BYTE_ORDER_MARK_NATIVE 0x0000FEFF #define UNI_UTF32_BYTE_ORDER_MARK_SWAPPED 0xFFFE0000 -typedef enum { - conversionOK, /* conversion successful */ - sourceExhausted, /* partial character in source, but hit end */ - targetExhausted, /* insuff. room in target for conversion */ - sourceIllegal /* source sequence is illegal/malformed */ -} ConversionResult; - -typedef enum { - strictConversion = 0, - lenientConversion -} ConversionFlags; +enum ConversionResult { + conversionOK, /* conversion successful */ + sourceExhausted, /* partial character in source, but hit end */ + targetExhausted, /* insuff. room in target for conversion */ + sourceIllegal /* source sequence is illegal/malformed */ +}; + +enum ConversionFlags { strictConversion = 0, lenientConversion }; LLVM_ABI ConversionResult ConvertUTF8toUTF16(const UTF8 **sourceStart, const UTF8 *sourceEnd, diff --git a/llvm/include/llvm/Support/DebugCounter.h b/llvm/include/llvm/Support/DebugCounter.h index 39a08d4..9904a0d 100644 --- a/llvm/include/llvm/Support/DebugCounter.h +++ b/llvm/include/llvm/Support/DebugCounter.h @@ -140,7 +140,7 @@ public: } // Iterate through the registered counters - typedef UniqueVector<std::string> CounterVector; + using CounterVector = UniqueVector<std::string>; CounterVector::const_iterator begin() const { return RegisteredCounters.begin(); } diff --git a/llvm/include/llvm/Support/ELFAttributeParser.h b/llvm/include/llvm/Support/ELFAttributeParser.h index 97350ed..c2ad812 100644 --- a/llvm/include/llvm/Support/ELFAttributeParser.h +++ b/llvm/include/llvm/Support/ELFAttributeParser.h @@ -17,7 +17,7 @@ namespace llvm { class ELFAttributeParser { public: - virtual ~ELFAttributeParser() {} + virtual ~ELFAttributeParser() = default; virtual Error parse(ArrayRef<uint8_t> Section, llvm::endianness Endian) { return llvm::Error::success(); diff --git a/llvm/include/llvm/Support/ErrorHandling.h b/llvm/include/llvm/Support/ErrorHandling.h index 4c17b6e8..a4fd008 100644 --- a/llvm/include/llvm/Support/ErrorHandling.h +++ b/llvm/include/llvm/Support/ErrorHandling.h @@ -21,8 +21,8 @@ class StringRef; class Twine; /// An error handler callback. -typedef void (*fatal_error_handler_t)(void *user_data, const char *reason, - bool gen_crash_diag); +using fatal_error_handler_t = void (*)(void *user_data, const char *reason, + bool gen_crash_diag); /// install_fatal_error_handler - Installs a new error handler to be used /// whenever a serious (non-recoverable) error is encountered by LLVM. diff --git a/llvm/include/llvm/Support/FormatProviders.h b/llvm/include/llvm/Support/FormatProviders.h index 8eaa5e38..3377781 100644 --- a/llvm/include/llvm/Support/FormatProviders.h +++ b/llvm/include/llvm/Support/FormatProviders.h @@ -261,7 +261,7 @@ template <> struct format_provider<bool> { .Case("y", B ? "yes" : "no") .CaseLower("D", B ? "1" : "0") .Case("T", B ? "TRUE" : "FALSE") - .Cases("t", "", B ? "true" : "false") + .Cases({"t", ""}, B ? "true" : "false") .Default(B ? "1" : "0"); } }; diff --git a/llvm/include/llvm/Support/FormatVariadicDetails.h b/llvm/include/llvm/Support/FormatVariadicDetails.h index 0fdc7b6..c0b245e 100644 --- a/llvm/include/llvm/Support/FormatVariadicDetails.h +++ b/llvm/include/llvm/Support/FormatVariadicDetails.h @@ -63,8 +63,8 @@ template <typename T> class missing_format_adapter; template <class T> class has_FormatProvider { public: using Decayed = std::decay_t<T>; - typedef void (*Signature_format)(const Decayed &, llvm::raw_ostream &, - StringRef); + using Signature_format = void (*)(const Decayed &, llvm::raw_ostream &, + StringRef); template <typename U> using check = SameType<Signature_format, &U::format>; diff --git a/llvm/include/llvm/Support/GenericLoopInfo.h b/llvm/include/llvm/Support/GenericLoopInfo.h index b6bb360..9e2f61f 100644 --- a/llvm/include/llvm/Support/GenericLoopInfo.h +++ b/llvm/include/llvm/Support/GenericLoopInfo.h @@ -150,9 +150,9 @@ public: assert(!isInvalid() && "Loop not in a valid state!"); return SubLoops; } - typedef typename std::vector<LoopT *>::const_iterator iterator; - typedef - typename std::vector<LoopT *>::const_reverse_iterator reverse_iterator; + using iterator = typename std::vector<LoopT *>::const_iterator; + using reverse_iterator = + typename std::vector<LoopT *>::const_reverse_iterator; iterator begin() const { return getSubLoops().begin(); } iterator end() const { return getSubLoops().end(); } reverse_iterator rbegin() const { return getSubLoops().rbegin(); } @@ -174,7 +174,7 @@ public: assert(!isInvalid() && "Loop not in a valid state!"); return Blocks; } - typedef typename ArrayRef<BlockT *>::const_iterator block_iterator; + using block_iterator = typename ArrayRef<BlockT *>::const_iterator; block_iterator block_begin() const { return getBlocks().begin(); } block_iterator block_end() const { return getBlocks().end(); } inline iterator_range<block_iterator> blocks() const { @@ -302,7 +302,7 @@ public: bool hasNoExitBlocks() const; /// Edge type. - typedef std::pair<BlockT *, BlockT *> Edge; + using Edge = std::pair<BlockT *, BlockT *>; /// Return all pairs of (_inside_block_,_outside_block_). void getExitEdges(SmallVectorImpl<Edge> &ExitEdges) const; @@ -575,9 +575,9 @@ public: /// iterator/begin/end - The interface to the top-level loops in the current /// function. /// - typedef typename std::vector<LoopT *>::const_iterator iterator; - typedef - typename std::vector<LoopT *>::const_reverse_iterator reverse_iterator; + using iterator = typename std::vector<LoopT *>::const_iterator; + using reverse_iterator = + typename std::vector<LoopT *>::const_reverse_iterator; iterator begin() const { return TopLevelLoops.begin(); } iterator end() const { return TopLevelLoops.end(); } reverse_iterator rbegin() const { return TopLevelLoops.rbegin(); } diff --git a/llvm/include/llvm/Support/GenericLoopInfoImpl.h b/llvm/include/llvm/Support/GenericLoopInfoImpl.h index 5416780..c830f0a 100644 --- a/llvm/include/llvm/Support/GenericLoopInfoImpl.h +++ b/llvm/include/llvm/Support/GenericLoopInfoImpl.h @@ -459,7 +459,7 @@ template <class BlockT, class LoopT> static void discoverAndMapSubloop(LoopT *L, ArrayRef<BlockT *> Backedges, LoopInfoBase<BlockT, LoopT> *LI, const DomTreeBase<BlockT> &DomTree) { - typedef GraphTraits<Inverse<BlockT *>> InvBlockTraits; + using InvBlockTraits = GraphTraits<Inverse<BlockT *>>; unsigned NumBlocks = 0; unsigned NumSubloops = 0; @@ -513,8 +513,8 @@ static void discoverAndMapSubloop(LoopT *L, ArrayRef<BlockT *> Backedges, /// Populate all loop data in a stable order during a single forward DFS. template <class BlockT, class LoopT> class PopulateLoopsDFS { - typedef GraphTraits<BlockT *> BlockTraits; - typedef typename BlockTraits::ChildIteratorType SuccIterTy; + using BlockTraits = GraphTraits<BlockT *>; + using SuccIterTy = typename BlockTraits::ChildIteratorType; LoopInfoBase<BlockT, LoopT> *LI; diff --git a/llvm/include/llvm/Support/GraphWriter.h b/llvm/include/llvm/Support/GraphWriter.h index 3bef75c..43d9b0c 100644 --- a/llvm/include/llvm/Support/GraphWriter.h +++ b/llvm/include/llvm/Support/GraphWriter.h @@ -128,7 +128,7 @@ public: DTraits = DOTTraits(SN); RenderUsingHTML = DTraits.renderNodesUsingHTML(); } - virtual ~GraphWriterBase() {} + virtual ~GraphWriterBase() = default; void writeGraph(const std::string &Title = "") { // Output the header for the graph... @@ -369,7 +369,7 @@ class GraphWriter : public GraphWriterBase<GraphType, GraphWriter<GraphType>> { public: GraphWriter(raw_ostream &o, const GraphType &g, bool SN) : GraphWriterBase<GraphType, GraphWriter<GraphType>>(o, g, SN) {} - ~GraphWriter() override {} + ~GraphWriter() override = default; }; template <typename GraphType> diff --git a/llvm/include/llvm/Support/JSON.h b/llvm/include/llvm/Support/JSON.h index d8c6de4..37baa7b 100644 --- a/llvm/include/llvm/Support/JSON.h +++ b/llvm/include/llvm/Support/JSON.h @@ -154,7 +154,7 @@ public: LLVM_ABI const json::Array *getArray(StringRef K) const; LLVM_ABI json::Array *getArray(StringRef K); - friend bool operator==(const Object &LHS, const Object &RHS); + friend LLVM_ABI bool operator==(const Object &LHS, const Object &RHS); }; LLVM_ABI bool operator==(const Object &LHS, const Object &RHS); inline bool operator!=(const Object &LHS, const Object &RHS) { @@ -318,7 +318,7 @@ public: Value(std::string V) : Type(T_String) { if (LLVM_UNLIKELY(!isUTF8(V))) { assert(false && "Invalid UTF-8 in value used as JSON"); - V = fixUTF8(std::move(V)); + V = fixUTF8(V); } create<std::string>(std::move(V)); } @@ -549,10 +549,10 @@ inline const Value &Array::back() const { return V.back(); } inline Value *Array::data() { return V.data(); } inline const Value *Array::data() const { return V.data(); } -inline typename Array::iterator Array::begin() { return V.begin(); } -inline typename Array::const_iterator Array::begin() const { return V.begin(); } -inline typename Array::iterator Array::end() { return V.end(); } -inline typename Array::const_iterator Array::end() const { return V.end(); } +inline Array::iterator Array::begin() { return V.begin(); } +inline Array::const_iterator Array::begin() const { return V.begin(); } +inline Array::iterator Array::end() { return V.end(); } +inline Array::const_iterator Array::end() const { return V.end(); } inline bool Array::empty() const { return V.empty(); } inline size_t Array::size() const { return V.size(); } @@ -565,18 +565,18 @@ template <typename... Args> inline void Array::emplace_back(Args &&...A) { V.emplace_back(std::forward<Args>(A)...); } inline void Array::pop_back() { V.pop_back(); } -inline typename Array::iterator Array::insert(const_iterator P, const Value &E) { +inline Array::iterator Array::insert(const_iterator P, const Value &E) { return V.insert(P, E); } -inline typename Array::iterator Array::insert(const_iterator P, Value &&E) { +inline Array::iterator Array::insert(const_iterator P, Value &&E) { return V.insert(P, std::move(E)); } template <typename It> -inline typename Array::iterator Array::insert(const_iterator P, It A, It Z) { +inline Array::iterator Array::insert(const_iterator P, It A, It Z) { return V.insert(P, A, Z); } template <typename... Args> -inline typename Array::iterator Array::emplace(const_iterator P, Args &&...A) { +inline Array::iterator Array::emplace(const_iterator P, Args &&...A) { return V.emplace(P, std::forward<Args>(A)...); } inline bool operator==(const Array &L, const Array &R) { return L.V == R.V; } @@ -591,7 +591,7 @@ public: ObjectKey(std::string S) : Owned(new std::string(std::move(S))) { if (LLVM_UNLIKELY(!isUTF8(*Owned))) { assert(false && "Invalid UTF-8 in value used as JSON"); - *Owned = fixUTF8(std::move(*Owned)); + *Owned = fixUTF8(*Owned); } Data = *Owned; } diff --git a/llvm/include/llvm/Support/MD5.h b/llvm/include/llvm/Support/MD5.h index 4ba3867..dbcb66d 100644 --- a/llvm/include/llvm/Support/MD5.h +++ b/llvm/include/llvm/Support/MD5.h @@ -90,7 +90,7 @@ public: private: // Any 32-bit or wider unsigned integer data type will do. - typedef uint32_t MD5_u32plus; + using MD5_u32plus = uint32_t; // Internal State struct { diff --git a/llvm/include/llvm/Support/Mutex.h b/llvm/include/llvm/Support/Mutex.h index d61e3fd..3ca5c9a 100644 --- a/llvm/include/llvm/Support/Mutex.h +++ b/llvm/include/llvm/Support/Mutex.h @@ -63,12 +63,12 @@ namespace llvm }; /// Mutex - A standard, always enforced mutex. - typedef SmartMutex<false> Mutex; + using Mutex = SmartMutex<false>; template <bool mt_only> using SmartScopedLock = std::lock_guard<SmartMutex<mt_only>>; - typedef SmartScopedLock<false> ScopedLock; + using ScopedLock = SmartScopedLock<false>; } } diff --git a/llvm/include/llvm/Support/OnDiskHashTable.h b/llvm/include/llvm/Support/OnDiskHashTable.h index d7d72cf..54c6b71 100644 --- a/llvm/include/llvm/Support/OnDiskHashTable.h +++ b/llvm/include/llvm/Support/OnDiskHashTable.h @@ -69,7 +69,7 @@ template <typename Info> class OnDiskChainedHashTableGenerator { : Key(Key), Data(Data), Next(nullptr), Hash(InfoObj.ComputeHash(Key)) {} }; - typedef typename Info::offset_type offset_type; + using offset_type = typename Info::offset_type; offset_type NumBuckets; offset_type NumEntries; llvm::SpecificBumpPtrAllocator<Item> BA; @@ -278,12 +278,12 @@ template <typename Info> class OnDiskChainedHashTable { Info InfoObj; public: - typedef Info InfoType; - typedef typename Info::internal_key_type internal_key_type; - typedef typename Info::external_key_type external_key_type; - typedef typename Info::data_type data_type; - typedef typename Info::hash_value_type hash_value_type; - typedef typename Info::offset_type offset_type; + using InfoType = Info; + using internal_key_type = typename Info::internal_key_type; + using external_key_type = typename Info::external_key_type; + using data_type = typename Info::data_type; + using hash_value_type = typename Info::hash_value_type; + using offset_type = typename Info::offset_type; OnDiskChainedHashTable(offset_type NumBuckets, offset_type NumEntries, const unsigned char *Buckets, @@ -435,12 +435,12 @@ class OnDiskIterableChainedHashTable : public OnDiskChainedHashTable<Info> { const unsigned char *Payload; public: - typedef OnDiskChainedHashTable<Info> base_type; - typedef typename base_type::internal_key_type internal_key_type; - typedef typename base_type::external_key_type external_key_type; - typedef typename base_type::data_type data_type; - typedef typename base_type::hash_value_type hash_value_type; - typedef typename base_type::offset_type offset_type; + using base_type = OnDiskChainedHashTable<Info>; + using internal_key_type = typename base_type::internal_key_type; + using external_key_type = typename base_type::external_key_type; + using data_type = typename base_type::data_type; + using hash_value_type = typename base_type::hash_value_type; + using offset_type = typename base_type::offset_type; private: /// Iterates over all of the keys in the table. @@ -450,7 +450,7 @@ private: offset_type NumEntriesLeft; public: - typedef external_key_type value_type; + using value_type = external_key_type; iterator_base(const unsigned char *const Ptr, offset_type NumEntries) : Ptr(Ptr), NumItemsInBucketLeft(0), NumEntriesLeft(NumEntries) {} @@ -505,7 +505,7 @@ public: Info *InfoObj; public: - typedef external_key_type value_type; + using value_type = external_key_type; key_iterator(const unsigned char *const Ptr, offset_type NumEntries, Info *InfoObj) @@ -551,7 +551,7 @@ public: Info *InfoObj; public: - typedef data_type value_type; + using value_type = data_type; data_iterator(const unsigned char *const Ptr, offset_type NumEntries, Info *InfoObj) diff --git a/llvm/include/llvm/Support/PointerLikeTypeTraits.h b/llvm/include/llvm/Support/PointerLikeTypeTraits.h index 320f6b6..a47d684 100644 --- a/llvm/include/llvm/Support/PointerLikeTypeTraits.h +++ b/llvm/include/llvm/Support/PointerLikeTypeTraits.h @@ -70,7 +70,7 @@ template <> struct PointerLikeTypeTraits<void *> { // Provide PointerLikeTypeTraits for const things. template <typename T> struct PointerLikeTypeTraits<const T> { - typedef PointerLikeTypeTraits<T> NonConst; + using NonConst = PointerLikeTypeTraits<T>; static inline const void *getAsVoidPointer(const T P) { return NonConst::getAsVoidPointer(P); @@ -83,7 +83,7 @@ template <typename T> struct PointerLikeTypeTraits<const T> { // Provide PointerLikeTypeTraits for const pointers. template <typename T> struct PointerLikeTypeTraits<const T *> { - typedef PointerLikeTypeTraits<T *> NonConst; + using NonConst = PointerLikeTypeTraits<T *>; static inline const void *getAsVoidPointer(const T *P) { return NonConst::getAsVoidPointer(const_cast<T *>(P)); diff --git a/llvm/include/llvm/Support/Program.h b/llvm/include/llvm/Support/Program.h index 53c2e75..575e416 100644 --- a/llvm/include/llvm/Support/Program.h +++ b/llvm/include/llvm/Support/Program.h @@ -39,8 +39,8 @@ const char EnvPathSeparator = ';'; typedef unsigned long procid_t; // Must match the type of DWORD on Windows. typedef void *process_t; // Must match the type of HANDLE on Windows. #else -typedef ::pid_t procid_t; -typedef procid_t process_t; +using procid_t = ::pid_t; +using process_t = procid_t; #endif /// This struct encapsulates information about a process. diff --git a/llvm/include/llvm/Support/RISCVISAUtils.h b/llvm/include/llvm/Support/RISCVISAUtils.h index 165bb08..05fd32e 100644 --- a/llvm/include/llvm/Support/RISCVISAUtils.h +++ b/llvm/include/llvm/Support/RISCVISAUtils.h @@ -40,8 +40,8 @@ struct ExtensionComparator { /// OrderedExtensionMap is std::map, it's specialized to keep entries /// in canonical order of extension. -typedef std::map<std::string, ExtensionVersion, ExtensionComparator> - OrderedExtensionMap; +using OrderedExtensionMap = + std::map<std::string, ExtensionVersion, ExtensionComparator>; } // namespace RISCVISAUtils diff --git a/llvm/include/llvm/Support/RWMutex.h b/llvm/include/llvm/Support/RWMutex.h index 8d221aa..efc1ca1 100644 --- a/llvm/include/llvm/Support/RWMutex.h +++ b/llvm/include/llvm/Support/RWMutex.h @@ -162,7 +162,7 @@ public: bool try_lock() { return impl.try_lock(); } }; -typedef SmartRWMutex<false> RWMutex; +using RWMutex = SmartRWMutex<false>; /// ScopedReader - RAII acquisition of a reader lock #if !defined(LLVM_USE_RW_MUTEX_IMPL) @@ -179,7 +179,7 @@ template <bool mt_only> struct SmartScopedReader { ~SmartScopedReader() { mutex.unlock_shared(); } }; #endif -typedef SmartScopedReader<false> ScopedReader; +using ScopedReader = SmartScopedReader<false>; /// ScopedWriter - RAII acquisition of a writer lock #if !defined(LLVM_USE_RW_MUTEX_IMPL) @@ -196,7 +196,7 @@ template <bool mt_only> struct SmartScopedWriter { ~SmartScopedWriter() { mutex.unlock(); } }; #endif -typedef SmartScopedWriter<false> ScopedWriter; +using ScopedWriter = SmartScopedWriter<false>; } // end namespace sys } // end namespace llvm diff --git a/llvm/include/llvm/Support/Registry.h b/llvm/include/llvm/Support/Registry.h index c02f15e..acd3b06 100644 --- a/llvm/include/llvm/Support/Registry.h +++ b/llvm/include/llvm/Support/Registry.h @@ -43,8 +43,8 @@ namespace llvm { template <typename T> class Registry { public: - typedef T type; - typedef SimpleRegistryEntry<T> entry; + using type = T; + using entry = SimpleRegistryEntry<T>; class node; class iterator; diff --git a/llvm/include/llvm/Support/ScaledNumber.h b/llvm/include/llvm/Support/ScaledNumber.h index 07baf15..8ca8d457e 100644 --- a/llvm/include/llvm/Support/ScaledNumber.h +++ b/llvm/include/llvm/Support/ScaledNumber.h @@ -498,10 +498,10 @@ public: static_assert(!std::numeric_limits<DigitsT>::is_signed, "only unsigned floats supported"); - typedef DigitsT DigitsType; + using DigitsType = DigitsT; private: - typedef std::numeric_limits<DigitsType> DigitsLimits; + using DigitsLimits = std::numeric_limits<DigitsType>; static constexpr int Width = sizeof(DigitsType) * 8; static_assert(Width <= 64, "invalid integer width for digits"); @@ -782,7 +782,7 @@ uint64_t ScaledNumber<DigitsT>::scale(uint64_t N) const { template <class DigitsT> template <class IntT> IntT ScaledNumber<DigitsT>::toInt() const { - typedef std::numeric_limits<IntT> Limits; + using Limits = std::numeric_limits<IntT>; if (*this < 1) return 0; if (*this >= Limits::max()) diff --git a/llvm/include/llvm/Support/SourceMgr.h b/llvm/include/llvm/Support/SourceMgr.h index 8320006..43f7e27 100644 --- a/llvm/include/llvm/Support/SourceMgr.h +++ b/llvm/include/llvm/Support/SourceMgr.h @@ -103,7 +103,7 @@ private: public: /// Create new source manager without support for include files. - SourceMgr(); + LLVM_ABI SourceMgr(); /// Create new source manager with the capability of finding include files /// via the provided file system. explicit SourceMgr(IntrusiveRefCntPtr<vfs::FileSystem> FS); @@ -111,10 +111,10 @@ public: SourceMgr &operator=(const SourceMgr &) = delete; SourceMgr(SourceMgr &&); SourceMgr &operator=(SourceMgr &&); - ~SourceMgr(); + LLVM_ABI ~SourceMgr(); IntrusiveRefCntPtr<vfs::FileSystem> getVirtualFileSystem() const; - void setVirtualFileSystem(IntrusiveRefCntPtr<vfs::FileSystem> FS); + LLVM_ABI void setVirtualFileSystem(IntrusiveRefCntPtr<vfs::FileSystem> FS); /// Return the include directories of this source manager. ArrayRef<std::string> getIncludeDirs() const { return IncludeDirectories; } diff --git a/llvm/include/llvm/Support/SuffixTree.h b/llvm/include/llvm/Support/SuffixTree.h index 4c78235..eac66d8 100644 --- a/llvm/include/llvm/Support/SuffixTree.h +++ b/llvm/include/llvm/Support/SuffixTree.h @@ -219,7 +219,7 @@ public: } }; - typedef RepeatedSubstringIterator iterator; + using iterator = RepeatedSubstringIterator; iterator begin() { return iterator(Root, LeafNodes); } iterator end() { return iterator(nullptr); } }; diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h index 8884680..89d90b3 100644 --- a/llvm/include/llvm/Support/Threading.h +++ b/llvm/include/llvm/Support/Threading.h @@ -53,7 +53,7 @@ constexpr bool llvm_is_multithreaded() { return LLVM_ENABLE_THREADS; } #if LLVM_THREADING_USE_STD_CALL_ONCE - typedef std::once_flag once_flag; +using once_flag = std::once_flag; #else diff --git a/llvm/include/llvm/Support/TrailingObjects.h b/llvm/include/llvm/Support/TrailingObjects.h index c479765..218c2e3 100644 --- a/llvm/include/llvm/Support/TrailingObjects.h +++ b/llvm/include/llvm/Support/TrailingObjects.h @@ -76,7 +76,7 @@ protected: // number of a different type. e.g.: // ExtractSecondType<Foo..., int>::type template <typename Ty1, typename Ty2> struct ExtractSecondType { - typedef Ty2 type; + using type = Ty2; }; // TrailingObjectsImpl is somewhat complicated, because it is a @@ -101,8 +101,8 @@ class TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, PrevTy, NextTy, : public TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, NextTy, MoreTys...> { - typedef TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, NextTy, MoreTys...> - ParentType; + using ParentType = + TrailingObjectsImpl<Align, BaseTy, TopTrailingObj, NextTy, MoreTys...>; struct RequiresRealignment { static const bool value = alignof(PrevTy) < alignof(NextTy); diff --git a/llvm/include/llvm/Support/UnicodeCharRanges.h b/llvm/include/llvm/Support/UnicodeCharRanges.h index 7f1a9b3..2b5fc83 100644 --- a/llvm/include/llvm/Support/UnicodeCharRanges.h +++ b/llvm/include/llvm/Support/UnicodeCharRanges.h @@ -37,7 +37,7 @@ inline bool operator<(UnicodeCharRange Range, uint32_t Value) { /// array. class UnicodeCharSet { public: - typedef ArrayRef<UnicodeCharRange> CharRanges; + using CharRanges = ArrayRef<UnicodeCharRange>; /// Constructs a UnicodeCharSet instance from an array of /// UnicodeCharRanges. diff --git a/llvm/include/llvm/Support/VirtualFileSystem.h b/llvm/include/llvm/Support/VirtualFileSystem.h index c8911a0..dbd5a5c 100644 --- a/llvm/include/llvm/Support/VirtualFileSystem.h +++ b/llvm/include/llvm/Support/VirtualFileSystem.h @@ -1116,8 +1116,9 @@ protected: /// Collect all pairs of <virtual path, real path> entries from the /// \p VFS. This is used by the module dependency collector to forward /// the entries into the reproducer output VFS YAML file. -void collectVFSEntries(RedirectingFileSystem &VFS, - SmallVectorImpl<YAMLVFSEntry> &CollectedEntries); +LLVM_ABI void +collectVFSEntries(RedirectingFileSystem &VFS, + SmallVectorImpl<YAMLVFSEntry> &CollectedEntries); class YAMLVFSWriter { std::vector<YAMLVFSEntry> Mappings; diff --git a/llvm/include/llvm/Support/VirtualOutputBackend.h b/llvm/include/llvm/Support/VirtualOutputBackend.h index 85caa021..78ed4b9b 100644 --- a/llvm/include/llvm/Support/VirtualOutputBackend.h +++ b/llvm/include/llvm/Support/VirtualOutputBackend.h @@ -32,7 +32,7 @@ namespace llvm::vfs { /// If virtual functions are added here, also add them to \a /// ProxyOutputBackend. class OutputBackend : public RefCountedBase<OutputBackend> { - virtual void anchor(); + LLVM_ABI virtual void anchor(); public: /// Get a backend that points to the same destination as this one but that @@ -47,7 +47,7 @@ public: /// have been customized). /// /// Thread-safe. - Expected<OutputFile> + LLVM_ABI Expected<OutputFile> createFile(const Twine &Path, std::optional<OutputConfig> Config = std::nullopt); diff --git a/llvm/include/llvm/Support/VirtualOutputBackends.h b/llvm/include/llvm/Support/VirtualOutputBackends.h index 219bc30..13a9611 100644 --- a/llvm/include/llvm/Support/VirtualOutputBackends.h +++ b/llvm/include/llvm/Support/VirtualOutputBackends.h @@ -77,14 +77,14 @@ private: /// An output backend that creates files on disk, wrapping APIs in sys::fs. class OnDiskOutputBackend : public OutputBackend { - void anchor() override; + LLVM_ABI void anchor() override; protected: IntrusiveRefCntPtr<OutputBackend> cloneImpl() const override { return clone(); } - Expected<std::unique_ptr<OutputFileImpl>> + LLVM_ABI Expected<std::unique_ptr<OutputFileImpl>> createFileImpl(StringRef Path, std::optional<OutputConfig> Config) override; public: diff --git a/llvm/include/llvm/Support/VirtualOutputError.h b/llvm/include/llvm/Support/VirtualOutputError.h index 2293ff9..44590a1 100644 --- a/llvm/include/llvm/Support/VirtualOutputError.h +++ b/llvm/include/llvm/Support/VirtualOutputError.h @@ -43,7 +43,7 @@ public: void log(raw_ostream &OS) const override; // Used by ErrorInfo::classID. - static char ID; + LLVM_ABI static char ID; OutputError(const Twine &OutputPath, std::error_code EC) : ErrorInfo<OutputError, ECError>(EC), OutputPath(OutputPath.str()) { @@ -99,7 +99,7 @@ public: void log(raw_ostream &OS) const override; // Used by ErrorInfo::classID. - static char ID; + LLVM_ABI static char ID; TempFileOutputError(const Twine &TempPath, const Twine &OutputPath, std::error_code EC) diff --git a/llvm/include/llvm/Support/VirtualOutputFile.h b/llvm/include/llvm/Support/VirtualOutputFile.h index dd50437..d53701c 100644 --- a/llvm/include/llvm/Support/VirtualOutputFile.h +++ b/llvm/include/llvm/Support/VirtualOutputFile.h @@ -80,13 +80,13 @@ public: /// /// If there's an open proxy from \a createProxy(), calls \a discard() to /// clean up temporaries followed by \a report_fatal_error(). - Error keep(); + LLVM_ABI Error keep(); /// Discard an output, cleaning up any temporary state. Errors if clean-up /// fails. /// /// If it has already been closed, calls \a report_fatal_error(). - Error discard(); + LLVM_ABI Error discard(); /// Discard the output when destroying it if it's still open, sending the /// result to \a Handler. @@ -98,7 +98,7 @@ public: /// producer. Errors if there's already a proxy. The proxy must be deleted /// before calling \a keep(). The proxy will crash if it's written to after /// calling \a discard(). - Expected<std::unique_ptr<raw_pwrite_stream>> createProxy(); + LLVM_ABI Expected<std::unique_ptr<raw_pwrite_stream>> createProxy(); bool hasOpenProxy() const { return OpenProxy; } @@ -132,7 +132,7 @@ public: private: /// Destroy \a Impl. Reports fatal error if the file is open and there's no /// handler from \a discardOnDestroy(). - void destroy(); + LLVM_ABI void destroy(); OutputFile &moveFrom(OutputFile &O) { Path = std::move(O.Path); Impl = std::move(O.Impl); diff --git a/llvm/include/llvm/Support/YAMLTraits.h b/llvm/include/llvm/Support/YAMLTraits.h index 3d36f41..b53b28d 100644 --- a/llvm/include/llvm/Support/YAMLTraits.h +++ b/llvm/include/llvm/Support/YAMLTraits.h @@ -1921,12 +1921,12 @@ template <typename T> struct StdMapStringCustomMappingTraitsImpl { using map_type = std::map<std::string, T>; static void inputOne(IO &io, StringRef key, map_type &v) { - io.mapRequired(key.str().c_str(), v[std::string(key)]); + io.mapRequired(key, v[std::string(key)]); } static void output(IO &io, map_type &v) { for (auto &p : v) - io.mapRequired(p.first.c_str(), p.second); + io.mapRequired(p.first, p.second); } }; diff --git a/llvm/include/llvm/Support/float128.h b/llvm/include/llvm/Support/float128.h index e15a98d..ffad124 100644 --- a/llvm/include/llvm/Support/float128.h +++ b/llvm/include/llvm/Support/float128.h @@ -14,7 +14,7 @@ namespace llvm { #if defined(__clang__) && defined(__FLOAT128__) && \ defined(__SIZEOF_INT128__) && !defined(__LONG_DOUBLE_IBM128__) #define HAS_IEE754_FLOAT128 -typedef __float128 float128; +using float128 = __float128; #elif defined(__FLOAT128__) && defined(__SIZEOF_INT128__) && \ !defined(__LONG_DOUBLE_IBM128__) && \ (defined(__GNUC__) || defined(__GNUG__)) diff --git a/llvm/include/llvm/Support/thread.h b/llvm/include/llvm/Support/thread.h index 16e322b..ecde62d 100644 --- a/llvm/include/llvm/Support/thread.h +++ b/llvm/include/llvm/Support/thread.h @@ -127,7 +127,7 @@ LLVM_ABI thread::id llvm_thread_get_current_id_impl(); template <class Function, class... Args> thread::thread(std::optional<unsigned> StackSizeInBytes, Function &&f, Args &&...args) { - typedef std::tuple<std::decay_t<Function>, std::decay_t<Args>...> CalleeTuple; + using CalleeTuple = std::tuple<std::decay_t<Function>, std::decay_t<Args>...>; std::unique_ptr<CalleeTuple> Callee( new CalleeTuple(std::forward<Function>(f), std::forward<Args>(args)...)); |
