
After #70144 Clang started resolving module maps even for `__has_include()` expressions. This had the unintended consequence of emitting diagnostics around header misuse. These don't make sense if you actually don't bring contents of the header into the importer, so should be skipped for `__has_include()`. This patch moves emission of these diagnostics out of `Preprocessor::LookupFile()` up into `Preprocessor::LookupHeaderIncludeOrImport()`.
15 lines
308 B
C
15 lines
308 B
C
// RUN: rm -rf %t
|
|
// RUN: split-file %s %t
|
|
|
|
//--- module.modulemap
|
|
module Mod { header "mod.h" }
|
|
//--- mod.h
|
|
#if __has_include("textual.h")
|
|
#endif
|
|
//--- textual.h
|
|
|
|
//--- tu.c
|
|
#include "mod.h"
|
|
|
|
// RUN: %clang -fsyntax-only %t/tu.c -fmodules -fmodules-cache-path=%t/cache -Werror=non-modular-include-in-module
|