forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang][modules] Avoid modules diagnostics for
__has_include()
(llv…
…m#71450) After llvm#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()`. (cherry picked from commit bdb309c)
- Loading branch information
1 parent
38a8c52
commit b62ebbb
Showing
2 changed files
with
34 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// 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 |