diff options
author | Will Dietz <wdietz2@illinois.edu> | 2013-01-18 11:29:21 +0000 |
---|---|---|
committer | Will Dietz <wdietz2@illinois.edu> | 2013-01-18 11:29:21 +0000 |
commit | ae36eccdfbad53a1e76ca263b7540b84d50d3524 (patch) | |
tree | b940ebcc1dfcc73df3578b70d97a4f111df31bc5 /include/llvm/Transforms | |
parent | deb318745ddf34ba983d1f292a136ec5ea0b6008 (diff) | |
download | external_llvm-ae36eccdfbad53a1e76ca263b7540b84d50d3524.zip external_llvm-ae36eccdfbad53a1e76ca263b7540b84d50d3524.tar.gz external_llvm-ae36eccdfbad53a1e76ca263b7540b84d50d3524.tar.bz2 |
Move Blacklist.h to include/ to enable use from clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Transforms')
-rw-r--r-- | include/llvm/Transforms/Utils/BlackList.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/include/llvm/Transforms/Utils/BlackList.h b/include/llvm/Transforms/Utils/BlackList.h new file mode 100644 index 0000000..f19470e --- /dev/null +++ b/include/llvm/Transforms/Utils/BlackList.h @@ -0,0 +1,58 @@ +//===-- BlackList.h - blacklist for sanitizers ------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +//===----------------------------------------------------------------------===// +// +// This is a utility class for instrumentation passes (like AddressSanitizer +// or ThreadSanitizer) to avoid instrumenting some functions or global +// variables based on a user-supplied blacklist. +// +// The blacklist disables instrumentation of various functions and global +// variables. Each line contains a prefix, followed by a wild card expression. +// Empty lines and lines starting with "#" are ignored. +// --- +// # Blacklisted items: +// fun:*_ZN4base6subtle* +// global:*global_with_bad_access_or_initialization* +// global-init:*global_with_initialization_issues* +// global-init-type:*Namespace::ClassName* +// src:file_with_tricky_code.cc +// --- +// Note that the wild card is in fact an llvm::Regex, but * is automatically +// replaced with .* +// This is similar to the "ignore" feature of ThreadSanitizer. +// http://code.google.com/p/data-race-test/wiki/ThreadSanitizerIgnores +// +//===----------------------------------------------------------------------===// +// + +#include "llvm/ADT/StringMap.h" + +namespace llvm { +class Function; +class GlobalVariable; +class Module; +class Regex; +class StringRef; + +class BlackList { + public: + BlackList(const StringRef Path); + // Returns whether either this function or it's source file are blacklisted. + bool isIn(const Function &F) const; + // Returns whether either this global or it's source file are blacklisted. + bool isIn(const GlobalVariable &G) const; + // Returns whether this module is blacklisted by filename. + bool isIn(const Module &M) const; + // Returns whether a global should be excluded from initialization checking. + bool isInInit(const GlobalVariable &G) const; + private: + StringMap<Regex*> Entries; + + bool inSection(const StringRef Section, const StringRef Query) const; +}; + +} // namespace llvm |