Files
TheRock/compiler/amd-llvm/clang/test/ClangScanDeps/build-session-validation-relocated-modules.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

72 lines
3.1 KiB
C

// Check that a relocated module is rebuilt and no error occurs.
// This is required when a incremental build adds a newer version of an
// already built library into a preexisting search path.
// In this example, on the second scan, `DepThatLoadsOldPCMs` is resolved first and
// populates `MovedDep` into memory.
// Then when `InvalidatedDep` is loaded, it's input file is out of date
// and requires a rebuild.
// When that happens the compiler notices `MovedDep` is in a earlier search path.
// RUN: rm -rf %t
// RUN: split-file %s %t
// RUN: sed -e "s|DIR|%/t|g" %t/compile-commands.json.in > %t/compile-commands.json
// RUN: clang-scan-deps -format experimental-full -j 1 \
// RUN: -compilation-database %t/compile-commands.json -o %t/deps1.json
// RUN: cat %t/deps1.json | FileCheck %s --check-prefix=DEPS1
// Model update where same framework appears in earlier search path.
// This can occur on an incremental build where dependency relationships are updated.
// RUN: sleep 1
// RUN: mkdir %t/preferred_frameworks/
// RUN: cp -r %t/fallback_frameworks/MovedDep.framework %t/preferred_frameworks/
// RUN: touch %t/fallback_frameworks/InvalidatedDep.framework/Modules/module.modulemap
// RUN: clang-scan-deps -format experimental-full -j 1 \
// RUN: -compilation-database %t/compile-commands.json -o %t/deps2.json
// RUN: cat %t/deps2.json | FileCheck %s --check-prefix=DEPS2
// DEPS1: "clang-module-deps": [],
// DEPS1-NEXT: "clang-modulemap-file": "{{.*}}fallback_frameworks{{.*}}MovedDep.framework
// DEPS1: "name": "MovedDep"
// DEPS2: "clang-module-deps": [],
// DEPS2-NEXT: "clang-modulemap-file": "{{.*}}preferred_frameworks{{.*}}MovedDep.framework
// DEPS2: "name": "MovedDep"
//--- compile-commands.json.in
[
{
"directory": "DIR",
"command": "clang -c DIR/tu1.c -fmodules -fmodules-cache-path=DIR/cache -FDIR/preferred_frameworks -FDIR/fallback_frameworks -fbuild-session-file=DIR/session.timestamp -fmodules-validate-once-per-build-session -o DIR/tu1.o ",
"file": "DIR/tu1.c"
}
]
//--- session.timestamp
//--- fallback_frameworks/MovedDep.framework/Modules/module.modulemap
framework module MovedDep { header "MovedDep.h" }
//--- fallback_frameworks/MovedDep.framework/Headers/MovedDep.h
int foo(void);
//--- fallback_frameworks/InvalidatedDep.framework/Modules/module.modulemap
framework module InvalidatedDep { header "InvalidatedDep.h" }
//--- fallback_frameworks/InvalidatedDep.framework/Headers/InvalidatedDep.h
#include <MovedDep/MovedDep.h>
//--- fallback_frameworks/DirectDep.framework/Modules/module.modulemap
framework module DirectDep { header "DirectDep.h" }
//--- fallback_frameworks/DirectDep.framework/Headers/DirectDep.h
#include <DepThatLoadsOldPCMs/DepThatLoadsOldPCMs.h>
#include <InvalidatedDep/InvalidatedDep.h>
//--- fallback_frameworks/DepThatLoadsOldPCMs.framework/Modules/module.modulemap
framework module DepThatLoadsOldPCMs { header "DepThatLoadsOldPCMs.h" }
//--- fallback_frameworks/DepThatLoadsOldPCMs.framework/Headers/DepThatLoadsOldPCMs.h
#include <MovedDep/MovedDep.h>
//--- tu1.c
#include <DirectDep/DirectDep.h>