summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/PTHLexer.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-01-28 20:49:33 +0000
committerTed Kremenek <kremenek@apple.com>2009-01-28 20:49:33 +0000
commit3b0589e4b4abc36bc46d5804820dfe8a930be472 (patch)
treedc92c386b8c0951195c2c3b99a5325e5221fe1f9 /clang/lib/Lex/PTHLexer.cpp
parent5241832d1dffb02984b839b167f16e563413407c (diff)
downloadbcm5719-llvm-3b0589e4b4abc36bc46d5804820dfe8a930be472.tar.gz
bcm5719-llvm-3b0589e4b4abc36bc46d5804820dfe8a930be472.zip
Enhance PTHManager::Create() to take an optional Diagnostic* argument that can be used to report issues such as a missing PTH file.
llvm-svn: 63231
Diffstat (limited to 'clang/lib/Lex/PTHLexer.cpp')
-rw-r--r--clang/lib/Lex/PTHLexer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Lex/PTHLexer.cpp b/clang/lib/Lex/PTHLexer.cpp
index f9f2b210612..36f509cba64 100644
--- a/clang/lib/Lex/PTHLexer.cpp
+++ b/clang/lib/Lex/PTHLexer.cpp
@@ -390,13 +390,20 @@ PTHManager::~PTHManager() {
free(PerIDCache);
}
-PTHManager* PTHManager::Create(const std::string& file) {
+PTHManager* PTHManager::Create(const std::string& file, Diagnostic* Diags) {
// Memory map the PTH file.
llvm::OwningPtr<llvm::MemoryBuffer>
File(llvm::MemoryBuffer::getFile(file.c_str()));
- if (!File)
+ if (!File) {
+ if (Diags) {
+ unsigned DiagID = Diags->getCustomDiagID(Diagnostic::Note,
+ "PTH file %0 could not be read");
+ Diags->Report(FullSourceLoc(), DiagID) << file;
+ }
+
return 0;
+ }
// Get the buffer ranges and check if there are at least three 32-bit
// words at the end of the file.
OpenPOWER on IntegriCloud