r219840 - Move SanitizerBlacklist to clangBasic. NFC.
Alexey Samsonov
vonosmas at gmail.com
Wed Oct 15 12:57:45 PDT 2014
Author: samsonov
Date: Wed Oct 15 14:57:45 2014
New Revision: 219840
URL: http://llvm.org/viewvc/llvm-project?rev=219840&view=rev
Log:
Move SanitizerBlacklist to clangBasic. NFC.
This change moves SanitizerBlacklist.h from lib/CodeGen
to public Clang headers in include/clang/Basic. SanitizerBlacklist
is currently only used in CodeGen to decide which functions/modules
should be instrumented, but this will soon change as ASan will
optionally modify class layouts during AST construction
(http://reviews.llvm.org/D5687). We need blacklist machinery
to be available at this point.
Added:
cfe/trunk/include/clang/Basic/SanitizerBlacklist.h
- copied, changed from r219818, cfe/trunk/lib/CodeGen/SanitizerBlacklist.h
cfe/trunk/lib/Basic/SanitizerBlacklist.cpp
- copied, changed from r219818, cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp
Removed:
cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp
cfe/trunk/lib/CodeGen/SanitizerBlacklist.h
Modified:
cfe/trunk/lib/Basic/CMakeLists.txt
cfe/trunk/lib/CodeGen/CMakeLists.txt
cfe/trunk/lib/CodeGen/CodeGenModule.h
Copied: cfe/trunk/include/clang/Basic/SanitizerBlacklist.h (from r219818, cfe/trunk/lib/CodeGen/SanitizerBlacklist.h)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SanitizerBlacklist.h?p2=cfe/trunk/include/clang/Basic/SanitizerBlacklist.h&p1=cfe/trunk/lib/CodeGen/SanitizerBlacklist.h&r1=219818&r2=219840&rev=219840&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/SanitizerBlacklist.h (original)
+++ cfe/trunk/include/clang/Basic/SanitizerBlacklist.h Wed Oct 15 14:57:45 2014
@@ -11,8 +11,8 @@
// sanitizers.
//
//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H
-#define LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H
+#ifndef LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H
+#define LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H
#include "clang/Basic/LLVM.h"
#include "llvm/ADT/StringRef.h"
@@ -26,7 +26,6 @@ class Module;
}
namespace clang {
-namespace CodeGen {
class SanitizerBlacklist {
std::unique_ptr<llvm::SpecialCaseList> SCL;
@@ -41,7 +40,7 @@ public:
StringRef Category = StringRef()) const;
bool isBlacklistedType(StringRef MangledTypeName) const;
};
-} // end namespace CodeGen
+
} // end namespace clang
#endif
Modified: cfe/trunk/lib/Basic/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/CMakeLists.txt?rev=219840&r1=219839&r2=219840&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/CMakeLists.txt (original)
+++ cfe/trunk/lib/Basic/CMakeLists.txt Wed Oct 15 14:57:45 2014
@@ -17,6 +17,7 @@ add_clang_library(clangBasic
ObjCRuntime.cpp
OpenMPKinds.cpp
OperatorPrecedence.cpp
+ SanitizerBlacklist.cpp
SourceLocation.cpp
SourceManager.cpp
TargetInfo.cpp
Copied: cfe/trunk/lib/Basic/SanitizerBlacklist.cpp (from r219818, cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp)
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SanitizerBlacklist.cpp?p2=cfe/trunk/lib/Basic/SanitizerBlacklist.cpp&p1=cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp&r1=219818&r2=219840&rev=219840&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp (original)
+++ cfe/trunk/lib/Basic/SanitizerBlacklist.cpp Wed Oct 15 14:57:45 2014
@@ -11,13 +11,12 @@
// sanitizers.
//
//===----------------------------------------------------------------------===//
-#include "SanitizerBlacklist.h"
+#include "clang/Basic/SanitizerBlacklist.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Module.h"
using namespace clang;
-using namespace CodeGen;
static StringRef GetGlobalTypeString(const llvm::GlobalValue &G) {
// Types of GlobalVariables are always pointer types.
Modified: cfe/trunk/lib/CodeGen/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CMakeLists.txt?rev=219840&r1=219839&r2=219840&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CMakeLists.txt (original)
+++ cfe/trunk/lib/CodeGen/CMakeLists.txt Wed Oct 15 14:57:45 2014
@@ -61,7 +61,6 @@ add_clang_library(clangCodeGen
ItaniumCXXABI.cpp
MicrosoftCXXABI.cpp
ModuleBuilder.cpp
- SanitizerBlacklist.cpp
SanitizerMetadata.cpp
TargetInfo.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=219840&r1=219839&r2=219840&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Wed Oct 15 14:57:45 2014
@@ -16,7 +16,6 @@
#include "CGVTables.h"
#include "CodeGenTypes.h"
-#include "SanitizerBlacklist.h"
#include "SanitizerMetadata.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclCXX.h"
@@ -26,6 +25,7 @@
#include "clang/Basic/ABI.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/Module.h"
+#include "clang/Basic/SanitizerBlacklist.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
Removed: cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp?rev=219839&view=auto
==============================================================================
--- cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp (original)
+++ cfe/trunk/lib/CodeGen/SanitizerBlacklist.cpp (removed)
@@ -1,52 +0,0 @@
-//===--- SanitizerBlacklist.cpp - Blacklist for sanitizers ----------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// User-provided blacklist used to disable/alter instrumentation done in
-// sanitizers.
-//
-//===----------------------------------------------------------------------===//
-#include "SanitizerBlacklist.h"
-#include "llvm/IR/Function.h"
-#include "llvm/IR/GlobalValue.h"
-#include "llvm/IR/Module.h"
-
-using namespace clang;
-using namespace CodeGen;
-
-static StringRef GetGlobalTypeString(const llvm::GlobalValue &G) {
- // Types of GlobalVariables are always pointer types.
- llvm::Type *GType = G.getType()->getElementType();
- // For now we support blacklisting struct types only.
- if (llvm::StructType *SGType = dyn_cast<llvm::StructType>(GType)) {
- if (!SGType->isLiteral())
- return SGType->getName();
- }
- return "<unknown type>";
-}
-
-bool SanitizerBlacklist::isIn(const llvm::Module &M,
- StringRef Category) const {
- return SCL->inSection("src", M.getModuleIdentifier(), Category);
-}
-
-bool SanitizerBlacklist::isIn(const llvm::Function &F) const {
- return isIn(*F.getParent()) ||
- SCL->inSection("fun", F.getName(), "");
-}
-
-bool SanitizerBlacklist::isIn(const llvm::GlobalVariable &G,
- StringRef Category) const {
- return isIn(*G.getParent(), Category) ||
- SCL->inSection("global", G.getName(), Category) ||
- SCL->inSection("type", GetGlobalTypeString(G), Category);
-}
-
-bool SanitizerBlacklist::isBlacklistedType(StringRef MangledTypeName) const {
- return SCL->inSection("type", MangledTypeName);
-}
Removed: cfe/trunk/lib/CodeGen/SanitizerBlacklist.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/SanitizerBlacklist.h?rev=219839&view=auto
==============================================================================
--- cfe/trunk/lib/CodeGen/SanitizerBlacklist.h (original)
+++ cfe/trunk/lib/CodeGen/SanitizerBlacklist.h (removed)
@@ -1,47 +0,0 @@
-//===--- SanitizerBlacklist.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.
-//
-//===----------------------------------------------------------------------===//
-//
-// User-provided blacklist used to disable/alter instrumentation done in
-// sanitizers.
-//
-//===----------------------------------------------------------------------===//
-#ifndef LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H
-#define LLVM_CLANG_LIB_CODEGEN_SANITIZERBLACKLIST_H
-
-#include "clang/Basic/LLVM.h"
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/SpecialCaseList.h"
-#include <memory>
-
-namespace llvm {
-class GlobalVariable;
-class Function;
-class Module;
-}
-
-namespace clang {
-namespace CodeGen {
-
-class SanitizerBlacklist {
- std::unique_ptr<llvm::SpecialCaseList> SCL;
-
-public:
- SanitizerBlacklist(std::unique_ptr<llvm::SpecialCaseList> SCL)
- : SCL(std::move(SCL)) {}
- bool isIn(const llvm::Module &M,
- StringRef Category = StringRef()) const;
- bool isIn(const llvm::Function &F) const;
- bool isIn(const llvm::GlobalVariable &G,
- StringRef Category = StringRef()) const;
- bool isBlacklistedType(StringRef MangledTypeName) const;
-};
-} // end namespace CodeGen
-} // end namespace clang
-
-#endif
More information about the cfe-commits
mailing list