Index: llvm/include/llvm/Support/TimeProfiler.h =================================================================== --- llvm/include/llvm/Support/TimeProfiler.h +++ llvm/include/llvm/Support/TimeProfiler.h @@ -9,12 +9,19 @@ #ifndef LLVM_SUPPORT_TIME_PROFILER_H #define LLVM_SUPPORT_TIME_PROFILER_H +#include "llvm/Config/llvm-config.h" #include "llvm/Support/raw_ostream.h" +#if LLVM_ENABLE_THREADS +#define THREAD_LOCAL_IF_THREADS_ENABLED thread_local +#else +#define THREAD_LOCAL_IF_THREADS_ENABLED +#endif + namespace llvm { struct TimeTraceProfiler; -extern thread_local std::unique_ptr +extern THREAD_LOCAL_IF_THREADS_ENABLED std::unique_ptr TimeTraceProfilerInstance; /// Initialize the time trace profiler. Index: llvm/lib/Support/TimeProfiler.cpp =================================================================== --- llvm/lib/Support/TimeProfiler.cpp +++ llvm/lib/Support/TimeProfiler.cpp @@ -33,7 +33,7 @@ namespace llvm { -thread_local std::unique_ptr TimeTraceProfilerInstance = +THREAD_LOCAL_IF_THREADS_ENABLED std::unique_ptr TimeTraceProfilerInstance = nullptr; typedef duration DurationType;