aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/PTHLexer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Lex/PTHLexer.cpp')
-rw-r--r--lib/Lex/PTHLexer.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/Lex/PTHLexer.cpp b/lib/Lex/PTHLexer.cpp
index 0a810ceaa6..e62accb642 100644
--- a/lib/Lex/PTHLexer.cpp
+++ b/lib/Lex/PTHLexer.cpp
@@ -648,10 +648,11 @@ PTHManager* PTHManager::Create(const std::string& file, Diagnostic* Diags) {
}
llvm::OwningPtr<PTHFileLookup> FL(PTHFileLookup::Create(FileTable, BufBeg));
- if (FL->isEmpty()) {
+
+ // Warn if the PTH file is empty. We still want to create a PTHManager
+ // as the PTH could be used with -include-pth.
+ if (FL->isEmpty())
InvalidPTH(Diags, "PTH file contains no cached source data");
- return 0;
- }
// Get the location of the table mapping from persistent ids to the
// data needed to reconstruct identifiers.
@@ -674,7 +675,7 @@ PTHManager* PTHManager::Create(const std::string& file, Diagnostic* Diags) {
llvm::OwningPtr<PTHStringIdLookup> SL(PTHStringIdLookup::Create(StringIdTable,
BufBeg));
- if (SL->isEmpty()) {
+ if (!FL->isEmpty() && SL->isEmpty()) {
InvalidPTH(Diags, "PTH file contains no identifiers.");
return 0;
}