summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp3
-rw-r--r--clang/lib/Lex/Preprocessor.cpp11
2 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 11afa84f3ba..2aa8eaedd43 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -674,7 +674,8 @@ void Preprocessor::HandleIncludeDirective(Token &IncludeTok,
}
// Look up the file, create a File ID for it.
- unsigned FileID = SourceMgr.createFileID(File, FilenameTok.getLocation());
+ unsigned FileID = SourceMgr.createFileID(File, FilenameTok.getLocation(),
+ isSystemHeader(File));
if (FileID == 0)
return Diag(FilenameTok, diag::err_pp_file_not_found,
std::string(FilenameStart, FilenameEnd));
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index 33c94b6e8ad..bc284427840 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -115,6 +115,17 @@ Preprocessor::~Preprocessor() {
delete Callbacks;
}
+bool Preprocessor::isSystemHeader(const FileEntry* F) const {
+ if (F) {
+ DirectoryLookup::DirType DirInfo = HeaderInfo.getFileDirFlavor(F);
+ if (DirInfo == DirectoryLookup::SystemHeaderDir ||
+ DirInfo == DirectoryLookup::ExternCSystemHeaderDir)
+ return true;
+ }
+ return false;
+}
+
+
/// Diag - Forwarding function for diagnostics. This emits a diagnostic at
/// the specified Token's location, translating the token's start
/// position in the current buffer into a SourcePosition object for rendering.
OpenPOWER on IntegriCloud