From nobody Sat Apr 20 10:34:35 2024 X-Original-To: dev-commits-src-all@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 4VM7DX2962z5HWV0; Sat, 20 Apr 2024 10:34:36 +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 4VM7DW5Tx0z4SyL; Sat, 20 Apr 2024 10:34:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713609275; 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=sQjFmkNCCJEMnjPQD4phf+ff750ad5a8yfU6uEE/+cg=; b=Y2RcVA3aHjzywpdOTjfo1sSyS69ldtr6CKSABqWHMpTyma+RtNHZOJZqd+HP+I1ZexqaEF blFgaUvxnHcU/1RlOwQw/YJdU2P7/T5x1mCEkG44FYBm9M9onF7h4XmnrgFziSOw7T/wLm bSm+HHhRvvd4zqgsmaHhRVStAG8ck86yiK0LaHkfc6IhDL5kkT0b5F8JfSe22XLyOp2dQm 9o5PsS6jqJYvfYYwqiQBOC0956zaj8q3VzTI9NKBpnYimtiDax+m6YrO/oCfnbW6/59aKr lBKrhql998U77gkRCCTm1QbiKnWDFiOfzDozZt07GPW5SUb/0xK6GX64YLXXnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713609275; a=rsa-sha256; cv=none; b=Vg5+sAFp/BztYyI8u42kGuCauBMrxoXzxKw9dC9ru9PpOOt4JgGlfHgCazTtcNAHWXZ1gD 11/58wAZlbn7T7Booyty3oJ2IYy9V0LZpeRUcLb/ukSDUdgH+DNXdN8343773VBpMo5cUN cQIvw6tpXxkLda74UIeSqI8mbQCs8GT/Swv4AXlwPKlXq+3xMDv4EJmsj/K4yrbiGUqogG tHX+6GhVIafTStvU1gIK5mgon3HjlRKoznItKEBkkjf3sBiZmkAjIbshdZLNGdKDN4hYWz /Q3Pr3hv3lF5mUrDIzov7oyFoz4JZ7bjiheQL3J9q2Xqm95EjvrW1ekDMDO2WQ== 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=1713609275; 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=sQjFmkNCCJEMnjPQD4phf+ff750ad5a8yfU6uEE/+cg=; b=TorBe/DJIvjC1uKWVfBHo7K8o9Z+ineLctwJ50mC+9aFhYrH8VwOi+NTHpS8yiRAS7OObP WuFMFpTzJB13yi+QXDuL5Yuh46Z5Z0b2I9hDHtYM6bLLPCoQpKq2FLXCRBENYGa2a0EB4l ZEDIoLcNhvtbtv5Ae3LkiiT8AS8slz8wfnEzcRHgmQQqFTvrmdgwUOV37cEHRfOb914lDR SmsfNnJVug7pem4S3HMwGVm67Xhvb3/ovN1Ms8T7Qu4Y3BSAcDi4EyCP4n2/NGC5oIQnbV nJlyL7Uk1ICwGVTqTb9MNCHF07HLwPqCEXJQrD/O5HgTWqhneNqT7egjMhcfmg== 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 4VM7DW4ctxzZFn; Sat, 20 Apr 2024 10:34:35 +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 43KAYZbQ013813; Sat, 20 Apr 2024 10:34:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43KAYZC1013810; Sat, 20 Apr 2024 10:34:35 GMT (envelope-from git) Date: Sat, 20 Apr 2024 10:34:35 GMT Message-Id: <202404201034.43KAYZC1013810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 6c596be66539 - stable/13 - Merge commit 5f4ee5a2dfa9 from llvm-project (by Shanzhi): List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6c596be66539299d553c77acf94db2bed63a6fc5 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=6c596be66539299d553c77acf94db2bed63a6fc5 commit 6c596be66539299d553c77acf94db2bed63a6fc5 Author: Dimitry Andric AuthorDate: 2024-02-05 09:16:17 +0000 Commit: Dimitry Andric CommitDate: 2024-04-19 21:24:46 +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 (cherry picked from commit dc36515b628331e03ac8c23a6749f7f3eb1ebec8) --- 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 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.