]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/lib/Basic/Sanitizers.cpp
Merge ^/head r279163 through r279308.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / lib / Basic / Sanitizers.cpp
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 }
32
33 bool SanitizerSet::empty() const {
34   return Kinds == 0;
35 }