[flang][cuda] Adapt ExternalNameConversion to work in gpu module (#117039)
[llvm-project.git] / compiler-rt / lib / sanitizer_common / sanitizer_chained_origin_depot.h
blobf3da28129e6bd8b66302c220ccaa64b8c0feb2d9
1 //===-- sanitizer_chained_origin_depot.h ------------------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
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 {
20 public:
21 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
29 // existing ID.
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);
37 void TestOnlyUnmap();
39 private:
40 ChainedOriginDepot(const ChainedOriginDepot &) = delete;
41 void operator=(const ChainedOriginDepot &) = delete;
44 } // namespace __sanitizer
46 #endif // SANITIZER_CHAINED_ORIGIN_DEPOT_H