clang  19.0.0git
ProfileList.h
Go to the documentation of this file.
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 
17 #include "clang/Basic/LLVM.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.
32  /// Profiling is allowed.
34  /// Profiling is skipped using the \p skipprofile attribute.
36  /// Profiling is forbidden using the \p noprofile attribute.
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:
50 
51  bool isEmpty() const { return Empty; }
53 
54  std::optional<ExclusionType>
55  isFunctionExcluded(StringRef FunctionName,
57  std::optional<ExclusionType>
60  std::optional<ExclusionType>
61  isFileExcluded(StringRef FileName,
63 };
64 
65 } // namespace clang
66 
67 #endif
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
SourceLocation Loc
Definition: SemaObjC.cpp:755
Defines the clang::SourceLocation class and associated facilities.
std::optional< ExclusionType > isFunctionExcluded(StringRef FunctionName, CodeGenOptions::ProfileInstrKind Kind) const
std::optional< ExclusionType > isLocationExcluded(SourceLocation Loc, CodeGenOptions::ProfileInstrKind Kind) const
bool isEmpty() const
Definition: ProfileList.h:51
ExclusionType
Represents if an how something should be excluded from profiling.
Definition: ProfileList.h:31
@ Forbid
Profiling is forbidden using the noprofile attribute.
Definition: ProfileList.h:37
@ Skip
Profiling is skipped using the skipprofile attribute.
Definition: ProfileList.h:35
@ Allow
Profiling is allowed.
Definition: ProfileList.h:33
ExclusionType getDefault(CodeGenOptions::ProfileInstrKind Kind) const
Definition: ProfileList.cpp:89
ProfileList(ArrayRef< std::string > Paths, SourceManager &SM)
Definition: ProfileList.cpp:67
std::optional< ExclusionType > isFileExcluded(StringRef FileName, CodeGenOptions::ProfileInstrKind Kind) const
Encodes a location in the source.
This class handles loading and caching of source files into memory.
The JSON file list parser is used to communicate input to InstallAPI.