From: Pavel Labath Date: Mon, 25 Mar 2019 14:45:31 +0000 (+0000) Subject: MinidumpYAML.cpp: Fix some code standard violations missed during review X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=af815f178f79d0460951e952b2db3e094e701d49;p=llvm MinidumpYAML.cpp: Fix some code standard violations missed during review functions should begin with lower case letters. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@356901 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/ObjectYAML/MinidumpYAML.cpp b/lib/ObjectYAML/MinidumpYAML.cpp index e578e0591f9..bd017c82fb4 100644 --- a/lib/ObjectYAML/MinidumpYAML.cpp +++ b/lib/ObjectYAML/MinidumpYAML.cpp @@ -17,7 +17,7 @@ class BlobAllocator { public: size_t tell() const { return NextOffset; } - size_t AllocateCallback(size_t Size, + size_t allocateCallback(size_t Size, std::function Callback) { size_t Offset = NextOffset; NextOffset += Size; @@ -25,18 +25,18 @@ public: return Offset; } - size_t AllocateBytes(ArrayRef Data) { - return AllocateCallback( + size_t allocateBytes(ArrayRef Data) { + return allocateCallback( Data.size(), [Data](raw_ostream &OS) { OS << toStringRef(Data); }); } - template size_t AllocateArray(ArrayRef Data) { - return AllocateBytes({reinterpret_cast(Data.data()), + template size_t allocateArray(ArrayRef Data) { + return allocateBytes({reinterpret_cast(Data.data()), sizeof(T) * Data.size()}); } - template size_t AllocateObject(const T &Data) { - return AllocateArray(makeArrayRef(Data)); + template size_t allocateObject(const T &Data) { + return allocateArray(makeArrayRef(Data)); } void writeTo(raw_ostream &OS) const; @@ -340,7 +340,7 @@ static Directory layout(BlobAllocator &File, Stream &S) { switch (S.Kind) { case Stream::StreamKind::RawContent: { RawContentStream &Raw = cast(S); - File.AllocateCallback(Raw.Size, [&Raw](raw_ostream &OS) { + File.allocateCallback(Raw.Size, [&Raw](raw_ostream &OS) { Raw.Content.writeAsBinary(OS); assert(Raw.Content.binary_size() <= Raw.Size); OS << std::string(Raw.Size - Raw.Content.binary_size(), '\0'); @@ -348,10 +348,10 @@ static Directory layout(BlobAllocator &File, Stream &S) { break; } case Stream::StreamKind::SystemInfo: - File.AllocateObject(cast(S).Info); + File.allocateObject(cast(S).Info); break; case Stream::StreamKind::TextContent: - File.AllocateArray(arrayRefFromStringRef(cast(S).Text)); + File.allocateArray(arrayRefFromStringRef(cast(S).Text)); break; } Result.Location.DataSize = File.tell() - Result.Location.RVA; @@ -360,11 +360,11 @@ static Directory layout(BlobAllocator &File, Stream &S) { void MinidumpYAML::writeAsBinary(Object &Obj, raw_ostream &OS) { BlobAllocator File; - File.AllocateObject(Obj.Header); + File.allocateObject(Obj.Header); std::vector StreamDirectory(Obj.Streams.size()); Obj.Header.StreamDirectoryRVA = - File.AllocateArray(makeArrayRef(StreamDirectory)); + File.allocateArray(makeArrayRef(StreamDirectory)); Obj.Header.NumberOfStreams = StreamDirectory.size(); for (auto &Stream : enumerate(Obj.Streams))