diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc index a354984cabb1e..c7b4c7af3b9f3 100644 --- a/llvm/lib/Support/Unix/Threading.inc +++ b/llvm/lib/Support/Unix/Threading.inc @@ -33,6 +33,13 @@ #include // For pthread_getthreadid_np() / pthread_set_name_np() #endif +// Must be included after Threading.inc to provide definition for llvm::thread +// because FreeBSD's condvar.h (included by user.h) misuses the "thread" +// keyword. +#ifndef __FreeBSD__ +#include "llvm/Support/thread.h" +#endif + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #include diff --git a/llvm/lib/Support/Windows/Threading.inc b/llvm/lib/Support/Windows/Threading.inc index 4baf8b8cb82ae..d862dbd7f71c9 100644 --- a/llvm/lib/Support/Windows/Threading.inc +++ b/llvm/lib/Support/Windows/Threading.inc @@ -12,6 +12,7 @@ #include "llvm/ADT/SmallString.h" #include "llvm/ADT/Twine.h" +#include "llvm/Support/thread.h" #include "llvm/Support/Windows/WindowsSupport.h" #include