Skip to content

[libc++] Remove unnecessary #ifdef guards around PSTL implementation details #95268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

ldionne
Copy link
Member

@ldionne ldionne commented Jun 12, 2024

We want the PSTL implementation details to be available regardless of the Standard mode or whether the experimental PSTL is enabled. This patch guards the inclusion of the PSTL to the top-level headers that define the public API in __numeric and __algorithm.

…details

We want the PSTL implementation details to be available regardless of
the Standard mode or whether the experimental PSTL is enabled. This
patch guards the inclusion of the PSTL to the top-level headers that
define the public API in `__numeric` and `__algorithm`.
@ldionne ldionne requested a review from a team as a code owner June 12, 2024 16:46
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jun 12, 2024
@llvmbot
Copy link
Member

llvmbot commented Jun 12, 2024

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

Changes

We want the PSTL implementation details to be available regardless of the Standard mode or whether the experimental PSTL is enabled. This patch guards the inclusion of the PSTL to the top-level headers that define the public API in __numeric and __algorithm.


Full diff: https://github.com/llvm/llvm-project/pull/95268.diff

14 Files Affected:

  • (modified) libcxx/include/__algorithm/pstl.h (+12-11)
  • (modified) libcxx/include/__numeric/pstl.h (+13-12)
  • (modified) libcxx/include/__pstl/backends/default.h (-4)
  • (modified) libcxx/include/__pstl/backends/libdispatch.h (+4-8)
  • (modified) libcxx/include/__pstl/backends/serial.h (+1-5)
  • (modified) libcxx/include/__pstl/backends/std_thread.h (-4)
  • (modified) libcxx/include/__pstl/cpu_algos/any_of.h (+1-5)
  • (modified) libcxx/include/__pstl/cpu_algos/fill.h (-4)
  • (modified) libcxx/include/__pstl/cpu_algos/find_if.h (+1-5)
  • (modified) libcxx/include/__pstl/cpu_algos/for_each.h (-4)
  • (modified) libcxx/include/__pstl/cpu_algos/merge.h (+1-5)
  • (modified) libcxx/include/__pstl/cpu_algos/stable_sort.h (-4)
  • (modified) libcxx/include/__pstl/cpu_algos/transform.h (+1-5)
  • (modified) libcxx/include/__pstl/cpu_algos/transform_reduce.h (-4)
diff --git a/libcxx/include/__algorithm/pstl.h b/libcxx/include/__algorithm/pstl.h
index 66ddf4360c827..0bb052b3f97c7 100644
--- a/libcxx/include/__algorithm/pstl.h
+++ b/libcxx/include/__algorithm/pstl.h
@@ -10,17 +10,6 @@
 #define _LIBCPP___ALGORITHM_PSTL_H
 
 #include <__config>
-#include <__functional/operations.h>
-#include <__iterator/cpp17_iterator_concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__pstl/backend.h>
-#include <__pstl/dispatch.h>
-#include <__pstl/handle_exception.h>
-#include <__type_traits/enable_if.h>
-#include <__type_traits/is_execution_policy.h>
-#include <__type_traits/remove_cvref.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -31,6 +20,18 @@ _LIBCPP_PUSH_MACROS
 
 #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
 
+#  include <__functional/operations.h>
+#  include <__iterator/cpp17_iterator_concepts.h>
+#  include <__iterator/iterator_traits.h>
+#  include <__pstl/backend.h>
+#  include <__pstl/dispatch.h>
+#  include <__pstl/handle_exception.h>
+#  include <__type_traits/enable_if.h>
+#  include <__type_traits/is_execution_policy.h>
+#  include <__type_traits/remove_cvref.h>
+#  include <__utility/forward.h>
+#  include <__utility/move.h>
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _ExecutionPolicy,
diff --git a/libcxx/include/__numeric/pstl.h b/libcxx/include/__numeric/pstl.h
index 3238b59794cbf..7557686a3663d 100644
--- a/libcxx/include/__numeric/pstl.h
+++ b/libcxx/include/__numeric/pstl.h
@@ -10,18 +10,6 @@
 #define _LIBCPP___NUMERIC_PSTL_H
 
 #include <__config>
-#include <__functional/identity.h>
-#include <__functional/operations.h>
-#include <__iterator/cpp17_iterator_concepts.h>
-#include <__iterator/iterator_traits.h>
-#include <__pstl/backend.h>
-#include <__pstl/dispatch.h>
-#include <__pstl/handle_exception.h>
-#include <__type_traits/enable_if.h>
-#include <__type_traits/is_execution_policy.h>
-#include <__type_traits/remove_cvref.h>
-#include <__utility/forward.h>
-#include <__utility/move.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
@@ -32,6 +20,19 @@ _LIBCPP_PUSH_MACROS
 
 #if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
 
+#  include <__functional/identity.h>
+#  include <__functional/operations.h>
+#  include <__iterator/cpp17_iterator_concepts.h>
+#  include <__iterator/iterator_traits.h>
+#  include <__pstl/backend.h>
+#  include <__pstl/dispatch.h>
+#  include <__pstl/handle_exception.h>
+#  include <__type_traits/enable_if.h>
+#  include <__type_traits/is_execution_policy.h>
+#  include <__type_traits/remove_cvref.h>
+#  include <__utility/forward.h>
+#  include <__utility/move.h>
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _ExecutionPolicy,
diff --git a/libcxx/include/__pstl/backends/default.h b/libcxx/include/__pstl/backends/default.h
index 8372caf0b0a38..61a128805f854 100644
--- a/libcxx/include/__pstl/backends/default.h
+++ b/libcxx/include/__pstl/backends/default.h
@@ -33,8 +33,6 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 namespace __pstl {
 
@@ -500,8 +498,6 @@ struct __rotate_copy<__default_backend_tag, _ExecutionPolicy> {
 } // namespace __pstl
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_POP_MACROS
 
 #endif // _LIBCPP___PSTL_BACKENDS_DEFAULT_H
diff --git a/libcxx/include/__pstl/backends/libdispatch.h b/libcxx/include/__pstl/backends/libdispatch.h
index 414524223cfc0..a0c3ad980ed1b 100644
--- a/libcxx/include/__pstl/backends/libdispatch.h
+++ b/libcxx/include/__pstl/backends/libdispatch.h
@@ -44,8 +44,6 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 namespace __pstl {
 
@@ -142,15 +140,15 @@ struct __cpu_traits<__libdispatch_backend_tag> {
 
     unique_ptr<__merge_range_t[], decltype(__destroy)> __ranges(
         [&]() -> __merge_range_t* {
-#  ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
           try {
-#  endif
+#endif
             return std::allocator<__merge_range_t>().allocate(__n_ranges);
-#  ifndef _LIBCPP_HAS_NO_EXCEPTIONS
+#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
           } catch (const std::bad_alloc&) {
             return nullptr;
           }
-#  endif
+#endif
         }(),
         __destroy);
 
@@ -394,8 +392,6 @@ struct __fill<__libdispatch_backend_tag, _ExecutionPolicy>
 } // namespace __pstl
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_POP_MACROS
 
 #endif // _LIBCPP___PSTL_BACKENDS_LIBDISPATCH_H
diff --git a/libcxx/include/__pstl/backends/serial.h b/libcxx/include/__pstl/backends/serial.h
index 72b500bfc864f..5f24499899bd2 100644
--- a/libcxx/include/__pstl/backends/serial.h
+++ b/libcxx/include/__pstl/backends/serial.h
@@ -27,10 +27,8 @@
 #  pragma GCC system_header
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_PUSH_MACROS
-#  include <__undef_macros>
+#include <__undef_macros>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 namespace __pstl {
@@ -180,6 +178,4 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_BACKENDS_SERIAL_H
diff --git a/libcxx/include/__pstl/backends/std_thread.h b/libcxx/include/__pstl/backends/std_thread.h
index 4e85fc0d66155..49570bd30b082 100644
--- a/libcxx/include/__pstl/backends/std_thread.h
+++ b/libcxx/include/__pstl/backends/std_thread.h
@@ -32,8 +32,6 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 namespace __pstl {
 
@@ -133,8 +131,6 @@ struct __fill<__std_thread_backend_tag, _ExecutionPolicy>
 } // namespace __pstl
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_POP_MACROS
 
 #endif // _LIBCPP___PSTL_BACKENDS_STD_THREAD_H
diff --git a/libcxx/include/__pstl/cpu_algos/any_of.h b/libcxx/include/__pstl/cpu_algos/any_of.h
index 3173eade7585b..f42d8c6463e21 100644
--- a/libcxx/include/__pstl/cpu_algos/any_of.h
+++ b/libcxx/include/__pstl/cpu_algos/any_of.h
@@ -23,10 +23,8 @@
 #include <cstdint>
 #include <optional>
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_PUSH_MACROS
-#  include <__undef_macros>
+#include <__undef_macros>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -96,6 +94,4 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_CPU_ALGOS_ANY_OF_H
diff --git a/libcxx/include/__pstl/cpu_algos/fill.h b/libcxx/include/__pstl/cpu_algos/fill.h
index b99a9d3c660d8..c2a0e92618528 100644
--- a/libcxx/include/__pstl/cpu_algos/fill.h
+++ b/libcxx/include/__pstl/cpu_algos/fill.h
@@ -23,8 +23,6 @@
 #  pragma GCC system_header
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Index, class _DifferenceType, class _Tp>
@@ -63,6 +61,4 @@ struct __cpu_parallel_fill {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_CPU_ALGOS_FILL_H
diff --git a/libcxx/include/__pstl/cpu_algos/find_if.h b/libcxx/include/__pstl/cpu_algos/find_if.h
index 3ddbee44890f6..569120d57ea5f 100644
--- a/libcxx/include/__pstl/cpu_algos/find_if.h
+++ b/libcxx/include/__pstl/cpu_algos/find_if.h
@@ -28,10 +28,8 @@
 #  pragma GCC system_header
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_PUSH_MACROS
-#  include <__undef_macros>
+#include <__undef_macros>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -134,6 +132,4 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_CPU_ALGOS_FIND_IF_H
diff --git a/libcxx/include/__pstl/cpu_algos/for_each.h b/libcxx/include/__pstl/cpu_algos/for_each.h
index 1e5677d998994..f3f429f2a9e17 100644
--- a/libcxx/include/__pstl/cpu_algos/for_each.h
+++ b/libcxx/include/__pstl/cpu_algos/for_each.h
@@ -23,8 +23,6 @@
 #  pragma GCC system_header
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Iterator, class _DifferenceType, class _Function>
@@ -63,6 +61,4 @@ struct __cpu_parallel_for_each {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_CPU_ALGOS_FOR_EACH_H
diff --git a/libcxx/include/__pstl/cpu_algos/merge.h b/libcxx/include/__pstl/cpu_algos/merge.h
index 4f4192cccb3e8..927424f708c3f 100644
--- a/libcxx/include/__pstl/cpu_algos/merge.h
+++ b/libcxx/include/__pstl/cpu_algos/merge.h
@@ -23,10 +23,8 @@
 #  pragma GCC system_header
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_PUSH_MACROS
-#  include <__undef_macros>
+#include <__undef_macros>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -82,6 +80,4 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_CPU_ALGOS_MERGE_H
diff --git a/libcxx/include/__pstl/cpu_algos/stable_sort.h b/libcxx/include/__pstl/cpu_algos/stable_sort.h
index 8ea5e8a01d2ce..f74ef110a0c19 100644
--- a/libcxx/include/__pstl/cpu_algos/stable_sort.h
+++ b/libcxx/include/__pstl/cpu_algos/stable_sort.h
@@ -21,8 +21,6 @@
 #  pragma GCC system_header
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <class _Backend, class _RawExecutionPolicy>
@@ -44,6 +42,4 @@ struct __cpu_parallel_stable_sort {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_CPU_ALGOS_STABLE_SORT_H
diff --git a/libcxx/include/__pstl/cpu_algos/transform.h b/libcxx/include/__pstl/cpu_algos/transform.h
index 440368d97f182..445e22b38b284 100644
--- a/libcxx/include/__pstl/cpu_algos/transform.h
+++ b/libcxx/include/__pstl/cpu_algos/transform.h
@@ -24,10 +24,8 @@
 #  pragma GCC system_header
 #endif
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_PUSH_MACROS
-#  include <__undef_macros>
+#include <__undef_macros>
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
@@ -150,6 +148,4 @@ _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 #endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_H
diff --git a/libcxx/include/__pstl/cpu_algos/transform_reduce.h b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
index 914c46dcd6dcf..101fefb5f26b2 100644
--- a/libcxx/include/__pstl/cpu_algos/transform_reduce.h
+++ b/libcxx/include/__pstl/cpu_algos/transform_reduce.h
@@ -31,8 +31,6 @@
 _LIBCPP_PUSH_MACROS
 #include <__undef_macros>
 
-#if !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <typename _Backend,
@@ -211,8 +209,6 @@ struct __cpu_parallel_transform_reduce {
 
 _LIBCPP_END_NAMESPACE_STD
 
-#endif // !defined(_LIBCPP_HAS_NO_INCOMPLETE_PSTL) && _LIBCPP_STD_VER >= 17
-
 _LIBCPP_POP_MACROS
 
 #endif // _LIBCPP___PSTL_CPU_ALGOS_TRANSFORM_REDUCE_H

@ldionne ldionne merged commit acb896a into llvm:main Jun 12, 2024
54 of 57 checks passed
@ldionne ldionne deleted the review/pstl-remove-ifdef-guards branch June 12, 2024 21:25
@fmayer
Copy link
Contributor

fmayer commented Jun 13, 2024

Could this have caused this? The other change in https://lab.llvm.org/buildbot/#/builders/168/builds/20919 seems unrelated.

FAILED: include/llvm/IR/IntrinsicsRISCV.h /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/include/llvm/IR/IntrinsicsRISCV.h 
cd /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan && /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-min-tblgen -gen-intrinsic-enums -intrinsic-prefix=riscv -I /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/IR -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/include -I/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/IR/Intrinsics.td --write-if-changed -o include/llvm/IR/IntrinsicsRISCV.h -d include/llvm/IR/IntrinsicsRISCV.h.d
=================================================================
==824036==ERROR: AddressSanitizer: new-delete-type-mismatch on 0x503000003520 in thread T0:
  object passed to delete has wrong type:
  size of the allocated type:   25 bytes;
  size of the deallocated type: 24 bytes.
    #0 0x55b16e73bb02 in operator delete(void*, unsigned long) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:155:3
    #1 0x55b16e8d5264 in __libcpp_operator_delete<void *, unsigned long> /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:280:3
    #2 0x55b16e8d5264 in __do_deallocate_handle_size<> /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:304:10
    #3 0x55b16e8d5264 in __libcpp_deallocate /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:317:12
    #4 0x55b16e8d5264 in deallocate /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocator.h:139:7
    #5 0x55b16e8d5264 in deallocate /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocator_traits.h:289:9
    #6 0x55b16e8d5264 in ~basic_string /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/string:1105:7
    #7 0x55b16e8d5264 in llvm::TGParser::addDefOne(std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:545:22
    #8 0x55b16e8d39c1 in llvm::TGParser::addEntry(llvm::RecordsEntry) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:416:10
    #9 0x55b16e901594 in llvm::TGParser::ParseDef(llvm::MultiClass*) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:3619:10
    #10 0x55b16e90417e in llvm::TGParser::ParseObject(llvm::MultiClass*) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4277:31
    #11 0x55b16e90c4e1 in ParseObjectList /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4306:9
    #12 0x55b16e90c4e1 in llvm::TGParser::ParseFile() /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4315:7
    #13 0x55b16e86052f in llvm::TableGenMain(char const*, std::__1::function<bool (llvm::raw_ostream&, llvm::RecordKeeper&)>) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/Main.cpp:125:14
    #14 0x55b16e7998f6 in main /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/TableGen/TableGen.cpp:84:10
    #15 0x7f3a2ba2814f  (/lib/x86_64-linux-gnu/libc.so.6+0x2814f) (BuildId: 502d55a5e424889ddb2846eb6dbeddaedd75b323)
    #16 0x7f3a2ba28208 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28208) (BuildId: 502d55a5e424889ddb2846eb6dbeddaedd75b323)
    #17 0x55b16e668f14 in _start (/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-min-tblgen+0x134f14)
0x503000003520 is located 0 bytes inside of 25-byte region [0x503000003520,0x503000003539)
allocated by thread T0 here:
    #0 0x55b16e73ae9d in operator new(unsigned long) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:86:3
    #1 0x55b16e8a17c5 in __libcpp_operator_new<unsigned long> /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:271:10
    #2 0x55b16e8a17c5 in __libcpp_allocate /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/new:295:10
    #3 0x55b16e8a17c5 in allocate /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocator.h:125:32
    #4 0x55b16e8a17c5 in __allocate_at_least<std::__1::allocator<char> > /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/__memory/allocate_at_least.h:55:19
    #5 0x55b16e8a17c5 in __init /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/string:2212:25
    #6 0x55b16e8a17c5 in basic_string<llvm::StringRef, 0> /b/sanitizer-x86_64-linux-bootstrap-asan/build/libcxx_build_asan/include/c++/v1/string:1050:5
    #7 0x55b16e8a17c5 in llvm::StringInit::getAsUnquotedString() const /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/TableGen/Record.h:736:12
    #8 0x55b16e8d517d in getNameInitAsString /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/include/llvm/TableGen/Record.h:1718:27
    #9 0x55b16e8d517d in llvm::TGParser::addDefOne(std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:545:42
    #10 0x55b16e8d39c1 in llvm::TGParser::addEntry(llvm::RecordsEntry) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:416:10
    #11 0x55b16e901594 in llvm::TGParser::ParseDef(llvm::MultiClass*) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:3619:10
    #12 0x55b16e90417e in llvm::TGParser::ParseObject(llvm::MultiClass*) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4277:31
    #13 0x55b16e90c4e1 in ParseObjectList /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4306:9
    #14 0x55b16e90c4e1 in llvm::TGParser::ParseFile() /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:4315:7
    #15 0x55b16e86052f in llvm::TableGenMain(char const*, std::__1::function<bool (llvm::raw_ostream&, llvm::RecordKeeper&)>) /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/Main.cpp:125:14
    #16 0x55b16e7998f6 in main /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/TableGen/TableGen.cpp:84:10
    #17 0x7f3a2ba2814f  (/lib/x86_64-linux-gnu/libc.so.6+0x2814f) (BuildId: 502d55a5e424889ddb2846eb6dbeddaedd75b323)
SUMMARY: AddressSanitizer: new-delete-type-mismatch /b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/lib/TableGen/TGParser.cpp:545:22 in llvm::TGParser::addDefOne(std::__1::unique_ptr<llvm::Record, std::__1::default_delete<llvm::Record>>)
==824036==HINT: if you don't care about these errors you may set ASAN_OPTIONS=new_delete_type_mismatch=0
==824036==ABORTING

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants