diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-06-21 13:59:01 +0000 |
commit | 3a0822f094b578157263e04114075ad7df81db41 (patch) | |
tree | bc48361fe2cd1ca5f93ac01b38b183774468fc79 /include/llvm/Support | |
parent | 85d8b2bbe386bcfe669575d05b61482d7be07e5d (diff) |
Diffstat (limited to 'include/llvm/Support')
68 files changed, 176 insertions, 118 deletions
diff --git a/include/llvm/Support/ARMEHABI.h b/include/llvm/Support/ARMEHABI.h index 9b052df0a908..db045a8a3efa 100644 --- a/include/llvm/Support/ARMEHABI.h +++ b/include/llvm/Support/ARMEHABI.h @@ -127,8 +127,8 @@ namespace EHABI { NUM_PERSONALITY_INDEX }; -} -} -} +} // namespace EHABI +} // namespace ARM +} // namespace llvm #endif diff --git a/include/llvm/Support/ARMWinEH.h b/include/llvm/Support/ARMWinEH.h index 1463629f45dc..0b379032c200 100644 --- a/include/llvm/Support/ARMWinEH.h +++ b/include/llvm/Support/ARMWinEH.h @@ -375,8 +375,8 @@ struct ExceptionDataRecord { inline size_t HeaderWords(const ExceptionDataRecord &XR) { return (XR.Data[0] & 0xff800000) ? 1 : 2; } -} -} -} +} // namespace WinEH +} // namespace ARM +} // namespace llvm #endif diff --git a/include/llvm/Support/AlignOf.h b/include/llvm/Support/AlignOf.h index 574b514aef39..07da02d063c7 100644 --- a/include/llvm/Support/AlignOf.h +++ b/include/llvm/Support/AlignOf.h @@ -44,9 +44,18 @@ private: /// compile-time constant (e.g., for template instantiation). template <typename T> struct AlignOf { +#ifndef _MSC_VER + // Avoid warnings from GCC like: + // comparison between 'enum llvm::AlignOf<X>::<anonymous>' and 'enum + // llvm::AlignOf<Y>::<anonymous>' [-Wenum-compare] + // by using constexpr instead of enum. + // (except on MSVC, since it doesn't support constexpr yet). + static constexpr unsigned Alignment = + static_cast<unsigned int>(sizeof(AlignmentCalcImpl<T>) - sizeof(T)); +#else enum { Alignment = static_cast<unsigned int>(sizeof(AlignmentCalcImpl<T>) - sizeof(T)) }; - +#endif enum { Alignment_GreaterEqual_2Bytes = Alignment >= 2 ? 1 : 0 }; enum { Alignment_GreaterEqual_4Bytes = Alignment >= 4 ? 1 : 0 }; enum { Alignment_GreaterEqual_8Bytes = Alignment >= 8 ? 1 : 0 }; @@ -58,6 +67,10 @@ struct AlignOf { enum { Alignment_LessEqual_16Bytes = Alignment <= 16 ? 1 : 0 }; }; +#ifndef _MSC_VER +template <typename T> constexpr unsigned AlignOf<T>::Alignment; +#endif + /// alignOf - A templated function that returns the minimum alignment of /// of a type. This provides no extra functionality beyond the AlignOf /// class besides some cosmetic cleanliness. Example usage: diff --git a/include/llvm/Support/ArrayRecycler.h b/include/llvm/Support/ArrayRecycler.h index 36f644af2880..5907c79db2be 100644 --- a/include/llvm/Support/ArrayRecycler.h +++ b/include/llvm/Support/ArrayRecycler.h @@ -138,6 +138,6 @@ public: } }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/Atomic.h b/include/llvm/Support/Atomic.h index 9ec23e827023..a3cec47563b8 100644 --- a/include/llvm/Support/Atomic.h +++ b/include/llvm/Support/Atomic.h @@ -33,7 +33,7 @@ namespace llvm { cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val); cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val); cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val); - } -} + } // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/BlockFrequency.h b/include/llvm/Support/BlockFrequency.h index 4304a253b287..20b2782ad61a 100644 --- a/include/llvm/Support/BlockFrequency.h +++ b/include/llvm/Support/BlockFrequency.h @@ -69,6 +69,6 @@ public: } }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/BranchProbability.h b/include/llvm/Support/BranchProbability.h index a6429dd22a3b..df89d2dd4da9 100644 --- a/include/llvm/Support/BranchProbability.h +++ b/include/llvm/Support/BranchProbability.h @@ -84,6 +84,6 @@ inline raw_ostream &operator<<(raw_ostream &OS, const BranchProbability &Prob) { return Prob.print(OS); } -} +} // namespace llvm #endif diff --git a/include/llvm/Support/COM.h b/include/llvm/Support/COM.h index a2d5a7a68ba9..45559b0ec149 100644 --- a/include/llvm/Support/COM.h +++ b/include/llvm/Support/COM.h @@ -30,7 +30,7 @@ private: InitializeCOMRAII(const InitializeCOMRAII &) = delete; void operator=(const InitializeCOMRAII &) = delete; }; -} -} +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/Casting.h b/include/llvm/Support/Casting.h index 6ba5efa47554..e84676abc779 100644 --- a/include/llvm/Support/Casting.h +++ b/include/llvm/Support/Casting.h @@ -321,6 +321,6 @@ dyn_cast_or_null(Y *Val) { return (Val && isa<X>(Val)) ? cast<X>(Val) : nullptr; } -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/CodeGen.h b/include/llvm/Support/CodeGen.h index 243f2dd7498c..1eca5681e449 100644 --- a/include/llvm/Support/CodeGen.h +++ b/include/llvm/Support/CodeGen.h @@ -90,6 +90,6 @@ namespace llvm { } llvm_unreachable("Bad CodeModel!"); } -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h index 1ad8a3bfd937..ed809211ea97 100644 --- a/include/llvm/Support/CommandLine.h +++ b/include/llvm/Support/CommandLine.h @@ -33,6 +33,9 @@ namespace llvm { +class BumpPtrStringSaver; +class StringSaver; + /// cl Namespace - This namespace contains all of the command line option /// processing machinery. It is intentionally a short name to make qualified /// usage concise. @@ -1676,16 +1679,6 @@ StringMap<Option *> &getRegisteredOptions(); // Standalone command line processing utilities. // -/// \brief Saves strings in the inheritor's stable storage and returns a stable -/// raw character pointer. -class StringSaver { - virtual void anchor(); - -public: - virtual const char *SaveString(const char *Str) = 0; - virtual ~StringSaver(){}; // Pacify -Wnon-virtual-dtor. -}; - /// \brief Tokenizes a command line that can contain escapes and quotes. // /// The quoting rules match those used by GCC and other tools that use diff --git a/include/llvm/Support/CrashRecoveryContext.h b/include/llvm/Support/CrashRecoveryContext.h index c08c3c1f0d21..13aff7a37b7a 100644 --- a/include/llvm/Support/CrashRecoveryContext.h +++ b/include/llvm/Support/CrashRecoveryContext.h @@ -199,6 +199,6 @@ public: cleanup = 0; } }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/DOTGraphTraits.h b/include/llvm/Support/DOTGraphTraits.h index 95e37c01d7d5..3d21129066ec 100644 --- a/include/llvm/Support/DOTGraphTraits.h +++ b/include/llvm/Support/DOTGraphTraits.h @@ -161,6 +161,6 @@ struct DOTGraphTraits : public DefaultDOTGraphTraits { DOTGraphTraits (bool simple=false) : DefaultDOTGraphTraits (simple) {} }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/DataStream.h b/include/llvm/Support/DataStream.h index 8bc413360307..9a4daec1e9cc 100644 --- a/include/llvm/Support/DataStream.h +++ b/include/llvm/Support/DataStream.h @@ -17,6 +17,7 @@ #ifndef LLVM_SUPPORT_DATASTREAM_H #define LLVM_SUPPORT_DATASTREAM_H +#include <memory> #include <string> namespace llvm { @@ -30,9 +31,8 @@ public: virtual ~DataStreamer(); }; -DataStreamer *getDataFileStreamer(const std::string &Filename, - std::string *Err); - -} +std::unique_ptr<DataStreamer> getDataFileStreamer(const std::string &Filename, + std::string *Err); +} // namespace llvm #endif // LLVM_SUPPORT_DATASTREAM_H_ diff --git a/include/llvm/Support/Debug.h b/include/llvm/Support/Debug.h index fff4f986a6c0..2f3fe77f0e50 100644 --- a/include/llvm/Support/Debug.h +++ b/include/llvm/Support/Debug.h @@ -91,6 +91,6 @@ raw_ostream &dbgs(); // #define DEBUG(X) DEBUG_WITH_TYPE(DEBUG_TYPE, X) -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/DynamicLibrary.h b/include/llvm/Support/DynamicLibrary.h index a7d22212dbdb..d6ff9043c46a 100644 --- a/include/llvm/Support/DynamicLibrary.h +++ b/include/llvm/Support/DynamicLibrary.h @@ -99,7 +99,7 @@ namespace sys { static void AddSymbol(StringRef symbolName, void *symbolValue); }; -} // End sys namespace -} // End llvm namespace +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/ELF.h b/include/llvm/Support/ELF.h index 8b915ff0581d..e23fcbb5eb8c 100644 --- a/include/llvm/Support/ELF.h +++ b/include/llvm/Support/ELF.h @@ -133,7 +133,7 @@ enum { EM_386 = 3, // Intel 386 EM_68K = 4, // Motorola 68000 EM_88K = 5, // Motorola 88000 - EM_486 = 6, // Intel 486 (deprecated) + EM_IAMCU = 6, // Intel MCU EM_860 = 7, // Intel 80860 EM_MIPS = 8, // MIPS R3000 EM_S370 = 9, // IBM System/370 diff --git a/include/llvm/Support/ELFRelocs/Sparc.def b/include/llvm/Support/ELFRelocs/Sparc.def index d6772ea675d6..7e01a4a8a0a0 100644 --- a/include/llvm/Support/ELFRelocs/Sparc.def +++ b/include/llvm/Support/ELFRelocs/Sparc.def @@ -83,7 +83,7 @@ ELF_RELOC(R_SPARC_TLS_DTPOFF64, 77) ELF_RELOC(R_SPARC_TLS_TPOFF32, 78) ELF_RELOC(R_SPARC_TLS_TPOFF64, 79) ELF_RELOC(R_SPARC_GOTDATA_HIX22, 80) -ELF_RELOC(R_SPARC_GOTDATA_LOX22, 81) +ELF_RELOC(R_SPARC_GOTDATA_LOX10, 81) ELF_RELOC(R_SPARC_GOTDATA_OP_HIX22, 82) -ELF_RELOC(R_SPARC_GOTDATA_OP_LOX22, 83) +ELF_RELOC(R_SPARC_GOTDATA_OP_LOX10, 83) ELF_RELOC(R_SPARC_GOTDATA_OP, 84) diff --git a/include/llvm/Support/Endian.h b/include/llvm/Support/Endian.h index e9fe22e5eda8..fd59009e0d3a 100644 --- a/include/llvm/Support/Endian.h +++ b/include/llvm/Support/Endian.h @@ -104,6 +104,16 @@ struct packed_endian_specific_integral { return *this; } + packed_endian_specific_integral &operator|=(value_type newValue) { + *this = *this | newValue; + return *this; + } + + packed_endian_specific_integral &operator&=(value_type newValue) { + *this = *this & newValue; + return *this; + } + private: AlignedCharArray<PickAlignment<value_type, alignment>::value, sizeof(value_type)> Value; diff --git a/include/llvm/Support/Errc.h b/include/llvm/Support/Errc.h index 80bfe2ac2ee5..7efca026d1e4 100644 --- a/include/llvm/Support/Errc.h +++ b/include/llvm/Support/Errc.h @@ -78,7 +78,7 @@ enum class errc { inline std::error_code make_error_code(errc E) { return std::error_code(static_cast<int>(E), std::generic_category()); } -} +} // namespace llvm namespace std { template <> struct is_error_code_enum<llvm::errc> : std::true_type {}; diff --git a/include/llvm/Support/ErrorHandling.h b/include/llvm/Support/ErrorHandling.h index 9afd52d1abc7..427d8ea2c570 100644 --- a/include/llvm/Support/ErrorHandling.h +++ b/include/llvm/Support/ErrorHandling.h @@ -84,7 +84,7 @@ namespace llvm { LLVM_ATTRIBUTE_NORETURN void llvm_unreachable_internal(const char *msg=nullptr, const char *file=nullptr, unsigned line=0); -} +} // namespace llvm /// Marks that the current location is not supposed to be reachable. /// In !NDEBUG builds, prints the message and location info to stderr. diff --git a/include/llvm/Support/FileSystem.h b/include/llvm/Support/FileSystem.h index a736c324f8aa..5a857e41b95a 100644 --- a/include/llvm/Support/FileSystem.h +++ b/include/llvm/Support/FileSystem.h @@ -724,7 +724,7 @@ namespace detail { intptr_t IterationHandle; directory_entry CurrentEntry; }; -} +} // namespace detail /// directory_iterator - Iterates through the entries in path. There is no /// operator++ because we need an error_code. If it's really needed we can make @@ -786,7 +786,7 @@ namespace detail { uint16_t Level; bool HasNoPushRequest; }; -} +} // namespace detail /// recursive_directory_iterator - Same as directory_iterator except for it /// recurses down into child directories. diff --git a/include/llvm/Support/FileUtilities.h b/include/llvm/Support/FileUtilities.h index 2ee2c60b9964..8a790dece225 100644 --- a/include/llvm/Support/FileUtilities.h +++ b/include/llvm/Support/FileUtilities.h @@ -73,6 +73,6 @@ namespace llvm { /// will not be removed when the object is destroyed. void releaseFile() { DeleteIt = false; } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/FormattedStream.h b/include/llvm/Support/FormattedStream.h index 4a135cd23174..145d8984a418 100644 --- a/include/llvm/Support/FormattedStream.h +++ b/include/llvm/Support/FormattedStream.h @@ -156,7 +156,7 @@ formatted_raw_ostream &ferrs(); /// debug output. Use it like: fdbgs() << "foo" << "bar"; formatted_raw_ostream &fdbgs(); -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/GCOV.h b/include/llvm/Support/GCOV.h index c2e34bd3eaeb..138b9dbe0a37 100644 --- a/include/llvm/Support/GCOV.h +++ b/include/llvm/Support/GCOV.h @@ -435,6 +435,6 @@ private: FileCoverageList FileCoverages; FuncCoverageMap FuncCoverages; }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/GenericDomTree.h b/include/llvm/Support/GenericDomTree.h index 63678bb98bb1..cd59f82eea72 100644 --- a/include/llvm/Support/GenericDomTree.h +++ b/include/llvm/Support/GenericDomTree.h @@ -772,6 +772,6 @@ bool DominatorTreeBase<NodeT>::properlyDominates(const NodeT *A, getNode(const_cast<NodeT *>(B))); } -} +} // namespace llvm #endif diff --git a/include/llvm/Support/GenericDomTreeConstruction.h b/include/llvm/Support/GenericDomTreeConstruction.h index 7c065f939256..76e3cc8af40c 100644 --- a/include/llvm/Support/GenericDomTreeConstruction.h +++ b/include/llvm/Support/GenericDomTreeConstruction.h @@ -288,6 +288,6 @@ void Calculate(DominatorTreeBase<typename GraphTraits<NodeT>::NodeType>& DT, DT.updateDFSNumbers(); } -} +} // namespace llvm #endif diff --git a/include/llvm/Support/GraphWriter.h b/include/llvm/Support/GraphWriter.h index 7d1c273c988d..04b40848cb76 100644 --- a/include/llvm/Support/GraphWriter.h +++ b/include/llvm/Support/GraphWriter.h @@ -356,6 +356,6 @@ void ViewGraph(const GraphType &G, const Twine &Name, DisplayGraph(Filename, true, Program); } -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/Host.h b/include/llvm/Support/Host.h index 8f4bf3c1ba56..f2519df41aa2 100644 --- a/include/llvm/Support/Host.h +++ b/include/llvm/Support/Host.h @@ -68,7 +68,7 @@ namespace sys { /// /// \return - True on success. bool getHostCPUFeatures(StringMap<bool> &Features); -} -} +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/LineIterator.h b/include/llvm/Support/LineIterator.h index 9d4cd3bd4c6d..d0f7d30a7076 100644 --- a/include/llvm/Support/LineIterator.h +++ b/include/llvm/Support/LineIterator.h @@ -83,6 +83,6 @@ private: /// \brief Advance the iterator to the next line. void advance(); }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/MD5.h b/include/llvm/Support/MD5.h index f6e1e92c9fa8..8658c8ef5c24 100644 --- a/include/llvm/Support/MD5.h +++ b/include/llvm/Support/MD5.h @@ -65,6 +65,6 @@ private: const uint8_t *body(ArrayRef<uint8_t> Data); }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/ManagedStatic.h b/include/llvm/Support/ManagedStatic.h index addd34e704bc..1187e055aadd 100644 --- a/include/llvm/Support/ManagedStatic.h +++ b/include/llvm/Support/ManagedStatic.h @@ -106,6 +106,6 @@ struct llvm_shutdown_obj { ~llvm_shutdown_obj() { llvm_shutdown(); } }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index 2cf7e0e5d0b3..7c63aaa06998 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -642,6 +642,6 @@ inline int64_t SignExtend64(uint64_t X, unsigned B) { } extern const float huge_valf; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/Memory.h b/include/llvm/Support/Memory.h index b4305cb697d0..6abb17aff8c6 100644 --- a/include/llvm/Support/Memory.h +++ b/include/llvm/Support/Memory.h @@ -155,7 +155,7 @@ namespace sys { /// as writable. static bool setRangeWritable(const void *Addr, size_t Size); }; -} -} +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/MemoryBuffer.h b/include/llvm/Support/MemoryBuffer.h index 35a7bdb004a9..81616d8ba3ac 100644 --- a/include/llvm/Support/MemoryBuffer.h +++ b/include/llvm/Support/MemoryBuffer.h @@ -124,7 +124,7 @@ public: static ErrorOr<std::unique_ptr<MemoryBuffer>> getFileOrSTDIN(const Twine &Filename, int64_t FileSize = -1); - /// Map a subrange of the the specified file as a MemoryBuffer. + /// Map a subrange of the specified file as a MemoryBuffer. static ErrorOr<std::unique_ptr<MemoryBuffer>> getFileSlice(const Twine &Filename, uint64_t MapSize, uint64_t Offset); diff --git a/include/llvm/Support/MemoryObject.h b/include/llvm/Support/MemoryObject.h index e0c8749da346..deff6c1c667f 100644 --- a/include/llvm/Support/MemoryObject.h +++ b/include/llvm/Support/MemoryObject.h @@ -63,6 +63,6 @@ public: virtual bool isValidAddress(uint64_t address) const = 0; }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/MipsABIFlags.h b/include/llvm/Support/MipsABIFlags.h index 93f6b416ba88..8740823dac42 100644 --- a/include/llvm/Support/MipsABIFlags.h +++ b/include/llvm/Support/MipsABIFlags.h @@ -96,7 +96,7 @@ enum Val_GNU_MIPS_ABI_MSA { Val_GNU_MIPS_ABI_MSA_ANY = 0, // not tagged Val_GNU_MIPS_ABI_MSA_128 = 1 // 128-bit MSA }; -} -} +} // namespace Mips +} // namespace llvm #endif diff --git a/include/llvm/Support/Mutex.h b/include/llvm/Support/Mutex.h index 0f4e61af4439..47f0ab6d5c6f 100644 --- a/include/llvm/Support/Mutex.h +++ b/include/llvm/Support/Mutex.h @@ -152,7 +152,7 @@ namespace llvm }; typedef SmartScopedLock<false> ScopedLock; - } -} + } // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/MutexGuard.h b/include/llvm/Support/MutexGuard.h index 07b64b611960..ea5861761acd 100644 --- a/include/llvm/Support/MutexGuard.h +++ b/include/llvm/Support/MutexGuard.h @@ -36,6 +36,6 @@ namespace llvm { /// is held. bool holds(const sys::Mutex& lock) const { return &M == &lock; } }; -} +} // namespace llvm #endif // LLVM_SUPPORT_MUTEXGUARD_H diff --git a/include/llvm/Support/PluginLoader.h b/include/llvm/Support/PluginLoader.h index bdbb134b28eb..da4324e6c13f 100644 --- a/include/llvm/Support/PluginLoader.h +++ b/include/llvm/Support/PluginLoader.h @@ -32,6 +32,6 @@ namespace llvm { LoadOpt("load", cl::ZeroOrMore, cl::value_desc("pluginfilename"), cl::desc("Load the specified plugin")); #endif -} +} // namespace llvm #endif diff --git a/include/llvm/Support/Process.h b/include/llvm/Support/Process.h index cfdd06c62f33..089894cf9020 100644 --- a/include/llvm/Support/Process.h +++ b/include/llvm/Support/Process.h @@ -184,7 +184,7 @@ public: static unsigned GetRandomNumber(); }; -} -} +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/Program.h b/include/llvm/Support/Program.h index b89a0f73ec68..5f1bc12601b1 100644 --- a/include/llvm/Support/Program.h +++ b/include/llvm/Support/Program.h @@ -187,7 +187,7 @@ struct ProcessInfo { ///< string is non-empty upon return an error occurred while invoking the ///< program. ); - } -} + } // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/RWMutex.h b/include/llvm/Support/RWMutex.h index 4be931337765..5299708c6a6a 100644 --- a/include/llvm/Support/RWMutex.h +++ b/include/llvm/Support/RWMutex.h @@ -171,7 +171,7 @@ namespace llvm } }; typedef SmartScopedWriter<false> ScopedWriter; - } -} + } // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/RandomNumberGenerator.h b/include/llvm/Support/RandomNumberGenerator.h index 7446558f0c88..316778b00e5e 100644 --- a/include/llvm/Support/RandomNumberGenerator.h +++ b/include/llvm/Support/RandomNumberGenerator.h @@ -53,6 +53,6 @@ private: friend class Module; }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/Recycler.h b/include/llvm/Support/Recycler.h index e97f36a735fd..a909b9d57376 100644 --- a/include/llvm/Support/Recycler.h +++ b/include/llvm/Support/Recycler.h @@ -123,6 +123,6 @@ public: } }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/RecyclingAllocator.h b/include/llvm/Support/RecyclingAllocator.h index 001d1cf7c3df..fded4edcad44 100644 --- a/include/llvm/Support/RecyclingAllocator.h +++ b/include/llvm/Support/RecyclingAllocator.h @@ -57,7 +57,7 @@ public: } }; -} +} // namespace llvm template<class AllocatorType, class T, size_t Size, size_t Align> inline void *operator new(size_t size, diff --git a/include/llvm/Support/Regex.h b/include/llvm/Support/Regex.h index 31b35ed0cad6..15f20a668ae5 100644 --- a/include/llvm/Support/Regex.h +++ b/include/llvm/Support/Regex.h @@ -100,6 +100,6 @@ namespace llvm { struct llvm_regex *preg; int error; }; -} +} // namespace llvm #endif // LLVM_SUPPORT_REGEX_H diff --git a/include/llvm/Support/Registry.h b/include/llvm/Support/Registry.h index 95c4e96f7f29..7eb1090a393b 100644 --- a/include/llvm/Support/Registry.h +++ b/include/llvm/Support/Registry.h @@ -228,6 +228,6 @@ namespace llvm { template <typename T, typename U> typename Registry<T,U>::listener *Registry<T,U>::ListenerTail; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/Signals.h b/include/llvm/Support/Signals.h index 7e165d7f3a42..0cb421bcf32b 100644 --- a/include/llvm/Support/Signals.h +++ b/include/llvm/Support/Signals.h @@ -62,7 +62,7 @@ namespace sys { /// different thread on some platforms. /// @brief Register a function to be called when ctrl-c is pressed. void SetInterruptFunction(void (*IF)()); -} // End sys namespace -} // End llvm namespace +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/SourceMgr.h b/include/llvm/Support/SourceMgr.h index d492748e7781..5eef9a075c46 100644 --- a/include/llvm/Support/SourceMgr.h +++ b/include/llvm/Support/SourceMgr.h @@ -276,10 +276,10 @@ public: return FixIts; } - void print(const char *ProgName, raw_ostream &S, - bool ShowColors = true) const; + void print(const char *ProgName, raw_ostream &S, bool ShowColors = true, + bool ShowKindLabel = true) const; }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/StreamingMemoryObject.h b/include/llvm/Support/StreamingMemoryObject.h index 932e635cd072..fe0cc7e71f97 100644 --- a/include/llvm/Support/StreamingMemoryObject.h +++ b/include/llvm/Support/StreamingMemoryObject.h @@ -24,7 +24,7 @@ namespace llvm { /// setKnownObjectSize methods which are not applicable to non-streamed objects. class StreamingMemoryObject : public MemoryObject { public: - StreamingMemoryObject(DataStreamer *streamer); + StreamingMemoryObject(std::unique_ptr<DataStreamer> Streamer); uint64_t getExtent() const override; uint64_t readBytes(uint8_t *Buf, uint64_t Size, uint64_t Address) const override; @@ -89,5 +89,5 @@ private: MemoryObject *getNonStreamedMemoryObject( const unsigned char *Start, const unsigned char *End); -} +} // namespace llvm #endif // STREAMINGMEMORYOBJECT_H_ diff --git a/include/llvm/Support/StringPool.h b/include/llvm/Support/StringPool.h index 2ec0c3b76c11..3aa826b5ae9f 100644 --- a/include/llvm/Support/StringPool.h +++ b/include/llvm/Support/StringPool.h @@ -133,6 +133,6 @@ namespace llvm { inline bool operator!=(const PooledStringPtr &That) const { return S != That.S; } }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/StringSaver.h b/include/llvm/Support/StringSaver.h new file mode 100644 index 000000000000..c7a2e8f48e86 --- /dev/null +++ b/include/llvm/Support/StringSaver.h @@ -0,0 +1,42 @@ +//===- llvm/Support/StringSaver.h -------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_SUPPORT_STRINGSAVER_H +#define LLVM_SUPPORT_STRINGSAVER_H + +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Support/Allocator.h" + +namespace llvm { + +/// \brief Saves strings in the inheritor's stable storage and returns a stable +/// raw character pointer. +class StringSaver { +protected: + ~StringSaver() {} + virtual const char *saveImpl(StringRef S); + +public: + StringSaver(BumpPtrAllocator &Alloc) : Alloc(Alloc) {} + const char *save(const char *S) { return save(StringRef(S)); } + const char *save(StringRef S) { return saveImpl(S); } + const char *save(const Twine &S) { return save(StringRef(S.str())); } + const char *save(std::string &S) { return save(StringRef(S)); } + +private: + BumpPtrAllocator &Alloc; +}; + +class BumpPtrStringSaver final : public StringSaver { +public: + BumpPtrStringSaver(BumpPtrAllocator &Alloc) : StringSaver(Alloc) {} +}; +} // namespace llvm +#endif diff --git a/include/llvm/Support/SystemUtils.h b/include/llvm/Support/SystemUtils.h index 2997b1b0c9cf..f8c5dc85a5e9 100644 --- a/include/llvm/Support/SystemUtils.h +++ b/include/llvm/Support/SystemUtils.h @@ -27,6 +27,6 @@ bool CheckBitcodeOutputToConsole( bool print_warning = true ///< Control whether warnings are printed ); -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/TargetRegistry.h b/include/llvm/Support/TargetRegistry.h index 837fc66f38af..1c11ef31f82c 100644 --- a/include/llvm/Support/TargetRegistry.h +++ b/include/llvm/Support/TargetRegistry.h @@ -69,7 +69,7 @@ MCStreamer *createMachOStreamer(MCContext &Ctx, MCAsmBackend &TAB, bool RelaxAll, bool DWARFMustBeAtTheEnd, bool LabelSections = false); -MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx); +MCRelocationInfo *createMCRelocationInfo(const Triple &TT, MCContext &Ctx); MCSymbolizer *createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp, @@ -98,7 +98,7 @@ public: typedef MCInstrInfo *(*MCInstrInfoCtorFnTy)(void); typedef MCInstrAnalysis *(*MCInstrAnalysisCtorFnTy)(const MCInstrInfo *Info); typedef MCRegisterInfo *(*MCRegInfoCtorFnTy)(StringRef TT); - typedef MCSubtargetInfo *(*MCSubtargetInfoCtorFnTy)(StringRef TT, + typedef MCSubtargetInfo *(*MCSubtargetInfoCtorFnTy)(const Triple &TT, StringRef CPU, StringRef Features); typedef TargetMachine *(*TargetMachineCtorTy)( @@ -112,7 +112,7 @@ public: TargetMachine &TM, std::unique_ptr<MCStreamer> &&Streamer); typedef MCAsmBackend *(*MCAsmBackendCtorTy)(const Target &T, const MCRegisterInfo &MRI, - StringRef TT, StringRef CPU); + const Triple &TT, StringRef CPU); typedef MCTargetAsmParser *(*MCAsmParserCtorTy)( MCSubtargetInfo &STI, MCAsmParser &P, const MCInstrInfo &MII, const MCTargetOptions &Options); @@ -147,7 +147,7 @@ public: bool IsVerboseAsm); typedef MCTargetStreamer *(*ObjectTargetStreamerCtorTy)( MCStreamer &S, const MCSubtargetInfo &STI); - typedef MCRelocationInfo *(*MCRelocationInfoCtorTy)(StringRef TT, + typedef MCRelocationInfo *(*MCRelocationInfoCtorTy)(const Triple &TT, MCContext &Ctx); typedef MCSymbolizer *(*MCSymbolizerCtorTy)( StringRef TT, LLVMOpInfoCallback GetOpInfo, @@ -334,18 +334,18 @@ public: /// createMCSubtargetInfo - Create a MCSubtargetInfo implementation. /// - /// \param Triple This argument is used to determine the target machine + /// \param TheTriple This argument is used to determine the target machine /// feature set; it should always be provided. Generally this should be /// either the target triple from the module, or the target triple of the /// host if that does not exist. /// \param CPU This specifies the name of the target CPU. /// \param Features This specifies the string representation of the /// additional target features. - MCSubtargetInfo *createMCSubtargetInfo(StringRef Triple, StringRef CPU, + MCSubtargetInfo *createMCSubtargetInfo(StringRef TheTriple, StringRef CPU, StringRef Features) const { if (!MCSubtargetInfoCtorFn) return nullptr; - return MCSubtargetInfoCtorFn(Triple, CPU, Features); + return MCSubtargetInfoCtorFn(Triple(TheTriple), CPU, Features); } /// createTargetMachine - Create a target specific machine implementation @@ -369,12 +369,12 @@ public: /// createMCAsmBackend - Create a target specific assembly parser. /// - /// \param Triple The target triple string. - MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI, StringRef Triple, - StringRef CPU) const { + /// \param TheTriple The target triple string. + MCAsmBackend *createMCAsmBackend(const MCRegisterInfo &MRI, + StringRef TheTriple, StringRef CPU) const { if (!MCAsmBackendCtorFn) return nullptr; - return MCAsmBackendCtorFn(*this, MRI, Triple, CPU); + return MCAsmBackendCtorFn(*this, MRI, Triple(TheTriple), CPU); } /// createMCAsmParser - Create a target specific assembly parser. @@ -507,7 +507,7 @@ public: MCRelocationInfoCtorTy Fn = MCRelocationInfoCtorFn ? MCRelocationInfoCtorFn : llvm::createMCRelocationInfo; - return Fn(TT, Ctx); + return Fn(Triple(TT), Ctx); } /// createMCSymbolizer - Create a target specific MCSymbolizer. @@ -1056,7 +1056,7 @@ template <class MCSubtargetInfoImpl> struct RegisterMCSubtargetInfo { } private: - static MCSubtargetInfo *Allocator(StringRef /*TT*/, StringRef /*CPU*/, + static MCSubtargetInfo *Allocator(const Triple & /*TT*/, StringRef /*CPU*/, StringRef /*FS*/) { return new MCSubtargetInfoImpl(); } @@ -1094,7 +1094,7 @@ private: StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL) { - return new TargetMachineImpl(T, TT, CPU, FS, Options, RM, CM, OL); + return new TargetMachineImpl(T, Triple(TT), CPU, FS, Options, RM, CM, OL); } }; @@ -1112,8 +1112,8 @@ template <class MCAsmBackendImpl> struct RegisterMCAsmBackend { private: static MCAsmBackend *Allocator(const Target &T, const MCRegisterInfo &MRI, - StringRef Triple, StringRef CPU) { - return new MCAsmBackendImpl(T, MRI, Triple, CPU); + const Triple &TheTriple, StringRef CPU) { + return new MCAsmBackendImpl(T, MRI, TheTriple, CPU); } }; @@ -1178,6 +1178,6 @@ private: return new MCCodeEmitterImpl(); } }; -} +} // namespace llvm #endif diff --git a/include/llvm/Support/TargetSelect.h b/include/llvm/Support/TargetSelect.h index a86e953f00ea..96ecf0b5e5c6 100644 --- a/include/llvm/Support/TargetSelect.h +++ b/include/llvm/Support/TargetSelect.h @@ -161,6 +161,6 @@ namespace llvm { #endif } -} +} // namespace llvm #endif diff --git a/include/llvm/Support/ThreadLocal.h b/include/llvm/Support/ThreadLocal.h index 427a67e2a96d..db61f5c17b96 100644 --- a/include/llvm/Support/ThreadLocal.h +++ b/include/llvm/Support/ThreadLocal.h @@ -57,7 +57,7 @@ namespace llvm { // erase - Removes the pointer associated with the current thread. void erase() { removeInstance(); } }; - } -} + } // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/Threading.h b/include/llvm/Support/Threading.h index 3cca1d6a9913..365fb9ee9b8e 100644 --- a/include/llvm/Support/Threading.h +++ b/include/llvm/Support/Threading.h @@ -34,6 +34,6 @@ namespace llvm { /// the thread stack. void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData, unsigned RequestedStackSize = 0); -} +} // namespace llvm #endif diff --git a/include/llvm/Support/TimeValue.h b/include/llvm/Support/TimeValue.h index 6bca58b6bc20..a9efb1b9f78e 100644 --- a/include/llvm/Support/TimeValue.h +++ b/include/llvm/Support/TimeValue.h @@ -380,7 +380,7 @@ inline TimeValue operator - (const TimeValue &tv1, const TimeValue &tv2) { return difference; } -} -} +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/Timer.h b/include/llvm/Support/Timer.h index 2cd30e2aaf32..56fbcccc5cd9 100644 --- a/include/llvm/Support/Timer.h +++ b/include/llvm/Support/Timer.h @@ -184,6 +184,6 @@ private: void PrintQueuedTimers(raw_ostream &OS); }; -} // End llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/ToolOutputFile.h b/include/llvm/Support/ToolOutputFile.h index 1be26c2cb58b..e7a65456e3de 100644 --- a/include/llvm/Support/ToolOutputFile.h +++ b/include/llvm/Support/ToolOutputFile.h @@ -58,6 +58,6 @@ public: void keep() { Installer.Keep = true; } }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/UniqueLock.h b/include/llvm/Support/UniqueLock.h index 529284d3868b..c5f37a7b8ce0 100644 --- a/include/llvm/Support/UniqueLock.h +++ b/include/llvm/Support/UniqueLock.h @@ -62,6 +62,6 @@ namespace llvm { bool owns_lock() { return locked; } }; -} +} // namespace llvm #endif // LLVM_SUPPORT_UNIQUE_LOCK_H diff --git a/include/llvm/Support/Valgrind.h b/include/llvm/Support/Valgrind.h index cebf75c49c19..7eabca93d6b4 100644 --- a/include/llvm/Support/Valgrind.h +++ b/include/llvm/Support/Valgrind.h @@ -67,7 +67,7 @@ namespace sys { #define TsanIgnoreWritesBegin() #define TsanIgnoreWritesEnd() #endif -} -} +} // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/Watchdog.h b/include/llvm/Support/Watchdog.h index 01e1d926eb95..5642ae2e2322 100644 --- a/include/llvm/Support/Watchdog.h +++ b/include/llvm/Support/Watchdog.h @@ -32,7 +32,7 @@ namespace llvm { Watchdog(const Watchdog &other) = delete; Watchdog &operator=(const Watchdog &other) = delete; }; - } -} + } // namespace sys +} // namespace llvm #endif diff --git a/include/llvm/Support/circular_raw_ostream.h b/include/llvm/Support/circular_raw_ostream.h index 19f9c2c4b155..89d6421e1e33 100644 --- a/include/llvm/Support/circular_raw_ostream.h +++ b/include/llvm/Support/circular_raw_ostream.h @@ -152,7 +152,7 @@ namespace llvm delete TheStream; } }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/raw_os_ostream.h b/include/llvm/Support/raw_os_ostream.h index a983aeb90879..c13e7792821b 100644 --- a/include/llvm/Support/raw_os_ostream.h +++ b/include/llvm/Support/raw_os_ostream.h @@ -37,6 +37,6 @@ public: ~raw_os_ostream() override; }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index b59317112c44..4b4f933aa017 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -545,6 +545,6 @@ public: ~buffer_ostream() { OS << str(); } }; -} // end llvm namespace +} // namespace llvm #endif diff --git a/include/llvm/Support/type_traits.h b/include/llvm/Support/type_traits.h index 45465aea004b..6e2e202b0f2d 100644 --- a/include/llvm/Support/type_traits.h +++ b/include/llvm/Support/type_traits.h @@ -91,7 +91,7 @@ struct add_const_past_pointer< typedef const typename std::remove_pointer<T>::type *type; }; -} +} // namespace llvm #ifdef LLVM_DEFINED_HAS_FEATURE #undef __has_feature |