================ @@ -0,0 +1,164 @@ +// Test correctly reporting what a module exports during dependency scanning. +// Module A depends on modules B, C and D, but only exports B and C. +// Module E depends on modules B, C and D, and exports all of them. + +// RUN: rm -rf %t +// RUN: split-file %s %t +// RUN: sed -e "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json +// RUN: clang-scan-deps -compilation-database \ +// RUN: %t/cdb.json -format experimental-full > %t/deps.db +// RUN: cat %t/deps.db | sed 's:\\\\\?:/:g' | FileCheck %s + +//--- cdb.json.template +[ + { + "directory": "DIR", + "command": "clang -c DIR/test.c -I DIR/AH -I DIR/BH -I DIR/CH -I DIR/DH -I DIR/EH -fmodules -fmodules-cache-path=DIR/cache", + "file": "DIR/test.c" + }, +] + +//--- AH/A.h +#include "B.h" +#include "C.h" +#include "D.h" + +int funcA(); + +//--- AH/module.modulemap +module A { + header "A.h" + + export B + export C +} + +//--- BH/B.h +//--- BH/module.modulemap +module B { + header "B.h" +} + +//--- CH/C.h +//--- CH/module.modulemap +module C { + header "C.h" +} + +//--- DH/D.h +//--- DH/module.modulemap +module D { + header "D.h" +} + +//--- EH/E.h +#include "B.h" +#include "C.h" +#include "D.h" + +//--- EH/module.modulemap +module E { + header "E.h" + export * +} + +//--- test.c +#include "A.h" +#include "E.h" + +int test1() { + return funcA(); +} + +// CHECK: { +// CHECK-NEXT: "modules": [ +// CHECK-NEXT: { +// CHECK-NEXT: "clang-module-deps": [ +// CHECK-NEXT: { ---------------- qiongsiwu wrote:
Good point! Fixed. https://github.com/llvm/llvm-project/pull/137421 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits