diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td index 89cb03cc33b98..1d827ecbc3b06 100644 --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -3353,7 +3353,7 @@ defm implicit_modules : BoolFOption<"implicit-modules", NegFlag, PosFlag, BothFlags< [NoXarchOption], [ClangOption, CLOption]>>; -def fno_modules_check_relocated : Joined<["-"], "fno-modules-check-relocated">, +def fno_modules_check_relocated : Flag<["-"], "fno-modules-check-relocated">, Group, Visibility<[ClangOption, CC1Option]>, HelpText<"Skip checks for relocated modules when loading PCM files">, MarshallingInfoNegativeFlag>; diff --git a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp index b7d44caca4954..df8db38131b95 100644 --- a/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp +++ b/clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp @@ -427,9 +427,6 @@ class DependencyScanningAction : public tooling::ToolAction { ScanInstance.getHeaderSearchOpts().ModulesSkipPragmaDiagnosticMappings = true; - // Avoid some checks and module map parsing when loading PCM files. - ScanInstance.getPreprocessorOpts().ModulesCheckRelocated = false; - std::unique_ptr Action; if (Service.getFormat() == ScanningOutputFormat::P1689) diff --git a/clang/test/ClangScanDeps/modules-relocated-module-map.c b/clang/test/ClangScanDeps/modules-relocated-module-map.c new file mode 100644 index 0000000000000..3aad52027cc43 --- /dev/null +++ b/clang/test/ClangScanDeps/modules-relocated-module-map.c @@ -0,0 +1,36 @@ +// RUN: rm -rf %t +// RUN: split-file %s %t + +// RUN: mkdir %t/frameworks1 + +// RUN: clang-scan-deps -format experimental-full -- \ +// RUN: %clang -fmodules -fmodules-cache-path=%t/cache \ +// RUN: -F %t/frameworks1 -F %t/frameworks2 \ +// RUN: -c %t/tu1.m -o %t/tu1.o + +// RUN: cp -r %t/frameworks2/A.framework %t/frameworks1 + +// RUN: clang-scan-deps -format experimental-full -- \ +// RUN: %clang -fmodules -fmodules-cache-path=%t/cache \ +// RUN: -F %t/frameworks1 -F %t/frameworks2 \ +// RUN: -c %t/tu2.m -o %t/tu2.o + +//--- frameworks2/A.framework/Modules/module.modulemap +framework module A { header "A.h" } +//--- frameworks2/A.framework/Headers/A.h +#define MACRO_A 1 + +//--- frameworks2/B.framework/Modules/module.modulemap +framework module B { header "B.h" } +//--- frameworks2/B.framework/Headers/B.h +#include + +//--- tu1.m +#include + +//--- tu2.m +#include +#include + +#if MACRO_A == 3 +#endif