aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:45:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:01 +0300
commit2d37894b1b037cf24231090eda8589bbb44fb6fc (patch)
treebe835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp
parent718c552901d703c502ccbefdfc3c9028d608b947 (diff)
downloadydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp')
-rw-r--r--contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp250
1 files changed, 125 insertions, 125 deletions
diff --git a/contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp b/contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp
index 4893b3fab7..48ec7e4ecd 100644
--- a/contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp
+++ b/contrib/libs/llvm12/lib/DebugInfo/CodeView/DebugInlineeLinesSubsection.cpp
@@ -1,125 +1,125 @@
-//===- DebugInlineeLinesSubsection.cpp ------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
-#include "llvm/Support/BinaryStreamReader.h"
-#include "llvm/Support/BinaryStreamWriter.h"
-#include "llvm/Support/Endian.h"
-#include "llvm/Support/Error.h"
-#include <cassert>
-#include <cstdint>
-
-using namespace llvm;
-using namespace llvm::codeview;
-
-Error VarStreamArrayExtractor<InlineeSourceLine>::
-operator()(BinaryStreamRef Stream, uint32_t &Len, InlineeSourceLine &Item) {
- BinaryStreamReader Reader(Stream);
-
- if (auto EC = Reader.readObject(Item.Header))
- return EC;
-
- if (HasExtraFiles) {
- uint32_t ExtraFileCount;
- if (auto EC = Reader.readInteger(ExtraFileCount))
- return EC;
- if (auto EC = Reader.readArray(Item.ExtraFiles, ExtraFileCount))
- return EC;
- }
-
- Len = Reader.getOffset();
- return Error::success();
-}
-
-DebugInlineeLinesSubsectionRef::DebugInlineeLinesSubsectionRef()
- : DebugSubsectionRef(DebugSubsectionKind::InlineeLines) {}
-
-Error DebugInlineeLinesSubsectionRef::initialize(BinaryStreamReader Reader) {
- if (auto EC = Reader.readEnum(Signature))
- return EC;
-
- Lines.getExtractor().HasExtraFiles = hasExtraFiles();
- if (auto EC = Reader.readArray(Lines, Reader.bytesRemaining()))
- return EC;
-
- assert(Reader.bytesRemaining() == 0);
- return Error::success();
-}
-
-bool DebugInlineeLinesSubsectionRef::hasExtraFiles() const {
- return Signature == InlineeLinesSignature::ExtraFiles;
-}
-
-DebugInlineeLinesSubsection::DebugInlineeLinesSubsection(
- DebugChecksumsSubsection &Checksums, bool HasExtraFiles)
- : DebugSubsection(DebugSubsectionKind::InlineeLines), Checksums(Checksums),
- HasExtraFiles(HasExtraFiles) {}
-
-uint32_t DebugInlineeLinesSubsection::calculateSerializedSize() const {
- // 4 bytes for the signature
- uint32_t Size = sizeof(InlineeLinesSignature);
-
- // one header for each entry.
- Size += Entries.size() * sizeof(InlineeSourceLineHeader);
- if (HasExtraFiles) {
- // If extra files are enabled, one count for each entry.
- Size += Entries.size() * sizeof(uint32_t);
-
- // And one file id for each file.
- Size += ExtraFileCount * sizeof(uint32_t);
- }
- assert(Size % 4 == 0);
- return Size;
-}
-
-Error DebugInlineeLinesSubsection::commit(BinaryStreamWriter &Writer) const {
- InlineeLinesSignature Sig = InlineeLinesSignature::Normal;
- if (HasExtraFiles)
- Sig = InlineeLinesSignature::ExtraFiles;
-
- if (auto EC = Writer.writeEnum(Sig))
- return EC;
-
- for (const auto &E : Entries) {
- if (auto EC = Writer.writeObject(E.Header))
- return EC;
-
- if (!HasExtraFiles)
- continue;
-
- if (auto EC = Writer.writeInteger<uint32_t>(E.ExtraFiles.size()))
- return EC;
- if (auto EC = Writer.writeArray(makeArrayRef(E.ExtraFiles)))
- return EC;
- }
-
- return Error::success();
-}
-
-void DebugInlineeLinesSubsection::addExtraFile(StringRef FileName) {
- uint32_t Offset = Checksums.mapChecksumOffset(FileName);
-
- auto &Entry = Entries.back();
- Entry.ExtraFiles.push_back(ulittle32_t(Offset));
- ++ExtraFileCount;
-}
-
-void DebugInlineeLinesSubsection::addInlineSite(TypeIndex FuncId,
- StringRef FileName,
- uint32_t SourceLine) {
- uint32_t Offset = Checksums.mapChecksumOffset(FileName);
-
- Entries.emplace_back();
- auto &Entry = Entries.back();
- Entry.Header.FileID = Offset;
- Entry.Header.SourceLineNum = SourceLine;
- Entry.Header.Inlinee = FuncId;
-}
+//===- DebugInlineeLinesSubsection.cpp ------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/DebugInfo/CodeView/CodeView.h"
+#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"
+#include "llvm/Support/BinaryStreamReader.h"
+#include "llvm/Support/BinaryStreamWriter.h"
+#include "llvm/Support/Endian.h"
+#include "llvm/Support/Error.h"
+#include <cassert>
+#include <cstdint>
+
+using namespace llvm;
+using namespace llvm::codeview;
+
+Error VarStreamArrayExtractor<InlineeSourceLine>::
+operator()(BinaryStreamRef Stream, uint32_t &Len, InlineeSourceLine &Item) {
+ BinaryStreamReader Reader(Stream);
+
+ if (auto EC = Reader.readObject(Item.Header))
+ return EC;
+
+ if (HasExtraFiles) {
+ uint32_t ExtraFileCount;
+ if (auto EC = Reader.readInteger(ExtraFileCount))
+ return EC;
+ if (auto EC = Reader.readArray(Item.ExtraFiles, ExtraFileCount))
+ return EC;
+ }
+
+ Len = Reader.getOffset();
+ return Error::success();
+}
+
+DebugInlineeLinesSubsectionRef::DebugInlineeLinesSubsectionRef()
+ : DebugSubsectionRef(DebugSubsectionKind::InlineeLines) {}
+
+Error DebugInlineeLinesSubsectionRef::initialize(BinaryStreamReader Reader) {
+ if (auto EC = Reader.readEnum(Signature))
+ return EC;
+
+ Lines.getExtractor().HasExtraFiles = hasExtraFiles();
+ if (auto EC = Reader.readArray(Lines, Reader.bytesRemaining()))
+ return EC;
+
+ assert(Reader.bytesRemaining() == 0);
+ return Error::success();
+}
+
+bool DebugInlineeLinesSubsectionRef::hasExtraFiles() const {
+ return Signature == InlineeLinesSignature::ExtraFiles;
+}
+
+DebugInlineeLinesSubsection::DebugInlineeLinesSubsection(
+ DebugChecksumsSubsection &Checksums, bool HasExtraFiles)
+ : DebugSubsection(DebugSubsectionKind::InlineeLines), Checksums(Checksums),
+ HasExtraFiles(HasExtraFiles) {}
+
+uint32_t DebugInlineeLinesSubsection::calculateSerializedSize() const {
+ // 4 bytes for the signature
+ uint32_t Size = sizeof(InlineeLinesSignature);
+
+ // one header for each entry.
+ Size += Entries.size() * sizeof(InlineeSourceLineHeader);
+ if (HasExtraFiles) {
+ // If extra files are enabled, one count for each entry.
+ Size += Entries.size() * sizeof(uint32_t);
+
+ // And one file id for each file.
+ Size += ExtraFileCount * sizeof(uint32_t);
+ }
+ assert(Size % 4 == 0);
+ return Size;
+}
+
+Error DebugInlineeLinesSubsection::commit(BinaryStreamWriter &Writer) const {
+ InlineeLinesSignature Sig = InlineeLinesSignature::Normal;
+ if (HasExtraFiles)
+ Sig = InlineeLinesSignature::ExtraFiles;
+
+ if (auto EC = Writer.writeEnum(Sig))
+ return EC;
+
+ for (const auto &E : Entries) {
+ if (auto EC = Writer.writeObject(E.Header))
+ return EC;
+
+ if (!HasExtraFiles)
+ continue;
+
+ if (auto EC = Writer.writeInteger<uint32_t>(E.ExtraFiles.size()))
+ return EC;
+ if (auto EC = Writer.writeArray(makeArrayRef(E.ExtraFiles)))
+ return EC;
+ }
+
+ return Error::success();
+}
+
+void DebugInlineeLinesSubsection::addExtraFile(StringRef FileName) {
+ uint32_t Offset = Checksums.mapChecksumOffset(FileName);
+
+ auto &Entry = Entries.back();
+ Entry.ExtraFiles.push_back(ulittle32_t(Offset));
+ ++ExtraFileCount;
+}
+
+void DebugInlineeLinesSubsection::addInlineSite(TypeIndex FuncId,
+ StringRef FileName,
+ uint32_t SourceLine) {
+ uint32_t Offset = Checksums.mapChecksumOffset(FileName);
+
+ Entries.emplace_back();
+ auto &Entry = Entries.back();
+ Entry.Header.FileID = Offset;
+ Entry.Header.SourceLineNum = SourceLine;
+ Entry.Header.Inlinee = FuncId;
+}