From nobody Sat Apr 6 20:18:37 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VBmrs4XhFz5HGfV; Sat, 6 Apr 2024 20:18:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VBmrs2fQVz4Lsf; Sat, 6 Apr 2024 20:18:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712434717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kEtInG5v1OBgNH2P2uwHb6npSYyDRQPHtp7ORkHk7bI=; b=ZQa5ePgMEBnB1fsm7S550JgcqmK8yuJiRX+9XZdodIEXEnfLD3rRfYTcBUqn+7zFb0KklR AeaVhK8IYuhAyH+H1KpG29KmtR//jkTFc5W+SoyF07tT/8oiaACKbnKjjSRGAaj3Jbxs6Q n+Z9Fyy6fxCvXOrUHPPVDFuhXyP0fKvSCJBBvgbWQVQdHBMvLlZ2K5oUN3ZOKzjodpQmkQ FDPmNe9tqr2fpxVrm9RlRK0KYWp8cS+38b613DDFyp2G6JFFU6gCM1v0QAUg/P5PLZvOc6 /6TcPV5jDPz+JOMioGqSANk1A1QhYoS8nFjD3nd31Bx7dcWNEfaHJxVfSLSqDQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1712434717; a=rsa-sha256; cv=none; b=e5Zx/Ndk2puKy3WP+HAcijM2WBkrAdbOPHzpAbQfBUc9tJAJtpU21HGbW5xS0MdNuZ1d3p zwsehFV8oI0fuYfb09MH+x7xm48/u3FiyZgtn7lsrCaOj9AR48Foj68RSeNg997aD3xIDc K0XSyk3ypn0ZPLdfB4VgfbGJxAokRWytWRH1bhzAym1GMZKr7JHwSkdYVw7dc+NySIeMCv 3rXKGMdpV3SmB6Ng6ryZ5gl9/ufTZbSOiUNw4jqQCyGcPs7fbbVfz0ciD2gB9+PuwTTSa8 ShILIbzH0uMMZUPZ2T0F0w2ypluZdq2CSkiLa50aH3PiX3AxsQoXFZj5bTMT9Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1712434717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=kEtInG5v1OBgNH2P2uwHb6npSYyDRQPHtp7ORkHk7bI=; b=OncR+gcOBH5DVv+8k8EdG9N/lmA+XTDl9jxwRWdGfy5Q5eeo5wlpJXHx4SdtV+WEMqcuQY VQTkHhNku8if0grhhPaYY+t+Ep+go/Lel7zFic9j+qzxgvu4J6pHi3ZE9/gRWlfWX/rIj3 vGn5PHjkD/mzfZsR6gUIk3YGd/DWqS3pIJ58BYxz9+16deiHTWbpJFJB/6jrVAEJ/MlgF0 UOuBlT5oc7+NQpInVqCa76hdiTZO+9PAYadKx0+niMe52YZeTo5z/vo+MLgAFOaefVzNtJ By60k9SUC86igK+yLk81eycSKvjKD86xzVI4tCIvDHX2oVE4ragujVaRl4cH5g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VBmrs2Djjzxcr; Sat, 6 Apr 2024 20:18:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 436KIbTY030013; Sat, 6 Apr 2024 20:18:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 436KIbAO030010; Sat, 6 Apr 2024 20:18:37 GMT (envelope-from git) Date: Sat, 6 Apr 2024 20:18:37 GMT Message-Id: <202404062018.436KIbAO030010@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric <dim@FreeBSD.org> Subject: git: dc36515b6283 - main - Merge commit 5f4ee5a2dfa9 from llvm-project (by Shanzhi): List-Id: Commit messages for the main branch of the src repository <dev-commits-src-main.freebsd.org> List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: <mailto:dev-commits-src-main+help@freebsd.org> List-Post: <mailto:dev-commits-src-main@freebsd.org> List-Subscribe: <mailto:dev-commits-src-main+subscribe@freebsd.org> List-Unsubscribe: <mailto:dev-commits-src-main+unsubscribe@freebsd.org> Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dc36515b628331e03ac8c23a6749f7f3eb1ebec8 Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=dc36515b628331e03ac8c23a6749f7f3eb1ebec8 commit dc36515b628331e03ac8c23a6749f7f3eb1ebec8 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-02-05 09:16:17 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-04-06 20:14:02 +0000 Merge commit 5f4ee5a2dfa9 from llvm-project (by Shanzhi): [Clang][AST] Fix a crash on attaching doc comments (#78716) This crash is basically caused by calling `ASTContext::getRawCommentForDeclNoCacheImp` with its input arguments `RepresentativeLocForDecl` and `CommentsInTheFile` refering to different files. A reduced reproducer is provided in this patch. After the source locations for instantiations of funtion template are corrected in the commit 256a0b298c68b89688b80350b034daf2f7785b67, the variable `CommitsInThisFile` in the function `ASTContext::attachCommentsToJustParsedDecls` would refer to the source file rather than the header file for implicit function template instantiation. Therefore, in the first loop in `ASTContext::attachCommentsToJustParsedDecls`, `D` should also be adjusted for relevant scenarios like the second loop. Fixes #67979 Fixes #68524 Fixes #70550 This should fix a segfault when compiling graphics/gdal. PR: 276104 MFC after: 1 month --- contrib/llvm-project/clang/lib/AST/ASTContext.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp index 5eb7aa366456..9a0ede201059 100644 --- a/contrib/llvm-project/clang/lib/AST/ASTContext.cpp +++ b/contrib/llvm-project/clang/lib/AST/ASTContext.cpp @@ -498,7 +498,11 @@ void ASTContext::attachCommentsToJustParsedDecls(ArrayRef<Decl *> Decls, return; FileID File; - for (Decl *D : Decls) { + for (const Decl *D : Decls) { + if (D->isInvalidDecl()) + continue; + + D = &adjustDeclToTemplate(*D); SourceLocation Loc = D->getLocation(); if (Loc.isValid()) { // See if there are any new comments that are not attached to a decl.