Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===--- ProfileList.h - ProfileList filter ---------------------*- 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 include/exclude profile instrumentation in certain |
||
10 | // functions. |
||
11 | // |
||
12 | //===----------------------------------------------------------------------===// |
||
13 | #ifndef LLVM_CLANG_BASIC_PROFILELIST_H |
||
14 | #define LLVM_CLANG_BASIC_PROFILELIST_H |
||
15 | |||
16 | #include "clang/Basic/CodeGenOptions.h" |
||
17 | #include "clang/Basic/LLVM.h" |
||
18 | #include "clang/Basic/SourceLocation.h" |
||
19 | #include "llvm/ADT/ArrayRef.h" |
||
20 | #include "llvm/ADT/StringRef.h" |
||
21 | #include <memory> |
||
22 | #include <optional> |
||
23 | |||
24 | namespace clang { |
||
25 | |||
26 | class ProfileSpecialCaseList; |
||
27 | |||
28 | class ProfileList { |
||
29 | public: |
||
30 | /// Represents if an how something should be excluded from profiling. |
||
31 | enum ExclusionType { |
||
32 | /// Profiling is allowed. |
||
33 | Allow, |
||
34 | /// Profiling is skipped using the \p skipprofile attribute. |
||
35 | Skip, |
||
36 | /// Profiling is forbidden using the \p noprofile attribute. |
||
37 | Forbid, |
||
38 | }; |
||
39 | |||
40 | private: |
||
41 | std::unique_ptr<ProfileSpecialCaseList> SCL; |
||
42 | const bool Empty; |
||
43 | SourceManager &SM; |
||
44 | std::optional<ExclusionType> inSection(StringRef Section, StringRef Prefix, |
||
45 | StringRef Query) const; |
||
46 | |||
47 | public: |
||
48 | ProfileList(ArrayRef<std::string> Paths, SourceManager &SM); |
||
49 | ~ProfileList(); |
||
50 | |||
51 | bool isEmpty() const { return Empty; } |
||
52 | ExclusionType getDefault(CodeGenOptions::ProfileInstrKind Kind) const; |
||
53 | |||
54 | std::optional<ExclusionType> |
||
55 | isFunctionExcluded(StringRef FunctionName, |
||
56 | CodeGenOptions::ProfileInstrKind Kind) const; |
||
57 | std::optional<ExclusionType> |
||
58 | isLocationExcluded(SourceLocation Loc, |
||
59 | CodeGenOptions::ProfileInstrKind Kind) const; |
||
60 | std::optional<ExclusionType> |
||
61 | isFileExcluded(StringRef FileName, |
||
62 | CodeGenOptions::ProfileInstrKind Kind) const; |
||
63 | }; |
||
64 | |||
65 | } // namespace clang |
||
66 | |||
67 | #endif |