[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

Ilya Biryukov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 9 09:47:03 PDT 2024


ilya-biryukov wrote:

We have hit quite a few issues when trying this out. I have spent a day trying to reduce to a small repro that I can share, but haven't not fully succeeded yet, I will continue tomorrow.
Still wanted to share the error descriptions in case that would allow to make progress in the meanwhile.

* Crash with the following assertion failure:

```
assert.h assertion failed at third_party/llvm/llvm-project/clang/include/clang/AST/DeclCXX.h:464 in struct DefinitionData &clang::CXXRecordDecl::data() const: DD && "queried property of class with no definition"
*** Check failure stack trace: ***
    @     0x55fb619aaea4  absl::log_internal::LogMessage::SendToLog()
    @     0x55fb619aad04  absl::log_internal::LogMessage::Flush()
    @     0x55fb619ab209  absl::log_internal::LogMessageFatal::~LogMessageFatal()
    @     0x55fb6199a3e4  __assert_fail
    @     0x55fb5bd8d400  clang::CXXRecordDecl::data()
    @     0x55fb5e24de0d  clang::CXXBasePaths::lookupInBases()
    @     0x55fb5e24e388  clang::CXXBasePaths::lookupInBases()
    @     0x55fb5e24d55c  clang::CXXRecordDecl::lookupInBases()
    @     0x55fb5da8bd60  clang::Sema::LookupQualifiedName()
    @     0x55fb5dc747f3  clang::Sema::CheckTypenameType()
    @     0x55fb5de19e72  clang::TreeTransform<>::TransformDependentNameType()
    @     0x55fb5ddee35c  clang::TreeTransform<>::TransformType()
    @     0x55fb5ddedd3f  clang::TreeTransform<>::TransformType()
    @     0x55fb5dded94d  clang::Sema::SubstType()
    @     0x55fb5dc62c9f  SubstDefaultTemplateArgument()
    @     0x55fb5dc58761  clang::Sema::CheckTemplateArgumentList()
    @     0x55fb5dc5720b  clang::Sema::CheckTemplateIdType()
    @     0x55fb5de19086  clang::TreeTransform<>::TransformTemplateSpecializationType()
    @     0x55fb5de2115d  clang::TreeTransform<>::TransformTemplateSpecializationType()
    @     0x55fb5ddee280  clang::TreeTransform<>::TransformType()
    @     0x55fb5de1dc1a  clang::TreeTransform<>::TransformElaboratedType()
    @     0x55fb5ddee3c4  clang::TreeTransform<>::TransformType()
    @     0x55fb5ddedd3f  clang::TreeTransform<>::TransformType()
    @     0x55fb5dded94d  clang::Sema::SubstType()
    @     0x55fb5dc62c9f  SubstDefaultTemplateArgument()
    @     0x55fb5dc62632  clang::Sema::SubstDefaultTemplateArgumentIfAvailable()
    @     0x55fb5dd7056b  clang::Sema::FinishTemplateArgumentDeduction()
    @     0x55fb5dde5796  llvm::function_ref<>::callback_fn<>()
    @     0x55fb5d420dcf  clang::Sema::runWithSufficientStackSpace()
    @     0x55fb5dd729f4  clang::Sema::DeduceTemplateArguments()
    @     0x55fb5dbc00d5  clang::Sema::AddTemplateOverloadCandidate()
    @     0x55fb5da7065d  ResolveConstructorOverload()
    @     0x55fb5da52dd8  TryConstructorInitialization()
    @     0x55fb5da50e7a  TryDefaultInitialization()
    @     0x55fb5da4e6b1  clang::InitializationSequence::InitializeFrom()
    @     0x55fb5d72c3ed  CollectFieldInitializer()
    @     0x55fb5d72a972  clang::Sema::SetCtorInitializers()
    @     0x55fb5d72ef65  clang::Sema::ActOnDefaultCtorInitializers()
    @     0x55fb5d2401b0  clang::Parser::ParseLexedMethodDef()
    @     0x55fb5d23e77a  clang::Parser::ParseLexedMethodDefs()
    @     0x55fb5d1b50e0  clang::Parser::ParseCXXMemberSpecification()
    @     0x55fb5d1b2744  clang::Parser::ParseClassSpecifier()
    @     0x55fb5d1d8ef0  clang::Parser::ParseDeclarationSpecifiers()
    @     0x55fb5d15ea4a  clang::Parser::ParseDeclOrFunctionDefInternal()
    @     0x55fb5d15e5b6  clang::Parser::ParseDeclarationOrFunctionDefinition()
    @     0x55fb5d15d2ea  clang::Parser::ParseExternalDeclaration()
    @     0x55fb5d1a8c73  clang::Parser::ParseInnerNamespace()
    @     0x55fb5d1a7e4f  clang::Parser::ParseNamespace()
    @     0x55fb5d1d2bde  clang::Parser::ParseDeclaration()
    @     0x55fb5d15ceb6  clang::Parser::ParseExternalDeclaration()
    @     0x55fb5d1a8c73  clang::Parser::ParseInnerNamespace()
    @     0x55fb5d1a7e4f  clang::Parser::ParseNamespace()
    @     0x55fb5d1d2bde  clang::Parser::ParseDeclaration()
    @     0x55fb5d15ceb6  clang::Parser::ParseExternalDeclaration()
    @     0x55fb5d15b04b  clang::Parser::ParseTopLevelDecl()
    @     0x55fb5d154d2e  clang::ParseAST()
    @     0x55fb5cea31e3  clang::FrontendAction::Execute()
    @     0x55fb5ce1c62d  clang::CompilerInstance::ExecuteAction()
    @     0x55fb5bd4a20e  clang::ExecuteCompilerInvocation()
    @     0x55fb5bd3e106  cc1_main()
    @     0x55fb5bd3b9a6  ExecuteCC1Tool()
```

* Invalid errors about absence or presence of certain members in std::pointer_traits and other types:

```
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/pointer_traits.h:161:3: error: 'std::pointer_traits<const proto2::FieldDescriptor **>::pointer_to' from module '/
/third_party/crosstool/v18/stable:stl_cc_library.third_party/stl/cxx17/optional' is not present in definition of 'std::pointer_traits<const proto2::FieldDescriptor **>' provided earlier
  161 |   pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT {
      |   ^
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/pointer_traits.h:138:29: note: definition has no member 'pointer_to'
  138 | struct _LIBCPP_TEMPLATE_VIS pointer_traits : __pointer_traits_impl<_Ptr> {};
      |                             ^
In module '//third_party/crosstool/v18/stable:stl_cc_library':
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/pointer_traits.h:161:3: error: multiple overloads of 'pointer_to' instantiate to the same signature 'pointer (__c
onditional_t<is_void<element_type>::value, __nat, element_type> &) noexcept' (aka 'const proto2::FieldDescriptor **(const proto2::FieldDescriptor *&) noexcept')
  161 |   pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT {
      |   ^
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/allocator_traits.h:68:41: note: in instantiation of template class 'std::pointer_traits<const proto2::FieldDescri
ptor **>' requested here
   68 |   using type _LIBCPP_NODEBUG = typename pointer_traits<_Ptr>::template rebind<const _Tp>;
      |                                         ^
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/allocator_traits.h:251:39: note: in instantiation of template class 'std::__const_pointer<const proto2::FieldDesc
riptor *, const proto2::FieldDescriptor **, std::allocator<const proto2::FieldDescriptor *>>' requested here
  251 |   using const_pointer      = typename __const_pointer<value_type, pointer, allocator_type>::type;
      |                                       ^
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/vector:399:20: note: in instantiation of template class 'std::allocator_traits<std::allocator<const proto2::FieldDescripto
r *>>' requested here
  399 |   typedef typename __alloc_traits::size_type size_type;
      |                    ^
maps/render/pipeline/signals-side-input-utils.cc:3:47: note: in instantiation of template class 'std::vector<const proto2::FieldDescriptor *>' requested here
    3 |   std::vector<const proto2::FieldDescriptor*> filter_subfield_descriptors_;
      |                                               ^
third_party/crosstool/v18/stable/toolchain/bin/../include/c++/v1/__memory/pointer_traits.h:161:3: note: previous declaration is here
  161 |   pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT {

```

* Errors from "different definitions", probably coming from invalid merging or ODR hashing

```
third_party/absl/functional/any_invocable.h:170:3: error: 'absl::AnyInvocable<void () &&>' has different definitions in different modules; first difference is defined here found constructor with body
  170 |   AnyInvocable() noexcept = default;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/absl/functional/any_invocable.h:170:3: note: but in '//third_party/absl/functional:any_invocable.third_party/absl/functional/any_invocable.h' found constructor with different body
  170 |   AnyInvocable() noexcept = default;
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```

* Some significant compile-time regressions (up to 33%).
  Unfortunately that's on internal code, will need further investigation to profile or reduce.

* Some compilations timed out. This needs more investigation to see if that was a flake, but likely not.


https://github.com/llvm/llvm-project/pull/83237


More information about the llvm-branch-commits mailing list