ThreadSanitizer.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. namespace llvm {
  21. class Function;
  22. class Module;
  23. /// A function pass for tsan instrumentation.
  24. ///
  25. /// Instruments functions to detect race conditions reads. This function pass
  26. /// inserts calls to runtime library functions. If the functions aren't declared
  27. /// yet, the pass inserts the declarations. Otherwise the existing globals are
  28. struct ThreadSanitizerPass : public PassInfoMixin<ThreadSanitizerPass> {
  29. PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
  30. static bool isRequired() { return true; }
  31. };
  32. /// A module pass for tsan instrumentation.
  33. ///
  34. /// Create ctor and init functions.
  35. struct ModuleThreadSanitizerPass
  36. : public PassInfoMixin<ModuleThreadSanitizerPass> {
  37. PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
  38. static bool isRequired() { return true; }
  39. };
  40. } // namespace llvm
  41. #endif /* LLVM_TRANSFORMS_INSTRUMENTATION_THREADSANITIZER_H */
  42. #ifdef __GNUC__
  43. #pragma GCC diagnostic pop
  44. #endif