Skip to content

[lldb] Fix --source-regexp-function for Swift static functions#12873

Open
kastiglione wants to merge 2 commits into
swift/release/6.4.xfrom
dl/lldb-Fix-source-regexp-function-for-Swift-static-functions
Open

[lldb] Fix --source-regexp-function for Swift static functions#12873
kastiglione wants to merge 2 commits into
swift/release/6.4.xfrom
dl/lldb-Fix-source-regexp-function-for-Swift-static-functions

Conversation

@kastiglione
Copy link
Copy Markdown

@kastiglione kastiglione commented May 1, 2026

Fixes the ability to set a source breakpoint with a function filter – where the function is a static Swift function.

@kastiglione kastiglione requested a review from a team as a code owner May 1, 2026 17:04
@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test

1 similar comment
@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test macOS

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test windows

5 similar comments
@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test windows

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test windows

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test windows

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test windows

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test windows

@kastiglione kastiglione force-pushed the dl/lldb-Fix-source-regexp-function-for-Swift-static-functions branch from c7458b3 to 8ff00c8 Compare May 11, 2026 21:07
@kastiglione kastiglione changed the base branch from stable/21.x to swift/release/6.4.x May 11, 2026 21:08
@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test

@kastiglione
Copy link
Copy Markdown
Author

depends on #12945

@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test

1 similar comment
@kastiglione
Copy link
Copy Markdown
Author

@swift-ci test

MODULENAME?=$(shell basename $(EXE) .out)
# Compile with -parse-as-library when main.swift contains "@main".
ifneq "$(shell grep -w '@main' $(VPATH)/main.swift 2>/dev/null)" ""
ifneq "$(wildcard $(VPATH)/main.swift)" ""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be much more straightforward to grep in $(SWIFT_SOURCES)? Or is that not set here?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or $(VPATH)/$(SWIFT_SOURCES)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote it as main.swift to follow/enforce convention. Currently all 46 uses of @main are in files named main.swift.

# Compile with -parse-as-library when main.swift contains "@main".
ifneq "$(shell grep -w '@main' $(VPATH)/main.swift 2>/dev/null)" ""
ifneq "$(wildcard $(VPATH)/main.swift)" ""
ifneq "$(shell git -C $(VPATH) grep --no-index -w '@main' main.swift)" ""
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think invoking git during the build is a great idea. Some build pipelines copy the sources somewhere else for building.

Copy link
Copy Markdown
Author

@kastiglione kastiglione May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some build pipelines copy the sources somewhere else for building.

Meaning it won't work if the sources aren't part of git? That's a case that --no-index handles:

--no-index
    Search files in the current directory that is not managed by Git, or by
    ignoring that the current directory is managed by Git. This is rather similar
    to running the regular grep(1) utility with its -r option specified, but with
    some additional benefits, such as ...

Copy link
Copy Markdown
Author

@kastiglione kastiglione May 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw since I find git-diff much better than original diff, I use the following alias:

alias diff='git diff --no-index'

In my experience git grep --no-index and git diff --no-index are capable replacements for grep and diff respectively.

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