summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PPDirectives.cpp
diff options
context:
space:
mode:
authorErik Verbruggen <erikjv@me.com>2016-10-27 14:17:10 +0000
committerErik Verbruggen <erikjv@me.com>2016-10-27 14:17:10 +0000
commite0bde7554ce04ef7af99c69d526882a56f54a928 (patch)
treea62a277df65a36bb68e905945eadb07a6b4efb70 /clang/lib/Lex/PPDirectives.cpp
parent7cc713adcb668c23cbac71cfd7f268dd5afb618d (diff)
downloadbcm5719-llvm-e0bde7554ce04ef7af99c69d526882a56f54a928.tar.gz
bcm5719-llvm-e0bde7554ce04ef7af99c69d526882a56f54a928.zip
Do not print include_next/pragma once warnings when input is a header.
r276653 suppressed the pragma once warning when generating a PCH file. This patch extends that to any main file for which clang is told (with the -x option) that it's a header file. It will also suppress the warning "#include_next in primary source file". Differential Revision: http://reviews.llvm.org/D25989 llvm-svn: 285295
Diffstat (limited to 'clang/lib/Lex/PPDirectives.cpp')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index ff20492e9aa..7fc008274bd 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -2058,7 +2058,11 @@ void Preprocessor::HandleIncludeNextDirective(SourceLocation HashLoc,
// diagnostic.
const DirectoryLookup *Lookup = CurDirLookup;
const FileEntry *LookupFromFile = nullptr;
- if (isInPrimaryFile()) {
+ if (isInPrimaryFile() && LangOpts.IsHeaderFile) {
+ // If the main file is a header, then it's either for PCH/AST generation,
+ // or libclang opened it. Either way, handle it as a normal include below
+ // and do not complain about include_next.
+ } else if (isInPrimaryFile()) {
Lookup = nullptr;
Diag(IncludeNextTok, diag::pp_include_next_in_primary);
} else if (CurSubmodule) {
OpenPOWER on IntegriCloud