[llvm] r287355 - [DebugInfo] Fix some Clang-tidy modernize-use-default, modernize-use-equal-delete and Include What You Use warnings; other minor fixes (NFC).

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 21 10:23:54 PST 2016


On Fri, Nov 18, 2016 at 10:10 AM Eugene Zelenko via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: eugenezelenko
> Date: Fri Nov 18 12:00:19 2016
> New Revision: 287355
>
> URL: http://llvm.org/viewvc/llvm-project?rev=287355&view=rev
> Log:
> [DebugInfo] Fix some Clang-tidy modernize-use-default,
> modernize-use-equal-delete and Include What You Use warnings; other minor
> fixes (NFC).
>
> Per Zachary Turner and Mehdi Amini suggestion to make only post-commit
> reviews.
>
>
> Modified:
>     llvm/trunk/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
>     llvm/trunk/include/llvm/DebugInfo/DIContext.h
>     llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
>     llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
>     llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h
>     llvm/trunk/include/llvm/DebugInfo/MSF/IMSFFile.h
>     llvm/trunk/include/llvm/DebugInfo/MSF/SequencedItemStream.h
>     llvm/trunk/include/llvm/DebugInfo/MSF/StreamArray.h
>     llvm/trunk/include/llvm/DebugInfo/MSF/StreamInterface.h
>     llvm/trunk/include/llvm/DebugInfo/MSF/StreamRef.h
>     llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h
>     llvm/trunk/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h
>     llvm/trunk/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h
>     llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h
>     llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h
>     llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h
>     llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiHashing.h
>
> Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeTableBuilder.h Fri Nov
> 18 12:00:19 2016
> @@ -10,22 +10,26 @@
>  #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
>  #define LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
>
> +#include "llvm/ADT/ArrayRef.h"
> +#include "llvm/DebugInfo/CodeView/CodeView.h"
> +#include "llvm/DebugInfo/CodeView/TypeIndex.h"
>  #include "llvm/DebugInfo/CodeView/TypeSerializer.h"
> +#include "llvm/DebugInfo/CodeView/TypeRecord.h"
>  #include "llvm/Support/Allocator.h"
>  #include "llvm/Support/Error.h"
> +#include <algorithm>
> +#include <cassert>
> +#include <cstdint>
> +#include <type_traits>
>
>  namespace llvm {
> -
>  namespace codeview {
>
>  class TypeTableBuilder {
>  private:
> -  TypeTableBuilder(const TypeTableBuilder &) = delete;
> -  TypeTableBuilder &operator=(const TypeTableBuilder &) = delete;
> -
> -  TypeIndex handleError(llvm::Error EC) const {
> +  TypeIndex handleError(Error EC) const {
>      assert(false && "Couldn't write Type!");
> -    llvm::consumeError(std::move(EC));
> +    consumeError(std::move(EC));
>      return TypeIndex();
>    }
>
> @@ -35,6 +39,8 @@ private:
>  public:
>    explicit TypeTableBuilder(BumpPtrAllocator &Allocator)
>        : Allocator(Allocator), Serializer(Allocator) {}
> +  TypeTableBuilder(const TypeTableBuilder &) = delete;
> +  TypeTableBuilder &operator=(const TypeTableBuilder &) = delete;
>
>    bool empty() const { return Serializer.records().empty(); }
>
> @@ -116,7 +122,8 @@ public:
>      return Index;
>    }
>  };
> -}
> -}
>
> -#endif
> +} // end namespace codeview
> +} // end namespace llvm
> +
> +#endif // LLVM_DEBUGINFO_CODEVIEW_TYPETABLEBUILDER_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DIContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DIContext.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DIContext.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DIContext.h Fri Nov 18 12:00:19 2016
> @@ -17,9 +17,12 @@
>
>  #include "llvm/ADT/SmallVector.h"
>  #include "llvm/Object/ObjectFile.h"
> -#include "llvm/Support/Casting.h"
> -#include "llvm/Support/DataTypes.h"
> +#include <cassert>
> +#include <cstdint>
> +#include <memory>
>  #include <string>
> +#include <tuple>
> +#include <utility>
>
>  namespace llvm {
>
> @@ -53,19 +56,24 @@ typedef SmallVector<std::pair<uint64_t,
>  /// DIInliningInfo - a format-neutral container for inlined code
> description.
>  class DIInliningInfo {
>    SmallVector<DILineInfo, 4> Frames;
> - public:
> -  DIInliningInfo() {}

+
> +public:
> +  DIInliningInfo() = default;
>

I'd just remove this ^ entirely, it's the implicit/default.


> +
>    DILineInfo getFrame(unsigned Index) const {
>      assert(Index < Frames.size());
>      return Frames[Index];
>    }
> +
>    DILineInfo *getMutableFrame(unsigned Index) {
>      assert(Index < Frames.size());
>      return &Frames[Index];
>    }
> +
>    uint32_t getNumberOfFrames() const {
>      return Frames.size();
>    }
> +
>    void addFrame(const DILineInfo &Frame) {
>      Frames.push_back(Frame);
>    }
> @@ -138,10 +146,11 @@ public:
>      CK_DWARF,
>      CK_PDB
>    };
> -  DIContextKind getKind() const { return Kind; }
>
>    DIContext(DIContextKind K) : Kind(K) {}
> -  virtual ~DIContext() {}
> +  virtual ~DIContext() = default;
> +
> +  DIContextKind getKind() const { return Kind; }
>
>    virtual void dump(raw_ostream &OS, DIDumpType DumpType = DIDT_All,
>                      bool DumpEH = false, bool SummarizeTypes = false) = 0;
> @@ -152,6 +161,7 @@ public:
>        uint64_t Size, DILineInfoSpecifier Specifier =
> DILineInfoSpecifier()) = 0;
>    virtual DIInliningInfo getInliningInfoForAddress(uint64_t Address,
>        DILineInfoSpecifier Specifier = DILineInfoSpecifier()) = 0;
> +
>  private:
>    const DIContextKind Kind;
>  };
> @@ -197,6 +207,6 @@ public:
>    virtual std::unique_ptr<LoadedObjectInfo> clone() const = 0;
>  };
>
> -}
> +} // end namespace llvm
>
> -#endif
> +#endif // LLVM_DEBUGINFO_DICONTEXT_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFContext.h Fri Nov 18
> 12:00:19 2016
> @@ -10,19 +10,31 @@
>  #ifndef LLVM_LIB_DEBUGINFO_DWARFCONTEXT_H
>  #define LLVM_LIB_DEBUGINFO_DWARFCONTEXT_H
>
> +#include "llvm/ADT/DenseMap.h"
> +#include "llvm/ADT/iterator_range.h"
>  #include "llvm/ADT/MapVector.h"
> +#include "llvm/ADT/SmallString.h"
>  #include "llvm/ADT/SmallVector.h"
> +#include "llvm/ADT/StringRef.h"
>  #include "llvm/DebugInfo/DIContext.h"
>  #include "llvm/DebugInfo/DWARF/DWARFCompileUnit.h"
> +#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
>  #include "llvm/DebugInfo/DWARF/DWARFDebugAranges.h"
>  #include "llvm/DebugInfo/DWARF/DWARFDebugFrame.h"
>  #include "llvm/DebugInfo/DWARF/DWARFDebugLine.h"
>  #include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
>  #include "llvm/DebugInfo/DWARF/DWARFDebugMacro.h"
> -#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
>  #include "llvm/DebugInfo/DWARF/DWARFGdbIndex.h"
>  #include "llvm/DebugInfo/DWARF/DWARFSection.h"
>  #include "llvm/DebugInfo/DWARF/DWARFTypeUnit.h"
> +#include "llvm/DebugInfo/DWARF/DWARFUnit.h"
> +#include "llvm/DebugInfo/DWARF/DWARFUnitIndex.h"
> +#include "llvm/Object/ObjectFile.h"
> +#include <cstdint>
> +#include <deque>
> +#include <map>
> +#include <memory>
> +#include <utility>
>
>  namespace llvm {
>
> @@ -31,14 +43,13 @@ namespace llvm {
>  // dwarf where we expect relocated values. This adds a bit of complexity
> to the
>  // dwarf parsing/extraction at the benefit of not allocating memory for
> the
>  // entire size of the debug info sections.
> -typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t> > RelocAddrMap;
> +typedef DenseMap<uint64_t, std::pair<uint8_t, int64_t>> RelocAddrMap;
>

In the future, it's best not to reformat the whole file -
use tools/clang/tools/clang-format/git-clang-format to only reformat the
parts you change.


>
>  /// DWARFContext
>  /// This data structure is the top level entity that deals with dwarf
> debug
>  /// information parsing. The actual data is supplied through pure virtual
>  /// methods that a concrete implementation provides.
>  class DWARFContext : public DIContext {
> -
>    DWARFUnitSection<DWARFCompileUnit> CUs;
>    std::deque<DWARFUnitSection<DWARFTypeUnit>> TUs;
>    std::unique_ptr<DWARFUnitIndex> CUIndex;
> @@ -57,9 +68,6 @@ class DWARFContext : public DIContext {
>    std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
>    std::unique_ptr<DWARFDebugLocDWO> LocDWO;
>
> -  DWARFContext(DWARFContext &) = delete;
> -  DWARFContext &operator=(DWARFContext &) = delete;
> -
>    /// Read compile units from the debug_info section (if necessary)
>    /// and store them in CUs.
>    void parseCompileUnits();
> @@ -78,6 +86,8 @@ class DWARFContext : public DIContext {
>
>  public:
>    DWARFContext() : DIContext(CK_DWARF) {}
> +  DWARFContext(DWARFContext &) = delete;
> +  DWARFContext &operator=(DWARFContext &) = delete;
>

I'm assuming these are the defaults? ^ could they be omitted? (though,
really, these ops should be protected defaulted in the base class, and the
derived class should be final, otherwise there's risk of slicing - but the
ops could still be implicit in the final derived class)


>
>    static bool classof(const DIContext *DICtx) {
>      return DICtx->getKind() == CK_DWARF;
> @@ -229,6 +239,7 @@ public:
>    static bool isSupportedVersion(unsigned version) {
>      return version == 2 || version == 3 || version == 4 || version == 5;
>    }
> +
>  private:
>    /// Return the compile unit that includes an offset (relative to
> .debug_info).
>    DWARFCompileUnit *getCompileUnitForOffset(uint32_t Offset);
> @@ -243,6 +254,7 @@ private:
>  /// pointers to it.
>  class DWARFContextInMemory : public DWARFContext {
>    virtual void anchor();
> +
>    bool IsLittleEndian;
>    uint8_t AddressSize;
>    DWARFSection InfoSection;
> @@ -284,6 +296,7 @@ class DWARFContextInMemory : public DWAR
>  public:
>    DWARFContextInMemory(const object::ObjectFile &Obj,
>      const LoadedObjectInfo *L = nullptr);
> +
>    bool isLittleEndian() const override { return IsLittleEndian; }
>    uint8_t getAddressSize() const override { return AddressSize; }
>    const DWARFSection &getInfoSection() override { return InfoSection; }
> @@ -327,6 +340,6 @@ public:
>    StringRef getTUIndexSection() override { return TUIndexSection; }
>  };
>
> -}
> +} // end namespace llvm
>
> -#endif
> +#endif // LLVM_LIB_DEBUGINFO_DWARFCONTEXT_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/DWARF/DWARFDebugMacro.h Fri Nov 18
> 12:00:19 2016
> @@ -12,7 +12,7 @@
>
>  #include "llvm/ADT/SmallVector.h"
>  #include "llvm/Support/DataExtractor.h"
> -#include "llvm/Support/Dwarf.h"
> +#include <cstdint>
>
>  namespace llvm {
>
> @@ -46,13 +46,14 @@ class DWARFDebugMacro {
>    MacroList Macros;
>
>  public:
> -  DWARFDebugMacro() {}
> +  DWARFDebugMacro() = default;
>

Implicit default?


> +
>    /// Print the macro list found within the debug_macinfo section.
>    void dump(raw_ostream &OS) const;
>    /// Parse the debug_macinfo section accessible via the 'data' parameter.
>    void parse(DataExtractor data);
>  };
>
> -}
> +} // end namespace llvm
>
> -#endif
> +#endif // LLVM_DEBUGINFO_DWARF_DWARFDEBUGMACRO_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/ByteStream.h Fri Nov 18 12:00:19
> 2016
> @@ -17,16 +17,17 @@
>  #include "llvm/Support/Error.h"
>  #include "llvm/Support/FileOutputBuffer.h"
>  #include "llvm/Support/MemoryBuffer.h"
> +#include <algorithm>
>  #include <cstdint>
> +#include <cstring>
>  #include <memory>
> -#include <type_traits>
>
>  namespace llvm {
>  namespace msf {
>
>  class ByteStream : public ReadableStream {
>  public:
> -  ByteStream() {}
> +  ByteStream() = default;
>    explicit ByteStream(ArrayRef<uint8_t> Data) : Data(Data) {}
>    explicit ByteStream(StringRef Data)
>        : Data(Data.bytes_begin(), Data.bytes_end()) {}
> @@ -40,6 +41,7 @@ public:
>      Buffer = Data.slice(Offset, Size);
>      return Error::success();
>    }
> +
>    Error readLongestContiguousChunk(uint32_t Offset,
>                                     ArrayRef<uint8_t> &Buffer) const
> override {
>      if (Offset >= Data.size())
> @@ -75,7 +77,7 @@ public:
>
>  class MutableByteStream : public WritableStream {
>  public:
> -  MutableByteStream() {}
> +  MutableByteStream() = default;
>    explicit MutableByteStream(MutableArrayRef<uint8_t> Data)
>        : Data(Data), ImmutableStream(Data) {}
>
> @@ -83,6 +85,7 @@ public:
>                    ArrayRef<uint8_t> &Buffer) const override {
>      return ImmutableStream.readBytes(Offset, Size, Buffer);
>    }
> +
>    Error readLongestContiguousChunk(uint32_t Offset,
>                                     ArrayRef<uint8_t> &Buffer) const
> override {
>      return ImmutableStream.readLongestContiguousChunk(Offset, Buffer);
> @@ -142,6 +145,7 @@ public:
>                    ArrayRef<uint8_t> &Buffer) const override {
>      return Impl.readBytes(Offset, Size, Buffer);
>    }
> +
>    Error readLongestContiguousChunk(uint32_t Offset,
>                                     ArrayRef<uint8_t> &Buffer) const
> override {
>      return Impl.readLongestContiguousChunk(Offset, Buffer);
> @@ -152,13 +156,13 @@ public:
>    Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> Data) const
> override {
>      return Impl.writeBytes(Offset, Data);
>    }
> +
>    Error commit() const override { return Impl.commit(); }
>
>  private:
>    StreamImpl Impl;
>  };
>
> -
>  } // end namespace msf
>  } // end namespace llvm
>
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/IMSFFile.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/IMSFFile.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/IMSFFile.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/IMSFFile.h Fri Nov 18 12:00:19
> 2016
> @@ -11,19 +11,16 @@
>  #define LLVM_DEBUGINFO_MSF_IMSFFILE_H
>
>  #include "llvm/ADT/ArrayRef.h"
> -#include "llvm/ADT/StringRef.h"
> -#include "llvm/DebugInfo/MSF/StreamArray.h"
>  #include "llvm/Support/Endian.h"
>  #include "llvm/Support/Error.h"
> -
> -#include <stdint.h>
> +#include <cstdint>
>
>  namespace llvm {
>  namespace msf {
>
>  class IMSFFile {
>  public:
> -  virtual ~IMSFFile() {}
> +  virtual ~IMSFFile() = default;
>
>    virtual uint32_t getBlockSize() const = 0;
>    virtual uint32_t getBlockCount() const = 0;
> @@ -38,7 +35,8 @@ public:
>    virtual Error setBlockData(uint32_t BlockIndex, uint32_t Offset,
>                               ArrayRef<uint8_t> Data) const = 0;
>  };
> -}
> -}
> +
> +} // end namespace msf
> +} // end namespace llvm
>
>  #endif // LLVM_DEBUGINFO_MSF_IMSFFILE_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/SequencedItemStream.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/SequencedItemStream.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/SequencedItemStream.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/SequencedItemStream.h Fri Nov 18
> 12:00:19 2016
> @@ -14,12 +14,12 @@
>  #include "llvm/DebugInfo/MSF/MSFError.h"
>  #include "llvm/DebugInfo/MSF/StreamInterface.h"
>  #include "llvm/Support/Error.h"
> +#include <cstddef>
>  #include <cstdint>
> -#include <memory>
> -#include <type_traits>
>
>  namespace llvm {
>  namespace msf {
> +
>  template <typename T> struct SequencedItemTraits {
>    static size_t length(const T &Item) = delete;
>    static ArrayRef<uint8_t> bytes(const T &Item) = delete;
> @@ -37,7 +37,7 @@ template <typename T> struct SequencedIt
>  template <typename T, typename Traits = SequencedItemTraits<T>>
>  class SequencedItemStream : public ReadableStream {
>  public:
> -  SequencedItemStream() {}
> +  SequencedItemStream() = default;
>

Implicit default?


>
>    Error readBytes(uint32_t Offset, uint32_t Size,
>                    ArrayRef<uint8_t> &Buffer) const override {
> @@ -83,8 +83,10 @@ private:
>        return make_error<MSFError>(msf_error_code::insufficient_buffer);
>      return CurrentIndex;
>    }
> +
>    ArrayRef<T> Items;
>  };
> +
>  } // end namespace msf
>  } // end namespace llvm
>
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/StreamArray.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/StreamArray.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/StreamArray.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/StreamArray.h Fri Nov 18
> 12:00:19 2016
> @@ -1,4 +1,4 @@
> -//===- StreamArray.h - Array backed by an arbitrary stream
> ----------------===//
> +//===- StreamArray.h - Array backed by an arbitrary stream ------*- C++
> -*-===//
>  //
>  //                     The LLVM Compiler Infrastructure
>  //
> @@ -10,12 +10,11 @@
>  #ifndef LLVM_DEBUGINFO_MSF_STREAMARRAY_H
>  #define LLVM_DEBUGINFO_MSF_STREAMARRAY_H
>
> -#include "llvm/DebugInfo/MSF/SequencedItemStream.h"
> +#include "llvm/ADT/ArrayRef.h"
>  #include "llvm/DebugInfo/MSF/StreamRef.h"
>  #include "llvm/Support/Error.h"
> -
> -#include <functional>
> -#include <type_traits>
> +#include <cassert>
> +#include <cstdint>
>
>  namespace llvm {
>  namespace msf {
> @@ -76,13 +75,14 @@ template <typename ValueType, typename E
>
>  template <typename ValueType,
>            typename Extractor = VarStreamArrayExtractor<ValueType>>
> +
>  class VarStreamArray {
>    friend class VarStreamArrayIterator<ValueType, Extractor>;
>
>  public:
>    typedef VarStreamArrayIterator<ValueType, Extractor> Iterator;
>
> -  VarStreamArray() {}
> +  VarStreamArray() = default;
>    explicit VarStreamArray(const Extractor &E) : E(E) {}
>
>    explicit VarStreamArray(ReadableStreamRef Stream) : Stream(Stream) {}
> @@ -125,9 +125,9 @@ public:
>        }
>      }
>    }
> -  VarStreamArrayIterator() {}
> +  VarStreamArrayIterator() = default;
>    explicit VarStreamArrayIterator(const Extractor &E) : Extract(E) {}
> -  ~VarStreamArrayIterator() {}
> +  ~VarStreamArrayIterator() = default;
>

Implicit default dtor? (just omit it entirely)


>
>    bool operator==(const IterType &R) const {
>      if (Array && R.Array) {
> @@ -206,7 +206,7 @@ template <typename T> class FixedStreamA
>    friend class FixedStreamArrayIterator<T>;
>
>  public:
> -  FixedStreamArray() : Stream() {}
> +  FixedStreamArray() = default;
>    FixedStreamArray(ReadableStreamRef Stream) : Stream(Stream) {
>      assert(Stream.getLength() % sizeof(T) == 0);
>    }
> @@ -229,6 +229,7 @@ public:
>    FixedStreamArrayIterator<T> begin() const {
>      return FixedStreamArrayIterator<T>(*this, 0);
>    }
> +
>    FixedStreamArrayIterator<T> end() const {
>      return FixedStreamArrayIterator<T>(*this, size());
>    }
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/StreamInterface.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/StreamInterface.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/StreamInterface.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/StreamInterface.h Fri Nov 18
> 12:00:19 2016
> @@ -19,7 +19,7 @@ namespace msf {
>
>  class ReadableStream {
>  public:
> -  virtual ~ReadableStream() {}
> +  virtual ~ReadableStream() = default;
>
>    // Given an offset into the stream and a number of bytes, attempt to
> read
>    // the bytes and set the output ArrayRef to point to a reference into
> the
> @@ -37,7 +37,7 @@ public:
>
>  class WritableStream : public ReadableStream {
>  public:
> -  virtual ~WritableStream() {}
> +  ~WritableStream() override = default;
>

Implicit default?


>
>    // Attempt to write the given bytes into the stream at the desired
> offset.
>    // This will always necessitate a copy.  Cannot shrink or grow the
> stream,
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/StreamRef.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/StreamRef.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/StreamRef.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/StreamRef.h Fri Nov 18 12:00:19
> 2016
> @@ -10,11 +10,16 @@
>  #ifndef LLVM_DEBUGINFO_MSF_STREAMREF_H
>  #define LLVM_DEBUGINFO_MSF_STREAMREF_H
>
> +#include "llvm/ADT/ArrayRef.h"
>  #include "llvm/DebugInfo/MSF/MSFError.h"
>  #include "llvm/DebugInfo/MSF/StreamInterface.h"
> +#include "llvm/Support/Error.h"
> +#include <algorithm>
> +#include <cstdint>
>
>  namespace llvm {
>  namespace msf {
> +
>  template <class StreamType, class RefType> class StreamRefBase {
>  public:
>    StreamRefBase() : Stream(nullptr), ViewOffset(0), Length(0) {}
> @@ -62,7 +67,7 @@ protected:
>  class ReadableStreamRef
>      : public StreamRefBase<ReadableStream, ReadableStreamRef> {
>  public:
> -  ReadableStreamRef() : StreamRefBase() {}
> +  ReadableStreamRef() = default;
>    ReadableStreamRef(const ReadableStream &Stream)
>        : StreamRefBase(Stream, 0, Stream.getLength()) {}
>    ReadableStreamRef(const ReadableStream &Stream, uint32_t Offset,
> @@ -104,7 +109,7 @@ public:
>  class WritableStreamRef
>      : public StreamRefBase<WritableStream, WritableStreamRef> {
>  public:
> -  WritableStreamRef() : StreamRefBase() {}
> +  WritableStreamRef() = default;
>    WritableStreamRef(const WritableStream &Stream)
>        : StreamRefBase(Stream, 0, Stream.getLength()) {}
>    WritableStreamRef(const WritableStream &Stream, uint32_t Offset,
> @@ -124,7 +129,7 @@ public:
>    Error commit() const { return Stream->commit(); }
>  };
>
> -} // namespace msf
> -} // namespace llvm
> +} // end namespace msf
> +} // end namespace llvm
>
>  #endif // LLVM_DEBUGINFO_MSF_STREAMREF_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/MSF/StreamWriter.h Fri Nov 18
> 12:00:19 2016
> @@ -11,21 +11,20 @@
>  #define LLVM_DEBUGINFO_MSF_STREAMWRITER_H
>
>  #include "llvm/ADT/ArrayRef.h"
> +#include "llvm/ADT/StringRef.h"
>  #include "llvm/DebugInfo/MSF/MSFError.h"
>  #include "llvm/DebugInfo/MSF/StreamArray.h"
> -#include "llvm/DebugInfo/MSF/StreamInterface.h"
>  #include "llvm/DebugInfo/MSF/StreamRef.h"
> -#include "llvm/Support/Endian.h"
>  #include "llvm/Support/Error.h"
> -
> -#include <string>
> +#include <cstdint>
> +#include <type_traits>
>
>  namespace llvm {
>  namespace msf {
>
>  class StreamWriter {
>  public:
> -  StreamWriter() {}
> +  StreamWriter() = default;
>    explicit StreamWriter(WritableStreamRef Stream);
>
>    Error writeBytes(ArrayRef<uint8_t> Buffer);
> @@ -57,7 +56,7 @@ public:
>    }
>
>    template <typename T> Error writeArray(ArrayRef<T> Array) {
> -    if (Array.size() == 0)
> +    if (Array.empty())
>        return Error::success();
>
>      if (Array.size() > UINT32_MAX / sizeof(T))
> @@ -86,7 +85,8 @@ private:
>    WritableStreamRef Stream;
>    uint32_t Offset = 0;
>  };
> -} // namespace msf
> -} // namespace llvm
> +
> +} // end namespace msf
> +} // end namespace llvm
>
>  #endif // LLVM_DEBUGINFO_MSF_STREAMWRITER_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h Fri
> Nov 18 12:00:19 2016
> @@ -10,8 +10,11 @@
>  #ifndef LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
>  #define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
>
> -#include "IPDBEnumChildren.h"
> +#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
> +#include "llvm/DebugInfo/PDB/PDBTypes.h"
>  #include "llvm/Support/Casting.h"
> +#include <algorithm>
> +#include <cstdint>
>  #include <memory>
>
>  namespace llvm {
> @@ -23,7 +26,7 @@ public:
>    ConcreteSymbolEnumerator(std::unique_ptr<IPDBEnumSymbols>
> SymbolEnumerator)
>        : Enumerator(std::move(SymbolEnumerator)) {}
>
> -  ~ConcreteSymbolEnumerator() override {}
> +  ~ConcreteSymbolEnumerator() override = default;
>

Implicit default?


>
>    uint32_t getChildCount() const override {
>      return Enumerator->getChildCount();
> @@ -55,7 +58,8 @@ private:
>
>    std::unique_ptr<IPDBEnumSymbols> Enumerator;
>  };
> -}
> -}
>
> -#endif
> +} // end namespace pdb
> +} // end namespace llvm
> +
> +#endif // LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h Fri Nov 18
> 12:00:19 2016
> @@ -10,7 +10,7 @@
>  #ifndef LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
>  #define LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
>
> -#include "PDBTypes.h"
> +#include <cstdint>
>  #include <memory>
>
>  namespace llvm {
> @@ -21,7 +21,7 @@ public:
>    typedef std::unique_ptr<ChildType> ChildTypePtr;
>    typedef IPDBEnumChildren<ChildType> MyType;
>
> -  virtual ~IPDBEnumChildren() {}
> +  virtual ~IPDBEnumChildren() = default;
>
>    virtual uint32_t getChildCount() const = 0;
>    virtual ChildTypePtr getChildAtIndex(uint32_t Index) const = 0;
> @@ -29,7 +29,8 @@ public:
>    virtual void reset() = 0;
>    virtual MyType *clone() const = 0;
>  };
> -}
> -}
>
> -#endif
> +} // end namespace pdb
> +} // end namespace llvm
> +
> +#endif // LLVM_DEBUGINFO_PDB_IPDBENUMCHILDREN_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/PDBContext.h Fri Nov 18 12:00:19
> 2016
> @@ -12,14 +12,18 @@
>
>  #include "llvm/DebugInfo/DIContext.h"
>  #include "llvm/DebugInfo/PDB/IPDBSession.h"
> +#include <cstdint>
> +#include <memory>
> +#include <string>
>
>  namespace llvm {
>
>  namespace object {
>  class COFFObjectFile;
> -  }
> +} // end namespace object
> +
> +namespace pdb {
>
> -  namespace pdb {
>    /// PDBContext
>    /// This data structure is the top level entity that deals with PDB
> debug
>    /// information parsing.  This data structure exists only when there is
> a
> @@ -27,13 +31,11 @@ class COFFObjectFile;
>    /// (e.g. PDB and DWARF).  More control and power over the debug
> information
>    /// access can be had by using the PDB interfaces directly.
>    class PDBContext : public DIContext {
> -
> -    PDBContext(PDBContext &) = delete;
> -    PDBContext &operator=(PDBContext &) = delete;
> -
>    public:
>      PDBContext(const object::COFFObjectFile &Object,
>                 std::unique_ptr<IPDBSession> PDBSession);
> +    PDBContext(PDBContext &) = delete;
> +    PDBContext &operator=(PDBContext &) = delete;
>
>      static bool classof(const DIContext *DICtx) {
>        return DICtx->getKind() == CK_PDB;
> @@ -56,7 +58,9 @@ class COFFObjectFile;
>      std::string getFunctionName(uint64_t Address, DINameKind NameKind)
> const;
>      std::unique_ptr<IPDBSession> Session;
>    };
> -  }
> -}
>
> -#endif
> +} // end namespace pdb
> +
> +} // end namespace llvm
> +
> +#endif // LLVM_DEBUGINFO_PDB_PDBCONTEXT_H
>
> Modified:
> llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h
> (original)
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ISectionContribVisitor.h Fri
> Nov 18 12:00:19 2016
> @@ -12,17 +12,19 @@
>
>  namespace llvm {
>  namespace pdb {
> +
>  struct SectionContrib;
>  struct SectionContrib2;
>
>  class ISectionContribVisitor {
>  public:
> -  virtual ~ISectionContribVisitor() {}
> +  virtual ~ISectionContribVisitor() = default;
>
>    virtual void visit(const SectionContrib &C) = 0;
>    virtual void visit(const SectionContrib2 &C) = 0;
>  };
> -} // namespace pdb
> -} // namespace llvm
> +
> +} // end namespace pdb
> +} // end namespace llvm
>
>  #endif // LLVM_DEBUGINFO_PDB_RAW_ISECTIONCONTRIBVISITOR_H
>
> Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/ModInfo.h Fri Nov 18
> 12:00:19 2016
> @@ -14,11 +14,12 @@
>  #include "llvm/DebugInfo/MSF/StreamArray.h"
>  #include "llvm/DebugInfo/MSF/StreamRef.h"
>  #include "llvm/DebugInfo/PDB/Raw/RawTypes.h"
> -#include "llvm/Support/Endian.h"
> +#include "llvm/Support/Error.h"
>  #include <cstdint>
>  #include <vector>
>
>  namespace llvm {
> +
>  namespace pdb {
>
>  class ModInfo {
> @@ -54,8 +55,7 @@ private:
>
>  struct ModuleInfoEx {
>    ModuleInfoEx(const ModInfo &Info) : Info(Info) {}
> -  ModuleInfoEx(const ModuleInfoEx &Ex)
> -      : Info(Ex.Info), SourceFiles(Ex.SourceFiles) {}
> +  ModuleInfoEx(const ModuleInfoEx &Ex) = default;
>

Implicit default?


>
>    ModInfo Info;
>    std::vector<StringRef> SourceFiles;
> @@ -64,6 +64,7 @@ struct ModuleInfoEx {
>  } // end namespace pdb
>
>  namespace msf {
> +
>  template <> struct VarStreamArrayExtractor<pdb::ModInfo> {
>    Error operator()(ReadableStreamRef Stream, uint32_t &Length,
>                     pdb::ModInfo &Info) const {
> @@ -73,6 +74,7 @@ template <> struct VarStreamArrayExtract
>      return Error::success();
>    }
>  };
> +
>  } // end namespace msf
>
>  } // end namespace llvm
>
> Modified: llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiHashing.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiHashing.h?rev=287355&r1=287354&r2=287355&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiHashing.h (original)
> +++ llvm/trunk/include/llvm/DebugInfo/PDB/Raw/TpiHashing.h Fri Nov 18
> 12:00:19 2016
> @@ -11,6 +11,7 @@
>  #define LLVM_DEBUGINFO_PDB_TPIHASHING_H
>
>  #include "llvm/ADT/Optional.h"
> +#include "llvm/ADT/StringExtras.h"
>  #include "llvm/DebugInfo/CodeView/TypeIndex.h"
>  #include "llvm/DebugInfo/CodeView/TypeRecord.h"
>  #include "llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h"
> @@ -18,12 +19,15 @@
>  #include "llvm/DebugInfo/PDB/Raw/RawError.h"
>  #include "llvm/Support/Endian.h"
>  #include "llvm/Support/Error.h"
> +#include <cstdint>
> +#include <string>
>
>  namespace llvm {
>  namespace pdb {
> +
>  class TpiHashUpdater : public codeview::TypeVisitorCallbacks {
>  public:
> -  TpiHashUpdater() {}
> +  TpiHashUpdater() = default;
>

Implicit default?


>
>  #define TYPE_RECORD(EnumName, EnumVal, Name)
>      \
>    virtual Error visitKnownRecord(codeview::CVType &CVR,
>       \
> @@ -84,7 +88,8 @@ private:
>    uint32_t NumHashBuckets;
>    uint32_t Index = -1;
>  };
> -}
> -}
>
> -#endif
> +} // end namespace pdb
> +} // end namespace llvm
> +
> +#endif // LLVM_DEBUGINFO_PDB_TPIHASHING_H
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161121/09f26e41/attachment-0001.html>


More information about the llvm-commits mailing list