diff options
author | Zachary Turner <zturner@google.com> | 2017-05-17 16:39:06 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-05-17 16:39:06 +0000 |
commit | 1d795c451e132f3a1232821aeb941ce303ef3b96 (patch) | |
tree | 68422d20f8ec68992757dbf1cbe7dbf0a641be13 /llvm/unittests/Support/CrashRecoveryTest.cpp | |
parent | e67c5f6b52d328bfe08d2830467badaca21611fa (diff) | |
download | bcm5719-llvm-1d795c451e132f3a1232821aeb941ce303ef3b96.tar.gz bcm5719-llvm-1d795c451e132f3a1232821aeb941ce303ef3b96.zip |
[CodeView] Simplify the use of visiting type records & streams.
There is often a lot of boilerplate code required to visit a type
record or type stream. The #1 use case is that you have a sequence
of bytes that represent one or more records, and you want to
deserialize each one, switch on it, and call a callback with the
deserialized record that the user can examine. Currently this
requires at least 6 lines of code:
codeview::TypeVisitorCallbackPipeline Pipeline;
Pipeline.addCallbackToPipeline(Deserializer);
Pipeline.addCallbackToPipeline(MyCallbacks);
codeview::CVTypeVisitor Visitor(Pipeline);
consumeError(Visitor.visitTypeRecord(Record));
With this patch, it becomes one line of code:
consumeError(codeview::visitTypeRecord(Record, MyCallbacks));
This is done by having the deserialization happen internally inside
of the visitTypeRecord function. Since this is occasionally not
desirable, the function provides a 3rd parameter that can be used
to change this behavior.
Hopefully this can significantly reduce the barrier to entry
to using the visitation infrastructure.
Differential Revision: https://reviews.llvm.org/D33245
llvm-svn: 303271
Diffstat (limited to 'llvm/unittests/Support/CrashRecoveryTest.cpp')
0 files changed, 0 insertions, 0 deletions