Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow filtering of detect headers without messing up dependency detection #433

Merged
merged 1 commit into from
May 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/generator/context.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,11 @@ function get_default_args(triple=get_triple())
end

"""
detect_headers(include_dir, args, options::Dict=Dict())
detect_headers(include_dir, args, options::Dict=Dict(), filter=(header)->false)
Detect a set of headers which can span the whole directory.
Use `filter` to filter out headers you don't want to consider as candidates
"""
function detect_headers(include_dir, args, options::Dict=Dict())
function detect_headers(include_dir, args, options::Dict=Dict(), filter_op = (header)->false)
system_dirs = filter(x->startswith(x, "-isystem"), args)
system_dirs = map(x->x[9:end], system_dirs)

Expand All @@ -259,6 +260,7 @@ function detect_headers(include_dir, args, options::Dict=Dict())
for (root, dirs, files) in walkdir(normpath(include_dir))
for file in files
header = joinpath(root, file)
filter_op(header) && continue
try
# FIXME: C++ could also be successful parsed, but that's not what we want
parse_header(idx, header, args, flags)
Expand Down