From ee2f195dd3e40f49698ca4dc2666ec09c770e80d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Tue, 30 May 2017 17:37:31 +0000 Subject: Vendor import of llvm trunk r304222: https://llvm.org/svn/llvm-project/llvm/trunk@304222 --- .../DebugInfo/CodeView/DebugSubsectionVisitor.h | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h (limited to 'include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h') diff --git a/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h b/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h new file mode 100644 index 000000000000..55bef491c97e --- /dev/null +++ b/include/llvm/DebugInfo/CodeView/DebugSubsectionVisitor.h @@ -0,0 +1,66 @@ +//===- DebugSubsectionVisitor.h -----------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H +#define LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H + +#include "llvm/Support/Error.h" +#include + +namespace llvm { + +namespace codeview { + +class DebugChecksumsSubsectionRef; +class DebugSubsectionRecord; +class DebugInlineeLinesSubsectionRef; +class DebugLinesSubsectionRef; +class DebugUnknownSubsectionRef; + +class DebugSubsectionVisitor { +public: + virtual ~DebugSubsectionVisitor() = default; + + virtual Error visitUnknown(DebugUnknownSubsectionRef &Unknown) { + return Error::success(); + } + virtual Error visitLines(DebugLinesSubsectionRef &Lines) { + return Error::success(); + } + + virtual Error visitFileChecksums(DebugChecksumsSubsectionRef &Checksums) { + return Error::success(); + } + + virtual Error visitInlineeLines(DebugInlineeLinesSubsectionRef &Inlinees) { + return Error::success(); + } + + virtual Error finished() { return Error::success(); } +}; + +Error visitDebugSubsection(const DebugSubsectionRecord &R, + DebugSubsectionVisitor &V); + +template +Error visitDebugSubsections(T &&FragmentRange, DebugSubsectionVisitor &V) { + for (const auto &L : FragmentRange) { + if (auto EC = visitDebugSubsection(L, V)) + return EC; + } + if (auto EC = V.finished()) + return EC; + return Error::success(); +} + +} // end namespace codeview + +} // end namespace llvm + +#endif // LLVM_DEBUGINFO_CODEVIEW_MODULEDEBUGFRAGMENTVISITOR_H -- cgit v1.3