Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:daae67adf04085b9ae54a816b35053b79086070434d2da4aafd6662f6ecb0bf7
image: ghcr.io/edgcpp/ci-runner@sha256:1a594bb42ba068c4b7e0194235770335107e5e12e9f7a561f726450173a02b3f
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: &ci-runner-image ghcr.io/edgcpp/ci-runner@sha256:daae67adf04085b9ae54a816b35053b79086070434d2da4aafd6662f6ecb0bf7
image: &ci-runner-image ghcr.io/edgcpp/ci-runner@sha256:1a594bb42ba068c4b7e0194235770335107e5e12e9f7a561f726450173a02b3f
defaults: &container-defaults
run:
shell: edg-container-exec "bash -eo pipefail {0}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/promote-test-cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
# The test legs' image, so that actions/cache picks the same compression
# (part of an entry's version) and the test legs can restore the entry.
container:
image: ghcr.io/edgcpp/ci-runner@sha256:daae67adf04085b9ae54a816b35053b79086070434d2da4aafd6662f6ecb0bf7
image: ghcr.io/edgcpp/ci-runner@sha256:1a594bb42ba068c4b7e0194235770335107e5e12e9f7a561f726450173a02b3f
strategy:
fail-fast: false
matrix:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/strict-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:daae67adf04085b9ae54a816b35053b79086070434d2da4aafd6662f6ecb0bf7
image: ghcr.io/edgcpp/ci-runner@sha256:1a594bb42ba068c4b7e0194235770335107e5e12e9f7a561f726450173a02b3f
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
Expand All @@ -185,7 +185,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:daae67adf04085b9ae54a816b35053b79086070434d2da4aafd6662f6ecb0bf7
image: ghcr.io/edgcpp/ci-runner@sha256:1a594bb42ba068c4b7e0194235770335107e5e12e9f7a561f726450173a02b3f
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
Expand All @@ -212,7 +212,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:daae67adf04085b9ae54a816b35053b79086070434d2da4aafd6662f6ecb0bf7
image: ghcr.io/edgcpp/ci-runner@sha256:1a594bb42ba068c4b7e0194235770335107e5e12e9f7a561f726450173a02b3f
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
Expand All @@ -239,7 +239,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 120
container:
image: ghcr.io/edgcpp/ci-runner@sha256:daae67adf04085b9ae54a816b35053b79086070434d2da4aafd6662f6ecb0bf7
image: ghcr.io/edgcpp/ci-runner@sha256:1a594bb42ba068c4b7e0194235770335107e5e12e9f7a561f726450173a02b3f
defaults:
run:
shell: edg-container-exec "bash -eo pipefail {0}"
Expand Down
17 changes: 17 additions & 0 deletions dev_tools/bin/edg-first-stage-il
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
# Exceptions.
# See https://edgcpp.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# Route --il_display to the first (C++-generating) stage of cpfe-cp-gen-be.
# Some IL fields, such as declared_storage_class, are only present in that
# source-sequence-list configuration.

if [ -z "$CPFE" ] ; then
echo 'CPFE is not set.' >&2
exit 1
fi

CPFEA_IL_DISPLAY=1 exec "$CPFE" "$@"
73 changes: 73 additions & 0 deletions dev_tools/bin/edg-il-filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env python3

# Part of the EDG Compiler Project, under the Apache License v2.0 with LLVM
# Exceptions.
# See https://edgcpp.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

'''Filter an EDG IL dump using a specification embedded in a test source.

The specification is read from a ``/* @filter ... */`` comment in the test
source. The source defaults to ``Local_file.c`` in the current directory,
which is how the test harness checks out the original test file. An explicit
source path may be given, and ``EDG_TRANSLATION_UNIT_TAG`` is used as a
fallback. The IL dump is read from stdin.
'''

import argparse
import os
import sys

from pathlib import Path
from typing import Optional

from edgtest.il_filter import extract_filter_spec, filter_il_dump


def resolve_source_path(arg: Optional[str]) -> Path:
'''Return the test source path to read the filter specification from.'''
if arg is not None:
return Path(arg)

local_file = Path('Local_file.c')
if local_file.is_file():
return local_file

original_test = os.environ.get('EDG_TRANSLATION_UNIT_TAG')
if original_test is not None:
return Path(original_test)

return local_file


def read_filter_spec(source_path: Path) -> str:
'''Return the filter specification embedded in the given test source.'''
source_text = source_path.read_text(encoding='utf-8', errors='replace')
spec = extract_filter_spec(source_text)
if spec is None:
raise SystemExit(
f'missing /* @filter ... */ comment in {source_path}'
)
return spec


def main() -> int:
'''Read the IL dump from stdin and write the filtered IL to stdout.'''
parser = argparse.ArgumentParser(
description = 'Filter an EDG IL dump using an embedded test filter.'
)
parser.add_argument(
'source',
nargs = '?',
help = 'test source containing /* @filter ... */ (default: Local_file.c)'
)
args = parser.parse_args()

source_path = resolve_source_path(args.source)
spec = read_filter_spec(source_path)
sys.stdout.writelines(filter_il_dump(sys.stdin, spec))
return 0


if __name__ == '__main__':
raise SystemExit(main())
Loading
Loading