Back to home page

EIC code displayed by LXR

 
 

    


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

0001 //===--- XRayLists.h - XRay automatic attribution ---------------*- 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 for always/never XRay instrumenting certain functions.
0010 //
0011 //===----------------------------------------------------------------------===//
0012 #ifndef LLVM_CLANG_BASIC_XRAYLISTS_H
0013 #define LLVM_CLANG_BASIC_XRAYLISTS_H
0014 
0015 #include "clang/Basic/LLVM.h"
0016 #include "clang/Basic/SourceLocation.h"
0017 #include "llvm/ADT/ArrayRef.h"
0018 #include "llvm/ADT/StringRef.h"
0019 #include <memory>
0020 
0021 namespace llvm {
0022 class SpecialCaseList;
0023 }
0024 
0025 namespace clang {
0026 
0027 class SourceManager;
0028 
0029 class XRayFunctionFilter {
0030   std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
0031   std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
0032   std::unique_ptr<llvm::SpecialCaseList> AttrList;
0033   SourceManager &SM;
0034 
0035 public:
0036   XRayFunctionFilter(ArrayRef<std::string> AlwaysInstrumentPaths,
0037                      ArrayRef<std::string> NeverInstrumentPaths,
0038                      ArrayRef<std::string> AttrListPaths, SourceManager &SM);
0039   ~XRayFunctionFilter();
0040 
0041   enum class ImbueAttribute {
0042     NONE,
0043     ALWAYS,
0044     NEVER,
0045     ALWAYS_ARG1,
0046   };
0047 
0048   ImbueAttribute shouldImbueFunction(StringRef FunctionName) const;
0049 
0050   ImbueAttribute
0051   shouldImbueFunctionsInFile(StringRef Filename,
0052                              StringRef Category = StringRef()) const;
0053 
0054   ImbueAttribute shouldImbueLocation(SourceLocation Loc,
0055                                      StringRef Category = StringRef()) const;
0056 };
0057 
0058 } // namespace clang
0059 
0060 #endif