[llvm] r234694 - Mark empty default constructors as =default if it makes the type POD

Owen Anderson resistor at mac.com
Mon Apr 13 00:34:54 PDT 2015


Could the C++ modernizer be taught to do this?

—Owen

> On Apr 11, 2015, at 11:57 AM, Benjamin Kramer <benny.kra at googlemail.com> wrote:
> 
> Author: d0k
> Date: Sat Apr 11 13:57:14 2015
> New Revision: 234694
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=234694&view=rev
> Log:
> Mark empty default constructors as =default if it makes the type POD
> 
> NFC
> 
> Modified:
>    llvm/trunk/include/llvm/ADT/EpochTracker.h
>    llvm/trunk/include/llvm/ADT/Hashing.h
>    llvm/trunk/include/llvm/ADT/iterator.h
>    llvm/trunk/include/llvm/Support/FileSystem.h
>    llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
>    llvm/trunk/lib/Transforms/Scalar/LoadCombine.cpp
>    llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
>    llvm/trunk/tools/yaml2obj/yaml2coff.cpp
> 
> Modified: llvm/trunk/include/llvm/ADT/EpochTracker.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/EpochTracker.h?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/EpochTracker.h (original)
> +++ llvm/trunk/include/llvm/ADT/EpochTracker.h Sat Apr 11 13:57:14 2015
> @@ -30,7 +30,7 @@ public:
> 
>   class HandleBase {
>   public:
> -    HandleBase() {}
> +    HandleBase() = default;
>     explicit HandleBase(const DebugEpochBase *) {}
>     bool isHandleInSync() const { return true; }
>     const void *getEpochAddress() const { return nullptr; }
> 
> Modified: llvm/trunk/include/llvm/ADT/Hashing.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Hashing.h?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/Hashing.h (original)
> +++ llvm/trunk/include/llvm/ADT/Hashing.h Sat Apr 11 13:57:14 2015
> @@ -75,7 +75,7 @@ class hash_code {
> public:
>   /// \brief Default construct a hash_code.
>   /// Note that this leaves the value uninitialized.
> -  hash_code() {}
> +  hash_code() = default;
> 
>   /// \brief Form a hash code directly from a numerical value.
>   hash_code(size_t value) : value(value) {}
> 
> Modified: llvm/trunk/include/llvm/ADT/iterator.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/iterator.h?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/iterator.h (original)
> +++ llvm/trunk/include/llvm/ADT/iterator.h Sat Apr 11 13:57:14 2015
> @@ -150,7 +150,7 @@ class iterator_adaptor_base
> protected:
>   WrappedIteratorT I;
> 
> -  iterator_adaptor_base() {}
> +  iterator_adaptor_base() = default;
> 
>   template <typename U>
>   explicit iterator_adaptor_base(
> @@ -231,7 +231,7 @@ struct pointee_iterator
>           pointee_iterator<WrappedIteratorT>, WrappedIteratorT,
>           typename std::iterator_traits<WrappedIteratorT>::iterator_category,
>           T> {
> -  pointee_iterator() {}
> +  pointee_iterator() = default;
>   template <typename U>
>   pointee_iterator(U &&u)
>       : pointee_iterator::iterator_adaptor_base(std::forward<U &&>(u)) {}
> 
> Modified: llvm/trunk/include/llvm/Support/FileSystem.h
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/include/llvm/Support/FileSystem.h (original)
> +++ llvm/trunk/include/llvm/Support/FileSystem.h Sat Apr 11 13:57:14 2015
> @@ -120,7 +120,7 @@ class UniqueID {
>   uint64_t File;
> 
> public:
> -  UniqueID() {}
> +  UniqueID() = default;
>   UniqueID(uint64_t Device, uint64_t File) : Device(Device), File(File) {}
>   bool operator==(const UniqueID &Other) const {
>     return Device == Other.Device && File == Other.File;
> 
> Modified: llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp (original)
> +++ llvm/trunk/lib/Transforms/Instrumentation/GCOVProfiling.cpp Sat Apr 11 13:57:14 2015
> @@ -163,7 +163,7 @@ namespace {
>     static const char *const BlockTag;
>     static const char *const EdgeTag;
> 
> -    GCOVRecord() {}
> +    GCOVRecord() = default;
> 
>     void writeBytes(const char *Bytes, int Size) {
>       os->write(Bytes, Size);
> 
> Modified: llvm/trunk/lib/Transforms/Scalar/LoadCombine.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoadCombine.cpp?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoadCombine.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoadCombine.cpp Sat Apr 11 13:57:14 2015
> @@ -41,9 +41,9 @@ struct PointerOffsetPair {
> };
> 
> struct LoadPOPPair {
> +  LoadPOPPair() = default;
>   LoadPOPPair(LoadInst *L, PointerOffsetPair P, unsigned O)
>       : Load(L), POP(P), InsertOrder(O) {}
> -  LoadPOPPair() {}
>   LoadInst *Load;
>   PointerOffsetPair POP;
>   /// \brief The new load needs to be created before the first load in IR order.
> 
> Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Sat Apr 11 13:57:14 2015
> @@ -112,8 +112,6 @@ public:
>   /// a particular register.
>   SmallBitVector UsedByIndices;
> 
> -  RegSortData() {}
> -
>   void print(raw_ostream &OS) const;
>   void dump() const;
> };
> 
> Modified: llvm/trunk/tools/yaml2obj/yaml2coff.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/yaml2obj/yaml2coff.cpp?rev=234694&r1=234693&r2=234694&view=diff
> ==============================================================================
> --- llvm/trunk/tools/yaml2obj/yaml2coff.cpp (original)
> +++ llvm/trunk/tools/yaml2obj/yaml2coff.cpp Sat Apr 11 13:57:14 2015
> @@ -253,10 +253,7 @@ binary_le_impl<value_type> binary_le(val
>   return binary_le_impl<value_type>(V);
> }
> 
> -template <size_t NumBytes>
> -struct zeros_impl {
> -  zeros_impl() {}
> -};
> +template <size_t NumBytes> struct zeros_impl {};
> 
> template <size_t NumBytes>
> raw_ostream &operator<<(raw_ostream &OS, const zeros_impl<NumBytes> &) {
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list