1 //===-- sanitizer_chained_origin_depot.h ------------------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // A storage for chained origins.
10 //===----------------------------------------------------------------------===//
12 #ifndef SANITIZER_CHAINED_ORIGIN_DEPOT_H
13 #define SANITIZER_CHAINED_ORIGIN_DEPOT_H
15 #include "sanitizer_common.h"
17 namespace __sanitizer
{
19 class ChainedOriginDepot
{
23 // Gets the statistic of the origin chain storage.
24 StackDepotStats
GetStats() const;
26 // Stores a chain with StackDepot ID here_id and previous chain ID prev_id.
27 // If successful, returns true and the new chain id new_id.
28 // If the same element already exists, returns false and sets new_id to the
30 bool Put(u32 here_id
, u32 prev_id
, u32
*new_id
);
32 // Retrieves the stored StackDepot ID for the given origin ID.
33 u32
Get(u32 id
, u32
*other
);
35 void LockBeforeFork();
36 void UnlockAfterFork(bool fork_child
);
40 ChainedOriginDepot(const ChainedOriginDepot
&) = delete;
41 void operator=(const ChainedOriginDepot
&) = delete;
44 } // namespace __sanitizer
46 #endif // SANITIZER_CHAINED_ORIGIN_DEPOT_H