From nobody Sat Apr 20 10:32:29 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 4VM7B54d8Hz5HVx8; Sat, 20 Apr 2024 10:32:29 +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 4VM7B52Jj0z4PfR; Sat, 20 Apr 2024 10:32:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713609149; 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=4ptEKVF9/a8p4aJYO5JZlV3TSEPwbY6z5DbNtidbTMk=; b=uqFb/H4JAJEuVm5q6q+CA5YHivwUmSgDudWx8kHTuVEhZrri4WViJx562SxPWCzNZKS3Z2 HROSfezy733Eg066x/2YBio2rX4Z33DgY2z+/PQW/JK9Y3QcJlFGTCkuw25T16v6p3NNhP M0d5lfHFbSudJrYcd0ra7CbJ06raJOfNOrdcia98poXJng4+bTvMbPG/7H0B3FqGYO8MDq GHvu0gucAaLGhWTolLlS+Zzmk9s+QajMWmgBW7Lx1OBPhmkCqKw9AW2GtnR4cbGFDKzzuK 9/+wHrjAOWBsR1AW+8ZimpRI78Cule33lg0D2QPTHersfButfsDP97yGI3BgfA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713609149; a=rsa-sha256; cv=none; b=S7hzFyEQ6zO/IB+CqhQ/edMZzPnQ6d8CszSy+HDM9Vv1ouoCOajRz0locJsow6nVcLaVzB jg1mmzCf+LDaJS3MxaKygESNTlEB0fwX8klVzd0UqB0ZqLM961i8fvzblV89id9d8XwAFf dYKbhX5nM334qJKnIrt+cvnLoW+QJilXcmuduz7JTt7gCKQy240/1QxeqgNrb/UqQE5y0g FDg/ZAMlx0gaTEW1MHKfdcsUC+s+bLQ9jKvtkt3fsmcHM41O/VVMorXkN2UpQ22NTsS+zW P9AIasbmtJviL/3N/aCFJoNBpzlWaVeccILGMf2/NWw8npKjlJGxZ32dodoMiw== 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=1713609149; 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=4ptEKVF9/a8p4aJYO5JZlV3TSEPwbY6z5DbNtidbTMk=; b=J5yS/36JD5UhANLOeYrySb9ghVsquOlKR0ckRBayKGpIp4meEAO/LucsuImfqIJetj8m17 xjC+gDXifNNL2QUQztq4KnbQNjWhlJZrIpnaeB1hzOvZuA2vWrJT2ILh6PimO0i2yyDw1s y8cZzixWZSMf8EpVv3isqyXEveLQiBiPveoSOOIVI4sZRYDvZhkQ4cHQdaHrtOfrekO1yZ 2C4jafqIOHAp9lwXe/91hfXllLvzU7rhO3u6mAuXmk1kldjret/esVuWxDKTk3nMCcXJQK /KUt+61uiJ7CUNEQ0vwflEFR4E7BIICDT7nM24tlmHk66OmH9i6Fccpe+a7ktA== 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 4VM7B51wmgzYmB; Sat, 20 Apr 2024 10:32:29 +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 43KAWTNM011160; Sat, 20 Apr 2024 10:32:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43KAWTm4011156; Sat, 20 Apr 2024 10:32:29 GMT (envelope-from git) Date: Sat, 20 Apr 2024 10:32:29 GMT Message-Id: <202404201032.43KAWTm4011156@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: bf13152d9e61 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: bf13152d9e61246e5a5f494e5cd02bd55cccea80 Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=bf13152d9e61246e5a5f494e5cd02bd55cccea80 commit bf13152d9e61246e5a5f494e5cd02bd55cccea80 Author: Dimitry Andric AuthorDate: 2024-02-05 09:16:17 +0000 Commit: Dimitry Andric CommitDate: 2024-04-19 21:14:15 +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.