-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make clang-13 work with libstdc++ via convenience header (#547)
Once coroutine support moves from std::experimental to std, we don't need this anymore. This will be the case for clang-14.
- Loading branch information
Showing
7 changed files
with
70 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright 2022, University of Freiburg, | ||
// Chair of Algorithms and Data Structures. | ||
// Author: Johannes Kalmbach <kalmbach@cs.uni-freiburg.de> | ||
|
||
// Clang up to version 13 does not link again libstdc++, | ||
// because coroutines are still expected in the std::experimental | ||
// namespace. This is a helper file that overcomes this limitation, | ||
// simply include this file as a replacement of <coroutine> | ||
|
||
// TODO<LLVM14> Remove this file as soon as we have a stable | ||
// clang version that doesn't require this hack. | ||
#ifndef QLEVER_COROUTINES_H | ||
#define QLEVER_COROUTINES_H | ||
|
||
#include <version> | ||
|
||
#if defined(__clang__) && defined(__GLIBCXX__) && !__cpp_impl_coroutine | ||
// This is the constant that is defined by g++ when using the | ||
// -fcoroutines flag. We have to specify it manually for clang | ||
// before including the coroutine header. | ||
#define __cpp_impl_coroutine 1 | ||
|
||
#include <coroutine> | ||
|
||
namespace std::experimental { | ||
template <typename T, typename... Ts> | ||
struct coroutine_traits : std::coroutine_traits<T, Ts...> {}; | ||
|
||
template <typename T = void> | ||
struct coroutine_handle : std::coroutine_handle<T> {}; | ||
} // namespace std::experimental | ||
|
||
#else | ||
// Simply include the coroutine header, no special treatment | ||
// necessary. | ||
#include <coroutine> | ||
#endif | ||
|
||
#endif // QLEVER_COROUTINES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# CMake toolchain file for using `clang++-13` together with `libc++` | ||
set(CMAKE_C_COMPILER clang-13) | ||
set(CMAKE_CXX_COMPILER clang++-13) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++abi") | ||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") | ||
#set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++abi") |