clang API Documentation

Sanitizers.cpp
Go to the documentation of this file.
00001 //===--- Sanitizers.cpp - C Language Family Language Options ----*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 //  This file defines the classes from Sanitizers.h
00011 //
00012 //===----------------------------------------------------------------------===//
00013 #include "clang/Basic/Sanitizers.h"
00014 
00015 using namespace clang;
00016 
00017 SanitizerSet::SanitizerSet() : Kinds(0) {}
00018 
00019 bool SanitizerSet::has(SanitizerKind K) const {
00020   unsigned Bit = static_cast<unsigned>(K);
00021   return Kinds & (1 << Bit);
00022 }
00023 
00024 void SanitizerSet::set(SanitizerKind K, bool Value) {
00025   unsigned Bit = static_cast<unsigned>(K);
00026   Kinds = Value ? (Kinds | (1 << Bit)) : (Kinds & ~(1 << Bit));
00027 }
00028 
00029 void SanitizerSet::clear() {
00030   Kinds = 0;
00031 }
00032 
00033 bool SanitizerSet::empty() const {
00034   return Kinds == 0;
00035 }