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 SanitizerSet()17SanitizerSet::SanitizerSet() : Kinds(0) {} 18 has(SanitizerKind K) const19bool SanitizerSet::has(SanitizerKind K) const { 20 unsigned Bit = static_cast<unsigned>(K); 21 return Kinds & (1 << Bit); 22 } 23 set(SanitizerKind K,bool Value)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 clear()29void SanitizerSet::clear() { 30 Kinds = 0; 31 } 32 empty() const33bool SanitizerSet::empty() const { 34 return Kinds == 0; 35 } 36