xref: /llvm-project/clang/test/Modules/pch-with-module-name-import-twice.c (revision bbdb0c7e4496b145a5e9354f951eec272695049d)
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 
4 // This test checks that headers that are part of a module named by
5 // -fmodule-name= don't get included again if previously included from a PCH.
6 
7 //--- include/module.modulemap
8 module Mod { header "Mod.h" }
9 //--- include/Mod.h
10 struct Symbol {};
11 //--- pch.h
12 #import "Mod.h"
13 //--- tu.c
14 #import "Mod.h" // expected-no-diagnostics
15 
16 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fimplicit-module-maps -fmodule-name=Mod -I %t/include \
17 // RUN:   -emit-pch -x c-header %t/pch.h -o %t/pch.pch
18 // RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t/cache -fimplicit-module-maps -fmodule-name=Mod -I %t/include \
19 // RUN:   -fsyntax-only %t/tu.c -include-pch %t/pch.pch -verify
20