69 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/a.cppm -E -P -I%t -o %t/tmp 2>&1 | FileCheck %t/a.cppm6// RUN: %clang_cc1 -std=c++20 %t/a.cppm -E -P -I%t -o - 2>&1 \7// RUN: -Wno-include-angled-in-module-purview | FileCheck %t/a.cppm --check-prefix=CHECK-NO-WARN8// RUN: %clang_cc1 -std=c++20 %t/b.cpp -E -P -I%t -o - 2>&1 | FileCheck %t/a.cppm --check-prefix=CHECK-NO-WARN9 10//--- a.h11// left empty12 13//--- b.h14#include <stddef.h>15// The headers not get included shouldn't be affected.16#ifdef WHATEVER17#include <stdint.h>18#endif19 20//--- a.cppm21module;22#include <stddef.h>23#include <a.h>24#include <b.h>25#include "a.h"26#include "b.h"27export module a;28 29#include <stddef.h>30#include <a.h>31#include <b.h>32#include "a.h"33#include "b.h"34 35// CHECK: a.cppm:9:10: warning: '#include <filename>' attaches the declarations to the named module 'a'36// CHECK: a.cppm:10:10: warning: '#include <filename>' attaches the declarations to the named module 'a'37// CHECK: a.cppm:11:10: warning: '#include <filename>' attaches the declarations to the named module 'a'38// CHECK: In file included from {{.*}}/a.cppm:1139// CHECK-NEXT: b.h:1:10: warning: '#include <filename>' attaches the declarations to the named module 'a'40// CHECK: In file included from {{.*}}/a.cppm:1341// CHECK-NEXT: b.h:1:10: warning: '#include <filename>' attaches the declarations to the named module 'a'42 43module :private;44#include <stddef.h>45#include <a.h>46#include <b.h>47#include "a.h"48#include "b.h"49 50// CHECK: a.cppm:24:10: warning: '#include <filename>' attaches the declarations to the named module 'a'51// CHECK: a.cppm:25:10: warning: '#include <filename>' attaches the declarations to the named module 'a'52// CHECK: a.cppm:26:10: warning: '#include <filename>' attaches the declarations to the named module 'a'53// CHECK: In file included from {{.*}}/a.cppm:2654// CHECK-NEXT: b.h:1:10: warning: '#include <filename>' attaches the declarations to the named module 'a'55// CHECK: In file included from {{.*}}/a.cppm:2856// CHECK-NEXT: b.h:1:10: warning: '#include <filename>' attaches the declarations to the named module 'a'57 58// We should have catched all warnings.59// CHECK: 10 warnings generated.60 61// CHECK-NO-WARN-NOT: warning62 63//--- b.cpp64/// Don't recognize `module m);` as a module purview or report a spurious65/// warning for <stddef.h>.66struct module {};67void foo(module m);68#include <stddef.h>69