Fix ASTUnit to allows require a (persistent) Diagnostic object be provided; propogate and simplify.
llvm-svn: 90379
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 91c946c..e244d3c 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -46,11 +46,9 @@
assert(hasASTSupport() && "This action does not have AST support!");
std::string Error;
- ASTUnit *AST = ASTUnit::LoadFromPCHFile(Filename, &Error);
- if (!AST) {
- CI.getDiagnostics().Report(diag::err_fe_invalid_ast_file) << Error;
+ ASTUnit *AST = ASTUnit::LoadFromPCHFile(Filename, CI.getDiagnostics());
+ if (!AST)
goto failure;
- }
setCurrentFile(Filename, AST);