Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pdb] Change type visitor pattern to be dynamic.
This allows better catching of compiler errors since we can use the override keyword to verify that methods are actually overridden. Also in this patch I've changed from storing a boolean Error code everywhere to returning an llvm::Error, to propagate richer error information up the call stack. Reviewed By: ruiu, rnk Differential Revision: http://reviews.llvm.org/D21410 llvm-svn: 272926
- Loading branch information
Zachary Turner
committed
Jun 16, 2016
1 parent
41315f7
commit 1f6372c
Showing
14 changed files
with
466 additions
and
390 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
llvm/include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
//===- TypeVisitorCallbacks.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_TYPEVISITORCALLBACKS_H | ||
#define LLVM_DEBUGINFO_CODEVIEW_TYPEVISITORCALLBACKS_H | ||
|
||
#include "llvm/ADT/ArrayRef.h" | ||
#include "llvm/DebugInfo/CodeView/CodeView.h" | ||
#include "llvm/Support/Error.h" | ||
|
||
namespace llvm { | ||
namespace codeview { | ||
class TypeVisitorCallbacks { | ||
friend class CVTypeVisitor; | ||
|
||
public: | ||
virtual ~TypeVisitorCallbacks() {} | ||
|
||
/// Action to take on unknown types. By default, they are ignored. | ||
virtual Error visitUnknownType(const CVRecord<TypeLeafKind> &Record) { | ||
return Error::success(); | ||
} | ||
virtual Error visitUnknownMember(const CVRecord<TypeLeafKind> &Record) { | ||
return Error::success(); | ||
} | ||
|
||
/// Paired begin/end actions for all types. Receives all record data, | ||
/// including the fixed-length record prefix. | ||
virtual Error visitTypeBegin(const CVRecord<TypeLeafKind> &Record) { | ||
return Error::success(); | ||
} | ||
virtual Error visitTypeEnd(const CVRecord<TypeLeafKind> &Record) { | ||
return Error::success(); | ||
} | ||
|
||
#define TYPE_RECORD(EnumName, EnumVal, Name) \ | ||
virtual Error visit##Name(Name##Record &Record) { return Error::success(); } | ||
#define MEMBER_RECORD(EnumName, EnumVal, Name) \ | ||
TYPE_RECORD(EnumName, EnumVal, Name) | ||
#define TYPE_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) | ||
#define MEMBER_RECORD_ALIAS(EnumName, EnumVal, Name, AliasName) | ||
#include "TypeRecords.def" | ||
}; | ||
} | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.