XRayLists.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===--- XRayLists.h - XRay automatic attribution ---------------*- C++ -*-===//
  7. //
  8. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  9. // See https://llvm.org/LICENSE.txt for license information.
  10. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  11. //
  12. //===----------------------------------------------------------------------===//
  13. //
  14. // User-provided filters for always/never XRay instrumenting certain functions.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_CLANG_BASIC_XRAYLISTS_H
  18. #define LLVM_CLANG_BASIC_XRAYLISTS_H
  19. #include "clang/Basic/LLVM.h"
  20. #include "clang/Basic/SourceLocation.h"
  21. #include "llvm/ADT/ArrayRef.h"
  22. #include "llvm/ADT/StringRef.h"
  23. #include <memory>
  24. namespace llvm {
  25. class SpecialCaseList;
  26. }
  27. namespace clang {
  28. class SourceManager;
  29. class XRayFunctionFilter {
  30. std::unique_ptr<llvm::SpecialCaseList> AlwaysInstrument;
  31. std::unique_ptr<llvm::SpecialCaseList> NeverInstrument;
  32. std::unique_ptr<llvm::SpecialCaseList> AttrList;
  33. SourceManager &SM;
  34. public:
  35. XRayFunctionFilter(ArrayRef<std::string> AlwaysInstrumentPaths,
  36. ArrayRef<std::string> NeverInstrumentPaths,
  37. ArrayRef<std::string> AttrListPaths, SourceManager &SM);
  38. ~XRayFunctionFilter();
  39. enum class ImbueAttribute {
  40. NONE,
  41. ALWAYS,
  42. NEVER,
  43. ALWAYS_ARG1,
  44. };
  45. ImbueAttribute shouldImbueFunction(StringRef FunctionName) const;
  46. ImbueAttribute
  47. shouldImbueFunctionsInFile(StringRef Filename,
  48. StringRef Category = StringRef()) const;
  49. ImbueAttribute shouldImbueLocation(SourceLocation Loc,
  50. StringRef Category = StringRef()) const;
  51. };
  52. } // namespace clang
  53. #endif
  54. #ifdef __GNUC__
  55. #pragma GCC diagnostic pop
  56. #endif