summaryrefslogtreecommitdiffstats
path: root/lib/Basic/Sanitizers.cpp
blob: e9aaa366e32bbf86b1debe920f7d0d607411cfa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//===--- Sanitizers.cpp - C Language Family Language Options ----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  This file defines the classes from Sanitizers.h
//
//===----------------------------------------------------------------------===//
#include "clang/Basic/Sanitizers.h"

using namespace clang;

SanitizerSet::SanitizerSet() : Kinds(0) {}

bool SanitizerSet::has(SanitizerKind K) const {
  unsigned Bit = static_cast<unsigned>(K);
  return Kinds & (1 << Bit);
}

void SanitizerSet::set(SanitizerKind K, bool Value) {
  unsigned Bit = static_cast<unsigned>(K);
  Kinds = Value ? (Kinds | (1 << Bit)) : (Kinds & ~(1 << Bit));
}

void SanitizerSet::clear() {
  Kinds = 0;
}

bool SanitizerSet::empty() const {
  return Kinds == 0;
}
OpenPOWER on IntegriCloud