Skip to content

Commit

Permalink
[flang] Make runtimes headers independent of the main llvm headers
Browse files Browse the repository at this point in the history
llvm/Support/Compiler.h requires llvm-config.h, i.e. to include it,
you'd need to actually set up building llvm for that target.

If using flang to cross compile code for a different target, we need
the runtimes built for that target, but we might not want to build
llvm itself for that target.

This is one out of two essential steps for building the flang runtimes
for a foreign target, i.e. setting up cross compiling with flang.

Differential Revision: https://reviews.llvm.org/D130351
  • Loading branch information
mstorsjo committed Aug 23, 2022
1 parent 0565e65 commit 96a3b78
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions flang/include/flang/Common/idioms.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#endif

#include "visit.h"
#include "llvm/Support/Compiler.h"
#include <functional>
#include <list>
#include <memory>
Expand Down Expand Up @@ -125,11 +124,11 @@ template <typename A> struct ListItemCount {

#define ENUM_CLASS(NAME, ...) \
enum class NAME { __VA_ARGS__ }; \
LLVM_ATTRIBUTE_UNUSED static constexpr std::size_t NAME##_enumSize{[] { \
[[maybe_unused]] static constexpr std::size_t NAME##_enumSize{[] { \
enum { __VA_ARGS__ }; \
return Fortran::common::ListItemCount{__VA_ARGS__}.value; \
}()}; \
LLVM_ATTRIBUTE_UNUSED static inline std::string EnumToString(NAME e) { \
[[maybe_unused]] static inline std::string EnumToString(NAME e) { \
return Fortran::common::EnumIndexToString( \
static_cast<int>(e), #__VA_ARGS__); \
}
Expand Down

0 comments on commit 96a3b78

Please sign in to comment.