blob: e9aaa366e32bbf86b1debe920f7d0d607411cfa8 [file] [log] [blame]
Alexey Samsonova0416102014-11-11 01:26:14 +00001//===--- 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
15using namespace clang;
16
17SanitizerSet::SanitizerSet() : Kinds(0) {}
18
19bool SanitizerSet::has(SanitizerKind K) const {
20 unsigned Bit = static_cast<unsigned>(K);
21 return Kinds & (1 << Bit);
22}
23
24void SanitizerSet::set(SanitizerKind K, bool Value) {
25 unsigned Bit = static_cast<unsigned>(K);
26 Kinds = Value ? (Kinds | (1 << Bit)) : (Kinds & ~(1 << Bit));
27}
28
29void SanitizerSet::clear() {
30 Kinds = 0;
31}
Alexey Samsonov4c12c6c2014-11-14 02:59:20 +000032
33bool SanitizerSet::empty() const {
34 return Kinds == 0;
35}