Skip to content
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

Amend clang::Stmt bitflag setup to the "empty" CXXSpliceExpr ctor #106

Open
wants to merge 1 commit into
base: p2996
Choose a base branch
from

Conversation

fzuuzf
Copy link

@fzuuzf fzuuzf commented Oct 21, 2024

Before only the first eight bits were set.

Fixes issue 104.

@katzdm
Copy link
Collaborator

katzdm commented Oct 21, 2024

A more targeted change might be better - I think that the culprit might be here:
https://github.com/bloomberg/clang-p2996/blob/p2996/clang/lib/AST/ExprCXX.cpp#L2035-L2037

Would you mind setting HasTemplateKWAndArgsInfo to false here, and see if it fixes the issue (if you're able to reliably reproduce)?

@fzuuzf
Copy link
Author

fzuuzf commented Oct 21, 2024

Is it ok to write it as
HasTemplateKWAndArgsInfo = {}
?
(Will test tomorrow.)

@katzdm
Copy link
Collaborator

katzdm commented Oct 21, 2024

The HasTemplateKWAndArgInfo refers to whether we have recorded the source location of the keyword template, followed by zero or more template arguments (e.g., template [:r:]<arg0, arg1, arg2>).

The constructor in question creates an "empty" CXXSpliceExpr, so it seems correct to say false i.e., "No, this expression does not have a template keyword or template arguments" (this is generally done when deserializing an expression (e.g., during module import).

Speaking of - there's also probably a bug here, because we aren't including the template keyword/arguments in the serialized representation of the CXXSpliceExpr. So I would guess that probably e.g., importing a variable whose initializer contains a template splice may not currently work. (No need to tackle that in this PR)

Initialize Stmt::SpliceExprBits::HasTemplateKWAndArgsInfo to false.
Before it was left uninitialized.

Fixes issue 104.
@fzuuzf fzuuzf changed the title Default initialize all of clang::Stmt's bitfields Amend clang::Stmt bitflag setup to the "empty" CXXSpliceExpr ctor Oct 22, 2024
@fzuuzf
Copy link
Author

fzuuzf commented Oct 22, 2024

I still need need to apply

--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -7585,6 +7585,7 @@ ASTRecordReader::readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind) {
   case TemplateArgument::NullPtr:
   case TemplateArgument::StructuralValue:
   case TemplateArgument::Pack:
+  case TemplateArgument::SpliceSpecifier:
     // FIXME: Is this right?
     return TemplateArgumentLocInfo();
   }

on top of the PR's commit to not let clangd crash here.

So this probable bug here might be related?

@katzdm
Copy link
Collaborator

katzdm commented Oct 23, 2024

I still need need to apply

--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -7585,6 +7585,7 @@ ASTRecordReader::readTemplateArgumentLocInfo(TemplateArgument::ArgKind Kind) {
   case TemplateArgument::NullPtr:
   case TemplateArgument::StructuralValue:
   case TemplateArgument::Pack:
+  case TemplateArgument::SpliceSpecifier:
     // FIXME: Is this right?
     return TemplateArgumentLocInfo();
   }

on top of the PR's commit to not let clangd crash here.

So this probable bug here might be related?

I'm not so sure that those are related. Does the clangd crash produce a stacktrace? If so, would you mind sharing it?

@fzuuzf
Copy link
Author

fzuuzf commented Oct 23, 2024

Gladly. The code parsed includes a precompiled header containing lots of STL headers.
The compiler finishes without warning/error, the resulting executable runs fine.

unexpected template argument loc
UNREACHABLE executed at …/clang-p2996/clang/lib/Serialization/ASTReader.cpp:7591!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	…/test.cpp:8:25: current parser token ';'
1.	…/test.cpp:4:1: parsing namespace 'algorithm'
2.	…/test.cpp:6:1: parsing struct/union/class body 'algorithm::type::Test'
3.	…/test.cpp:7:8: parsing function body 'algorithm::type::Test::Test'
4.	…/test.cpp:7:8: in compound statement ('{}')
5.	…/../../Data/InterfaceImpl.h:8:26: instantiating class definition 'data::InterfaceImpl<algorithm::type::Img>'
6.	…/../../Data/../Sys/meta/utilities.h:28:50: instantiating function definition 'sys::meta::fields_based_on<algorithm::type::Img, data::Interface>'
 #0 0x0000640d0f347098 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/protechna/q/clang-p2996/llvm/lib/Support/Unix/Signals.inc:723:13
 #1 0x0000640d0f3453f0 llvm::sys::RunSignalHandlers() /home/protechna/q/clang-p2996/llvm/lib/Support/Signals.cpp:106:18
 #2 0x0000640d0f347878 SignalHandler(int) /home/protechna/q/clang-p2996/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x0000714d0da45320 (/lib/x86_64-linux-gnu/libc.so.6+0x45320)
 #4 0x0000714d0da9eb1c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x0000714d0da9eb1c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x0000714d0da9eb1c pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x0000714d0da4526e raise ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x0000714d0da288ff abort ./stdlib/abort.c:81:7
 #9 0x0000640d0f2ee99f (/opt/clang-p2996/clang-p2996/bin/clangd+0x20e899f)
#10 0x0000640d12448a97 clang::ASTReader::getContext() /home/protechna/q/clang-p2996/clang/include/clang/Serialization/ASTReader.h:2425:5
#11 0x0000640d12448a97 clang::ASTRecordReader::getContext() /home/protechna/q/clang-p2996/clang/include/clang/Serialization/ASTRecordReader.h:59:45
#12 0x0000640d12448a97 clang::ASTRecordReader::readTypeSourceInfo() /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReader.cpp:7197:27
#13 0x0000640d12448a97 clang::ASTRecordReader::readTemplateArgumentLocInfo(clang::TemplateArgument::ArgKind) /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReader.cpp:7567:12
#14 0x0000640d1244a137 clang::TemplateArgumentLoc::TemplateArgumentLoc(clang::TemplateArgument const&, clang::TemplateArgumentLocInfo) /home/protechna/q/clang-p2996/clang/include/clang/AST/TemplateBase.h:549:9
#15 0x0000640d1244a137 clang::ASTRecordReader::readTemplateArgumentLoc() /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReader.cpp:0:0
#16 0x0000640d124b965b clang::TemplateArgumentListInfo::addArgument(clang::TemplateArgumentLoc const&) /home/protechna/q/clang-p2996/clang/include/clang/AST/TemplateBase.h:689:64
#17 0x0000640d124b965b clang::ASTStmtReader::ReadTemplateKWAndArgsInfo(clang::ASTTemplateKWAndArgsInfo&, clang::TemplateArgumentLoc*, unsigned int) /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReaderStmt.cpp:139:13
#18 0x0000640d124c8ed0 clang::OverloadExpr::hasTemplateKWAndArgsInfo() const /home/protechna/q/clang-p2996/clang/include/clang/AST/ExprCXX.h:3034:29
#19 0x0000640d124c8ed0 clang::OverloadExpr::getLAngleLoc() const /home/protechna/q/clang-p2996/clang/include/clang/AST/ExprCXX.h:3124:10
#20 0x0000640d124c8ed0 clang::OverloadExpr::hasExplicitTemplateArgs() const /home/protechna/q/clang-p2996/clang/include/clang/AST/ExprCXX.h:3141:49
#21 0x0000640d124c8ed0 clang::OverloadExpr::getNumTemplateArgs() const /home/protechna/q/clang-p2996/clang/include/clang/AST/ExprCXX.h:3150:10
#22 0x0000640d124c8ed0 clang::ASTStmtReader::VisitOverloadExpr(clang::OverloadExpr*) /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReaderStmt.cpp:2168:5
#23 0x0000640d124c937f clang::BitsUnpacker::isValid() const /home/protechna/q/clang-p2996/clang/include/clang/Serialization/ASTReader.h:2522:33
#24 0x0000640d124c937f clang::BitsUnpacker::getNextBit() /home/protechna/q/clang-p2996/clang/include/clang/Serialization/ASTReader.h:2505:5
#25 0x0000640d124c937f clang::ASTStmtReader::VisitUnresolvedLookupExpr(clang::UnresolvedLookupExpr*) /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReaderStmt.cpp:2207:67
#26 0x0000640d124d014e clang::ASTReader::ReadStmtFromStream(clang::serialization::ModuleFile&) /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReaderStmt.cpp:0:14
#27 0x0000640d1244c7f3 clang::ASTReader::GetExternalDeclStmt(unsigned long) /home/protechna/q/clang-p2996/clang/lib/Serialization/ASTReader.cpp:8053:10
#28 0x0000640d0f4a0582 clang::LazyOffsetPtr<clang::Stmt, unsigned long, &clang::ExternalASTSource::GetExternalDeclStmt(unsigned long)>::get(clang::ExternalASTSource*) const /home/protechna/q/clang-p2996/clang/include/clang/AST/ExternalASTSource.h:378:40
#29 0x0000640d0f4a0582 clang::FunctionDecl::getBody(clang::FunctionDecl const*&) const /home/protechna/q/clang-p2996/clang/lib/AST/Decl.cpp:3248:29
#30 0x0000640d0f4aa129 clang::FunctionDecl::getBody() const /home/protechna/q/clang-p2996/clang/include/clang/AST/Decl.h:2242:5
#31 0x0000640d0f5f826b clang::LambdaExpr::capture_size() const /home/protechna/q/clang-p2996/clang/include/clang/AST/ExprCXX.h:2041:57
#32 0x0000640d0f5f826b clang::LambdaExpr::initBodyIfNeeded() const /home/protechna/q/clang-p2996/clang/lib/AST/ExprCXX.cpp:1326:28
#33 0x0000640d0f5f826b clang::LambdaExpr::getBody() const /home/protechna/q/clang-p2996/clang/lib/AST/ExprCXX.cpp:1331:3
#34 0x0000640d1065a05b clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformLambdaExpr(clang::LambdaExpr*) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:15601:42
#35 0x0000640d1064a69d (anonymous namespace)::TemplateInstantiator::TransformLambdaExpr(clang::LambdaExpr*) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiate.cpp:1705:25
#36 0x0000640d1065182a clang::ActionResult<clang::Expr*, true>::isInvalid() const /home/protechna/q/clang-p2996/clang/include/clang/Sema/Ownership.h:199:41
#37 0x0000640d1065182a clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformBinaryOperator(clang::BinaryOperator*) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:13373:11
#38 0x0000640d105de221 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformStmt(clang::Stmt*, clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::StmtDiscardKind) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:4224:15
#39 0x0000640d10653fb1 clang::ActionResult<clang::Stmt*, true>::isInvalid() const /home/protechna/q/clang-p2996/clang/include/clang/Sema/Ownership.h:199:41
#40 0x0000640d10653fb1 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCompoundStmt(clang::CompoundStmt*, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:8135:16
#41 0x0000640d105de1aa clang::Sema::SubstStmt(clang::Stmt*, clang::MultiLevelTemplateArgumentList const&) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiate.cpp:4495:23
#42 0x0000640d106a07e5 clang::Sema::InstantiateFunctionDefinition(clang::SourceLocation, clang::FunctionDecl*, bool, bool, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5325:14
#43 0x0000640d0fc306df clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) /home/protechna/q/clang-p2996/clang/lib/Sema/Sema.cpp:577:1
#44 0x0000640d104f6b72 clang::Sema::DeduceReturnType(clang::FunctionDecl*, clang::SourceLocation, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateDeduction.cpp:5442:25
#45 0x0000640d0fd17084 clang::Sema::DiagnoseUseOfDecl(clang::NamedDecl*, llvm::ArrayRef<clang::SourceLocation>, clang::ObjCInterfaceDecl const*, bool, bool, clang::ObjCInterfaceDecl*, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaExpr.cpp:307:9
#46 0x0000640d1037a036 FinishOverloadedCallExpr(clang::Sema&, clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, clang::OverloadCandidateSet*, clang::OverloadCandidate**, clang::OverloadingResult, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaOverload.cpp:14042:9
#47 0x0000640d10379de2 clang::Sema::BuildOverloadedCallExpr(clang::Scope*, clang::Expr*, clang::UnresolvedLookupExpr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaOverload.cpp:14189:10
#48 0x0000640d0fd1d038 clang::Sema::BuildCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*, bool, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaExpr.cpp:6554:16
#49 0x0000640d0fd335eb clang::Sema::ActOnCallExpr(clang::Scope*, clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaExpr.cpp:6440:7
#50 0x0000640d1064cad7 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::RebuildCallExpr(clang::Expr*, clang::SourceLocation, llvm::MutableArrayRef<clang::Expr*>, clang::SourceLocation, clang::Expr*) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:2920:22
#51 0x0000640d1064cad7 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformCallExpr(clang::CallExpr*) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:13269:23
#52 0x0000640d105e05ed clang::ActionResult<clang::Expr*, true>::isInvalid() const /home/protechna/q/clang-p2996/clang/include/clang/Sema/Ownership.h:199:41
#53 0x0000640d105e05ed clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformExprs(clang::Expr* const*, unsigned int, bool, llvm::SmallVectorImpl<clang::Expr*>&, bool*) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:4461:16
#54 0x0000640d1064a7b9 clang::TreeTransform<(anonymous namespace)::TemplateInstantiator>::TransformInitListExpr(clang::InitListExpr*) /home/protechna/q/clang-p2996/clang/lib/Sema/TreeTransform.h:0:20
#55 0x0000640d105dc855 clang::Sema::SubstInitializer(clang::Expr*, clang::MultiLevelTemplateArgumentList const&, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiate.cpp:4551:23
#56 0x0000640d1069ce42 clang::Sema::ContextRAII::pop() /home/protechna/q/clang-p2996/clang/include/clang/Sema/Sema.h:3013:12
#57 0x0000640d1069ce42 clang::Sema::ContextRAII::~ContextRAII() /home/protechna/q/clang-p2996/clang/include/clang/Sema/Sema.h:3023:22
#58 0x0000640d1069ce42 clang::Sema::InstantiateVariableInitializer(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5589:5
#59 0x0000640d1068ffd7 clang::Decl::isInvalidDecl() const /home/protechna/q/clang-p2996/clang/include/clang/AST/DeclBase.h:595:46
#60 0x0000640d1068ffd7 clang::Sema::BuildVariableInstantiation(clang::VarDecl*, clang::VarDecl*, clang::MultiLevelTemplateArgumentList const&, llvm::SmallVector<clang::Sema::LateInstantiatedAttribute, 16u>*, clang::DeclContext*, clang::LocalInstantiationScope*, bool, clang::VarTemplateSpecializationDecl*) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:5554:16
#61 0x0000640d1068f6dd clang::TemplateDeclInstantiator::VisitVarDecl(clang::VarDecl*, bool, llvm::ArrayRef<clang::BindingDecl*>*) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp:1290:11
#62 0x0000640d105db3c2 clang::Sema::InstantiateClass(clang::SourceLocation, clang::CXXRecordDecl*, clang::CXXRecordDecl*, clang::MultiLevelTemplateArgumentList const&, clang::TemplateSpecializationKind, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiate.cpp:3799:9
#63 0x0000640d105dd498 llvm::SmallVectorTemplateCommon<clang::MultiLevelTemplateArgumentList::ArgumentListLevel, void>::begin() /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/SmallVector.h:267:45
#64 0x0000640d105dd498 llvm::SmallVectorTemplateCommon<clang::MultiLevelTemplateArgumentList::ArgumentListLevel, void>::end() /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/SmallVector.h:269:27
#65 0x0000640d105dd498 llvm::SmallVector<clang::MultiLevelTemplateArgumentList::ArgumentListLevel, 4u>::~SmallVector() /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/SmallVector.h:1202:46
#66 0x0000640d105dd498 clang::MultiLevelTemplateArgumentList::~MultiLevelTemplateArgumentList() /home/protechna/q/clang-p2996/clang/include/clang/Sema/Template.h:76:9
#67 0x0000640d105dd498 clang::Sema::InstantiateClassTemplateSpecialization(clang::SourceLocation, clang::ClassTemplateSpecializationDecl*, clang::TemplateSpecializationKind, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaTemplateInstantiate.cpp:4239:3
#68 0x0000640d1073613e clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*)::$_0::operator()() const /home/protechna/q/clang-p2996/clang/lib/Sema/SemaType.cpp:9287:11
#69 0x0000640d1073613e void llvm::function_ref<void ()>::callback_fn<clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*)::$_0>(long) /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#70 0x0000640d0fc306df clang::Sema::runWithSufficientStackSpace(clang::SourceLocation, llvm::function_ref<void ()>) /home/protechna/q/clang-p2996/clang/lib/Sema/Sema.cpp:577:1
#71 0x0000640d1071f80c clang::Sema::RequireCompleteTypeImpl(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser*) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaType.cpp:9315:11
#72 0x0000640d1071f060 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, clang::Sema::TypeDiagnoser&) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaType.cpp:9012:7
#73 0x0000640d1071fe98 clang::Sema::RequireCompleteType(clang::SourceLocation, clang::QualType, clang::Sema::CompleteTypeKind, unsigned int) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaType.cpp:9357:1
#74 0x0000640d0fc76ff4 clang::Sema::AddInitializerToDecl(clang::Decl*, clang::Expr*, bool) /home/protechna/q/clang-p2996/clang/lib/Sema/SemaDecl.cpp:13412:9
#75 0x0000640d12390387 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*)::InitializerScopeRAII::InitializerScopeRAII(clang::Parser&, clang::Declarator&, clang::Decl*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDecl.cpp:2709:11
#76 0x0000640d12390387 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDecl.cpp:2934:26
#77 0x0000640d1238e1fe clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, clang::DeclaratorContext, clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo&, clang::SourceLocation*, clang::Parser::ForRangeInit*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDecl.cpp:2562:7
#78 0x0000640d1238d376 clang::Parser::ParseSimpleDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*, clang::SourceLocation*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDecl.cpp:0:10
#79 0x0000640d1238ce70 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDecl.cpp:0:20
#80 0x0000640d123da4ee clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*, clang::ParsedAttributes&, clang::ParsedAttributes&) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseStmt.cpp:0:16
#81 0x0000640d123d9ba9 clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, clang::Parser::ParsedStmtContext, clang::SourceLocation*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseStmt.cpp:125:20
#82 0x0000640d123e3032 clang::Parser::ParseCompoundStatementBody(bool) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseStmt.cpp:1261:11
#83 0x0000640d123e40c5 clang::Parser::ParseFunctionStatementBody(clang::Decl*, clang::Parser::ParseScope&) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseStmt.cpp:2584:21
#84 0x0000640d12405ab0 clang::Token::isNot(clang::tok::TokenKind) const /home/protechna/q/clang-p2996/clang/include/clang/Lex/Token.h:100:52
#85 0x0000640d12405ab0 clang::Parser::ParseLexedMethodDef(clang::Parser::LexedMethod&) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseCXXInlineMethods.cpp:664:14
#86 0x0000640d1240498a clang::Parser::ParseLexedMethodDefs(clang::Parser::ParsingClass&) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseCXXInlineMethods.cpp:591:33
#87 0x0000640d12374b66 clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation, clang::SourceLocation, clang::ParsedAttributes&, unsigned int, clang::Decl*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDeclCXX.cpp:4144:21
#88 0x0000640d123725ce clang::Parser::ParseClassSpecifier(clang::tok::TokenKind, clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext, clang::ParsedAttributes&) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDeclCXX.cpp:0:7
#89 0x0000640d123925dc llvm::SmallVectorBase<unsigned int>::empty() const /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/SmallVector.h:81:46
#90 0x0000640d123925dc clang::ParsedAttributesView::empty() const /home/protechna/q/clang-p2996/clang/include/clang/Sema/ParsedAttr.h:843:40
#91 0x0000640d123925dc clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&, clang::Parser::ParsedTemplateInfo&, clang::AccessSpecifier, clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*, clang::ImplicitTypenameContext) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDecl.cpp:4767:23
#92 0x0000640d1232e2f5 clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&, clang::AccessSpecifier) /home/protechna/q/clang-p2996/clang/lib/Parse/Parser.cpp:1176:10
#93 0x0000640d1232de34 clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier) /home/protechna/q/clang-p2996/clang/lib/Parse/Parser.cpp:1289:12
#94 0x0000640d1232d089 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /home/protechna/q/clang-p2996/clang/lib/Parse/Parser.cpp:0:14
#95 0x0000640d12369ef7 clang::AttributePool::~AttributePool() /home/protechna/q/clang-p2996/clang/include/clang/Sema/ParsedAttr.h:726:22
#96 0x0000640d12369ef7 clang::ParsedAttributes::~ParsedAttributes() /home/protechna/q/clang-p2996/clang/include/clang/Sema/ParsedAttr.h:958:7
#97 0x0000640d12369ef7 clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDeclCXX.cpp:301:5
#98 0x0000640d12369ffc clang::Parser::ParseScope::Exit() /home/protechna/q/clang-p2996/clang/include/clang/Parse/Parser.h:1226:15
#99 0x0000640d12369ffc clang::Parser::ParseInnerNamespace(llvm::SmallVector<clang::Parser::InnerNamespaceInfo, 4u> const&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, clang::BalancedDelimiterTracker&) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDeclCXX.cpp:324:18
#100 0x0000640d12369535 clang::Parser::ParseScope::Exit() /home/protechna/q/clang-p2996/clang/include/clang/Parse/Parser.h:1226:15
#101 0x0000640d12369535 clang::Parser::ParseNamespace(clang::DeclaratorContext, clang::SourceLocation&, clang::SourceLocation) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDeclCXX.cpp:254:18
#102 0x0000640d1238cc93 clang::Parser::ParseDeclaration(clang::DeclaratorContext, clang::SourceLocation&, clang::ParsedAttributes&, clang::ParsedAttributes&, clang::SourceLocation*) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseDecl.cpp:0:0
#103 0x0000640d1232ca43 clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*) /home/protechna/q/clang-p2996/clang/lib/Parse/Parser.cpp:0:0
#104 0x0000640d1232b43a clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /home/protechna/q/clang-p2996/clang/lib/Parse/Parser.cpp:773:10
#105 0x0000640d1232ade1 clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&) /home/protechna/q/clang-p2996/clang/lib/Parse/Parser.cpp:630:23
#106 0x0000640d1232732a clang::ParseAST(clang::Sema&, bool, bool) /home/protechna/q/clang-p2996/clang/lib/Parse/ParseAST.cpp:170:5
#107 0x0000640d121552f0 clang::FrontendAction::Execute() /home/protechna/q/clang-p2996/clang/lib/Frontend/FrontendAction.cpp:1082:10
#108 0x0000640d1096c6cf llvm::Error::getPtr() const /home/protechna/q/clang-p2996/llvm/include/llvm/Support/Error.h:282:12
#109 0x0000640d1096c6cf llvm::Error::operator bool() /home/protechna/q/clang-p2996/llvm/include/llvm/Support/Error.h:242:16
#110 0x0000640d1096c6cf clang::clangd::ParsedAST::build(llvm::StringRef, clang::clangd::ParseInputs const&, std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, llvm::ArrayRef<clang::clangd::Diag>, std::shared_ptr<clang::clangd::PreambleData const>) /home/protechna/q/clang-p2996/clang-tools-extra/clangd/ParsedAST.cpp:712:19
#111 0x0000640d10a13c82 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:1068:6
#112 0x0000640d10a13c82 std::__shared_ptr<clang::clangd::PreambleData const, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/shared_ptr_base.h:1525:31
#113 0x0000640d10a13c82 clang::clangd::(anonymous namespace)::ASTWorker::generateDiagnostics(std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, clang::clangd::ParseInputs, std::vector<clang::clangd::Diag, std::allocator<clang::clangd::Diag>>) /home/protechna/q/clang-p2996/clang-tools-extra/clangd/TUScheduler.cpp:1210:39
#114 0x0000640d10a136c9 void std::_Destroy_aux<false>::__destroy<clang::clangd::Diag*>(clang::clangd::Diag*, clang::clangd::Diag*) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_construct.h:162:19
#115 0x0000640d10a136c9 void std::_Destroy<clang::clangd::Diag*>(clang::clangd::Diag*, clang::clangd::Diag*) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_construct.h:195:7
#116 0x0000640d10a136c9 void std::_Destroy<clang::clangd::Diag*, clang::clangd::Diag>(clang::clangd::Diag*, clang::clangd::Diag*, std::allocator<clang::clangd::Diag>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/alloc_traits.h:944:7
#117 0x0000640d10a136c9 std::vector<clang::clangd::Diag, std::allocator<clang::clangd::Diag>>::~vector() /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/stl_vector.h:735:2
#118 0x0000640d10a136c9 clang::clangd::(anonymous namespace)::ASTWorker::updatePreamble(std::unique_ptr<clang::CompilerInvocation, std::default_delete<clang::CompilerInvocation>>, clang::clangd::ParseInputs, std::shared_ptr<clang::clangd::PreambleData const>, std::vector<clang::clangd::Diag, std::allocator<clang::clangd::Diag>>, clang::clangd::WantDiagnostics)::$_0::operator()() /home/protechna/q/clang-p2996/clang-tools-extra/clangd/TUScheduler.cpp:1144:5
#119 0x0000640d10a0fef1 llvm::function_ref<void ()>::operator()() const /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/STLFunctionalExtras.h:0:12
#120 0x0000640d10a0fef1 clang::clangd::(anonymous namespace)::ASTWorker::runTask(llvm::StringRef, llvm::function_ref<void ()>) /home/protechna/q/clang-p2996/clang-tools-extra/clangd/TUScheduler.cpp:1324:3
#121 0x0000640d10a0eddd clang::clangd::(anonymous namespace)::ASTWorker::run() /home/protechna/q/clang-p2996/clang-tools-extra/clangd/TUScheduler.cpp:1459:5
#122 0x0000640d10a0eddd clang::clangd::(anonymous namespace)::ASTWorker::create(llvm::StringRef, clang::clangd::GlobalCompilationDatabase const&, clang::clangd::TUScheduler::ASTCache&, clang::clangd::TUScheduler::HeaderIncluderCache&, clang::clangd::AsyncTaskRunner*, clang::clangd::Semaphore&, clang::clangd::TUScheduler::Options const&, clang::clangd::ParsingCallbacks&)::$_0::operator()() const /home/protechna/q/clang-p2996/clang-tools-extra/clangd/TUScheduler.cpp:822:42
#123 0x0000640d10a0eddd void llvm::detail::UniqueFunctionBase<void>::CallImpl<clang::clangd::(anonymous namespace)::ASTWorker::create(llvm::StringRef, clang::clangd::GlobalCompilationDatabase const&, clang::clangd::TUScheduler::ASTCache&, clang::clangd::TUScheduler::HeaderIncluderCache&, clang::clangd::AsyncTaskRunner*, clang::clangd::Semaphore&, clang::clangd::TUScheduler::Options const&, clang::clangd::ParsingCallbacks&)::$_0>(void*) /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/FunctionExtras.h:222:12
#124 0x0000640d10b777ff llvm::detail::PunnedPointer<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>::operator=(long) /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/PointerIntPair.h:48:5
#125 0x0000640d10b777ff llvm::detail::PunnedPointer<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>::PunnedPointer(long) /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/PointerIntPair.h:37:60
#126 0x0000640d10b777ff llvm::PointerIntPair<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>, 1u, bool, llvm::PointerLikeTypeTraits<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>, llvm::PointerIntPairInfo<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>, 1u, llvm::PointerLikeTypeTraits<llvm::PointerUnion<llvm::detail::UniqueFunctionBase<void>::TrivialCallback*, llvm::detail::UniqueFunctionBase<void>::NonTrivialCallbacks*>>>>::PointerIntPair() /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/PointerIntPair.h:86:13
#127 0x0000640d10b777ff llvm::detail::UniqueFunctionBase<void>::UniqueFunctionBase() /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/FunctionExtras.h:343:3
#128 0x0000640d10b777ff llvm::unique_function<void ()>::unique_function(std::nullptr_t) /home/protechna/q/clang-p2996/llvm/include/llvm/ADT/FunctionExtras.h:372:3
#129 0x0000640d10b777ff clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1::operator()() /home/protechna/q/clang-p2996/clang-tools-extra/clangd/support/Threading.cpp:103:14
#130 0x0000640d10b777ff auto void llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*)::'lambda'(auto&&, auto&&...)::operator()<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1&>(auto&&, auto&&...) const /home/protechna/q/clang-p2996/llvm/include/llvm/Support/thread.h:43:11
#131 0x0000640d10b777ff auto std::__invoke_impl<void, void llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*)::'lambda'(auto&&, auto&&...), clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1&>(std::__invoke_other, void llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*)::'lambda'(auto&&, auto&&...)&&, clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1&) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:61:14
#132 0x0000640d10b777ff std::__invoke_result<auto, auto...>::type std::__invoke<void llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*)::'lambda'(auto&&, auto&&...), clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1&>(auto&&, auto&&...) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/bits/invoke.h:96:14
#133 0x0000640d10b777ff decltype(auto) std::__apply_impl<void llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*)::'lambda'(auto&&, auto&&...), std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>&, 0ul>(auto&&, std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>&, std::integer_sequence<unsigned long, 0ul>) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/tuple:2921:14
#134 0x0000640d10b777ff decltype(auto) std::apply<void llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*)::'lambda'(auto&&, auto&&...), std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>&>(auto&&, std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>&) /usr/bin/../lib/gcc/x86_64-linux-gnu/14/../../../../include/c++/14/tuple:2936:14
#135 0x0000640d10b777ff void llvm::thread::GenericThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*) /home/protechna/q/clang-p2996/llvm/include/llvm/Support/thread.h:41:5
#136 0x0000640d10b777ff void* llvm::thread::ThreadProxy<std::tuple<clang::clangd::AsyncTaskRunner::runAsync(llvm::Twine const&, llvm::unique_function<void ()>)::$_1>>(void*) /home/protechna/q/clang-p2996/llvm/include/llvm/Support/thread.h:55:5
#137 0x0000714d0da9ca94 start_thread ./nptl/pthread_create.c:447:8
#138 0x0000714d0db29c3c clone3 ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:80:0
Signalled during AST worker action: Build AST
  Filename: …/test.cpp
  Directory: …/out/build/x64_clang++-p2996/lib/algorithm
  Command Line: /opt/clang-p2996/clang-p2996/bin/clang++ --driver-mode=g++ -DBOOST_IOSTREAMS_DYN_LINK -DBOOST_IOSTREAMS_NO_LIB -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_PROGRAM_OPTIONS_NO_LIB -I…/. -isystem /opt/clang-p2996/opencv/include/opencv4 -isystem /opt/clang-p2996/boost/include -Wno-dangling-else -Wno-invalid-offsetof -freflection-latest -stdlib=libc++ -DCONFIG_NAME="Debug" -g -std=gnu++26 -Winvalid-pch -Xclang -include-pch -Xclang …/out/build/x64_clang++-p2996/lib/Sys/CMakeFiles/Sys.dir/cmake_pch.hxx.pch -Xclang -include -Xclang …/out/build/x64_clang++-p2996/lib/Sys/CMakeFiles/Sys.dir/cmake_pch.hxx -o CMakeFiles/primitive_test.dir/type/test.cpp.o -c -resource-dir=/opt/clang-p2996/clang-p2996/lib/clang/20 -- …/test.cpp
  Version: 1
[Error - 5:35:47 PM] The Clang Language Server server crashed 1 times in the last 3 minutes. The server will not be restarted. See the output for more information.

@katzdm
Copy link
Collaborator

katzdm commented Oct 23, 2024

Ah, of course - Yes, you're right; that change is also needed. I think adding the missing case to ASTReader.cpp that you identified above, together with the setting of HasTemplateKWAndArgsInfo to false, ought to be enough for now. Let me know if that works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants