mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-15 10:26:23 +00:00

Previously, if a header was found via in a header map, and not just remapped. we wouldn't also find the module it maps to when using implicit modules (for module maps that were explicitly loaded). This diff just updates these code paths to also locate the owning module via `findUsableModuleForHeader`. Reviewed By: benlangmuir Differential Revision: https://reviews.llvm.org/D103930
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
// UNSUPPORTED: system-windows
|
|
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
// RUN: cd %t
|
|
//
|
|
// RUN: %hmaptool write a.hmap.json hmap
|
|
//
|
|
// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp
|
|
//
|
|
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
// RUN: cd %t
|
|
//
|
|
// RUN: sed -e "s|OUTPUTS_DIR|%t|g" b.hmap.json > hmap.json
|
|
// RUN: %hmaptool write hmap.json hmap
|
|
//
|
|
// RUN: %clang -Rmodule-build -fmodules -fimplicit-modules -fimplicit-module-maps -fmodule-map-file=module.modulemap -fsyntax-only -I hmap -fmodules-cache-path=%t test.cpp
|
|
|
|
//--- After/Mapping.h
|
|
#ifdef FOO
|
|
#error foo
|
|
#endif
|
|
|
|
//--- a.hmap.json
|
|
{
|
|
"mappings" :
|
|
{
|
|
"Before/Mapping.h" : "After/Mapping.h",
|
|
"After/Mapping.h" : "After/Mapping.h"
|
|
}
|
|
}
|
|
|
|
//--- b.hmap.json
|
|
{
|
|
"mappings" :
|
|
{
|
|
"Before/Mapping.h" : "OUTPUTS_DIR/After/Mapping.h"
|
|
}
|
|
}
|
|
|
|
//--- module.modulemap
|
|
module a {
|
|
header "After/Mapping.h"
|
|
}
|
|
|
|
|
|
//--- test.cpp
|
|
#define FOO
|
|
// This include will fail if:
|
|
// 1) modules are't used, as the `FOO` define will propagate into the included
|
|
// header and trip a `#error`, or
|
|
// 2) header maps aren't used, as the header name doesn't exist and relies on
|
|
// the header map to remap it to the real header.
|
|
#include "Before/Mapping.h"
|