[ASTImporter] Use llvm::Expected and Error in the importer API
Summary:
This is the final phase of the refactoring towards using llvm::Expected
and llvm::Error in the ASTImporter API.
This involves the following:
- remove old Import functions which returned with a pointer,
- use the Import_New functions (which return with Err or Expected) everywhere
and handle their return value
- rename Import_New functions to Import
This affects both Clang and LLDB.
Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin
Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits
Tags: #clang, #lldb
Differential Revision: https://reviews.llvm.org/D61438
llvm-svn: 360760
diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp
index 9b68f37..f504082 100644
--- a/clang/lib/CrossTU/CrossTranslationUnit.cpp
+++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp
@@ -398,7 +398,7 @@
assert(hasBodyOrInit(D) && "Decls to be imported should have body or init.");
ASTImporter &Importer = getOrCreateASTImporter(D->getASTContext());
- auto ToDeclOrError = Importer.Import_New(D);
+ auto ToDeclOrError = Importer.Import(D);
if (!ToDeclOrError) {
handleAllErrors(ToDeclOrError.takeError(),
[&](const ImportError &IE) {