Skip to content

Commit

Permalink
[Support] Include Support/thread.h before api implementations (#111175)
Browse files Browse the repository at this point in the history
This header was included after the implementations to work around an
issue with FreeBSD, however, , this causes some issues when
dllexport\explicit visibility
attributes will be added to the headers on Windows, since the
definitions need to see the declarations for the attributes to apply.

This is part of the work to enable LLVM_BUILD_LLVM_DYLIB and plugins on
windows.

---------

Co-authored-by: Tom Stellard <[email protected]>
  • Loading branch information
fsfod and tstellar authored Oct 10, 2024
1 parent 1be849c commit 9093ba9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions llvm/lib/Support/Unix/Threading.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
#include <pthread_np.h> // 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 <errno.h>
#include <sys/cpuset.h>
Expand Down
1 change: 1 addition & 0 deletions llvm/lib/Support/Windows/Threading.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <process.h>
Expand Down

0 comments on commit 9093ba9

Please sign in to comment.