#define LLVM_CLANG_BASIC_SANITIZERBLACKLIST_H
#include "clang/Basic/LLVM.h"
-#include "clang/Basic/SanitizerSpecialCaseList.h"
-#include "clang/Basic/Sanitizers.h"
#include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/StringRef.h"
#include <memory>
+#include <vector>
namespace clang {
+class SanitizerMask;
+class SourceManager;
+class SanitizerSpecialCaseList;
+
class SanitizerBlacklist {
std::unique_ptr<SanitizerSpecialCaseList> SSCL;
SourceManager &SM;
public:
SanitizerBlacklist(const std::vector<std::string> &BlacklistPaths,
SourceManager &SM);
+ ~SanitizerBlacklist();
bool isBlacklistedGlobal(SanitizerMask Mask, StringRef GlobalName,
StringRef Category = StringRef()) const;
bool isBlacklistedType(SanitizerMask Mask, StringRef MangledTypeName,
// SanitizerMask.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
#define LLVM_CLANG_BASIC_SANITIZERSPECIALCASELIST_H
#include "clang/Basic/Sanitizers.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/SpecialCaseList.h"
-#include "llvm/Support/VirtualFileSystem.h"
#include <memory>
+#include <vector>
+
+namespace llvm {
+namespace vfs {
+class FileSystem;
+}
+} // namespace llvm
namespace clang {
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
-#include "clang/Basic/SourceManager.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/SpecialCaseList.h"
#include <memory>
+namespace llvm {
+class SpecialCaseList;
+}
+
namespace clang {
+class SourceManager;
+
class XRayFunctionFilter {
std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
XRayFunctionFilter(ArrayRef<std::string> AlwaysInstrumentPaths,
ArrayRef<std::string> NeverInstrumentPaths,
ArrayRef<std::string> AttrListPaths, SourceManager &SM);
+ ~XRayFunctionFilter();
enum class ImbueAttribute {
NONE,
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/raw_ostream.h"
-
#include <string>
+#include <unordered_map>
namespace clang {
namespace tooling {
// sanitizers.
//
//===----------------------------------------------------------------------===//
+
#include "clang/Basic/SanitizerBlacklist.h"
+#include "clang/Basic/SanitizerSpecialCaseList.h"
+#include "clang/Basic/Sanitizers.h"
+#include "clang/Basic/SourceManager.h"
using namespace clang;
BlacklistPaths, SM.getFileManager().getVirtualFileSystem())),
SM(SM) {}
+SanitizerBlacklist::~SanitizerBlacklist() = default;
+
bool SanitizerBlacklist::isBlacklistedGlobal(SanitizerMask Mask,
StringRef GlobalName,
StringRef Category) const {
// User-provided filters for always/never XRay instrumenting certain functions.
//
//===----------------------------------------------------------------------===//
+
#include "clang/Basic/XRayLists.h"
+#include "clang/Basic/SourceManager.h"
+#include "llvm/Support/SpecialCaseList.h"
using namespace clang;
AttrListPaths, SM.getFileManager().getVirtualFileSystem())),
SM(SM) {}
+XRayFunctionFilter::~XRayFunctionFilter() = default;
+
XRayFunctionFilter::ImbueAttribute
XRayFunctionFilter::shouldImbueFunction(StringRef FunctionName) const {
// First apply the always instrument list, than if it isn't an "always" see
#include <algorithm>
#include <cstring>
#include <functional>
+#include <unordered_map>
using namespace clang;
using namespace sema;
typedef SmallVector<std::unique_ptr<ECDVector>, 3> DuplicatesVector;
typedef llvm::PointerUnion<EnumConstantDecl*, ECDVector*> DeclOrVector;
+
+ // DenseMaps cannot contain the all ones int64_t value, so use unordered_map.
typedef std::unordered_map<int64_t, DeclOrVector> ValueToVectorMap;
- // Use int64_t as a key to avoid needing special handling for DenseMap keys.
+ // Use int64_t as a key to avoid needing special handling for map keys.
auto EnumConstantToKey = [](const EnumConstantDecl *D) {
llvm::APSInt Val = D->getInitVal();
return Val.isSigned() ? Val.getSExtValue() : Val.getZExtValue();