#include "llvm/Transforms/Instrumentation.h"
#if LLVM_VERSION_GE(9, 0)
#include "llvm/Transforms/Instrumentation/AddressSanitizer.h"
+#include "llvm/Support/TimeProfiler.h"
#endif
#if LLVM_VERSION_GE(8, 0)
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
initializeTarget(Registry);
}
+extern "C" void LLVMTimeTraceProfilerInitialize() {
+#if LLVM_VERSION_GE(9, 0)
+ timeTraceProfilerInitialize();
+#endif
+}
+
+extern "C" void LLVMTimeTraceProfilerFinish(const char* FileName) {
+#if LLVM_VERSION_GE(9, 0)
+ StringRef FN(FileName);
+ std::error_code EC;
+ raw_fd_ostream OS(FN, EC, sys::fs::CD_CreateAlways);
+
+ timeTraceProfilerWrite(OS);
+ timeTraceProfilerCleanup();
+#endif
+}
+
enum class LLVMRustPassKind {
Other,
Function,
extern "C" LLVMPassRef LLVMRustCreateAddressSanitizerFunctionPass(bool Recover) {
const bool CompileKernel = false;
+ const bool UseAfterScope = true;
- return wrap(createAddressSanitizerFunctionPass(CompileKernel, Recover));
+ return wrap(createAddressSanitizerFunctionPass(CompileKernel, Recover, UseAfterScope));
}
extern "C" LLVMPassRef LLVMRustCreateModuleAddressSanitizerPass(bool Recover) {