Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:50

0001 //===--- ProfileList.h - ProfileList filter ---------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 //
0009 // User-provided filters include/exclude profile instrumentation in certain
0010 // functions.
0011 //
0012 //===----------------------------------------------------------------------===//
0013 #ifndef LLVM_CLANG_BASIC_PROFILELIST_H
0014 #define LLVM_CLANG_BASIC_PROFILELIST_H
0015 
0016 #include "clang/Basic/CodeGenOptions.h"
0017 #include "clang/Basic/LLVM.h"
0018 #include "clang/Basic/SourceLocation.h"
0019 #include "llvm/ADT/ArrayRef.h"
0020 #include "llvm/ADT/StringRef.h"
0021 #include <memory>
0022 #include <optional>
0023 
0024 namespace clang {
0025 
0026 class ProfileSpecialCaseList;
0027 
0028 class ProfileList {
0029 public:
0030   /// Represents if an how something should be excluded from profiling.
0031   enum ExclusionType {
0032     /// Profiling is allowed.
0033     Allow,
0034     /// Profiling is skipped using the \p skipprofile attribute.
0035     Skip,
0036     /// Profiling is forbidden using the \p noprofile attribute.
0037     Forbid,
0038   };
0039 
0040 private:
0041   std::unique_ptr<ProfileSpecialCaseList> SCL;
0042   const bool Empty;
0043   SourceManager &SM;
0044   std::optional<ExclusionType> inSection(StringRef Section, StringRef Prefix,
0045                                          StringRef Query) const;
0046 
0047 public:
0048   ProfileList(ArrayRef<std::string> Paths, SourceManager &SM);
0049   ~ProfileList();
0050 
0051   bool isEmpty() const { return Empty; }
0052   ExclusionType getDefault(CodeGenOptions::ProfileInstrKind Kind) const;
0053 
0054   std::optional<ExclusionType>
0055   isFunctionExcluded(StringRef FunctionName,
0056                      CodeGenOptions::ProfileInstrKind Kind) const;
0057   std::optional<ExclusionType>
0058   isLocationExcluded(SourceLocation Loc,
0059                      CodeGenOptions::ProfileInstrKind Kind) const;
0060   std::optional<ExclusionType>
0061   isFileExcluded(StringRef FileName,
0062                  CodeGenOptions::ProfileInstrKind Kind) const;
0063 };
0064 
0065 } // namespace clang
0066 
0067 #endif