Improve Register Setup
[llvm-core.git] / lib / XRay / LogBuilderConsumer.cpp
blob88b7d2d728b1eb8f5819dbd316d7a6448d3de9e8
1 //===- FDRRecordConsumer.h - XRay Flight Data Recorder Mode Records -------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #include "llvm/XRay/FDRRecordConsumer.h"
11 namespace llvm {
12 namespace xray {
14 Error LogBuilderConsumer::consume(std::unique_ptr<Record> R) {
15 if (!R)
16 return createStringError(
17 std::make_error_code(std::errc::invalid_argument),
18 "Must not call RecordConsumer::consume() with a null pointer.");
19 Records.push_back(std::move(R));
20 return Error::success();
23 Error PipelineConsumer::consume(std::unique_ptr<Record> R) {
24 if (!R)
25 return createStringError(
26 std::make_error_code(std::errc::invalid_argument),
27 "Must not call RecordConsumer::consume() with a null pointer.");
29 // We apply all of the visitors in order, and concatenate errors
30 // appropriately.
31 Error Result = Error::success();
32 for (auto *V : Visitors)
33 Result = joinErrors(std::move(Result), R->apply(*V));
34 return Result;
37 } // namespace xray
38 } // namespace llvm