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/Optional.h"
21 #include "llvm/ADT/StringRef.h"
22 #include <memory>
23 
24 namespace clang {
25 
26 class ProfileSpecialCaseList;
27 
28 class ProfileList {
29   std::unique_ptr<ProfileSpecialCaseList> SCL;
30   const bool Empty;
31   const bool Default;
32   SourceManager &SM;
33 
34 public:
35   ProfileList(ArrayRef<std::string> Paths, SourceManager &SM);
36   ~ProfileList();
37 
isEmpty()38   bool isEmpty() const { return Empty; }
getDefault()39   bool getDefault() const { return Default; }
40 
41   llvm::Optional<bool>
42   isFunctionExcluded(StringRef FunctionName,
43                      CodeGenOptions::ProfileInstrKind Kind) const;
44   llvm::Optional<bool>
45   isLocationExcluded(SourceLocation Loc,
46                      CodeGenOptions::ProfileInstrKind Kind) const;
47   llvm::Optional<bool>
48   isFileExcluded(StringRef FileName,
49                  CodeGenOptions::ProfileInstrKind Kind) const;
50 };
51 
52 } // namespace clang
53 
54 #endif
55