Files
archived-llvm/include/llvm/DebugInfo/CodeView/ModuleDebugFragmentVisitor.h
Zachary Turner 3b718709c4 [PDB/CodeView] Rename some classes.
In preparation for introducing writing capabilities for each of
these classes, I would like to adopt a Foo / FooRef naming
convention, where Foo indicates that the class can manipulate and
serialize Foos, and FooRef indicates that it is an immutable view of
an existing Foo.  In other words, Foo is a writer and FooRef is a
reader.  This patch names some existing readers to conform to the
FooRef convention, while offering no functional change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301810 91177308-0d34-0410-b5e6-96231b3b80d8
2017-05-01 16:46:39 +00:00

65 lines
1.8 KiB
C++

//===- ModuleDebugFragmentVisitor.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 <cstdint>
namespace llvm {
namespace codeview {
class ModuleDebugFileChecksumFragmentRef;
class ModuleDebugFragmentRecord;
class ModuleDebugInlineeLineFragmentRef;
class ModuleDebugLineFragmentRef;
class ModuleDebugUnknownFragmentRef;
class ModuleDebugFragmentVisitor {
public:
virtual ~ModuleDebugFragmentVisitor() = default;
virtual Error visitUnknown(ModuleDebugUnknownFragmentRef &Unknown) {
return Error::success();
}
virtual Error visitLines(ModuleDebugLineFragmentRef &Lines) {
return Error::success();
}
virtual Error
visitFileChecksums(ModuleDebugFileChecksumFragmentRef &Checksums) {
return Error::success();
}
virtual Error finished() { return Error::success(); }
};
Error visitModuleDebugFragment(const ModuleDebugFragmentRecord &R,
ModuleDebugFragmentVisitor &V);
template <typename T>
Error visitModuleDebugFragments(T &&FragmentRange,
ModuleDebugFragmentVisitor &V) {
for (const auto &L : FragmentRange) {
if (auto EC = visitModuleDebugFragment(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