diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 66b61116aa6e..16d52a216e43 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,184 +1,2 @@ -<<<<<<< HEAD ##SYCLomatic clang/ @oneapi-src/syclomatic-reviewers -======= -* @bader - -# Front-end compiler -clang/ @intel/dpcpp-cfe-reviewers - -# Clang driver -clang/**/Driver/ @intel/dpcpp-clang-driver-reviewers - -# Clang tools -clang-tools-extra/ @intel/dpcpp-cfe-reviewers - -# LLVM-SPIRV translator -llvm-spirv/ @intel/dpcpp-spirv-reviewers - -# OpenCL deps -opencl/ @intel/llvm-reviewers-runtime - -# OpenCL "offline" compiler -opencl/opencl-aot/ @intel/dpcpp-tools-reviewers - -# libclc library -libclc/ @intel/llvm-reviewers-cuda - -# Device library -libdevice/ @intel/llvm-reviewers-runtime - -# DPC++ runtime library -sycl/ @intel/llvm-reviewers-runtime - -# Documentation -sycl/ReleaseNotes.md @intel/dpcpp-doc-reviewers @tfzhu -sycl/doc/ @intel/dpcpp-doc-reviewers -sycl/doc/design/ @intel/llvm-reviewers-runtime -sycl/doc/design/spirv-extensions/ @intel/dpcpp-spirv-doc-reviewers -sycl/doc/extensions/ @intel/dpcpp-specification-reviewers - -# Unified Runtime -sycl/cmake/modules/FetchUnifiedRuntime.cmake @intel/unified-runtime-reviewers -sycl/cmake/modules/UnifiedRuntimeTag.cmake @intel/unified-runtime-reviewers -sycl/include/sycl/detail/ur.hpp @intel/unified-runtime-reviewers -sycl/source/detail/posix_ur.cpp @intel/unified-runtime-reviewers -sycl/source/detail/ur.cpp @intel/unified-runtime-reviewers -sycl/source/detail/windows_ur.cpp @intel/unified-runtime-reviewers -sycl/test-e2e/Plugin/ @intel/unified-runtime-reviewers - -# Win Proxy Loader -sycl/pi_win_proxy_loader @intel/llvm-reviewers-runtime -sycl/test-e2e/Plugin/dll-detach-order.cpp @intel/llvm-reviewers-runtime - -# CUDA specific runtime implementations -sycl/include/sycl/ext/oneapi/experimental/cuda/ @intel/llvm-reviewers-cuda - -# CUDA and HIP device code tests -sycl/test/check_device_code/cuda/ @intel/llvm-reviewers-cuda -sycl/test/check_device_code/hip/ @intel/llvm-reviewers-cuda - -# XPTI instrumentation utilities -xpti/ @intel/llvm-reviewers-runtime -xptifw/ @intel/llvm-reviewers-runtime - -# DPC++ tools -llvm/ @intel/dpcpp-tools-reviewers -clang/lib/CodeGen/BackendUtil.cpp @intel/dpcpp-cfe-reviewers @intel/dpcpp-tools-reviewers -clang/include/clang/CodeGen/BackendUtil.h @intel/dpcpp-cfe-reviewers @intel/dpcpp-tools-reviewers - -# OpenCL CPU RT -opencl-cpu/ @intel/ocl-cpu-rt-write - -# SPMD transform passes on CPU -llvm/lib/Transforms/SPMDTransforms/ @intel/ocl-cpu-rt-write - -# SPMD transform passes header files -llvm/include/llvm/Transforms/SPMDTransforms/ @intel/ocl-cpu-rt-write - -# SPMD transform passes LIT test -llvm/test/Transforms/SPMDTransforms/ @intel/ocl-cpu-rt-write - -# Clang offload tools -clang/**/OffloadBundler.h @intel/dpcpp-tools-reviewers -clang/**/OffloadBundler.cpp @intel/dpcpp-tools-reviewers -clang/tools/clang-offload-*/ @intel/dpcpp-tools-reviewers -clang/tools/clang-linker-wrapper/ @intel/dpcpp-tools-reviewers - -# Explicit SIMD -ESIMD/ @intel/dpcpp-esimd-reviewers -esimd/ @intel/dpcpp-esimd-reviewers -sycl/include/sycl/ext/intel/esimd.hpp @intel/dpcpp-esimd-reviewers -sycl/doc/extensions/**/sycl_ext_intel_esimd/ @intel/dpcpp-esimd-reviewers -llvm/lib/SYCLLowerIR/CMakeLists.txt @intel/dpcpp-tools-reviewers @intel/dpcpp-esimd-reviewers -sycl/test-e2e/ESIMD/ @intel/dpcpp-esimd-reviewers - -# invoke_simd -sycl/include/sycl/ext/oneapi/experimental/invoke_simd.hpp @intel/dpcpp-esimd-reviewers @rolandschulz -sycl/include/std/experimental/simd.hpp @intel/dpcpp-esimd-reviewers @rolandschulz -llvm/lib/SYCLLowerIR/LowerInvokeSimd.cpp @intel/dpcpp-esimd-reviewers -llvm/include/llvm/SYCLLowerIR/LowerInvokeSimd.h @intel/dpcpp-esimd-reviewers -invoke_simd/ @intel/dpcpp-esimd-reviewers -InvokeSimd/ @intel/dpcpp-esimd-reviewers -sycl/test-e2e/InvokeSimd/ @intel/dpcpp-esimd-reviewers - -# DevOps configs -.github/ @intel/dpcpp-devops-reviewers -buildbot/ @intel/dpcpp-devops-reviewers -devops/ @intel/dpcpp-devops-reviewers - -# dev-igc driver update -devops/dependencies-igc-dev.json @intel/sycl-matrix-reviewers @intel/dpcpp-esimd-reviewers @intel/dpcpp-devops-reviewers - -# Kernel fusion JIT compiler -sycl-jit/ @intel/dpcpp-kernel-fusion-reviewers -sycl/doc/design/KernelFusionJIT.md @intel/dpcpp-kernel-fusion-reviewers -sycl/doc/extensions/experimental/sycl_ext_codeplay_kernel_fusion.asciidoc @intel/dpcpp-kernel-fusion-reviewers -sycl/include/sycl/ext/codeplay/experimental/fusion_properties.hpp @intel/dpcpp-kernel-fusion-reviewers -sycl/include/sycl/ext/codeplay/experimental/fusion_wrapper.hpp @intel/dpcpp-kernel-fusion-reviewers -sycl/source/detail/fusion/ @intel/dpcpp-kernel-fusion-reviewers -sycl/source/detail/jit_compiler.hpp @intel/dpcpp-kernel-fusion-reviewers -sycl/source/detail/jit_compiler.cpp @intel/dpcpp-kernel-fusion-reviewers -sycl/source/detail/jit_device_binaries.hpp @intel/dpcpp-kernel-fusion-reviewers -sycl/source/detail/jit_device_binaries.cpp @intel/dpcpp-kernel-fusion-reviewers -sycl/test-e2e/KernelFusion @intel/dpcpp-kernel-fusion-reviewers - -# Matrix -sycl/include/sycl/ext/oneapi/matrix/ @intel/sycl-matrix-reviewers -sycl/test-e2e/Matrix @intel/sycl-matrix-reviewers -sycl/test/matrix @intel/sycl-matrix-reviewers -sycl/test/check_device_code/matrix @intel/sycl-matrix-reviewers - -# Native CPU -llvm/**/*SYCLNativeCPU* @intel/dpcpp-nativecpu-pi-reviewers -clang/include/clang/Basic/SYCLNativeCPUHelpers.h @intel/dpcpp-nativecpu-pi-reviewers -clang/test/CodeGenSYCL/native_cpu*.cpp @intel/dpcpp-nativecpu-pi-reviewers -clang/test/Driver/sycl-native-cpu*.cpp @intel/dpcpp-nativecpu-pi-reviewers -sycl/**/native_cpu/ @intel/dpcpp-nativecpu-pi-reviewers -sycl/doc/design/SYCLNativeCPU.md @intel/dpcpp-nativecpu-pi-reviewers -sycl/include/sycl/detail/native_cpu.hpp @intel/dpcpp-nativecpu-pi-reviewers -libdevice/nativecpu* @intel/dpcpp-nativecpu-pi-reviewers - -# SYCL-Graphs extensions -sycl/include/sycl/ext/oneapi/experimental/graph.hpp @intel/sycl-graphs-reviewers -sycl/source/detail/graph_impl.cpp @intel/sycl-graphs-reviewers -sycl/source/detail/graph_impl.hpp @intel/sycl-graphs-reviewers -sycl/unittests/Extensions/CommandGraph/ @intel/sycl-graphs-reviewers -sycl/test-e2e/Graph @intel/sycl-graphs-reviewers -sycl/doc/design/CommandGraph.md @intel/sycl-graphs-reviewers -sycl/doc/extensions/**/sycl_ext_oneapi_graph.asciidoc @intel/sycl-graphs-reviewers -sycl/doc/syclgraph/ @intel/sycl-graphs-reviewers - -# syclcompat library -sycl/**/syclcompat/ @intel/syclcompat-lib-reviewers -sycl/cmake/modules/AddSYCLLibraryUnitTest.cmake @intel/syclcompat-lib-reviewers -sycl/include/syclcompat.hpp @intel/syclcompat-lib-reviewers - -# bindless images -sycl/doc/extensions/experimental/sycl_ext_oneapi_bindless_images.asciidoc @intel/bindless-images-reviewers -sycl/include/sycl/ext/oneapi/bindless* @intel/bindless-images-reviewers -sycl/source/detail/bindless* @intel/bindless-images-reviewers -sycl/test/check_device_code/extensions/bindless_images.cpp @intel/bindless-images-reviewers -sycl/test-e2e/bindless_images/ @intel/bindless-images-reviewers - -# Miscellaneous sycl e2e tests -sycl/test-e2e/BFloat16/ @intel/dpcpp-tools-reviewers @intel/llvm-reviewers-runtime -sycl/test-e2e/AOT/ @intel/dpcpp-tools-reviewers -sycl/test-e2e/DeviceCodeSplit/ @intel/dpcpp-tools-reviewers -sycl/test-e2e/SeparateCompile/ @intel/dpcpp-tools-reviewers -sycl/test-e2e/Printf/ @intel/dpcpp-tools-reviewers @intel/llvm-reviewers-runtime -sycl/test-e2e/SpecConstants/ @intel/dpcpp-tools-reviewers -sycl/test-e2e/NewOffloadDriver/ @intel/dpcpp-tools-reviewers - -# Sanitizer -clang/lib/Driver/SanitizerArgs.cpp @intel/dpcpp-sanitizers-review -libdevice/sanitizer_utils.cpp @intel/dpcpp-sanitizers-review -libdevice/include/asan_libdevice.hpp @intel/dpcpp-sanitizers-review -libdevice/include/sanitizer_utils.hpp @intel/dpcpp-sanitizers-review -llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @intel/dpcpp-sanitizers-review -sycl/test-e2e/AddressSanitizer/ @intel/dpcpp-sanitizers-review -llvm/test/Instrumentation/AddressSanitizer/ @intel/dpcpp-sanitizers-review -llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerOptions.h @intel/dpcpp-sanitizers-review -llvm/include/llvm/Transforms/Instrumentation/AddressSanitizerCommon.h @intel/dpcpp-sanitizers-review -llvm/include/llvm/Transforms/Instrumentation/AddressSanitizer.h @intel/dpcpp-sanitizers-review ->>>>>>> origin/sycl diff --git a/.github/new-prs-labeler.yml b/.github/new-prs-labeler.yml index 8cc6c36fa945..88da245fa4be 100644 --- a/.github/new-prs-labeler.yml +++ b/.github/new-prs-labeler.yml @@ -1013,3 +1013,4 @@ tablegen: - llvm/include/TableGen/** - llvm/lib/TableGen/** - llvm/utils/TableGen/** + diff --git a/.github/workflows/containers/github-action-ci/stage1.Dockerfile b/.github/workflows/containers/github-action-ci/stage1.Dockerfile index 73828cc05736..3c05376c34bd 100644 --- a/.github/workflows/containers/github-action-ci/stage1.Dockerfile +++ b/.github/workflows/containers/github-action-ci/stage1.Dockerfile @@ -40,3 +40,4 @@ RUN cmake -B ./build -G Ninja ./llvm \ -DBOOTSTRAP_CLANG_PGO_TRAINING_DATA_SOURCE_DIR=/llvm-project-llvmorg-$LLVM_VERSION/llvm RUN ninja -C ./build stage2-instrumented-clang stage2-instrumented-lld + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 54f82bd4e4c0..e69de29bb2d1 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,169 +0,0 @@ -# LLVM Documentation CI -# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -# See https://llvm.org/LICENSE.txt for license information. -# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - -name: "Test documentation build" - -permissions: - contents: read - -on: - push: - branches: - - 'main' - paths: - - 'llvm/docs/**' - - 'clang/docs/**' - - 'clang/include/clang/Basic/AttrDocs.td' - - 'clang/include/clang/Driver/ClangOptionDocs.td' - - 'clang/include/clang/Basic/DiagnosticDocs.td' - - 'clang-tools-extra/docs/**' - - 'lldb/docs/**' - - 'libunwind/docs/**' - - 'libcxx/docs/**' - - 'libc/docs/**' - - 'lld/docs/**' - - 'openmp/docs/**' - - 'polly/docs/**' - - 'flang/docs/**' - - 'flang/include/flang/Optimizer/Dialect/FIROps.td' - - '.github/workflows/docs.yml' - pull_request: - paths: - - 'llvm/docs/**' - - 'clang/docs/**' - - 'clang/include/clang/Basic/AttrDocs.td' - - 'clang/include/clang/Driver/ClangOptionDocs.td' - - 'clang/include/clang/Basic/DiagnosticDocs.td' - - 'clang-tools-extra/docs/**' - - 'lldb/docs/**' - - 'libunwind/docs/**' - - 'libcxx/docs/**' - - 'libc/docs/**' - - 'lld/docs/**' - - 'openmp/docs/**' - - 'polly/docs/**' - - 'flang/docs/**' - - 'flang/include/flang/Optimizer/Dialect/FIROps.td' - - '.github/workflows/docs.yml' - -jobs: - check-docs-build: - name: "Test documentation build" - runs-on: ubuntu-latest - if: github.repository == 'llvm/llvm-project' - steps: - # Don't fetch before checking for file changes to force the file changes - # action to use the Github API in pull requests. If it's a push to a - # branch we can't use the Github API to get the diff, so we need to have - # a local checkout beforehand. - - name: Fetch LLVM sources (Push) - if: ${{ github.event_name == 'push' }} - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Get subprojects that have doc changes - id: docs-changed-subprojects - uses: tj-actions/changed-files@v45 - with: - files_yaml: | - llvm: - - 'llvm/docs/**' - clang: - - 'clang/docs/**' - - 'clang/include/clang/Basic/AttrDocs.td' - - 'clang/include/clang/Driver/ClangOptionDocs.td' - - 'clang/include/clang/Basic/DiagnosticDocs.td' - clang-tools-extra: - - 'clang-tools-extra/docs/**' - lldb: - - 'lldb/docs/**' - libunwind: - - 'libunwind/docs/**' - libcxx: - - 'libcxx/docs/**' - libc: - - 'libc/docs/**' - lld: - - 'lld/docs/**' - openmp: - - 'openmp/docs/**' - polly: - - 'polly/docs/**' - flang: - - 'flang/docs/**' - - 'flang/include/flang/Optimizer/Dialect/FIROps.td' - - name: Fetch LLVM sources (PR) - if: ${{ github.event_name == 'pull_request' }} - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - name: Setup Python env - uses: actions/setup-python@v5 - with: - python-version: '3.11' - cache: 'pip' - cache-dependency-path: 'llvm/docs/requirements.txt' - - name: Install python dependencies - run: pip install -r llvm/docs/requirements.txt - - name: Install system dependencies - run: | - sudo apt-get update - # swig and graphviz are lldb specific dependencies - sudo apt-get install -y cmake ninja-build swig graphviz libhwloc-dev - - name: Build LLVM docs - if: steps.docs-changed-subprojects.outputs.llvm_any_changed == 'true' - run: | - cmake -B llvm-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C llvm-build docs-llvm-html docs-llvm-man - - name: Build Clang docs - if: steps.docs-changed-subprojects.outputs.clang_any_changed == 'true' - run: | - cmake -B clang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C clang-build docs-clang-html docs-clang-man - - name: Build clang-tools-extra docs - if: steps.docs-changed-subprojects.outputs.clang-tools-extra_any_changed == 'true' - run: | - cmake -B clang-tools-extra-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C clang-tools-extra-build docs-clang-tools-html docs-clang-tools-man - - name: Build LLDB docs - if: steps.docs-changed-subprojects.outputs.lldb_any_changed == 'true' - run: | - cmake -B lldb-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C lldb-build docs-lldb-html docs-lldb-man - - name: Build libunwind docs - if: steps.docs-changed-subprojects.outputs.libunwind_any_changed == 'true' - run: | - cmake -B libunwind-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes - TZ=UTC ninja -C libunwind-build docs-libunwind-html - - name: Build libcxx docs - if: steps.docs-changed-subprojects.outputs.libcxx_any_changed == 'true' - run: | - cmake -B libcxx-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx;libunwind" -DLLVM_ENABLE_SPHINX=ON ./runtimes - TZ=UTC ninja -C libcxx-build docs-libcxx-html - - name: Build libc docs - if: steps.docs-changed-subprojects.outputs.libc_any_changed == 'true' - run: | - cmake -B libc-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_RUNTIMES="libc" -DLLVM_ENABLE_SPHINX=ON ./runtimes - TZ=UTC ninja -C libc-build docs-libc-html - - name: Build LLD docs - if: steps.docs-changed-subprojects.outputs.lld_any_changed == 'true' - run: | - cmake -B lld-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="lld" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C lld-build docs-lld-html - - name: Build OpenMP docs - if: steps.docs-changed-subprojects.outputs.openmp_any_changed == 'true' - run: | - cmake -B openmp-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;openmp" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C openmp-build docs-openmp-html - - name: Build Polly docs - if: steps.docs-changed-subprojects.outputs.polly_any_changed == 'true' - run: | - cmake -B polly-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="polly" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C polly-build docs-polly-html docs-polly-man - - name: Build Flang docs - if: steps.docs-changed-subprojects.outputs.flang_any_changed == 'true' - run: | - cmake -B flang-build -GNinja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;mlir;flang" -DLLVM_ENABLE_SPHINX=ON ./llvm - TZ=UTC ninja -C flang-build docs-flang-html diff --git a/.github/workflows/issue-write.yml b/.github/workflows/issue-write.yml index ef0d7e986fda..0ed7667cde9a 100644 --- a/.github/workflows/issue-write.yml +++ b/.github/workflows/issue-write.yml @@ -155,3 +155,4 @@ jobs: always() && steps.download-artifact.outputs.artifact-id != '' run: cat comments + diff --git a/.github/workflows/libclang-abi-tests.yml b/.github/workflows/libclang-abi-tests.yml index 8b04d8a086db..265133ca84a2 100644 --- a/.github/workflows/libclang-abi-tests.yml +++ b/.github/workflows/libclang-abi-tests.yml @@ -166,3 +166,4 @@ jobs: with: name: compat-report-${{ github.sha }} path: compat_reports/ + diff --git a/.github/workflows/libclang-python-tests.yml b/.github/workflows/libclang-python-tests.yml index 801a70172478..72ee5fad8a78 100644 --- a/.github/workflows/libclang-python-tests.yml +++ b/.github/workflows/libclang-python-tests.yml @@ -39,3 +39,4 @@ jobs: # See https://github.com/llvm/llvm-project/issues/76601#issuecomment-1873049082. os_list: '["ubuntu-latest"]' python_version: ${{ matrix.python-version }} + diff --git a/.github/workflows/libcxx-build-and-test.yaml b/.github/workflows/libcxx-build-and-test.yaml index b5e60781e000..80e81b6f5b04 100644 --- a/.github/workflows/libcxx-build-and-test.yaml +++ b/.github/workflows/libcxx-build-and-test.yaml @@ -276,3 +276,4 @@ jobs: - name: Build and test run: | bash libcxx/utils/ci/run-buildbot ${{ matrix.config }} + diff --git a/.github/workflows/llvm-project-tests.yml b/.github/workflows/llvm-project-tests.yml index 95a3890c0d2d..ad80233bd223 100644 --- a/.github/workflows/llvm-project-tests.yml +++ b/.github/workflows/llvm-project-tests.yml @@ -146,3 +146,4 @@ jobs: # The libclc tests don't have a generated check target so all we can # do is build it. ninja -C "$LLVM_BUILDDIR" + diff --git a/.github/workflows/llvm-tests.yml b/.github/workflows/llvm-tests.yml index d1a7fddb9d2b..fdf3ce38f7dc 100644 --- a/.github/workflows/llvm-tests.yml +++ b/.github/workflows/llvm-tests.yml @@ -190,3 +190,4 @@ jobs: with: name: compat-report-${{ github.sha }} path: compat_reports/ + diff --git a/.github/workflows/pr-code-format.yml b/.github/workflows/pr-code-format.yml index 67c80441dd3a..29261cb6f783 100644 --- a/.github/workflows/pr-code-format.yml +++ b/.github/workflows/pr-code-format.yml @@ -102,3 +102,4 @@ jobs: name: workflow-args path: | comments + diff --git a/.github/workflows/pr-request-release-note.yml b/.github/workflows/pr-request-release-note.yml index 2fa501dda16b..6275763ec27d 100644 --- a/.github/workflows/pr-request-release-note.yml +++ b/.github/workflows/pr-request-release-note.yml @@ -47,3 +47,4 @@ jobs: name: workflow-args path: | comments + diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml index 2341d5743e62..021adb054e57 100644 --- a/.github/workflows/release-binaries.yml +++ b/.github/workflows/release-binaries.yml @@ -490,3 +490,4 @@ jobs: shell: bash run: | ninja -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-check-all + diff --git a/.github/workflows/release-doxygen.yml b/.github/workflows/release-doxygen.yml index e6efe56f0c0c..d249ec21997d 100644 --- a/.github/workflows/release-doxygen.yml +++ b/.github/workflows/release-doxygen.yml @@ -71,3 +71,4 @@ jobs: USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} run: | ./llvm/utils/release/github-upload-release.py --token "$GITHUB_TOKEN" --release "${{ inputs.release-version }}" --user "${{ github.actor }}" --user-token "$USER_TOKEN" upload --files ./*doxygen*.tar.xz + diff --git a/.github/workflows/release-lit.yml b/.github/workflows/release-lit.yml index 9d6f3140e688..b0baca15dd1a 100644 --- a/.github/workflows/release-lit.yml +++ b/.github/workflows/release-lit.yml @@ -77,3 +77,4 @@ jobs: with: password: ${{ secrets.LLVM_LIT_PYPI_API_TOKEN }} packages-dir: llvm/utils/lit/dist/ + diff --git a/.github/workflows/release-sources.yml b/.github/workflows/release-sources.yml index f62d73e5e895..8f2179e30b1f 100644 --- a/.github/workflows/release-sources.yml +++ b/.github/workflows/release-sources.yml @@ -106,3 +106,4 @@ jobs: attestation.jsonl + diff --git a/.github/workflows/release-tasks.yml b/.github/workflows/release-tasks.yml index 780dd0ff6325..7c11eb7a8136 100644 --- a/.github/workflows/release-tasks.yml +++ b/.github/workflows/release-tasks.yml @@ -121,3 +121,4 @@ jobs: # Called workflows don't have access to secrets by default, so we need to explicitly pass secrets that we use. secrets: RELEASE_TASKS_USER_TOKEN: ${{ secrets.RELEASE_TASKS_USER_TOKEN }} + diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index b6bd85f3d556..5bbfa52af1fc 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -60,3 +60,4 @@ jobs: uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 with: sarif_file: results.sarif + diff --git a/.github/workflows/sycl-aws.yml b/.github/workflows/sycl-aws.yml index 869b734df541..b59caaba5004 100644 --- a/.github/workflows/sycl-aws.yml +++ b/.github/workflows/sycl-aws.yml @@ -32,3 +32,4 @@ jobs: GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} + diff --git a/.github/workflows/sycl-containers.yaml b/.github/workflows/sycl-containers.yaml index 7abeee17df01..39be91fdcc9e 100644 --- a/.github/workflows/sycl-containers.yaml +++ b/.github/workflows/sycl-containers.yaml @@ -75,3 +75,4 @@ jobs: ghcr.io/${{ github.repository }}/${{ matrix.file }}:${{ matrix.tag }} build-args: ${{ matrix.build_args }} + diff --git a/.github/workflows/sycl-detect-changes.yml b/.github/workflows/sycl-detect-changes.yml index 396cd424ff4a..fe6c45f54d48 100644 --- a/.github/workflows/sycl-detect-changes.yml +++ b/.github/workflows/sycl-detect-changes.yml @@ -88,3 +88,4 @@ jobs: - run: echo '${{ steps.result.outputs.result }}' + diff --git a/.github/workflows/sycl-docs.yml b/.github/workflows/sycl-docs.yml index 5c1e8e425111..765678c3e466 100644 --- a/.github/workflows/sycl-docs.yml +++ b/.github/workflows/sycl-docs.yml @@ -58,3 +58,4 @@ jobs: - name: Deploy to GitHub Pages if: ${{ github.event_name == 'push' }} uses: actions/deploy-pages@v4 + diff --git a/.github/workflows/sycl-linux-build.yml b/.github/workflows/sycl-linux-build.yml index 0b6eebda045a..a6460e90e6a0 100644 --- a/.github/workflows/sycl-linux-build.yml +++ b/.github/workflows/sycl-linux-build.yml @@ -248,3 +248,4 @@ jobs: name: sycl_linux_${{ inputs.build_artifact_suffix }} path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} retention-days: ${{ inputs.retention-days }} + diff --git a/.github/workflows/sycl-linux-matrix-e2e-on-nightly.yml b/.github/workflows/sycl-linux-matrix-e2e-on-nightly.yml index e021db2e950d..08eb5a90bb31 100644 --- a/.github/workflows/sycl-linux-matrix-e2e-on-nightly.yml +++ b/.github/workflows/sycl-linux-matrix-e2e-on-nightly.yml @@ -93,3 +93,4 @@ jobs: with: mode: stop runs-on-list: '[{"runs-on":"aws-cuda_${{ github.run_id }}-${{ github.run_attempt }}","aws-ami":"ami-01cb0573cb039ab24","aws-type":["g5.2xlarge","g5.4xlarge"],"aws-disk":"/dev/sda1:64","aws-spot":"false"}]' + diff --git a/.github/workflows/sycl-linux-precommit-aws.yml b/.github/workflows/sycl-linux-precommit-aws.yml index 07d309900d76..f9269124162e 100644 --- a/.github/workflows/sycl-linux-precommit-aws.yml +++ b/.github/workflows/sycl-linux-precommit-aws.yml @@ -121,3 +121,4 @@ jobs: GH_PERSONAL_ACCESS_TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} + diff --git a/.github/workflows/sycl-linux-precommit.yml b/.github/workflows/sycl-linux-precommit.yml index a73324e33fec..979305edb786 100644 --- a/.github/workflows/sycl-linux-precommit.yml +++ b/.github/workflows/sycl-linux-precommit.yml @@ -186,3 +186,4 @@ jobs: sycl_toolchain_artifact: sycl_linux_default sycl_toolchain_archive: ${{ needs.build.outputs.artifact_archive_name }} sycl_toolchain_decompress_command: ${{ needs.build.outputs.artifact_decompress_command }} + diff --git a/.github/workflows/sycl-linux-run-tests.yml b/.github/workflows/sycl-linux-run-tests.yml index eb018efe0d62..e4c54307cf48 100644 --- a/.github/workflows/sycl-linux-run-tests.yml +++ b/.github/workflows/sycl-linux-run-tests.yml @@ -384,3 +384,4 @@ jobs: grep 'exit code: [^0]' -r logs >> $GITHUB_STEP_SUMMARY exit $ret + diff --git a/.github/workflows/sycl-macos-build-and-test.yml b/.github/workflows/sycl-macos-build-and-test.yml index 20615ab78a42..7fe8473a28a3 100644 --- a/.github/workflows/sycl-macos-build-and-test.yml +++ b/.github/workflows/sycl-macos-build-and-test.yml @@ -56,3 +56,4 @@ jobs: --cmake-opt="-DSYCL_PI_TESTS=OFF" - name: Compile run: cmake --build $GITHUB_WORKSPACE/build --target deploy-sycl-toolchain + diff --git a/.github/workflows/sycl-nightly.yml b/.github/workflows/sycl-nightly.yml index 4becda0c89f8..d9972bacb8e2 100644 --- a/.github/workflows/sycl-nightly.yml +++ b/.github/workflows/sycl-nightly.yml @@ -260,3 +260,4 @@ jobs: tags: | ghcr.io/${{ github.repository }}/sycl_ubuntu2204_nightly:build-${{ github.sha }} ghcr.io/${{ github.repository }}/sycl_ubuntu2204_nightly:build + diff --git a/.github/workflows/sycl-post-commit.yml b/.github/workflows/sycl-post-commit.yml index 1abd497a9c97..c1a311d840c9 100644 --- a/.github/workflows/sycl-post-commit.yml +++ b/.github/workflows/sycl-post-commit.yml @@ -126,3 +126,4 @@ jobs: name: macOS if: github.repository == 'intel/llvm' uses: ./.github/workflows/sycl-macos-build-and-test.yml + diff --git a/.github/workflows/sycl-windows-run-tests.yml b/.github/workflows/sycl-windows-run-tests.yml index 65c2df129077..e69de29bb2d1 100644 --- a/.github/workflows/sycl-windows-run-tests.yml +++ b/.github/workflows/sycl-windows-run-tests.yml @@ -1,105 +0,0 @@ -name: SYCL E2E - -on: - workflow_call: - inputs: - name: - type: string - required: True - runner: - type: string - required: True - - extra_lit_opts: - description: | - Extra options to be added to LIT_OPTS. - type: string - default: '' - ref: - type: string - required: False - - sycl_toolchain_artifact: - type: string - default: 'sycl_windows_default' - required: False - sycl_toolchain_archive: - type: string - default: '' - required: False - - env: - type: string - default: '{}' - required: False - -permissions: read-all - -jobs: - run: - name: ${{ inputs.name }} - runs-on: ${{ fromJSON(inputs.runner) }} - environment: WindowsCILock - env: ${{ fromJSON(inputs.env) }} - steps: - - uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 - with: - arch: amd64 - - name: Set env - run: | - git config --system core.longpaths true - git config --global core.autocrlf false - echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - # TODO: use cached_checkout - - uses: actions/checkout@v4 - with: - persist-credentials: false - ref: ${{ inputs.ref || github.sha }} - path: llvm - - name: Register cleanup after job is finished - uses: ./llvm/devops/actions/cleanup - - name: Download compiler toolchain - uses: actions/download-artifact@v4 - with: - name: ${{ inputs.sycl_toolchain_artifact }} - - name: Extract SYCL toolchain - shell: bash - run: | - mkdir install - tar -xf ${{ inputs.sycl_toolchain_archive }} -C install - rm ${{ inputs.sycl_toolchain_archive }} - - name: Setup SYCL toolchain - run: | - echo "PATH=$env:GITHUB_WORKSPACE\\install\\bin;$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - - run: | - sycl-ls - - run: | - sycl-ls --verbose - - name: Configure E2E with Level Zero target - shell: cmd - run: | - mkdir build-e2e - cmake -GNinja -B build-e2e -S.\llvm\sycl\test-e2e -DSYCL_TEST_E2E_TARGETS="level_zero:gpu" -DCMAKE_CXX_COMPILER="clang++" -DLEVEL_ZERO_LIBS_DIR="D:\github\level-zero_win-sdk\lib" -DLEVEL_ZERO_INCLUDE="D:\github\level-zero_win-sdk\include" -DLLVM_LIT="..\llvm\llvm\utils\lit\lit.py" - - name: Run End-to-End tests - shell: bash - run: | - # Run E2E tests. - export LIT_OPTS="-v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests ${{ inputs.extra_lit_opts }}" - cmake --build build-e2e --target check-sycl-e2e - - name: Detect hung tests - shell: powershell - run: | - $exitCode = 0 - $hungTests = Get-Process | Where-Object { ($_.Path -match "llvm\\install") -or ($_.Path -match "llvm\\build-e2e") } - $hungTests | Foreach-Object { - $exitCode = 1 - echo "Test $($_.Path) hung!" - Stop-Process -Force $_ - } - exit $exitCode - - name: Cleanup - shell: cmd - if: always() - run: | - rmdir /q /s install - rmdir /q /s build-e2e diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml index 894e07d323ca..dc8b90303a9c 100644 --- a/.github/workflows/version-check.yml +++ b/.github/workflows/version-check.yml @@ -29,3 +29,4 @@ jobs: run: | version=$(grep -o 'LLVM_VERSION_\(MAJOR\|MINOR\|PATCH\) [0-9]\+' cmake/Modules/LLVMVersion.cmake | cut -d ' ' -f 2 | tr "\n" "." | sed 's/.$//g') .github/workflows/version-check.py "$version" + diff --git a/README.md b/README.md index b89ed66627cd..95ca8f8c186c 100644 --- a/README.md +++ b/README.md @@ -43,12 +43,7 @@ SYCLomatic supports migrating programs implemented with CUDA versions 8.0, 9.x, * Windows: `Visual Studio` 2019 or 2022 (In the following description, assume that the version used is 2019) - [Download](https://visualstudio.microsoft.com/downloads/) -<<<<<<< HEAD Note: SYCLomatic can be built from source without any CUDA dependencies. However, before migration of CUDA codebases to SYCL, ensure that CUDA header files are accessible to the tool. These header files are necessary for SYCLomatic to properly understand and process CUDA code during the migration process. -======= -Project documentation is available at: -[DPC++ Documentation](https://intel.github.io/llvm/). ->>>>>>> origin/sycl ### Create SYCLomatic workspace diff --git a/clang/include/clang/Basic/DiagnosticSerializationKinds.td b/clang/include/clang/Basic/DiagnosticSerializationKinds.td index c26bc6590603..fe60a2cacfb0 100644 --- a/clang/include/clang/Basic/DiagnosticSerializationKinds.td +++ b/clang/include/clang/Basic/DiagnosticSerializationKinds.td @@ -50,19 +50,6 @@ def warn_pch_vfsoverlay_mismatch : Warning< def note_pch_vfsoverlay_files : Note<"%select{PCH|current translation unit}0 has the following VFS overlays:\n%1">; def note_pch_vfsoverlay_empty : Note<"%select{PCH|current translation unit}0 has no VFS overlays">; -<<<<<<< HEAD -def err_pch_version_too_old : Error< - "PCH file uses an older PCH format that is no longer supported">; -def err_pch_version_too_new : Error< - "PCH file uses a newer PCH format that cannot be read">; - -// SYCLomatic_CUSTOMIZATION begin -def err_pch_different_branch : Error< - "PCH file is built by (%0), expected (%1)">; -def err_pch_with_compiler_errors : Error< - "PCH file contains syntax errors">; -// SYCLomatic_CUSTOMIZATION end -======= def err_ast_file_version_too_old : Error< "%select{PCH|module|AST}0 file '%1' uses an older PCH format that is no longer supported">; def err_ast_file_version_too_new : Error< @@ -71,7 +58,13 @@ def err_ast_file_different_branch : Error< "%select{PCH|module|AST}0 file '%1' built from a different branch (%2) than the compiler (%3)">; def err_ast_file_with_compiler_errors : Error< "%select{PCH|module|AST}0 file '%1' contains compiler errors">; ->>>>>>> origin/sycl + +// SYCLomatic_CUSTOMIZATION begin +def err_pch_different_branch : Error< + "PCH file is built by (%0), expected (%1)">; +def err_pch_with_compiler_errors : Error< + "PCH file contains syntax errors">; +// SYCLomatic_CUSTOMIZATION end def err_module_file_conflict : Error< "module '%0' is defined in both '%1' and '%2'">, DefaultFatal; diff --git a/clang/lib/AST/TypePrinter.cpp b/clang/lib/AST/TypePrinter.cpp index 61d0950330b4..a775cdfdb02d 100644 --- a/clang/lib/AST/TypePrinter.cpp +++ b/clang/lib/AST/TypePrinter.cpp @@ -1698,8 +1698,8 @@ void TypePrinter::printTemplateId(const TemplateSpecializationType *T, raw_ostream &OS, bool FullyQualify) { IncludeStrongLifetimeRAII Strong(Policy); -<<<<<<< HEAD - TemplateDecl *TD = T->getTemplateName().getAsTemplateDecl(); + TemplateDecl *TD = + T->getTemplateName().getAsTemplateDecl(/*IgnoreDeduced=*/true); #ifdef SYCLomatic_CUSTOMIZATION StringRef Name; if (getReplacedNamePtr) @@ -1708,10 +1708,6 @@ void TypePrinter::printTemplateId(const TemplateSpecializationType *T, OS << Name; else #endif // SYCLomatic_CUSTOMIZATION -======= - TemplateDecl *TD = - T->getTemplateName().getAsTemplateDecl(/*IgnoreDeduced=*/true); ->>>>>>> origin/sycl // FIXME: Null TD never exercised in test suite. if (FullyQualify && TD) { if (!Policy.SuppressScope) diff --git a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp index 6b0970029f78..fd86c2eaf0dd 100644 --- a/clang/lib/ASTMatchers/ASTMatchersInternal.cpp +++ b/clang/lib/ASTMatchers/ASTMatchersInternal.cpp @@ -541,46 +541,40 @@ class PatternSet { /// that didn't match. /// Return true if there are still any patterns left. bool consumeNameSuffix(StringRef NodeName, bool CanSkip) { -<<<<<<< HEAD #ifdef SYCLomatic_CUSTOMIZATION - bool IsEmpty=true; + bool IsEmpty = true; #endif // SYCLomatic_CUSTOMIZATION - for (size_t I = 0; I < Patterns.size();) { + if (CanSkip) { + // If we can skip the node, then we need to handle the case where a + // skipped node has the same name as its parent. + // namespace a { inline namespace a { class A; } } + // cxxRecordDecl(hasName("::a::A")) + // To do this, any patterns that match should be duplicated in our set, + // one of them with the tail removed. + for (size_t I = 0, E = Patterns.size(); I != E; ++I) { #ifdef SYCLomatic_CUSTOMIZATION if (!Patterns[I].IsValid) { I++; continue; } #endif // SYCLomatic_CUSTOMIZATION - if (::clang::ast_matchers::internal::consumeNameSuffix(Patterns[I].P, - NodeName) || - CanSkip) { - ++I; + + StringRef Pattern = Patterns[I].P; #ifdef SYCLomatic_CUSTOMIZATION +if (ast_matchers::internal::consumeNameSuffix(Patterns[I].P, + NodeName)) { IsEmpty = false; +#else + if (ast_matchers::internal::consumeNameSuffix(Patterns[I].P, NodeName)) #endif // SYCLomatic_CUSTOMIZATION - } else { +Patterns.push_back({Pattern, Patterns[I].IsFullyQualified}); #ifdef SYCLomatic_CUSTOMIZATION + } else { Patterns[I].IsValid = false; - I++; -#else - Patterns.erase(Patterns.begin() + I); -#endif // SYCLomatic_CUSTOMIZATION -======= - if (CanSkip) { - // If we can skip the node, then we need to handle the case where a - // skipped node has the same name as its parent. - // namespace a { inline namespace a { class A; } } - // cxxRecordDecl(hasName("::a::A")) - // To do this, any patterns that match should be duplicated in our set, - // one of them with the tail removed. - for (size_t I = 0, E = Patterns.size(); I != E; ++I) { - StringRef Pattern = Patterns[I].P; - if (ast_matchers::internal::consumeNameSuffix(Patterns[I].P, NodeName)) - Patterns.push_back({Pattern, Patterns[I].IsFullyQualified}); ->>>>>>> origin/sycl + } +#endif } - } else { + else { llvm::erase_if(Patterns, [&NodeName](auto &Pattern) { return !::clang::ast_matchers::internal::consumeNameSuffix(Pattern.P, NodeName); diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index 51bba589435d..5e6af5732de6 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -181,11 +181,7 @@ std::string Driver::GetResourcesPath(StringRef BinaryPath) { // exact same string ("a/../b/" and "b/" get different hashes, for example). // Dir is bin/ or lib/, depending on where BinaryPath is. -<<<<<<< HEAD - std::string Dir = std::string(llvm::sys::path::parent_path(BinaryPath)); -======= StringRef Dir = llvm::sys::path::parent_path(BinaryPath); ->>>>>>> origin/sycl SmallString<128> P(Dir); StringRef ConfiguredResourceDir(CLANG_RESOURCE_DIR); diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index fd738d5645bd..2d2f177772d3 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -1027,13 +1027,9 @@ static void PrintPreprocessedTokens(Preprocessor &PP, Token &Tok, *Callbacks->OS << static_cast(*Iter); PrintComma = true; } -<<<<<<< HEAD - IsStartOfLine = true; #ifdef SYCLomatic_CUSTOMIZATION continue; #endif -======= ->>>>>>> origin/sycl } else if (Tok.isAnnotation()) { // Ignore annotation tokens created by pragmas - the pragmas themselves // will be reproduced in the preprocessed output. diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp index cfcf79c5d2e0..c0d3d34a80a2 100644 --- a/clang/lib/Lex/PPDirectives.cpp +++ b/clang/lib/Lex/PPDirectives.cpp @@ -1136,18 +1136,14 @@ Preprocessor::LookupEmbedFile(StringRef Filename, bool isAngled, bool OpenFile, SeparateComponents(LookupPath, Entry, Filename, false); llvm::Expected ShouldBeEntry = FM.getFileRef(LookupPath, OpenFile); -<<<<<<< HEAD #ifdef SYCLomatic_CUSTOMIZATION - if(auto Result = llvm::expectedToOptional(std::move(ShouldBeEntry))) + if (auto Result = llvm::expectedToOptional(std::move(ShouldBeEntry))) return Result; #else - return llvm::expectedToOptional(std::move(ShouldBeEntry)); -#endif //SYCLomatic_CUSTOMIZATION -======= - if (ShouldBeEntry) + if (ShouldBeEntry) return llvm::expectedToOptional(std::move(ShouldBeEntry)); llvm::consumeError(ShouldBeEntry.takeError()); ->>>>>>> origin/sycl +#endif // SYCLomatic_CUSTOMIZATION } return std::nullopt; } diff --git a/clang/lib/Sema/SemaAvailability.cpp b/clang/lib/Sema/SemaAvailability.cpp index 251835f5a8a3..f3c462f17cb7 100644 --- a/clang/lib/Sema/SemaAvailability.cpp +++ b/clang/lib/Sema/SemaAvailability.cpp @@ -868,13 +868,7 @@ void DiagnoseUnguardedAvailability::DiagnoseDeclAvailability( const AvailabilityAttr *AA = getAttrForPlatform(SemaRef.getASTContext(), OffendingDecl); -<<<<<<< HEAD -#ifdef SYCLomatic_CUSTOMIZATION assert(AA != nullptr && "expecting valid availability attribute"); -#endif -======= - assert(AA != nullptr && "expecting valid availability attribute"); ->>>>>>> origin/sycl bool EnvironmentMatchesOrNone = hasMatchingEnvironmentOrNone(SemaRef.getASTContext(), AA); VersionTuple Introduced = AA->getIntroduced(); diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index c6f56931a617..e4a91d030fdc 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -12317,15 +12317,7 @@ Decl *Sema::ActOnUsingEnumDeclaration(Scope *S, AccessSpecifier AS, SourceLocation EnumLoc, SourceRange TyLoc, const IdentifierInfo &II, ParsedType Ty, CXXScopeSpec *SS) { -<<<<<<< HEAD -#ifdef SYCLomatic_CUSTOMIZATION assert(SS && !SS->isInvalid() && "ScopeSpec is invalid"); -#else - assert(!SS->isInvalid() && "ScopeSpec is invalid"); -#endif -======= - assert(SS && !SS->isInvalid() && "ScopeSpec is invalid"); ->>>>>>> origin/sycl TypeSourceInfo *TSI = nullptr; SourceLocation IdentLoc = TyLoc.getBegin(); QualType EnumTy = GetTypeFromParser(Ty, &TSI); diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index 06ca03add645..2f914ddc22a3 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -3207,23 +3207,10 @@ ExprResult SemaObjC::BuildInstanceMessage( } if (!isDesignatedInitChain) { const ObjCMethodDecl *InitMethod = nullptr; -<<<<<<< HEAD -#ifdef SYCLomatic_CUSTOMIZATION auto *CurMD = SemaRef.getCurMethodDecl(); assert(CurMD && "Current method declaration should not be null"); bool isDesignated = CurMD->isDesignatedInitializerForTheInterface(&InitMethod); -#else - bool isDesignated = - SemaRef.getCurMethodDecl()->isDesignatedInitializerForTheInterface( - &InitMethod); -#endif -======= - auto *CurMD = SemaRef.getCurMethodDecl(); - assert(CurMD && "Current method declaration should not be null"); - bool isDesignated = - CurMD->isDesignatedInitializerForTheInterface(&InitMethod); ->>>>>>> origin/sycl assert(isDesignated && InitMethod); (void)isDesignated; Diag(SelLoc, SuperLoc.isValid() ? diff --git a/clang/lib/Sema/SemaPPC.cpp b/clang/lib/Sema/SemaPPC.cpp index 564a1be02d29..833526a89f34 100644 --- a/clang/lib/Sema/SemaPPC.cpp +++ b/clang/lib/Sema/SemaPPC.cpp @@ -251,14 +251,10 @@ bool SemaPPC::CheckPPCBuiltinFunctionCall(const TargetInfo &TI, return BuiltinPPCMMACall(TheCall, BuiltinID, Types); #include "clang/Basic/BuiltinsPPC.def" } -<<<<<<< HEAD #ifdef SYCLomatic_CUSTOMIZATION #else - return SemaRef.BuiltinConstantArgRange(TheCall, i, l, u); + llvm_unreachable("must return from switch"); #endif -======= - llvm_unreachable("must return from switch"); ->>>>>>> origin/sycl } // Check if the given type is a non-pointer PPC MMA type. This function is used diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 98e327833cfc..1cdca4a34834 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2191,1206 +2191,6 @@ DeclResult Sema::CheckClassTemplate( return NewTemplate; } -<<<<<<< HEAD -namespace { -/// Tree transform to "extract" a transformed type from a class template's -/// constructor to a deduction guide. -class ExtractTypeForDeductionGuide - : public TreeTransform { - llvm::SmallVectorImpl &MaterializedTypedefs; - -public: - typedef TreeTransform Base; - ExtractTypeForDeductionGuide( - Sema &SemaRef, - llvm::SmallVectorImpl &MaterializedTypedefs) - : Base(SemaRef), MaterializedTypedefs(MaterializedTypedefs) {} - - TypeSourceInfo *transform(TypeSourceInfo *TSI) { return TransformType(TSI); } - - QualType TransformTypedefType(TypeLocBuilder &TLB, TypedefTypeLoc TL) { - ASTContext &Context = SemaRef.getASTContext(); - TypedefNameDecl *OrigDecl = TL.getTypedefNameDecl(); - TypedefNameDecl *Decl = OrigDecl; - // Transform the underlying type of the typedef and clone the Decl only if - // the typedef has a dependent context. - if (OrigDecl->getDeclContext()->isDependentContext()) { - TypeLocBuilder InnerTLB; - QualType Transformed = - TransformType(InnerTLB, OrigDecl->getTypeSourceInfo()->getTypeLoc()); - TypeSourceInfo *TSI = InnerTLB.getTypeSourceInfo(Context, Transformed); - if (isa(OrigDecl)) - Decl = TypeAliasDecl::Create( - Context, Context.getTranslationUnitDecl(), OrigDecl->getBeginLoc(), - OrigDecl->getLocation(), OrigDecl->getIdentifier(), TSI); - else { - assert(isa(OrigDecl) && "Not a Type alias or typedef"); - Decl = TypedefDecl::Create( - Context, Context.getTranslationUnitDecl(), OrigDecl->getBeginLoc(), - OrigDecl->getLocation(), OrigDecl->getIdentifier(), TSI); - } - MaterializedTypedefs.push_back(Decl); - } - - QualType TDTy = Context.getTypedefType(Decl); - TypedefTypeLoc TypedefTL = TLB.push(TDTy); - TypedefTL.setNameLoc(TL.getNameLoc()); - - return TDTy; - } -}; - -// Build a deduction guide with the specified parameter types. -FunctionTemplateDecl *buildDeductionGuide( - Sema &SemaRef, TemplateDecl *OriginalTemplate, - TemplateParameterList *TemplateParams, CXXConstructorDecl *Ctor, - ExplicitSpecifier ES, TypeSourceInfo *TInfo, SourceLocation LocStart, - SourceLocation Loc, SourceLocation LocEnd, bool IsImplicit, - llvm::ArrayRef MaterializedTypedefs = {}) { - DeclContext *DC = OriginalTemplate->getDeclContext(); - auto DeductionGuideName = - SemaRef.Context.DeclarationNames.getCXXDeductionGuideName( - OriginalTemplate); - - DeclarationNameInfo Name(DeductionGuideName, Loc); - ArrayRef Params = - TInfo->getTypeLoc().castAs().getParams(); - - // Build the implicit deduction guide template. - auto *Guide = - CXXDeductionGuideDecl::Create(SemaRef.Context, DC, LocStart, ES, Name, - TInfo->getType(), TInfo, LocEnd, Ctor); - Guide->setImplicit(IsImplicit); - Guide->setParams(Params); - - for (auto *Param : Params) - Param->setDeclContext(Guide); - for (auto *TD : MaterializedTypedefs) - TD->setDeclContext(Guide); - - auto *GuideTemplate = FunctionTemplateDecl::Create( - SemaRef.Context, DC, Loc, DeductionGuideName, TemplateParams, Guide); - GuideTemplate->setImplicit(IsImplicit); - Guide->setDescribedFunctionTemplate(GuideTemplate); - - if (isa(DC)) { - Guide->setAccess(AS_public); - GuideTemplate->setAccess(AS_public); - } - - DC->addDecl(GuideTemplate); - return GuideTemplate; -} - -// Transform a given template type parameter `TTP`. -TemplateTypeParmDecl * -transformTemplateTypeParam(Sema &SemaRef, DeclContext *DC, - TemplateTypeParmDecl *TTP, - MultiLevelTemplateArgumentList &Args, - unsigned NewDepth, unsigned NewIndex) { - // TemplateTypeParmDecl's index cannot be changed after creation, so - // substitute it directly. - auto *NewTTP = TemplateTypeParmDecl::Create( - SemaRef.Context, DC, TTP->getBeginLoc(), TTP->getLocation(), NewDepth, - NewIndex, TTP->getIdentifier(), TTP->wasDeclaredWithTypename(), - TTP->isParameterPack(), TTP->hasTypeConstraint(), - TTP->isExpandedParameterPack() - ? std::optional(TTP->getNumExpansionParameters()) - : std::nullopt); - if (const auto *TC = TTP->getTypeConstraint()) - SemaRef.SubstTypeConstraint(NewTTP, TC, Args, - /*EvaluateConstraint=*/true); - if (TTP->hasDefaultArgument()) { - TemplateArgumentLoc InstantiatedDefaultArg; - if (!SemaRef.SubstTemplateArgument( - TTP->getDefaultArgument(), Args, InstantiatedDefaultArg, - TTP->getDefaultArgumentLoc(), TTP->getDeclName())) - NewTTP->setDefaultArgument(SemaRef.Context, InstantiatedDefaultArg); - } - SemaRef.CurrentInstantiationScope->InstantiatedLocal(TTP, NewTTP); - return NewTTP; -} -// Similar to above, but for non-type template or template template parameters. -template -NonTypeTemplateOrTemplateTemplateParmDecl * -transformTemplateParam(Sema &SemaRef, DeclContext *DC, - NonTypeTemplateOrTemplateTemplateParmDecl *OldParam, - MultiLevelTemplateArgumentList &Args, unsigned NewIndex, - unsigned NewDepth) { - // Ask the template instantiator to do the heavy lifting for us, then adjust - // the index of the parameter once it's done. - auto *NewParam = cast( - SemaRef.SubstDecl(OldParam, DC, Args)); - NewParam->setPosition(NewIndex); - NewParam->setDepth(NewDepth); - return NewParam; -} - -/// Transform to convert portions of a constructor declaration into the -/// corresponding deduction guide, per C++1z [over.match.class.deduct]p1. -struct ConvertConstructorToDeductionGuideTransform { - ConvertConstructorToDeductionGuideTransform(Sema &S, - ClassTemplateDecl *Template) - : SemaRef(S), Template(Template) { - // If the template is nested, then we need to use the original - // pattern to iterate over the constructors. - ClassTemplateDecl *Pattern = Template; - while (Pattern->getInstantiatedFromMemberTemplate()) { - if (Pattern->isMemberSpecialization()) - break; - Pattern = Pattern->getInstantiatedFromMemberTemplate(); - NestedPattern = Pattern; - } - - if (NestedPattern) - OuterInstantiationArgs = SemaRef.getTemplateInstantiationArgs(Template); - } - - Sema &SemaRef; - ClassTemplateDecl *Template; - ClassTemplateDecl *NestedPattern = nullptr; - - DeclContext *DC = Template->getDeclContext(); - CXXRecordDecl *Primary = Template->getTemplatedDecl(); - DeclarationName DeductionGuideName = - SemaRef.Context.DeclarationNames.getCXXDeductionGuideName(Template); - - QualType DeducedType = SemaRef.Context.getTypeDeclType(Primary); - - // Index adjustment to apply to convert depth-1 template parameters into - // depth-0 template parameters. - unsigned Depth1IndexAdjustment = Template->getTemplateParameters()->size(); - - // Instantiation arguments for the outermost depth-1 templates - // when the template is nested - MultiLevelTemplateArgumentList OuterInstantiationArgs; - - /// Transform a constructor declaration into a deduction guide. - NamedDecl *transformConstructor(FunctionTemplateDecl *FTD, - CXXConstructorDecl *CD) { - SmallVector SubstArgs; - - LocalInstantiationScope Scope(SemaRef); - - // C++ [over.match.class.deduct]p1: - // -- For each constructor of the class template designated by the - // template-name, a function template with the following properties: - - // -- The template parameters are the template parameters of the class - // template followed by the template parameters (including default - // template arguments) of the constructor, if any. - TemplateParameterList *TemplateParams = GetTemplateParameterList(Template); - if (FTD) { - TemplateParameterList *InnerParams = FTD->getTemplateParameters(); - SmallVector AllParams; - SmallVector Depth1Args; - AllParams.reserve(TemplateParams->size() + InnerParams->size()); - AllParams.insert(AllParams.begin(), - TemplateParams->begin(), TemplateParams->end()); - SubstArgs.reserve(InnerParams->size()); - Depth1Args.reserve(InnerParams->size()); - - // Later template parameters could refer to earlier ones, so build up - // a list of substituted template arguments as we go. - for (NamedDecl *Param : *InnerParams) { - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(Depth1Args); - Args.addOuterRetainedLevel(); - if (NestedPattern) - Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); - NamedDecl *NewParam = transformTemplateParameter(Param, Args); - if (!NewParam) - return nullptr; - // Constraints require that we substitute depth-1 arguments - // to match depths when substituted for evaluation later - Depth1Args.push_back(SemaRef.Context.getCanonicalTemplateArgument( - SemaRef.Context.getInjectedTemplateArg(NewParam))); - - if (NestedPattern) { - TemplateDeclInstantiator Instantiator(SemaRef, DC, - OuterInstantiationArgs); - Instantiator.setEvaluateConstraints(false); - SemaRef.runWithSufficientStackSpace(NewParam->getLocation(), [&] { - NewParam = cast(Instantiator.Visit(NewParam)); - }); - } - - assert(NewParam->getTemplateDepth() == 0 && - "Unexpected template parameter depth"); - - AllParams.push_back(NewParam); - SubstArgs.push_back(SemaRef.Context.getCanonicalTemplateArgument( - SemaRef.Context.getInjectedTemplateArg(NewParam))); - } - - // Substitute new template parameters into requires-clause if present. - Expr *RequiresClause = nullptr; - if (Expr *InnerRC = InnerParams->getRequiresClause()) { - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(Depth1Args); - Args.addOuterRetainedLevel(); - if (NestedPattern) - Args.addOuterRetainedLevels(NestedPattern->getTemplateDepth()); - ExprResult E = SemaRef.SubstExpr(InnerRC, Args); - if (E.isInvalid()) - return nullptr; - RequiresClause = E.getAs(); - } - - TemplateParams = TemplateParameterList::Create( - SemaRef.Context, InnerParams->getTemplateLoc(), - InnerParams->getLAngleLoc(), AllParams, InnerParams->getRAngleLoc(), - RequiresClause); - } - - // If we built a new template-parameter-list, track that we need to - // substitute references to the old parameters into references to the - // new ones. - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - if (FTD) { - Args.addOuterTemplateArguments(SubstArgs); - Args.addOuterRetainedLevel(); - } - - FunctionProtoTypeLoc FPTL = CD->getTypeSourceInfo()->getTypeLoc() - .getAsAdjusted(); - assert(FPTL && "no prototype for constructor declaration"); - - // Transform the type of the function, adjusting the return type and - // replacing references to the old parameters with references to the - // new ones. - TypeLocBuilder TLB; - SmallVector Params; - SmallVector MaterializedTypedefs; - QualType NewType = transformFunctionProtoType(TLB, FPTL, Params, Args, - MaterializedTypedefs); - if (NewType.isNull()) - return nullptr; - TypeSourceInfo *NewTInfo = TLB.getTypeSourceInfo(SemaRef.Context, NewType); - - return buildDeductionGuide( - SemaRef, Template, TemplateParams, CD, CD->getExplicitSpecifier(), - NewTInfo, CD->getBeginLoc(), CD->getLocation(), CD->getEndLoc(), - /*IsImplicit=*/true, MaterializedTypedefs); - } - - /// Build a deduction guide with the specified parameter types. - NamedDecl *buildSimpleDeductionGuide(MutableArrayRef ParamTypes) { - SourceLocation Loc = Template->getLocation(); - - // Build the requested type. - FunctionProtoType::ExtProtoInfo EPI; - EPI.HasTrailingReturn = true; - QualType Result = SemaRef.BuildFunctionType(DeducedType, ParamTypes, Loc, - DeductionGuideName, EPI); - TypeSourceInfo *TSI = SemaRef.Context.getTrivialTypeSourceInfo(Result, Loc); - if (NestedPattern) - TSI = SemaRef.SubstType(TSI, OuterInstantiationArgs, Loc, - DeductionGuideName); -#ifdef SYCLomatic_CUSTOMIZATION - if (!TSI) - return nullptr; -#endif - FunctionProtoTypeLoc FPTL = - TSI->getTypeLoc().castAs(); - - // Build the parameters, needed during deduction / substitution. - SmallVector Params; - for (auto T : ParamTypes) { - auto *TSI = SemaRef.Context.getTrivialTypeSourceInfo(T, Loc); - if (NestedPattern) - TSI = SemaRef.SubstType(TSI, OuterInstantiationArgs, Loc, - DeclarationName()); -#ifdef SYCLomatic_CUSTOMIZATION - if (!TSI) - return nullptr; -#endif - ParmVarDecl *NewParam = - ParmVarDecl::Create(SemaRef.Context, DC, Loc, Loc, nullptr, - TSI->getType(), TSI, SC_None, nullptr); - NewParam->setScopeInfo(0, Params.size()); - FPTL.setParam(Params.size(), NewParam); - Params.push_back(NewParam); - } - - return buildDeductionGuide( - SemaRef, Template, GetTemplateParameterList(Template), nullptr, - ExplicitSpecifier(), TSI, Loc, Loc, Loc, /*IsImplicit=*/true); - } - -private: - /// Transform a constructor template parameter into a deduction guide template - /// parameter, rebuilding any internal references to earlier parameters and - /// renumbering as we go. - NamedDecl *transformTemplateParameter(NamedDecl *TemplateParam, - MultiLevelTemplateArgumentList &Args) { - if (auto *TTP = dyn_cast(TemplateParam)) - return transformTemplateTypeParam( - SemaRef, DC, TTP, Args, TTP->getDepth() - 1, - Depth1IndexAdjustment + TTP->getIndex()); - if (auto *TTP = dyn_cast(TemplateParam)) - return transformTemplateParam(SemaRef, DC, TTP, Args, - Depth1IndexAdjustment + TTP->getIndex(), - TTP->getDepth() - 1); - auto *NTTP = cast(TemplateParam); - return transformTemplateParam(SemaRef, DC, NTTP, Args, - Depth1IndexAdjustment + NTTP->getIndex(), - NTTP->getDepth() - 1); - } - - QualType transformFunctionProtoType( - TypeLocBuilder &TLB, FunctionProtoTypeLoc TL, - SmallVectorImpl &Params, - MultiLevelTemplateArgumentList &Args, - SmallVectorImpl &MaterializedTypedefs) { - SmallVector ParamTypes; - const FunctionProtoType *T = TL.getTypePtr(); - - // -- The types of the function parameters are those of the constructor. - for (auto *OldParam : TL.getParams()) { - ParmVarDecl *NewParam = OldParam; - // Given - // template struct C { - // template struct D { - // template D(U, V); - // }; - // }; - // First, transform all the references to template parameters that are - // defined outside of the surrounding class template. That is T in the - // above example. - if (NestedPattern) { - NewParam = transformFunctionTypeParam(NewParam, OuterInstantiationArgs, - MaterializedTypedefs); - if (!NewParam) - return QualType(); - } - // Then, transform all the references to template parameters that are - // defined at the class template and the constructor. In this example, - // they're U and V, respectively. - NewParam = - transformFunctionTypeParam(NewParam, Args, MaterializedTypedefs); - if (!NewParam) - return QualType(); - ParamTypes.push_back(NewParam->getType()); - Params.push_back(NewParam); - } - - // -- The return type is the class template specialization designated by - // the template-name and template arguments corresponding to the - // template parameters obtained from the class template. - // - // We use the injected-class-name type of the primary template instead. - // This has the convenient property that it is different from any type that - // the user can write in a deduction-guide (because they cannot enter the - // context of the template), so implicit deduction guides can never collide - // with explicit ones. - QualType ReturnType = DeducedType; - TLB.pushTypeSpec(ReturnType).setNameLoc(Primary->getLocation()); - - // Resolving a wording defect, we also inherit the variadicness of the - // constructor. - FunctionProtoType::ExtProtoInfo EPI; - EPI.Variadic = T->isVariadic(); - EPI.HasTrailingReturn = true; - - QualType Result = SemaRef.BuildFunctionType( - ReturnType, ParamTypes, TL.getBeginLoc(), DeductionGuideName, EPI); - if (Result.isNull()) - return QualType(); - - FunctionProtoTypeLoc NewTL = TLB.push(Result); - NewTL.setLocalRangeBegin(TL.getLocalRangeBegin()); - NewTL.setLParenLoc(TL.getLParenLoc()); - NewTL.setRParenLoc(TL.getRParenLoc()); - NewTL.setExceptionSpecRange(SourceRange()); - NewTL.setLocalRangeEnd(TL.getLocalRangeEnd()); - for (unsigned I = 0, E = NewTL.getNumParams(); I != E; ++I) - NewTL.setParam(I, Params[I]); - - return Result; - } - - ParmVarDecl *transformFunctionTypeParam( - ParmVarDecl *OldParam, MultiLevelTemplateArgumentList &Args, - llvm::SmallVectorImpl &MaterializedTypedefs) { - TypeSourceInfo *OldDI = OldParam->getTypeSourceInfo(); - TypeSourceInfo *NewDI; - if (auto PackTL = OldDI->getTypeLoc().getAs()) { - // Expand out the one and only element in each inner pack. - Sema::ArgumentPackSubstitutionIndexRAII SubstIndex(SemaRef, 0); - NewDI = - SemaRef.SubstType(PackTL.getPatternLoc(), Args, - OldParam->getLocation(), OldParam->getDeclName()); - if (!NewDI) return nullptr; - NewDI = - SemaRef.CheckPackExpansion(NewDI, PackTL.getEllipsisLoc(), - PackTL.getTypePtr()->getNumExpansions()); - } else - NewDI = SemaRef.SubstType(OldDI, Args, OldParam->getLocation(), - OldParam->getDeclName()); - if (!NewDI) - return nullptr; - - // Extract the type. This (for instance) replaces references to typedef - // members of the current instantiations with the definitions of those - // typedefs, avoiding triggering instantiation of the deduced type during - // deduction. - NewDI = ExtractTypeForDeductionGuide(SemaRef, MaterializedTypedefs) - .transform(NewDI); - - // Resolving a wording defect, we also inherit default arguments from the - // constructor. - ExprResult NewDefArg; - if (OldParam->hasDefaultArg()) { - // We don't care what the value is (we won't use it); just create a - // placeholder to indicate there is a default argument. - QualType ParamTy = NewDI->getType(); - NewDefArg = new (SemaRef.Context) - OpaqueValueExpr(OldParam->getDefaultArgRange().getBegin(), - ParamTy.getNonLValueExprType(SemaRef.Context), - ParamTy->isLValueReferenceType() ? VK_LValue - : ParamTy->isRValueReferenceType() ? VK_XValue - : VK_PRValue); - } - // Handle arrays and functions decay. - auto NewType = NewDI->getType(); - if (NewType->isArrayType() || NewType->isFunctionType()) - NewType = SemaRef.Context.getDecayedType(NewType); - - ParmVarDecl *NewParam = ParmVarDecl::Create( - SemaRef.Context, DC, OldParam->getInnerLocStart(), - OldParam->getLocation(), OldParam->getIdentifier(), NewType, NewDI, - OldParam->getStorageClass(), NewDefArg.get()); - NewParam->setScopeInfo(OldParam->getFunctionScopeDepth(), - OldParam->getFunctionScopeIndex()); - SemaRef.CurrentInstantiationScope->InstantiatedLocal(OldParam, NewParam); - return NewParam; - } -}; - -// Find all template parameters that appear in the given DeducedArgs. -// Return the indices of the template parameters in the TemplateParams. -SmallVector TemplateParamsReferencedInTemplateArgumentList( - ArrayRef TemplateParams, - ArrayRef DeducedArgs) { - struct TemplateParamsReferencedFinder - : public RecursiveASTVisitor { - llvm::DenseSet TemplateParams; - llvm::DenseSet ReferencedTemplateParams; - - TemplateParamsReferencedFinder(ArrayRef TemplateParams) - : TemplateParams(TemplateParams.begin(), TemplateParams.end()) {} - - bool VisitTemplateTypeParmType(TemplateTypeParmType *TTP) { - MarkAppeared(TTP->getDecl()); - return true; - } - bool VisitDeclRefExpr(DeclRefExpr *DRE) { - MarkAppeared(DRE->getFoundDecl()); - return true; - } - - bool TraverseTemplateName(TemplateName Template) { - if (auto *TD = Template.getAsTemplateDecl()) - MarkAppeared(TD); - return RecursiveASTVisitor::TraverseTemplateName(Template); - } - - void MarkAppeared(NamedDecl *ND) { - if (TemplateParams.contains(ND)) - ReferencedTemplateParams.insert(ND); - } - }; - TemplateParamsReferencedFinder Finder(TemplateParams); - Finder.TraverseTemplateArguments(DeducedArgs); - - SmallVector Results; - for (unsigned Index = 0; Index < TemplateParams.size(); ++Index) { - if (Finder.ReferencedTemplateParams.contains(TemplateParams[Index])) - Results.push_back(Index); - } - return Results; -} - -bool hasDeclaredDeductionGuides(DeclarationName Name, DeclContext *DC) { - // Check whether we've already declared deduction guides for this template. - // FIXME: Consider storing a flag on the template to indicate this. - assert(Name.getNameKind() == - DeclarationName::NameKind::CXXDeductionGuideName && - "name must be a deduction guide name"); - auto Existing = DC->lookup(Name); - for (auto *D : Existing) - if (D->isImplicit()) - return true; - return false; -} - -unsigned getTemplateParameterDepth(NamedDecl *TemplateParam) { - if (auto *TTP = dyn_cast(TemplateParam)) - return TTP->getDepth(); - if (auto *TTP = dyn_cast(TemplateParam)) - return TTP->getDepth(); - if (auto *NTTP = dyn_cast(TemplateParam)) - return NTTP->getDepth(); - llvm_unreachable("Unhandled template parameter types"); -} - -NamedDecl *transformTemplateParameter(Sema &SemaRef, DeclContext *DC, - NamedDecl *TemplateParam, - MultiLevelTemplateArgumentList &Args, - unsigned NewIndex, unsigned NewDepth) { - if (auto *TTP = dyn_cast(TemplateParam)) - return transformTemplateTypeParam(SemaRef, DC, TTP, Args, NewDepth, - NewIndex); - if (auto *TTP = dyn_cast(TemplateParam)) - return transformTemplateParam(SemaRef, DC, TTP, Args, NewIndex, NewDepth); - if (auto *NTTP = dyn_cast(TemplateParam)) - return transformTemplateParam(SemaRef, DC, NTTP, Args, NewIndex, NewDepth); - llvm_unreachable("Unhandled template parameter types"); -} - -// Build the associated constraints for the alias deduction guides. -// C++ [over.match.class.deduct]p3.3: -// The associated constraints ([temp.constr.decl]) are the conjunction of the -// associated constraints of g and a constraint that is satisfied if and only -// if the arguments of A are deducible (see below) from the return type. -// -// The return result is expected to be the require-clause for the synthesized -// alias deduction guide. -Expr * -buildAssociatedConstraints(Sema &SemaRef, FunctionTemplateDecl *F, - TypeAliasTemplateDecl *AliasTemplate, - ArrayRef DeduceResults, - Expr *IsDeducible) { - Expr *RC = F->getTemplateParameters()->getRequiresClause(); - if (!RC) - return IsDeducible; - - ASTContext &Context = SemaRef.Context; - LocalInstantiationScope Scope(SemaRef); - - // In the clang AST, constraint nodes are deliberately not instantiated unless - // they are actively being evaluated. Consequently, occurrences of template - // parameters in the require-clause expression have a subtle "depth" - // difference compared to normal occurrences in places, such as function - // parameters. When transforming the require-clause, we must take this - // distinction into account: - // - // 1) In the transformed require-clause, occurrences of template parameters - // must use the "uninstantiated" depth; - // 2) When substituting on the require-clause expr of the underlying - // deduction guide, we must use the entire set of template argument lists; - // - // It's important to note that we're performing this transformation on an - // *instantiated* AliasTemplate. - - // For 1), if the alias template is nested within a class template, we - // calcualte the 'uninstantiated' depth by adding the substitution level back. - unsigned AdjustDepth = 0; - if (auto *PrimaryTemplate = - AliasTemplate->getInstantiatedFromMemberTemplate()) - AdjustDepth = PrimaryTemplate->getTemplateDepth(); - - // We rebuild all template parameters with the uninstantiated depth, and - // build template arguments refer to them. - SmallVector AdjustedAliasTemplateArgs; - - for (auto *TP : *AliasTemplate->getTemplateParameters()) { - // Rebuild any internal references to earlier parameters and reindex - // as we go. - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(AdjustedAliasTemplateArgs); - NamedDecl *NewParam = transformTemplateParameter( - SemaRef, AliasTemplate->getDeclContext(), TP, Args, - /*NewIndex=*/AdjustedAliasTemplateArgs.size(), - getTemplateParameterDepth(TP) + AdjustDepth); - - auto NewTemplateArgument = Context.getCanonicalTemplateArgument( - Context.getInjectedTemplateArg(NewParam)); - AdjustedAliasTemplateArgs.push_back(NewTemplateArgument); - } - // Template arguments used to transform the template arguments in - // DeducedResults. - SmallVector TemplateArgsForBuildingRC( - F->getTemplateParameters()->size()); - // Transform the transformed template args - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(AdjustedAliasTemplateArgs); - - for (unsigned Index = 0; Index < DeduceResults.size(); ++Index) { - const auto &D = DeduceResults[Index]; - if (D.isNull()) - continue; - TemplateArgumentLoc Input = - SemaRef.getTrivialTemplateArgumentLoc(D, QualType(), SourceLocation{}); - TemplateArgumentLoc Output; - if (!SemaRef.SubstTemplateArgument(Input, Args, Output)) { - assert(TemplateArgsForBuildingRC[Index].isNull() && - "InstantiatedArgs must be null before setting"); - TemplateArgsForBuildingRC[Index] = Output.getArgument(); - } - } - - // A list of template arguments for transforming the require-clause of F. - // It must contain the entire set of template argument lists. - MultiLevelTemplateArgumentList ArgsForBuildingRC; - ArgsForBuildingRC.setKind(clang::TemplateSubstitutionKind::Rewrite); - ArgsForBuildingRC.addOuterTemplateArguments(TemplateArgsForBuildingRC); - // For 2), if the underlying F is instantiated from a member template, we need - // the entire template argument list, as the constraint AST in the - // require-clause of F remains completely uninstantiated. - // - // For example: - // template // depth 0 - // struct Outer { - // template - // struct Foo { Foo(U); }; - // - // template // depth 1 - // requires C - // Foo(U) -> Foo; - // }; - // template - // using AFoo = Outer::Foo; - // - // In this scenario, the deduction guide for `Foo` inside `Outer`: - // - The occurrence of U in the require-expression is [depth:1, index:0] - // - The occurrence of U in the function parameter is [depth:0, index:0] - // - The template parameter of U is [depth:0, index:0] - // - // We add the outer template arguments which is [int] to the multi-level arg - // list to ensure that the occurrence U in `C` will be replaced with int - // during the substitution. - if (F->getInstantiatedFromMemberTemplate()) { - auto OuterLevelArgs = SemaRef.getTemplateInstantiationArgs( - F, F->getLexicalDeclContext(), - /*Final=*/false, /*Innermost=*/std::nullopt, - /*RelativeToPrimary=*/true, - /*Pattern=*/nullptr, - /*ForConstraintInstantiation=*/true); - for (auto It : OuterLevelArgs) - ArgsForBuildingRC.addOuterTemplateArguments(It.Args); - } - - ExprResult E = SemaRef.SubstExpr(RC, ArgsForBuildingRC); - if (E.isInvalid()) - return nullptr; - - auto Conjunction = - SemaRef.BuildBinOp(SemaRef.getCurScope(), SourceLocation{}, - BinaryOperatorKind::BO_LAnd, E.get(), IsDeducible); - if (Conjunction.isInvalid()) - return nullptr; - return Conjunction.getAs(); -} -// Build the is_deducible constraint for the alias deduction guides. -// [over.match.class.deduct]p3.3: -// ... and a constraint that is satisfied if and only if the arguments -// of A are deducible (see below) from the return type. -Expr *buildIsDeducibleConstraint(Sema &SemaRef, - TypeAliasTemplateDecl *AliasTemplate, - QualType ReturnType, - SmallVector TemplateParams) { - ASTContext &Context = SemaRef.Context; - // Constraint AST nodes must use uninstantiated depth. - if (auto *PrimaryTemplate = - AliasTemplate->getInstantiatedFromMemberTemplate()) { - LocalInstantiationScope Scope(SemaRef); - - // Adjust the depth for TemplateParams. - unsigned AdjustDepth = PrimaryTemplate->getTemplateDepth(); - SmallVector TransformedTemplateArgs; - for (auto *TP : TemplateParams) { - // Rebuild any internal references to earlier parameters and reindex - // as we go. - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(TransformedTemplateArgs); - NamedDecl *NewParam = transformTemplateParameter( - SemaRef, AliasTemplate->getDeclContext(), TP, Args, - /*NewIndex=*/TransformedTemplateArgs.size(), - getTemplateParameterDepth(TP) + AdjustDepth); - - auto NewTemplateArgument = Context.getCanonicalTemplateArgument( - Context.getInjectedTemplateArg(NewParam)); - TransformedTemplateArgs.push_back(NewTemplateArgument); - } - // Transformed the ReturnType to restore the uninstantiated depth. - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(TransformedTemplateArgs); - ReturnType = SemaRef.SubstType( - ReturnType, Args, AliasTemplate->getLocation(), - Context.DeclarationNames.getCXXDeductionGuideName(AliasTemplate)); - }; - - SmallVector IsDeducibleTypeTraitArgs = { - Context.getTrivialTypeSourceInfo( - Context.getDeducedTemplateSpecializationType( - TemplateName(AliasTemplate), /*DeducedType=*/QualType(), - /*IsDependent=*/true)), // template specialization type whose - // arguments will be deduced. - Context.getTrivialTypeSourceInfo( - ReturnType), // type from which template arguments are deduced. - }; - return TypeTraitExpr::Create( - Context, Context.getLogicalOperationType(), AliasTemplate->getLocation(), - TypeTrait::BTT_IsDeducible, IsDeducibleTypeTraitArgs, - AliasTemplate->getLocation(), /*Value*/ false); -} - -std::pair> -getRHSTemplateDeclAndArgs(Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate) { - // Unwrap the sugared ElaboratedType. - auto RhsType = AliasTemplate->getTemplatedDecl() - ->getUnderlyingType() - .getSingleStepDesugaredType(SemaRef.Context); - TemplateDecl *Template = nullptr; - llvm::ArrayRef AliasRhsTemplateArgs; - if (const auto *TST = RhsType->getAs()) { - // Cases where the RHS of the alias is dependent. e.g. - // template - // using AliasFoo1 = Foo; // a class/type alias template specialization - Template = TST->getTemplateName().getAsTemplateDecl(); - AliasRhsTemplateArgs = TST->template_arguments(); - } else if (const auto *RT = RhsType->getAs()) { - // Cases where template arguments in the RHS of the alias are not - // dependent. e.g. - // using AliasFoo = Foo; - if (const auto *CTSD = llvm::dyn_cast( - RT->getAsCXXRecordDecl())) { - Template = CTSD->getSpecializedTemplate(); - AliasRhsTemplateArgs = CTSD->getTemplateArgs().asArray(); - } - } else { - assert(false && "unhandled RHS type of the alias"); - } - return {Template, AliasRhsTemplateArgs}; -} - -// Build deduction guides for a type alias template from the given underlying -// deduction guide F. -FunctionTemplateDecl * -BuildDeductionGuideForTypeAlias(Sema &SemaRef, - TypeAliasTemplateDecl *AliasTemplate, - FunctionTemplateDecl *F, SourceLocation Loc) { - LocalInstantiationScope Scope(SemaRef); - Sema::InstantiatingTemplate BuildingDeductionGuides( - SemaRef, AliasTemplate->getLocation(), F, - Sema::InstantiatingTemplate::BuildingDeductionGuidesTag{}); - if (BuildingDeductionGuides.isInvalid()) - return nullptr; - - auto &Context = SemaRef.Context; - auto [Template, AliasRhsTemplateArgs] = - getRHSTemplateDeclAndArgs(SemaRef, AliasTemplate); - - auto RType = F->getTemplatedDecl()->getReturnType(); - // The (trailing) return type of the deduction guide. - const TemplateSpecializationType *FReturnType = - RType->getAs(); - if (const auto *InjectedCNT = RType->getAs()) - // implicitly-generated deduction guide. - FReturnType = InjectedCNT->getInjectedTST(); - else if (const auto *ET = RType->getAs()) - // explicit deduction guide. - FReturnType = ET->getNamedType()->getAs(); - assert(FReturnType && "expected to see a return type"); - // Deduce template arguments of the deduction guide f from the RHS of - // the alias. - // - // C++ [over.match.class.deduct]p3: ...For each function or function - // template f in the guides of the template named by the - // simple-template-id of the defining-type-id, the template arguments - // of the return type of f are deduced from the defining-type-id of A - // according to the process in [temp.deduct.type] with the exception - // that deduction does not fail if not all template arguments are - // deduced. - // - // - // template - // f(X, Y) -> f; - // - // template - // using alias = f; - // - // The RHS of alias is f, we deduced the template arguments of - // the return type of the deduction guide from it: Y->int, X->U - sema::TemplateDeductionInfo TDeduceInfo(Loc); - // Must initialize n elements, this is required by DeduceTemplateArguments. - SmallVector DeduceResults( - F->getTemplateParameters()->size()); - - // FIXME: DeduceTemplateArguments stops immediately at the first - // non-deducible template argument. However, this doesn't seem to casue - // issues for practice cases, we probably need to extend it to continue - // performing deduction for rest of arguments to align with the C++ - // standard. - SemaRef.DeduceTemplateArguments( - F->getTemplateParameters(), FReturnType->template_arguments(), - AliasRhsTemplateArgs, TDeduceInfo, DeduceResults, - /*NumberOfArgumentsMustMatch=*/false); - - SmallVector DeducedArgs; - SmallVector NonDeducedTemplateParamsInFIndex; - // !!NOTE: DeduceResults respects the sequence of template parameters of - // the deduction guide f. - for (unsigned Index = 0; Index < DeduceResults.size(); ++Index) { - if (const auto &D = DeduceResults[Index]; !D.isNull()) // Deduced - DeducedArgs.push_back(D); - else - NonDeducedTemplateParamsInFIndex.push_back(Index); - } - auto DeducedAliasTemplateParams = - TemplateParamsReferencedInTemplateArgumentList( - AliasTemplate->getTemplateParameters()->asArray(), DeducedArgs); - // All template arguments null by default. - SmallVector TemplateArgsForBuildingFPrime( - F->getTemplateParameters()->size()); - - // Create a template parameter list for the synthesized deduction guide f'. - // - // C++ [over.match.class.deduct]p3.2: - // If f is a function template, f' is a function template whose template - // parameter list consists of all the template parameters of A - // (including their default template arguments) that appear in the above - // deductions or (recursively) in their default template arguments - SmallVector FPrimeTemplateParams; - // Store template arguments that refer to the newly-created template - // parameters, used for building `TemplateArgsForBuildingFPrime`. - SmallVector TransformedDeducedAliasArgs( - AliasTemplate->getTemplateParameters()->size()); - - for (unsigned AliasTemplateParamIdx : DeducedAliasTemplateParams) { - auto *TP = - AliasTemplate->getTemplateParameters()->getParam(AliasTemplateParamIdx); - // Rebuild any internal references to earlier parameters and reindex as - // we go. - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(TransformedDeducedAliasArgs); - NamedDecl *NewParam = transformTemplateParameter( - SemaRef, AliasTemplate->getDeclContext(), TP, Args, - /*NewIndex=*/FPrimeTemplateParams.size(), - getTemplateParameterDepth(TP)); - FPrimeTemplateParams.push_back(NewParam); - - auto NewTemplateArgument = Context.getCanonicalTemplateArgument( - Context.getInjectedTemplateArg(NewParam)); - TransformedDeducedAliasArgs[AliasTemplateParamIdx] = NewTemplateArgument; - } - // ...followed by the template parameters of f that were not deduced - // (including their default template arguments) - for (unsigned FTemplateParamIdx : NonDeducedTemplateParamsInFIndex) { - auto *TP = F->getTemplateParameters()->getParam(FTemplateParamIdx); - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - // We take a shortcut here, it is ok to reuse the - // TemplateArgsForBuildingFPrime. - Args.addOuterTemplateArguments(TemplateArgsForBuildingFPrime); - NamedDecl *NewParam = transformTemplateParameter( - SemaRef, F->getDeclContext(), TP, Args, FPrimeTemplateParams.size(), - getTemplateParameterDepth(TP)); - FPrimeTemplateParams.push_back(NewParam); - - assert(TemplateArgsForBuildingFPrime[FTemplateParamIdx].isNull() && - "The argument must be null before setting"); - TemplateArgsForBuildingFPrime[FTemplateParamIdx] = - Context.getCanonicalTemplateArgument( - Context.getInjectedTemplateArg(NewParam)); - } - - // To form a deduction guide f' from f, we leverage clang's instantiation - // mechanism, we construct a template argument list where the template - // arguments refer to the newly-created template parameters of f', and - // then apply instantiation on this template argument list to instantiate - // f, this ensures all template parameter occurrences are updated - // correctly. - // - // The template argument list is formed from the `DeducedArgs`, two parts: - // 1) appeared template parameters of alias: transfrom the deduced - // template argument; - // 2) non-deduced template parameters of f: rebuild a - // template argument; - // - // 2) has been built already (when rebuilding the new template - // parameters), we now perform 1). - MultiLevelTemplateArgumentList Args; - Args.setKind(TemplateSubstitutionKind::Rewrite); - Args.addOuterTemplateArguments(TransformedDeducedAliasArgs); - for (unsigned Index = 0; Index < DeduceResults.size(); ++Index) { - const auto &D = DeduceResults[Index]; - if (D.isNull()) { - // 2): Non-deduced template parameter has been built already. - assert(!TemplateArgsForBuildingFPrime[Index].isNull() && - "template arguments for non-deduced template parameters should " - "be been set!"); - continue; - } - TemplateArgumentLoc Input = - SemaRef.getTrivialTemplateArgumentLoc(D, QualType(), SourceLocation{}); - TemplateArgumentLoc Output; - if (!SemaRef.SubstTemplateArgument(Input, Args, Output)) { - assert(TemplateArgsForBuildingFPrime[Index].isNull() && - "InstantiatedArgs must be null before setting"); - TemplateArgsForBuildingFPrime[Index] = Output.getArgument(); - } - } - - auto *TemplateArgListForBuildingFPrime = - TemplateArgumentList::CreateCopy(Context, TemplateArgsForBuildingFPrime); - // Form the f' by substituting the template arguments into f. - if (auto *FPrime = SemaRef.InstantiateFunctionDeclaration( - F, TemplateArgListForBuildingFPrime, AliasTemplate->getLocation(), - Sema::CodeSynthesisContext::BuildingDeductionGuides)) { - auto *GG = cast(FPrime); - - Expr *IsDeducible = buildIsDeducibleConstraint( - SemaRef, AliasTemplate, FPrime->getReturnType(), FPrimeTemplateParams); - Expr *RequiresClause = buildAssociatedConstraints( - SemaRef, F, AliasTemplate, DeduceResults, IsDeducible); - - auto *FPrimeTemplateParamList = TemplateParameterList::Create( - Context, AliasTemplate->getTemplateParameters()->getTemplateLoc(), - AliasTemplate->getTemplateParameters()->getLAngleLoc(), - FPrimeTemplateParams, - AliasTemplate->getTemplateParameters()->getRAngleLoc(), - /*RequiresClause=*/RequiresClause); - FunctionTemplateDecl *Result = buildDeductionGuide( - SemaRef, AliasTemplate, FPrimeTemplateParamList, - GG->getCorrespondingConstructor(), GG->getExplicitSpecifier(), - GG->getTypeSourceInfo(), AliasTemplate->getBeginLoc(), - AliasTemplate->getLocation(), AliasTemplate->getEndLoc(), - F->isImplicit()); - cast(Result->getTemplatedDecl()) - ->setDeductionCandidateKind(GG->getDeductionCandidateKind()); - return Result; - } - return nullptr; -} - -void DeclareImplicitDeductionGuidesForTypeAlias( - Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate, SourceLocation Loc) { - if (AliasTemplate->isInvalidDecl()) - return; - auto &Context = SemaRef.Context; - // FIXME: if there is an explicit deduction guide after the first use of the - // type alias usage, we will not cover this explicit deduction guide. fix this - // case. - if (hasDeclaredDeductionGuides( - Context.DeclarationNames.getCXXDeductionGuideName(AliasTemplate), - AliasTemplate->getDeclContext())) - return; - auto [Template, AliasRhsTemplateArgs] = - getRHSTemplateDeclAndArgs(SemaRef, AliasTemplate); - if (!Template) - return; - DeclarationNameInfo NameInfo( - Context.DeclarationNames.getCXXDeductionGuideName(Template), Loc); - LookupResult Guides(SemaRef, NameInfo, clang::Sema::LookupOrdinaryName); - SemaRef.LookupQualifiedName(Guides, Template->getDeclContext()); - Guides.suppressDiagnostics(); - - for (auto *G : Guides) { - FunctionTemplateDecl *F = dyn_cast(G); - if (!F) - continue; - // The **aggregate** deduction guides are handled in a different code path - // (DeclareAggregateDeductionGuideFromInitList), which involves the tricky - // cache. - if (cast(F->getTemplatedDecl()) - ->getDeductionCandidateKind() == DeductionCandidate::Aggregate) - continue; - - BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, F, Loc); - } -} - -// Build an aggregate deduction guide for a type alias template. -FunctionTemplateDecl *DeclareAggregateDeductionGuideForTypeAlias( - Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate, - MutableArrayRef ParamTypes, SourceLocation Loc) { - TemplateDecl *RHSTemplate = - getRHSTemplateDeclAndArgs(SemaRef, AliasTemplate).first; - if (!RHSTemplate) - return nullptr; - auto *RHSDeductionGuide = SemaRef.DeclareAggregateDeductionGuideFromInitList( - RHSTemplate, ParamTypes, Loc); - if (!RHSDeductionGuide) - return nullptr; - return BuildDeductionGuideForTypeAlias(SemaRef, AliasTemplate, - RHSDeductionGuide, Loc); -} - -} // namespace - -FunctionTemplateDecl *Sema::DeclareAggregateDeductionGuideFromInitList( - TemplateDecl *Template, MutableArrayRef ParamTypes, - SourceLocation Loc) { - llvm::FoldingSetNodeID ID; - ID.AddPointer(Template); - for (auto &T : ParamTypes) - T.getCanonicalType().Profile(ID); - unsigned Hash = ID.ComputeHash(); - - auto Found = AggregateDeductionCandidates.find(Hash); - if (Found != AggregateDeductionCandidates.end()) { - CXXDeductionGuideDecl *GD = Found->getSecond(); - return GD->getDescribedFunctionTemplate(); - } - - if (auto *AliasTemplate = llvm::dyn_cast(Template)) { - if (auto *FTD = DeclareAggregateDeductionGuideForTypeAlias( - *this, AliasTemplate, ParamTypes, Loc)) { - auto *GD = cast(FTD->getTemplatedDecl()); - GD->setDeductionCandidateKind(DeductionCandidate::Aggregate); - AggregateDeductionCandidates[Hash] = GD; - return FTD; - } - } - - if (CXXRecordDecl *DefRecord = - cast(Template->getTemplatedDecl())->getDefinition()) { - if (TemplateDecl *DescribedTemplate = - DefRecord->getDescribedClassTemplate()) - Template = DescribedTemplate; - } - - DeclContext *DC = Template->getDeclContext(); - if (DC->isDependentContext()) - return nullptr; - - ConvertConstructorToDeductionGuideTransform Transform( - *this, cast(Template)); - if (!isCompleteType(Loc, Transform.DeducedType)) - return nullptr; - - // In case we were expanding a pack when we attempted to declare deduction - // guides, turn off pack expansion for everything we're about to do. - ArgumentPackSubstitutionIndexRAII SubstIndex(*this, - /*NewSubstitutionIndex=*/-1); - // Create a template instantiation record to track the "instantiation" of - // constructors into deduction guides. - InstantiatingTemplate BuildingDeductionGuides( - *this, Loc, Template, - Sema::InstantiatingTemplate::BuildingDeductionGuidesTag{}); - if (BuildingDeductionGuides.isInvalid()) - return nullptr; - - ClassTemplateDecl *Pattern = - Transform.NestedPattern ? Transform.NestedPattern : Transform.Template; - ContextRAII SavedContext(*this, Pattern->getTemplatedDecl()); - - auto *FTD = cast( - Transform.buildSimpleDeductionGuide(ParamTypes)); - SavedContext.pop(); - auto *GD = cast(FTD->getTemplatedDecl()); - GD->setDeductionCandidateKind(DeductionCandidate::Aggregate); - AggregateDeductionCandidates[Hash] = GD; - return FTD; -} - -void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, - SourceLocation Loc) { - if (auto *AliasTemplate = llvm::dyn_cast(Template)) { - DeclareImplicitDeductionGuidesForTypeAlias(*this, AliasTemplate, Loc); - return; - } - if (CXXRecordDecl *DefRecord = - cast(Template->getTemplatedDecl())->getDefinition()) { - if (TemplateDecl *DescribedTemplate = DefRecord->getDescribedClassTemplate()) - Template = DescribedTemplate; - } - - DeclContext *DC = Template->getDeclContext(); - if (DC->isDependentContext()) - return; - - ConvertConstructorToDeductionGuideTransform Transform( - *this, cast(Template)); - if (!isCompleteType(Loc, Transform.DeducedType)) - return; - - if (hasDeclaredDeductionGuides(Transform.DeductionGuideName, DC)) - return; - - // In case we were expanding a pack when we attempted to declare deduction - // guides, turn off pack expansion for everything we're about to do. - ArgumentPackSubstitutionIndexRAII SubstIndex(*this, -1); - // Create a template instantiation record to track the "instantiation" of - // constructors into deduction guides. - InstantiatingTemplate BuildingDeductionGuides( - *this, Loc, Template, - Sema::InstantiatingTemplate::BuildingDeductionGuidesTag{}); - if (BuildingDeductionGuides.isInvalid()) - return; - - // Convert declared constructors into deduction guide templates. - // FIXME: Skip constructors for which deduction must necessarily fail (those - // for which some class template parameter without a default argument never - // appears in a deduced context). - ClassTemplateDecl *Pattern = - Transform.NestedPattern ? Transform.NestedPattern : Transform.Template; - ContextRAII SavedContext(*this, Pattern->getTemplatedDecl()); - llvm::SmallPtrSet ProcessedCtors; - bool AddedAny = false; - for (NamedDecl *D : LookupConstructors(Pattern->getTemplatedDecl())) { - D = D->getUnderlyingDecl(); - if (D->isInvalidDecl() || D->isImplicit()) - continue; - - D = cast(D->getCanonicalDecl()); - - // Within C++20 modules, we may have multiple same constructors in - // multiple same RecordDecls. And it doesn't make sense to create - // duplicated deduction guides for the duplicated constructors. - if (ProcessedCtors.count(D)) - continue; - - auto *FTD = dyn_cast(D); - auto *CD = - dyn_cast_or_null(FTD ? FTD->getTemplatedDecl() : D); - // Class-scope explicit specializations (MS extension) do not result in - // deduction guides. - if (!CD || (!FTD && CD->isFunctionTemplateSpecialization())) - continue; - - // Cannot make a deduction guide when unparsed arguments are present. - if (llvm::any_of(CD->parameters(), [](ParmVarDecl *P) { - return !P || P->hasUnparsedDefaultArg(); - })) - continue; - - ProcessedCtors.insert(D); - Transform.transformConstructor(FTD, CD); - AddedAny = true; - } - - // C++17 [over.match.class.deduct] - // -- If C is not defined or does not declare any constructors, an - // additional function template derived as above from a hypothetical - // constructor C(). - if (!AddedAny) - Transform.buildSimpleDeductionGuide(std::nullopt); - - // -- An additional function template derived as above from a hypothetical - // constructor C(C), called the copy deduction candidate. - cast( - cast( - Transform.buildSimpleDeductionGuide(Transform.DeducedType)) - ->getTemplatedDecl()) - ->setDeductionCandidateKind(DeductionCandidate::Copy); - - SavedContext.pop(); -} - -======= ->>>>>>> origin/sycl /// Diagnose the presence of a default template argument on a /// template parameter, which is ill-formed in certain contexts. /// diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 61b3c4a780b3..41af3d3a44c7 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -3982,17 +3982,10 @@ Decl *TemplateDeclInstantiator::VisitUsingEnumDecl(UsingEnumDecl *D) { TypeSourceInfo *TSI = SemaRef.SubstType(D->getEnumType(), TemplateArgs, D->getLocation(), D->getDeclName()); -<<<<<<< HEAD -#ifdef SYCLomatic_CUSTOMIZATION - if (!TSI) - return nullptr; -#endif -======= if (!TSI) return nullptr; ->>>>>>> origin/sycl UsingEnumDecl *NewUD = UsingEnumDecl::Create(SemaRef.Context, Owner, D->getUsingLoc(), D->getEnumLoc(), D->getLocation(), TSI); diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 306ca12fe5cb..9272e23c7da3 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -4240,13 +4240,7 @@ void ASTReader::PassInterestingDeclsToConsumer() { }; std::deque MaybeInterestingDecls = std::move(PotentiallyInterestingDecls); -<<<<<<< HEAD -#ifdef SYCLomatic_CUSTOMIZATION PotentiallyInterestingDecls.clear(); -#endif -======= - PotentiallyInterestingDecls.clear(); ->>>>>>> origin/sycl assert(PotentiallyInterestingDecls.empty()); while (!MaybeInterestingDecls.empty()) { Decl *D = MaybeInterestingDecls.front(); diff --git a/clang/unittests/Tooling/ReplacementsYamlTest.cpp b/clang/unittests/Tooling/ReplacementsYamlTest.cpp index d968e87fd622..6598d6f394cb 100644 --- a/clang/unittests/Tooling/ReplacementsYamlTest.cpp +++ b/clang/unittests/Tooling/ReplacementsYamlTest.cpp @@ -68,7 +68,7 @@ TEST(ReplacementsYamlTest, serializesNewLines) { " Length: 0\n" " ReplacementText: '#include \n'\n" "...\n", - YamlContentStream.str().c_str()); + YamlContent.c_str()); #else ASSERT_STREQ("---\n" "MainSourceFile: '/path/to/source.cpp'\n" @@ -78,12 +78,8 @@ TEST(ReplacementsYamlTest, serializesNewLines) { " Length: 0\n" " ReplacementText: \"#include \\n\"\n" "...\n", -<<<<<<< HEAD - YamlContentStream.str().c_str()); -#endif // SYCLomatic_CUSTOMIZATION -======= YamlContent.c_str()); ->>>>>>> origin/sycl +#endif // SYCLomatic_CUSTOMIZATION } TEST(ReplacementsYamlTest, deserializesReplacements) { diff --git a/llvm/docs/requirements-hashed.txt b/llvm/docs/requirements-hashed.txt index 61a3e0807ba3..7755fa859fef 100644 --- a/llvm/docs/requirements-hashed.txt +++ b/llvm/docs/requirements-hashed.txt @@ -323,15 +323,9 @@ soupsieve==2.6 \ --hash=sha256:e2e68417777af359ec65daac1057404a3c8a5455bb8abc36f1a9866ab1a51abb \ --hash=sha256:e72c4ff06e4fb6e4b5a9f0f55fe6e81514581fca1515028625d0f299c602ccc9 # via beautifulsoup4 -<<<<<<< HEAD -sphinx==8.0.2 \ - --hash=sha256:0cce1ddcc4fd3532cf1dd283bc7d886758362c5c1de6598696579ce96d8ffa5b \ - --hash=sha256:56173572ae6c1b9a38911786e206a110c9749116745873feae4f9ce88e59391d -======= sphinx==8.1.3 \ --hash=sha256:09719015511837b76bf6e03e42eb7595ac8c2e41eeb9c29c5b755c6b677992a2 \ --hash=sha256:43c1911eecb0d3e161ad78611bc905d1ad0e523e4ddc202a58a821773dc4c927 ->>>>>>> origin/sycl # via # -r requirements.txt # furo diff --git a/llvm/docs/requirements.txt b/llvm/docs/requirements.txt index f2cdca0b6182..463d8129e556 100644 --- a/llvm/docs/requirements.txt +++ b/llvm/docs/requirements.txt @@ -1,8 +1,4 @@ -<<<<<<< HEAD -sphinx==8.0.2 -======= sphinx==8.1.3 ->>>>>>> origin/sycl docutils==0.21.2 sphinx-markdown-tables==0.0.17 recommonmark==0.7.1 diff --git a/llvm/include/llvm/ProfileData/InstrProfReader.h b/llvm/include/llvm/ProfileData/InstrProfReader.h index 8773c03e0ae6..0f686e0bb2f1 100644 --- a/llvm/include/llvm/ProfileData/InstrProfReader.h +++ b/llvm/include/llvm/ProfileData/InstrProfReader.h @@ -363,7 +363,6 @@ class RawInstrProfReader : public InstrProfReader { static const uint64_t MaxCounterValue = (1ULL << 56); public: -<<<<<<< HEAD #ifdef SYCLomatic_CUSTOMIZATION RawInstrProfReader(std::unique_ptr DataBuffer, const InstrProfCorrelator *Correlator, @@ -377,16 +376,7 @@ class RawInstrProfReader : public InstrProfReader { NamesStart(nullptr), NamesEnd(nullptr), ValueDataStart(nullptr), ValueKindLast(0), CurValueDataSize(0), BinaryIds({}), Warn(Warn) {} #else - RawInstrProfReader(std::unique_ptr DataBuffer, - const InstrProfCorrelator *Correlator, - std::function Warn) - : DataBuffer(std::move(DataBuffer)), - Correlator(dyn_cast_or_null>( - Correlator)), - Warn(Warn) {} -#endif // SYCLomatic_CUSTOMIZATION -======= - RawInstrProfReader( + RawInstrProfReader( std::unique_ptr DataBuffer, const InstrProfCorrelator *Correlator, const object::BuildIDFetcher *BIDFetcher, @@ -397,8 +387,8 @@ class RawInstrProfReader : public InstrProfReader { Correlator)), BIDFetcher(BIDFetcher), BIDFetcherCorrelatorKind(BIDFetcherCorrelatorKind), Warn(Warn) {} +#endif // SYCLomatic_CUSTOMIZATION ->>>>>>> origin/sycl RawInstrProfReader(const RawInstrProfReader &) = delete; RawInstrProfReader &operator=(const RawInstrProfReader &) = delete; diff --git a/llvm/utils/git/requirements.txt b/llvm/utils/git/requirements.txt index f948249e908c..11e41834c011 100644 --- a/llvm/utils/git/requirements.txt +++ b/llvm/utils/git/requirements.txt @@ -4,15 +4,9 @@ # # pip-compile --generate-hashes --output-file=requirements.txt requirements.txt.in # -<<<<<<< HEAD -certifi==2024.7.4 \ - --hash=sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b \ - --hash=sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90 -======= certifi==2024.8.30 \ --hash=sha256:922820b53db7a7257ffbda3f597266d435245903d80737e34f8a45ff3e3230d8 \ --hash=sha256:bec941d2aa8195e248a60b31ff9f0558284cf01a52591ceda73ea9afffd69fd9 ->>>>>>> origin/sycl # via # -r requirements.txt.in # requests @@ -268,13 +262,9 @@ typing-extensions==4.12.2 \ urllib3==2.2.2 \ --hash=sha256:a448b2f64d686155468037e1ace9f2d2199776e17f0a46610480d311f73e3472 \ --hash=sha256:dd505485549a7a552833da5e6063639d0d177c04f23bc3864e41e5dc5f612168 -<<<<<<< HEAD - # via requests -======= # via # pygithub # requests ->>>>>>> origin/sycl wrapt==1.16.0 \ --hash=sha256:0d2691979e93d06a95a26257adb7bfd0c93818e89b1406f5a28f36e0d8c1e1fc \ --hash=sha256:14d7dc606219cdd7405133c713f2c218d4252f2a469003f8c46bb92d5d095d81 \ diff --git a/llvm/utils/git/requirements.txt.in b/llvm/utils/git/requirements.txt.in index f8939bdb0cb3..512b80b60e1d 100644 --- a/llvm/utils/git/requirements.txt.in +++ b/llvm/utils/git/requirements.txt.in @@ -3,12 +3,7 @@ # pip install pip-tools # pip-compile -o requirements.txt requirements.txt.in -<<<<<<< HEAD -PyGithub -#GitPython==3.1.29 -======= certifi>=2023.7.22 # https://security.snyk.io/vuln/SNYK-PYTHON-CERTIFI-5805047 PyGithub==2.2.0 # >=1.59.1 For WorkflowRun.name # >= 2.2.0 for permission arg to Repository.get_collaborators GitPython>=3.1.32 # https://security.snyk.io/vuln/SNYK-PYTHON-GITPYTHON-5840584 ->>>>>>> origin/sycl diff --git a/llvm/utils/git/requirements_formatting.txt b/llvm/utils/git/requirements_formatting.txt index e0c1e90681a7..0b8ed11e95d6 100644 --- a/llvm/utils/git/requirements_formatting.txt +++ b/llvm/utils/git/requirements_formatting.txt @@ -201,9 +201,6 @@ click==8.1.7 \ --hash=sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28 \ --hash=sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de # via black -<<<<<<< HEAD -cryptography==43.0.1 -======= cryptography==43.0.1 \ --hash=sha256:014f58110f53237ace6a408b5beb6c427b64e084eb451ef25a28308270086494 \ --hash=sha256:1bbcce1a551e262dfbafb6e6252f1ae36a248e615ca44ba302df077a846a8806 \