2012-08-24 16:44:47 +00:00
|
|
|
//===-- BlackList.h - blacklist for sanitizers ------------------*- C++ -*-===//
|
2012-03-14 23:22:10 +00:00
|
|
|
//
|
|
|
|
// 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
|
2012-08-24 16:40:11 +00:00
|
|
|
// 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.
|
2012-10-19 15:24:46 +00:00
|
|
|
// Empty lines and lines starting with "#" are ignored.
|
2012-08-24 16:40:11 +00:00
|
|
|
// ---
|
2012-10-19 15:24:46 +00:00
|
|
|
// # Blacklisted items:
|
2012-08-24 16:40:11 +00:00
|
|
|
// fun:*_ZN4base6subtle*
|
2012-09-05 07:29:56 +00:00
|
|
|
// global:*global_with_bad_access_or_initialization*
|
|
|
|
// global-init:*global_with_initialization_issues*
|
2012-11-12 14:00:01 +00:00
|
|
|
// global-init-type:*Namespace::ClassName*
|
2012-08-24 16:40:11 +00:00
|
|
|
// src:file_with_tricky_code.cc
|
2013-04-11 13:20:00 +00:00
|
|
|
// global-init-src:ignore-global-initializers-issues.cc
|
2012-08-24 16:40:11 +00:00
|
|
|
// ---
|
|
|
|
// 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
|
2012-03-14 23:22:10 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
|
2012-08-24 16:40:11 +00:00
|
|
|
#include "llvm/ADT/StringMap.h"
|
2012-03-14 23:22:10 +00:00
|
|
|
|
|
|
|
namespace llvm {
|
|
|
|
class Function;
|
2012-08-24 16:40:11 +00:00
|
|
|
class GlobalVariable;
|
|
|
|
class Module;
|
2012-03-14 23:22:10 +00:00
|
|
|
class Regex;
|
2012-08-24 16:40:11 +00:00
|
|
|
class StringRef;
|
2012-03-14 23:22:10 +00:00
|
|
|
|
2012-08-24 16:44:47 +00:00
|
|
|
class BlackList {
|
2012-03-14 23:22:10 +00:00
|
|
|
public:
|
2012-08-24 16:44:47 +00:00
|
|
|
BlackList(const StringRef Path);
|
2012-08-24 16:40:11 +00:00
|
|
|
// Returns whether either this function or it's source file are blacklisted.
|
2013-01-18 11:29:21 +00:00
|
|
|
bool isIn(const Function &F) const;
|
2012-08-24 16:40:11 +00:00
|
|
|
// Returns whether either this global or it's source file are blacklisted.
|
2013-01-18 11:29:21 +00:00
|
|
|
bool isIn(const GlobalVariable &G) const;
|
2012-08-24 16:40:11 +00:00
|
|
|
// Returns whether this module is blacklisted by filename.
|
2013-01-18 11:29:21 +00:00
|
|
|
bool isIn(const Module &M) const;
|
2012-09-05 07:29:56 +00:00
|
|
|
// Returns whether a global should be excluded from initialization checking.
|
2013-01-18 11:29:21 +00:00
|
|
|
bool isInInit(const GlobalVariable &G) const;
|
2012-03-14 23:22:10 +00:00
|
|
|
private:
|
2012-08-24 16:40:11 +00:00
|
|
|
StringMap<Regex*> Entries;
|
|
|
|
|
2013-01-18 11:29:21 +00:00
|
|
|
bool inSection(const StringRef Section, const StringRef Query) const;
|
2012-03-14 23:22:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace llvm
|