[libcxx-commits] [libcxxabi] 72b18a8 - [libcxxabi] Fewer assumptions about path from libcxx to libcxxabi
Nico Weber via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 26 06:10:34 PST 2021
Author: Nico Weber
Date: 2021-02-26T09:10:18-05:00
New Revision: 72b18a86e11ebc970be96a8c2b11aa3a31c14c5d
URL: https://github.com/llvm/llvm-project/commit/72b18a86e11ebc970be96a8c2b11aa3a31c14c5d
DIFF: https://github.com/llvm/llvm-project/commit/72b18a86e11ebc970be96a8c2b11aa3a31c14c5d.diff
LOG: [libcxxabi] Fewer assumptions about path from libcxx to libcxxabi
This is useful for projects that pull in libcxx and libcxxabi and build
them using out-of-tree build files, but don't make them sibling
directories (or don't call the sibling directories libcxx and libcxxabi
for some reason).
Fixes PR49313.
Differential Revision: https://reviews.llvm.org/D97379
Added:
Modified:
libcxxabi/src/CMakeLists.txt
libcxxabi/src/stdlib_stdexcept.cpp
llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
Removed:
################################################################################
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index ff1e45705dca..50afdf6890a3 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -57,6 +57,9 @@ endif()
include_directories("${LIBCXXABI_LIBCXX_INCLUDES}")
+# stdlib_stdexcept.cpp depends on libc++ internals.
+include_directories("${LIBCXXABI_LIBCXX_PATH}")
+
if (LIBCXXABI_HAS_CXA_THREAD_ATEXIT_IMPL)
add_definitions(-DHAVE___CXA_THREAD_ATEXIT_IMPL)
endif()
diff --git a/libcxxabi/src/stdlib_stdexcept.cpp b/libcxxabi/src/stdlib_stdexcept.cpp
index 4a464e48893d..0f5efe491b49 100644
--- a/libcxxabi/src/stdlib_stdexcept.cpp
+++ b/libcxxabi/src/stdlib_stdexcept.cpp
@@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
-#include "../../libcxx/src/include/refstring.h"
#include "stdexcept"
#include "new"
#include <cstdlib>
@@ -14,6 +13,9 @@
#include <cstdint>
#include <cstddef>
+// This includes an implementation file from libc++.
+#include "src/include/refstring.h"
+
static_assert(sizeof(std::__libcpp_refstring) == sizeof(const char *), "");
namespace std // purposefully not using versioning namespace
diff --git a/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn b/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
index 3e6063a21175..2cce12921e38 100644
--- a/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
+++ b/llvm/utils/gn/secondary/libcxxabi/src/BUILD.gn
@@ -62,6 +62,9 @@ config("cxxabi_config") {
include_dirs = [
"//libcxxabi/include",
"//libcxx/include",
+
+ # stdlib_stdexcept.cpp depends on libc++ internals.
+ "//libcxx",
]
cflags_cc = [ "-nostdinc++" ]
defines = [ "_LIBCXXABI_BUILDING_LIBRARY" ]
More information about the libcxx-commits
mailing list