| 1 |
// Test scanning deps does not have more errors than the regular compilation. |
| 2 |
|
| 3 |
// RUN: rm -rf %t |
| 4 |
// RUN: split-file %s %t |
| 5 |
// RUN: sed "s|DIR|%/t|g" %t/cdb.json.template > %t/cdb.json |
| 6 |
|
| 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-module |
| 9 |
|
| 10 |
// And now scanning deps should succeed too. |
| 11 |
// RUN: clang-scan-deps -compilation-database %t/cdb.json -j 1 |
| 12 |
|
| 13 |
//--- cdb.json.template |
| 14 |
[ |
| 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.h |
| 23 |
// empty |
| 24 |
|
| 25 |
//--- include/modular-includer.h |
| 26 |
#pragma clang diagnostic push |
| 27 |
#pragma clang diagnostic ignored "-Wnon-modular-include-in-module" |
| 28 |
#include <nonmodular.h> |
| 29 |
#pragma clang diagnostic pop |
| 30 |
|
| 31 |
//--- include/module.modulemap |
| 32 |
module ModularIncluder { header "modular-includer.h" } |
| 33 |
|
| 34 |
//--- test.c |
| 35 |
#include <modular-includer.h> |