36 lines · c
1// Test scanning deps does not have more errors than the regular compilation.2 3// RUN: rm -rf %t4// RUN: split-file %s %t5// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json6 7// Check the regular compilation does not fail.8// RUN: %clang -fsyntax-only %t/test.c -I %t/include -fmodules -fimplicit-module-maps -fmodules-cache-path=%t/cache -Wnon-modular-include-in-module -Werror=non-modular-include-in-module9 10// And now scanning deps should succeed too.11// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 112 13//--- cdb.json.template14[15 {16 "directory": "DIR",17 "command": "clang -fsyntax-only DIR/test.c -I DIR/include -fmodules -fimplicit-module-maps -fmodules-cache-path=DIR/cache -Wnon-modular-include-in-module -Werror=non-modular-include-in-module",18 "file": "DIR/test.c"19 },20]21 22//--- include/nonmodular.h23// empty24 25//--- include/modular-includer.h26#pragma clang diagnostic push27#pragma clang diagnostic ignored "-Wnon-modular-include-in-module"28#include <nonmodular.h>29#pragma clang diagnostic pop30 31//--- include/module.modulemap32module ModularIncluder { header "modular-includer.h" }33 34//--- test.c35#include <modular-includer.h>36