1a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany//===-- FunctionBlackList.cpp - blacklist of functions ----------*- C++ -*-===// 2a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// 3a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// The LLVM Compiler Infrastructure 4a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// 5a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// This file is distributed under the University of Illinois Open Source 6a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// License. See LICENSE.TXT for details. 7a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany//===----------------------------------------------------------------------===// 8a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// 9a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// This is a utility class for instrumentation passes (like AddressSanitizer 10a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// or ThreadSanitizer) to avoid instrumenting some functions based on 11a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// user-supplied blacklist. 12a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// 13a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany//===----------------------------------------------------------------------===// 14a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// 15a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany 16a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany#include <string> 17a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany 18a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryanynamespace llvm { 19a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryanyclass Function; 20a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryanyclass Regex; 21a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany 22a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// Blacklisted functions are not instrumented. 23a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// The blacklist file contains one or more lines like this: 24a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// --- 25a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// fun:FunctionWildCard 26a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// --- 27a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// This is similar to the "ignore" feature of ThreadSanitizer. 28a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany// http://code.google.com/p/data-race-test/wiki/ThreadSanitizerIgnores 29a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryanyclass FunctionBlackList { 30a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany public: 31a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany FunctionBlackList(const std::string &Path); 32a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany bool isIn(const Function &F); 33a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany private: 34a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany Regex *Functions; 35a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany}; 36a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany 37a1c45044099cf7fb4a072f1326f164706d5bb2e2Kostya Serebryany} // namespace llvm 38