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

Vassil Vassilev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Feb 29 10:52:53 PST 2024


vgvassilev wrote:

> @vgvassilev this may be ready to test.

I triggered a test here: https://github.com/root-project/root/pull/14495 

I still need to verify if I did not screw up bringing your changes back to our builds but locally it crashes quite early with:

<details>

```
0  rootcling_stage1         0x00000001091d1c9d llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 61
1  rootcling_stage1         0x00000001091d221b PrintStackTraceSignalHandler(void*) + 27
2  rootcling_stage1         0x00000001091cff06 llvm::sys::RunSignalHandlers() + 134
3  rootcling_stage1         0x00000001091d480f SignalHandler(int) + 223
4  libsystem_platform.dylib 0x00007ff800ad137d _sigtramp + 29
5  rootcling_stage1         0x0000000100059595 llvm::SmallVectorTemplateCommon<char, void>::assertSafeToReferenceAfterResize(void const*, unsigned long) + 37
6  libsystem_c.dylib        0x00007ff8009c1a49 abort + 126
7  libsystem_c.dylib        0x00007ff8009c0d30 err + 0
8  rootcling_stage1         0x00000001019959f0 llvm::SmallVectorTemplateCommon<unsigned long long, void>::operator[](unsigned long) const + 96
9  rootcling_stage1         0x00000001017d43d9 clang::ASTReader::ReadString(llvm::SmallVector<unsigned long long, 64u> const&, unsigned int&) + 57
10 rootcling_stage1         0x00000001017e0f0b clang::ASTReader::ParseLanguageOptions(llvm::SmallVector<unsigned long long, 64u> const&, bool, clang::ASTReaderListener&, bool) + 27691
11 rootcling_stage1         0x00000001017da096 clang::ASTReader::ReadOptionsBlock(llvm::BitstreamCursor&, unsigned int, bool, clang::ASTReaderListener&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>&) + 758
12 rootcling_stage1         0x00000001017e2537 clang::ASTReader::ReadControlBlock(clang::serialization::ModuleFile&, llvm::SmallVectorImpl<clang::ASTReader::ImportedModule>&, clang::serialization::ModuleFile const*, unsigned int) + 2487
13 rootcling_stage1         0x00000001017e487e clang::ASTReader::ReadASTCore(llvm::StringRef, clang::serialization::ModuleKind, clang::SourceLocation, clang::serialization::ModuleFile*, llvm::SmallVectorImpl<clang::ASTReader::ImportedModule>&, long long, long, clang::ASTFileSignature, unsigned int) + 2110
14 rootcling_stage1         0x00000001017efae3 clang::ASTReader::ReadAST(llvm::StringRef, clang::serialization::ModuleKind, clang::SourceLocation, unsigned int, llvm::SmallVectorImpl<clang::ASTReader::ImportedSubmodule>*) + 627
15 rootcling_stage1         0x0000000101249f53 clang::CompilerInstance::findOrCompileModuleAndReadAST(llvm::StringRef, clang::SourceLocation, clang::SourceLocation, bool) + 1443
16 rootcling_stage1         0x000000010124b4be clang::CompilerInstance::loadModule(clang::SourceLocation, llvm::ArrayRef<std::__1::pair<clang::IdentifierInfo*, clang::SourceLocation>>, clang::Module::NameVisibilityKind, bool) + 1006
17 rootcling_stage1         0x0000000103f6a144 clang::Preprocessor::HandleHeaderIncludeOrImport(clang::SourceLocation, clang::Token&, clang::Token&, clang::SourceLocation, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) + 3348
18 rootcling_stage1         0x0000000103f648ec clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) + 316
19 rootcling_stage1         0x0000000103f65064 clang::Preprocessor::HandleDirective(clang::Token&) + 1412
20 rootcling_stage1         0x0000000103f07de8 clang::Lexer::LexTokenInternal(clang::Token&, bool) + 10120
21 rootcling_stage1         0x0000000103f032ce clang::Lexer::Lex(clang::Token&) + 270
22 rootcling_stage1         0x0000000103fd3cbf clang::Preprocessor::Lex(clang::Token&) + 111
23 rootcling_stage1         0x00000001005e1669 clang::Parser::ConsumeAnnotationToken() + 169
24 rootcling_stage1         0x00000001017ab553 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 1475
25 rootcling_stage1         0x0000000100583b29 clang::Parser::ParseTopLevelDecl() + 57
26 rootcling_stage1         0x00000001016b5d67 clang::Parser::ParseLinkage(clang::ParsingDeclSpec&, clang::DeclaratorContext) + 1303
27 rootcling_stage1         0x00000001017afa70 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) + 1792
28 rootcling_stage1         0x00000001017aef1a clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) + 218
29 rootcling_stage1         0x00000001017adeb0 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) + 3920
30 rootcling_stage1         0x00000001017ab8f3 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 2403
31 rootcling_stage1         0x00000001017aaf00 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 64
32 rootcling_stage1         0x000000010167af3b clang::ParseAST(clang::Sema&, bool, bool) + 459
33 rootcling_stage1         0x000000010135a5cc clang::ASTFrontendAction::ExecuteAction() + 300
34 rootcling_stage1         0x0000000101359dcc clang::FrontendAction::Execute() + 124
35 rootcling_stage1         0x000000010124769d clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 957
36 rootcling_stage1         0x000000010126e77d compileModuleImpl(clang::CompilerInstance&, clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile, llvm::StringRef, llvm::StringRef, llvm::function_ref<void (clang::CompilerInstance&)>, llvm::function_ref<void (clang::CompilerInstance&)>)::$_5::operator()() const + 45
37 rootcling_stage1         0x000000010126e745 void llvm::function_ref<void ()>::callback_fn<compileModuleImpl(clang::CompilerInstance&, clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile, llvm::StringRef, llvm::StringRef, llvm::function_ref<void (clang::CompilerInstance&)>, llvm::function_ref<void (clang::CompilerInstance&)>)::$_5>(long) + 21
38 rootcling_stage1         0x0000000108fc98e9 llvm::function_ref<void ()>::operator()() const + 25
39 rootcling_stage1         0x0000000108ff1bfc llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) + 236
40 rootcling_stage1         0x0000000108ff1fdf RunSafelyOnThread_Dispatch(void*) + 79
41 rootcling_stage1         0x0000000108ff2335 llvm::thread::thread<void (&)(void*), (anonymous namespace)::RunSafelyOnThreadInfo*>(std::__1::optional<unsigned int>, void (&)(void*), (anonymous namespace)::RunSafelyOnThreadInfo*&&) + 53
42 rootcling_stage1         0x0000000108ff202d llvm::thread::thread<void (&)(void*), (anonymous namespace)::RunSafelyOnThreadInfo*>(std::__1::optional<unsigned int>, void (&)(void*), (anonymous namespace)::RunSafelyOnThreadInfo*&&) + 45
43 rootcling_stage1         0x0000000108ff1ee5 llvm::CrashRecoveryContext::RunSafelyOnThread(llvm::function_ref<void ()>, unsigned int) + 149
44 rootcling_stage1         0x000000010124decb compileModuleImpl(clang::CompilerInstance&, clang::SourceLocation, llvm::StringRef, clang::FrontendInputFile, llvm::StringRef, llvm::StringRef, llvm::function_ref<void (clang::CompilerInstance&)>, llvm::function_ref<void (clang::CompilerInstance&)>) + 2171
45 rootcling_stage1         0x000000010125d719 compileModule(clang::CompilerInstance&, clang::SourceLocation, clang::Module*, llvm::StringRef) + 761
46 rootcling_stage1         0x000000010125d16f compileModuleAndReadASTImpl(clang::CompilerInstance&, clang::SourceLocation, clang::SourceLocation, clang::Module*, llvm::StringRef) + 79
47 rootcling_stage1         0x000000010125cee1 compileModuleAndReadASTBehindLock(clang::CompilerInstance&, clang::SourceLocation, clang::SourceLocation, clang::Module*, llvm::StringRef) + 673
48 rootcling_stage1         0x000000010124afde compileModuleAndReadAST(clang::CompilerInstance&, clang::SourceLocation, clang::SourceLocation, clang::Module*, llvm::StringRef) + 126
49 rootcling_stage1         0x000000010124a7c1 clang::CompilerInstance::findOrCompileModuleAndReadAST(llvm::StringRef, clang::SourceLocation, clang::SourceLocation, bool) + 3601
50 rootcling_stage1         0x000000010124b4be clang::CompilerInstance::loadModule(clang::SourceLocation, llvm::ArrayRef<std::__1::pair<clang::IdentifierInfo*, clang::SourceLocation>>, clang::Module::NameVisibilityKind, bool) + 1006
51 rootcling_stage1         0x0000000103f6a144 clang::Preprocessor::HandleHeaderIncludeOrImport(clang::SourceLocation, clang::Token&, clang::Token&, clang::SourceLocation, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) + 3348
52 rootcling_stage1         0x0000000103f648ec clang::Preprocessor::HandleIncludeDirective(clang::SourceLocation, clang::Token&, clang::detail::SearchDirIteratorImpl<true>, clang::FileEntry const*) + 316
53 rootcling_stage1         0x0000000103f65064 clang::Preprocessor::HandleDirective(clang::Token&) + 1412
54 rootcling_stage1         0x0000000103f07de8 clang::Lexer::LexTokenInternal(clang::Token&, bool) + 10120
55 rootcling_stage1         0x0000000103f032ce clang::Lexer::Lex(clang::Token&) + 270
56 rootcling_stage1         0x0000000103fd3cbf clang::Preprocessor::Lex(clang::Token&) + 111
57 rootcling_stage1         0x00000001005da570 clang::Parser::ConsumeToken() + 144
58 rootcling_stage1         0x00000001017ab023 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) + 147
59 rootcling_stage1         0x00000001005843ea cling::IncrementalParser::ParseInternal(llvm::StringRef) + 2218
60 rootcling_stage1         0x0000000100583431 cling::IncrementalParser::Initialize(llvm::SmallVectorImpl<llvm::PointerIntPair<cling::Transaction*, 2u, cling::IncrementalParser::EParseResult, llvm::PointerLikeTypeTraits<cling::Transaction*>, llvm::PointerIntPairInfo<cling::Transaction*, 2u, llvm::PointerLikeTypeTraits<cling::Transaction*>>>>&, bool) + 1121
61 rootcling_stage1         0x00000001005a4233 cling::Interpreter::Interpreter(int, char const* const*, char const*, std::__1::vector<std::__1::shared_ptr<clang::ModuleFileExtension>, std::__1::allocator<std::__1::shared_ptr<clang::ModuleFileExtension>>> const&, void*, bool, cling::Interpreter const*) + 4131
62 rootcling_stage1         0x00000001005a5d80 cling::Interpreter::Interpreter(int, char const* const*, char const*, std::__1::vector<std::__1::shared_ptr<clang::ModuleFileExtension>, std::__1::allocator<std::__1::shared_ptr<clang::ModuleFileExtension>>> const&, void*, bool, cling::Interpreter const*) + 96
63 rootcling_stage1         0x00000001001acb2a cling::Interpreter::Interpreter(int, char const* const*, char const*, std::__1::vector<std::__1::shared_ptr<clang::ModuleFileExtension>, std::__1::allocator<std::__1::shared_ptr<clang::ModuleFileExtension>>> const&, void*, bool) + 90
64 rootcling_stage1         0x00000001001a384e RootClingMain(int, char**, bool) + 15838
65 rootcling_stage1         0x00000001001b390f ROOT_rootcling_Driver + 447
66 rootcling_stage1         0x0000000100003de4 main + 148
67 dyld                     0x000000022286a386 start + 1942
```

</details>

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


More information about the llvm-branch-commits mailing list