diff options
| author | Ralf Luther <luther.ralf@gmail.com> | 2019-03-27 20:23:17 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit2@aicp-server-3> | 2019-03-27 20:23:17 +0000 |
| commit | 1ce3a9d272e564b22a1333a1e36a3d3ab7cfab01 (patch) | |
| tree | 391382eadd4fec5bb480f2e8934fa352770221d1 /clang-r353983/include/llvm/XRay/BlockVerifier.h | |
| parent | d1d48b140bafaa8a50107292f5fce95562575765 (diff) | |
| parent | 4f56932d3416ac03f646bc1a611b3135fec2fe08 (diff) | |
Merge "Update prebuilt Clang to r353983." into p9.0HEADp9.0-backupp9.0
Diffstat (limited to 'clang-r353983/include/llvm/XRay/BlockVerifier.h')
| -rw-r--r-- | clang-r353983/include/llvm/XRay/BlockVerifier.h | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/clang-r353983/include/llvm/XRay/BlockVerifier.h b/clang-r353983/include/llvm/XRay/BlockVerifier.h new file mode 100644 index 00000000..c848fdf0 --- /dev/null +++ b/clang-r353983/include/llvm/XRay/BlockVerifier.h @@ -0,0 +1,71 @@ +//===- BlockVerifier.h - FDR Block Verifier -------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// An implementation of the RecordVisitor which verifies a sequence of records +// associated with a block, following the FDR mode log format's specifications. +// +//===----------------------------------------------------------------------===// +#ifndef LLVM_INCLUDE_LLVM_XRAY_BLOCKVERIFIER_H_ +#define LLVM_INCLUDE_LLVM_XRAY_BLOCKVERIFIER_H_ + +#include "llvm/XRay/FDRRecords.h" +#include <array> +#include <bitset> + +namespace llvm { +namespace xray { + +class BlockVerifier : public RecordVisitor { +public: + // We force State elements to be size_t, to be used as indices for containers. + enum class State : std::size_t { + Unknown, + BufferExtents, + NewBuffer, + WallClockTime, + PIDEntry, + NewCPUId, + TSCWrap, + CustomEvent, + TypedEvent, + Function, + CallArg, + EndOfBuffer, + StateMax, + }; + +private: + // We keep track of the current record seen by the verifier. + State CurrentRecord = State::Unknown; + + // Transitions the current record to the new record, records an error on + // invalid transitions. + Error transition(State To); + +public: + Error visit(BufferExtents &) override; + Error visit(WallclockRecord &) override; + Error visit(NewCPUIDRecord &) override; + Error visit(TSCWrapRecord &) override; + Error visit(CustomEventRecord &) override; + Error visit(CallArgRecord &) override; + Error visit(PIDRecord &) override; + Error visit(NewBufferRecord &) override; + Error visit(EndBufferRecord &) override; + Error visit(FunctionRecord &) override; + Error visit(CustomEventRecordV5 &) override; + Error visit(TypedEventRecord &) override; + + Error verify(); + void reset(); +}; + +} // namespace xray +} // namespace llvm + +#endif // LLVM_INCLUDE_LLVM_XRAY_BLOCKVERIFIER_H_ |
