clang  14.0.0git
XRayLists.h
Go to the documentation of this file.
1 //===--- XRayLists.h - XRay automatic attribution ---------------*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // User-provided filters for always/never XRay instrumenting certain functions.
10 //
11 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_CLANG_BASIC_XRAYLISTS_H
13 #define LLVM_CLANG_BASIC_XRAYLISTS_H
14 
15 #include "clang/Basic/LLVM.h"
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/StringRef.h"
19 #include <memory>
20 
21 namespace llvm {
22 class SpecialCaseList;
23 }
24 
25 namespace clang {
26 
27 class SourceManager;
28 
30  std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
31  std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
32  std::unique_ptr<llvm::SpecialCaseList> AttrList;
33  SourceManager &SM;
34 
35 public:
36  XRayFunctionFilter(ArrayRef<std::string> AlwaysInstrumentPaths,
37  ArrayRef<std::string> NeverInstrumentPaths,
38  ArrayRef<std::string> AttrListPaths, SourceManager &SM);
40 
41  enum class ImbueAttribute {
42  NONE,
43  ALWAYS,
44  NEVER,
46  };
47 
48  ImbueAttribute shouldImbueFunction(StringRef FunctionName) const;
49 
52  StringRef Category = StringRef()) const;
53 
55  StringRef Category = StringRef()) const;
56 };
57 
58 } // namespace clang
59 
60 #endif
llvm
Definition: Dominators.h:30
clang::XRayFunctionFilter::shouldImbueLocation
ImbueAttribute shouldImbueLocation(SourceLocation Loc, StringRef Category=StringRef()) const
Definition: XRayLists.cpp:71
clang::XRayFunctionFilter::ImbueAttribute::ALWAYS_ARG1
@ ALWAYS_ARG1
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
Filename
StringRef Filename
Definition: Format.cpp:2333
clang::XRayFunctionFilter::XRayFunctionFilter
XRayFunctionFilter(ArrayRef< std::string > AlwaysInstrumentPaths, ArrayRef< std::string > NeverInstrumentPaths, ArrayRef< std::string > AttrListPaths, SourceManager &SM)
Definition: XRayLists.cpp:20
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:626
clang::XRayFunctionFilter
Definition: XRayLists.h:29
clang::XRayFunctionFilter::ImbueAttribute::NONE
@ NONE
clang::XRayFunctionFilter::ImbueAttribute::NEVER
@ NEVER
SourceLocation.h
llvm::ArrayRef< std::string >
LLVM.h
clang
Definition: CalledOnceCheck.h:17
clang::XRayFunctionFilter::shouldImbueFunction
ImbueAttribute shouldImbueFunction(StringRef FunctionName) const
Definition: XRayLists.cpp:35
clang::XRayFunctionFilter::~XRayFunctionFilter
~XRayFunctionFilter()
clang::XRayFunctionFilter::shouldImbueFunctionsInFile
ImbueAttribute shouldImbueFunctionsInFile(StringRef Filename, StringRef Category=StringRef()) const
Definition: XRayLists.cpp:57
SM
#define SM(sm)
Definition: Cuda.cpp:78
clang::XRayFunctionFilter::ImbueAttribute
ImbueAttribute
Definition: XRayLists.h:41
clang::XRayFunctionFilter::ImbueAttribute::ALWAYS
@ ALWAYS