Path: blob/main/contrib/llvm-project/llvm/lib/DebugInfo/CodeView/DebugSubsectionVisitor.cpp
35271 views
//===- DebugSubsectionVisitor.cpp -------------------------------*- C++ -*-===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h"910#include "llvm/DebugInfo/CodeView/CodeView.h"11#include "llvm/DebugInfo/CodeView/DebugChecksumsSubsection.h"12#include "llvm/DebugInfo/CodeView/DebugCrossExSubsection.h"13#include "llvm/DebugInfo/CodeView/DebugCrossImpSubsection.h"14#include "llvm/DebugInfo/CodeView/DebugFrameDataSubsection.h"15#include "llvm/DebugInfo/CodeView/DebugInlineeLinesSubsection.h"16#include "llvm/DebugInfo/CodeView/DebugLinesSubsection.h"17#include "llvm/DebugInfo/CodeView/DebugStringTableSubsection.h"18#include "llvm/DebugInfo/CodeView/DebugSubsectionRecord.h"19#include "llvm/DebugInfo/CodeView/DebugSymbolRVASubsection.h"20#include "llvm/DebugInfo/CodeView/DebugSymbolsSubsection.h"21#include "llvm/DebugInfo/CodeView/DebugUnknownSubsection.h"22#include "llvm/Support/BinaryStreamReader.h"23#include "llvm/Support/SwapByteOrder.h"2425using namespace llvm;26using namespace llvm::codeview;2728Error llvm::codeview::visitDebugSubsection(29const DebugSubsectionRecord &R, DebugSubsectionVisitor &V,30const StringsAndChecksumsRef &State) {31BinaryStreamReader Reader(R.getRecordData());32switch (R.kind()) {33case DebugSubsectionKind::Lines: {34DebugLinesSubsectionRef Fragment;35if (auto EC = Fragment.initialize(Reader))36return EC;3738return V.visitLines(Fragment, State);39}40case DebugSubsectionKind::FileChecksums: {41DebugChecksumsSubsectionRef Fragment;42if (auto EC = Fragment.initialize(Reader))43return EC;4445return V.visitFileChecksums(Fragment, State);46}47case DebugSubsectionKind::InlineeLines: {48DebugInlineeLinesSubsectionRef Fragment;49if (auto EC = Fragment.initialize(Reader))50return EC;51return V.visitInlineeLines(Fragment, State);52}53case DebugSubsectionKind::CrossScopeExports: {54DebugCrossModuleExportsSubsectionRef Section;55if (auto EC = Section.initialize(Reader))56return EC;57return V.visitCrossModuleExports(Section, State);58}59case DebugSubsectionKind::CrossScopeImports: {60DebugCrossModuleImportsSubsectionRef Section;61if (auto EC = Section.initialize(Reader))62return EC;63return V.visitCrossModuleImports(Section, State);64}65case DebugSubsectionKind::Symbols: {66DebugSymbolsSubsectionRef Section;67if (auto EC = Section.initialize(Reader))68return EC;69return V.visitSymbols(Section, State);70}71case DebugSubsectionKind::StringTable: {72DebugStringTableSubsectionRef Section;73if (auto EC = Section.initialize(Reader))74return EC;75return V.visitStringTable(Section, State);76}77case DebugSubsectionKind::FrameData: {78DebugFrameDataSubsectionRef Section;79if (auto EC = Section.initialize(Reader))80return EC;81return V.visitFrameData(Section, State);82}83case DebugSubsectionKind::CoffSymbolRVA: {84DebugSymbolRVASubsectionRef Section;85if (auto EC = Section.initialize(Reader))86return EC;87return V.visitCOFFSymbolRVAs(Section, State);88}89default: {90DebugUnknownSubsectionRef Fragment(R.kind(), R.getRecordData());91return V.visitUnknown(Fragment);92}93}94}959697