LLVM  8.0.1
LogBuilderConsumer.cpp
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
10 
11 namespace llvm {
12 namespace xray {
13 
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();
21 }
22 
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.");
28 
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;
35 }
36 
37 } // namespace xray
38 } // namespace llvm
This class represents lattice values for constants.
Definition: AllocatorList.h:24
Error consume(std::unique_ptr< Record > R) override
std::error_code make_error_code(BitcodeError E)
static ErrorSuccess success()
Create a success value.
Definition: Error.h:327
Error consume(std::unique_ptr< Record > R) override
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Definition: Error.h:424
Lightweight error class with error context and mandatory checking.
Definition: Error.h:158
Error createStringError(std::error_code EC, char const *Fmt, const Ts &... Vals)
Create formatted StringError object.
Definition: Error.h:1164