clang  16.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/Optional.h"
21 #include "llvm/ADT/StringRef.h"
22 #include <memory>
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  llvm::Optional<ExclusionType> inSection(StringRef Section, StringRef Prefix,
45  StringRef Query) const;
46 
47 public:
49  ~ProfileList();
50 
51  bool isEmpty() const { return Empty; }
53 
55  isFunctionExcluded(StringRef FunctionName,
61  isFileExcluded(StringRef FileName,
63 };
64 
65 } // namespace clang
66 
67 #endif
clang::ProfileList::isLocationExcluded
llvm::Optional< ExclusionType > isLocationExcluded(SourceLocation Loc, CodeGenOptions::ProfileInstrKind Kind) const
Definition: ProfileList.cpp:132
clang::ProfileList::Skip
@ Skip
Profiling is skipped using the skipprofile attribute.
Definition: ProfileList.h:35
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::ProfileList::ExclusionType
ExclusionType
Represents if an how something should be excluded from profiling.
Definition: ProfileList.h:31
llvm::Optional
Definition: LLVM.h:40
clang::CodeGenOptions::ProfileInstrKind
ProfileInstrKind
Definition: CodeGenOptions.h:85
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:636
CodeGenOptions.h
clang::ProfileList::isFileExcluded
llvm::Optional< ExclusionType > isFileExcluded(StringRef FileName, CodeGenOptions::ProfileInstrKind Kind) const
Definition: ProfileList.cpp:138
clang::ProfileList::isEmpty
bool isEmpty() const
Definition: ProfileList.h:51
clang::ProfileList::~ProfileList
~ProfileList()
SourceLocation.h
clang::ProfileList::getDefault
ExclusionType getDefault(CodeGenOptions::ProfileInstrKind Kind) const
Definition: ProfileList.cpp:88
llvm::ArrayRef< std::string >
LLVM.h
clang::ProfileList::ProfileList
ProfileList(ArrayRef< std::string > Paths, SourceManager &SM)
Definition: ProfileList.cpp:66
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang
Definition: CalledOnceCheck.h:17
clang::ProfileList::isFunctionExcluded
llvm::Optional< ExclusionType > isFunctionExcluded(StringRef FunctionName, CodeGenOptions::ProfileInstrKind Kind) const
Definition: ProfileList.cpp:118
clang::ProfileList::Forbid
@ Forbid
Profiling is forbidden using the noprofile attribute.
Definition: ProfileList.h:37
clang::ProfileList::Allow
@ Allow
Profiling is allowed.
Definition: ProfileList.h:33
clang::ProfileList
Definition: ProfileList.h:28