aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2008-08-10 19:59:06 +0000
committerNico Weber <nicolasweber@gmx.de>2008-08-10 19:59:06 +0000
commit7bfaaaecb3113f955db31e8d8a51acffd1bc0c27 (patch)
treebac57d5f77ac6696a51a822a63f513fb92d79a65 /lib/Lex
parent3ac5e9fc38e1a59da84844f6adb95e803779098d (diff)
* Remove isInSystemHeader() from DiagClient, move it to SourceManager
* Move FormatError() from TextDiagnostic up to DiagClient, remove now empty class TextDiagnostic * Make DiagClient optional for Diagnostic This fixes the following problems: * -html-diags (and probably others) does now output the same set of warnings as console clang does * nothing crashes if one forgets to call setHeaderSearch() on TextDiagnostic * some code duplication is removed git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex')
-rw-r--r--lib/Lex/PPDirectives.cpp3
-rw-r--r--lib/Lex/Preprocessor.cpp11
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/Lex/PPDirectives.cpp b/lib/Lex/PPDirectives.cpp
index 11afa84f3b..2aa8eaedd4 100644
--- a/lib/Lex/PPDirectives.cpp
+++ b/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/lib/Lex/Preprocessor.cpp b/lib/Lex/Preprocessor.cpp
index 33c94b6e8a..bc28442784 100644
--- a/lib/Lex/Preprocessor.cpp
+++ b/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.