1 //===-- utilities.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 #include "gwp_asan/definitions.h" 10 11 #include <stddef.h> 12 #include <stdint.h> 13 14 namespace gwp_asan { 15 // Checks that `Condition` is true, otherwise fails in a platform-specific way 16 // with `Message`. 17 void Check(bool Condition, const char *Message); 18 19 enum class AlignmentStrategy { 20 // Default => POWER_OF_TWO on most platforms, BIONIC for Android Bionic. 21 DEFAULT, 22 POWER_OF_TWO, 23 BIONIC, 24 PERFECT, 25 }; 26 27 // Returns the real size of a right-aligned allocation. 28 size_t rightAlignedAllocationSize( 29 size_t RealAllocationSize, 30 AlignmentStrategy Align = AlignmentStrategy::DEFAULT); 31 } // namespace gwp_asan 32