]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Basic/XRayLists.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Basic / XRayLists.h
1 //===--- XRayLists.h - XRay automatic attribution ---------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // User-provided filters for always/never XRay instrumenting certain functions.
11 //
12 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_CLANG_BASIC_XRAYLISTS_H
14 #define LLVM_CLANG_BASIC_XRAYLISTS_H
15
16 #include "clang/Basic/LLVM.h"
17 #include "clang/Basic/SourceLocation.h"
18 #include "clang/Basic/SourceManager.h"
19 #include "llvm/ADT/ArrayRef.h"
20 #include "llvm/ADT/StringRef.h"
21 #include "llvm/Support/SpecialCaseList.h"
22 #include <memory>
23
24 namespace clang {
25
26 class XRayFunctionFilter {
27   std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
28   std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
29   std::unique_ptr<llvm::SpecialCaseList> AttrList;
30   SourceManager &SM;
31
32 public:
33   XRayFunctionFilter(ArrayRef<std::string> AlwaysInstrumentPaths,
34                      ArrayRef<std::string> NeverInstrumentPaths,
35                      ArrayRef<std::string> AttrListPaths, SourceManager &SM);
36
37   enum class ImbueAttribute {
38     NONE,
39     ALWAYS,
40     NEVER,
41     ALWAYS_ARG1,
42   };
43
44   ImbueAttribute shouldImbueFunction(StringRef FunctionName) const;
45
46   ImbueAttribute
47   shouldImbueFunctionsInFile(StringRef Filename,
48                              StringRef Category = StringRef()) const;
49
50   ImbueAttribute shouldImbueLocation(SourceLocation Loc,
51                                      StringRef Category = StringRef()) const;
52 };
53
54 } // namespace clang
55
56 #endif