Home | History | Annotate | Download | only in Basic
      1 //===--- XRayLists.h - XRay automatic attribution ---------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // User-provided filters for always/never XRay instrumenting certain functions.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 #ifndef LLVM_CLANG_BASIC_XRAYLISTS_H
     14 #define LLVM_CLANG_BASIC_XRAYLISTS_H
     15 
     16 #include "clang/Basic/LLVM.h"
     17 #include "clang/Basic/SourceLocation.h"
     18 #include "clang/Basic/SourceManager.h"
     19 #include "llvm/ADT/ArrayRef.h"
     20 #include "llvm/ADT/StringRef.h"
     21 #include "llvm/Support/SpecialCaseList.h"
     22 #include <memory>
     23 
     24 namespace clang {
     25 
     26 class XRayFunctionFilter {
     27   std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
     28   std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
     29   SourceManager &SM;
     30 
     31 public:
     32   XRayFunctionFilter(ArrayRef<std::string> AlwaysInstrumentPaths,
     33                      ArrayRef<std::string> NeverInstrumentPaths,
     34                      SourceManager &SM);
     35 
     36   enum class ImbueAttribute {
     37     NONE,
     38     ALWAYS,
     39     NEVER,
     40     ALWAYS_ARG1,
     41   };
     42 
     43   ImbueAttribute shouldImbueFunction(StringRef FunctionName) const;
     44 
     45   ImbueAttribute
     46   shouldImbueFunctionsInFile(StringRef Filename,
     47                              StringRef Category = StringRef()) const;
     48 
     49   ImbueAttribute shouldImbueLocation(SourceLocation Loc,
     50                                      StringRef Category = StringRef()) const;
     51 };
     52 
     53 } // namespace clang
     54 
     55 #endif
     56