The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=37c9eba1644b0f9e1b5d130ccff381122f48aebe
commit 37c9eba1644b0f9e1b5d130ccff381122f48aebe Author: Dimitry Andric <[email protected]> AuthorDate: 2026-10-01 12:31:42 +0000 Commit: Dimitry Andric <[email protected]> CommitDate: 2026-10-01 12:31:42 +0000 Merge commit 80e8c0a59189 from llvm-project (by ShengYi Hung): [DebugInfo] Fill Column 0 if Line is not found (#227559) It is possible that user specified line 0 as the start of the line in C language (using `# 0`). However, it is rejected by the Lexer as we have no line but still carries column information. As a result, we fill column to 0 if we cannot find line. Assisted-by: Claude # Test Fixes: #56186 This fixes a fatal error when building the textproc/peg port. PR: 264853 MFC after: 3 days --- contrib/llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp index ec28bd259e8e..42e38bfc2872 100644 --- a/contrib/llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGDebugInfo.cpp @@ -4868,9 +4868,12 @@ void CGDebugInfo::CreateLexicalBlock(SourceLocation Loc) { llvm::MDNode *Back = nullptr; if (!LexicalBlockStack.empty()) Back = LexicalBlockStack.back().get(); + // A #line 0 macro carried no line information but still take column + // information. This will finally be rejected by the lexer but is legal. + unsigned Line = getLineNumber(CurLoc); + unsigned Column = Line ? getColumnNumber(CurLoc) : 0; LexicalBlockStack.emplace_back(DBuilder.createLexicalBlock( - cast<llvm::DIScope>(Back), getOrCreateFile(CurLoc), getLineNumber(CurLoc), - getColumnNumber(CurLoc))); + cast<llvm::DIScope>(Back), getOrCreateFile(CurLoc), Line, Column)); } void CGDebugInfo::AppendAddressSpaceXDeref(
