blob: 865892b53b285d19148daeba5ea623d2b24912e4 [file] [log] [blame]
Richard Smith040e1262017-06-02 01:55:39 +00001// 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:
Richard Smithac425e92015-01-23 00:01:13 +00002
Richard Smithae6df272015-07-14 02:06:01 +00003// CHECK: In file included from {{.*}}diagnostics-aux.modulemap:3:
4// CHECK: diagnostics-aux-2.modulemap:2:3: error: expected
5
Richard Smithac425e92015-01-23 00:01:13 +00006// PR22299: Ensure we can produce diagnostics for duplicate modules from -fmodule-map-file=.
7//
Richard Smith8f4d3ff2015-03-26 22:10:01 +00008// CHECK: diagnostics.modulemap:[[@LINE+2]]:8: error: redefinition of module 'foo'
9// CHECK: diagnostics-aux.modulemap:1:8: note: previously defined here
Richard Smithac425e92015-01-23 00:01:13 +000010module foo {}
Richard Smith0414b852015-02-14 05:32:00 +000011
12//* Check that we accept BCPL comments properly, not just as an extension. */
Richard Smith8f4d3ff2015-03-26 22:10:01 +000013
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}
Richard Smith040e1262017-06-02 01:55:39 +000018
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}