Alexey Samsonov | a041610 | 2014-11-11 01:26:14 +0000 | [diff] [blame] | 1 | //===--- Sanitizers.cpp - C Language Family Language Options ----*- C++ -*-===// |
| 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 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines the classes from Sanitizers.h |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | #include "clang/Basic/Sanitizers.h" |
| 14 | |
| 15 | using namespace clang; |
| 16 | |
| 17 | SanitizerSet::SanitizerSet() : Kinds(0) {} |
| 18 | |
| 19 | bool SanitizerSet::has(SanitizerKind K) const { |
| 20 | unsigned Bit = static_cast<unsigned>(K); |
| 21 | return Kinds & (1 << Bit); |
| 22 | } |
| 23 | |
| 24 | void SanitizerSet::set(SanitizerKind K, bool Value) { |
| 25 | unsigned Bit = static_cast<unsigned>(K); |
| 26 | Kinds = Value ? (Kinds | (1 << Bit)) : (Kinds & ~(1 << Bit)); |
| 27 | } |
| 28 | |
| 29 | void SanitizerSet::clear() { |
| 30 | Kinds = 0; |
| 31 | } |
Alexey Samsonov | 4c12c6c | 2014-11-14 02:59:20 +0000 | [diff] [blame^] | 32 | |
| 33 | bool SanitizerSet::empty() const { |
| 34 | return Kinds == 0; |
| 35 | } |