ThreadSanitizer.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #ifdef __GNUC__
  3. #pragma GCC diagnostic push
  4. #pragma GCC diagnostic ignored "-Wunused-parameter"
  5. #endif
  6. //===- Transforms/Instrumentation/ThreadSanitizer.h - TSan Pass -----------===//
  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. // This file defines the thread sanitizer pass.
  15. //
  16. //===----------------------------------------------------------------------===//
  17. #ifndef LLVM_TRANSFORMS_INSTRUMENTATION_THREADSANITIZER_H
  18. #define LLVM_TRANSFORMS_INSTRUMENTATION_THREADSANITIZER_H
  19. #include "llvm/IR/PassManager.h"
  20. #include "llvm/Pass.h"
  21. namespace llvm {
  22. // Insert ThreadSanitizer (race detection) instrumentation
  23. FunctionPass *createThreadSanitizerLegacyPassPass();
  24. /// A function pass for tsan instrumentation.
  25. ///
  26. /// Instruments functions to detect race conditions reads. This function pass
  27. /// inserts calls to runtime library functions. If the functions aren't declared
  28. /// yet, the pass inserts the declarations. Otherwise the existing globals are
  29. struct ThreadSanitizerPass : public PassInfoMixin<ThreadSanitizerPass> {
  30. PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
  31. static bool isRequired() { return true; }
  32. };
  33. /// A module pass for tsan instrumentation.
  34. ///
  35. /// Create ctor and init functions.
  36. struct ModuleThreadSanitizerPass
  37. : public PassInfoMixin<ModuleThreadSanitizerPass> {
  38. PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
  39. static bool isRequired() { return true; }
  40. };
  41. } // namespace llvm
  42. #endif /* LLVM_TRANSFORMS_INSTRUMENTATION_THREADSANITIZER_H */
  43. #ifdef __GNUC__
  44. #pragma GCC diagnostic pop
  45. #endif