Clang Project

clang_source_code/test/Modules/diagnostics.modulemap
1// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%S/Inputs/diagnostics-aux.modulemap -fmodule-map-file=%s -fsyntax-only -x c++ /dev/null 2>&1 | FileCheck %s --implicit-check-not error:
2
3// CHECK: In file included from {{.*}}diagnostics-aux.modulemap:3:
4// CHECK: diagnostics-aux-2.modulemap:2:3: error: expected
5
6// PR22299: Ensure we can produce diagnostics for duplicate modules from -fmodule-map-file=.
7//
8// CHECK: diagnostics.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo'
9// CHECK: diagnostics-aux.modulemap:1:8: note: previously defined here
10module foo {}
11
12//* Check that we accept BCPL comments properly, not just as an extension. */
13
14module bad_use {
15  // CHECK: diagnostics.modulemap:[[@LINE+1]]:22: error: use declarations are only allowed in top-level modules
16  module submodule { use foo }
17}
18
19module header_attr {
20  // CHECK: diagnostics.modulemap:[[@LINE+1]]:20: error: expected a header attribute name
21  header "foo.h" { x }
22  // CHECK: diagnostics.modulemap:[[@LINE+1]]:27: error: header attribute 'size' specified multiple times
23  header "bar.h" { size 1 size 2 }
24  // CHECK: diagnostics.modulemap:[[@LINE+1]]:25: error: expected integer literal as value for header attribute 'size'
25  header "baz.h" { size "30 kilobytes" }
26
27  header "quux.h" { size 1 mtime 2 }
28  header "no_attrs.h" {}
29}
30