PTHManager::Create():
- Make the Diagnostic::Level for PTH errors to be specified by the caller
clang (driver):
- Set the PTHManager diagnostic level to "Diagnostic::Error" for -include-pth
(a hard error) and Diagnostic::Warning for -token-cache (we can still
proceed).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67462 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/clang.cpp b/Driver/clang.cpp
index 9c0ce10..160c252 100644
--- a/Driver/clang.cpp
+++ b/Driver/clang.cpp
@@ -1156,15 +1156,20 @@
if (!TokenCache.empty() && !ImplicitIncludePTH.empty()) {
fprintf(stderr, "error: cannot use both -token-cache and -include-pth "
"options\n");
- exit (1);
+ exit(1);
}
// Use PTH?
if (!TokenCache.empty() || !ImplicitIncludePTH.empty()) {
const std::string& x = TokenCache.empty() ? ImplicitIncludePTH:TokenCache;
- PTHMgr.reset(PTHManager::Create(x, &Diags));
+ PTHMgr.reset(PTHManager::Create(x, &Diags,
+ TokenCache.empty() ? Diagnostic::Error
+ : Diagnostic::Warning));
}
+ if (Diags.hasErrorOccurred())
+ exit(1);
+
// Create the Preprocessor.
llvm::OwningPtr<Preprocessor> PP(new Preprocessor(Diags, LangInfo, Target,
SourceMgr, HeaderInfo,