1 //===--- XRayLists.h - XRay automatic attribution ---------------*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // User-provided filters for always/never XRay instrumenting certain functions.
11 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_CLANG_BASIC_XRAYLISTS_H
13 #define LLVM_CLANG_BASIC_XRAYLISTS_H
15 #include "clang/Basic/LLVM.h"
16 #include "clang/Basic/SourceLocation.h"
17 #include "clang/Basic/SourceManager.h"
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/StringRef.h"
20 #include "llvm/Support/SpecialCaseList.h"
25 class XRayFunctionFilter {
26 std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
27 std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
28 std::unique_ptr<llvm::SpecialCaseList> AttrList;
32 XRayFunctionFilter(ArrayRef<std::string> AlwaysInstrumentPaths,
33 ArrayRef<std::string> NeverInstrumentPaths,
34 ArrayRef<std::string> AttrListPaths, SourceManager &SM);
36 enum class ImbueAttribute {
43 ImbueAttribute shouldImbueFunction(StringRef FunctionName) const;
46 shouldImbueFunctionsInFile(StringRef Filename,
47 StringRef Category = StringRef()) const;
49 ImbueAttribute shouldImbueLocation(SourceLocation Loc,
50 StringRef Category = StringRef()) const;