diff options
author | Balazs Keri <1.int32@gmail.com> | 2019-04-08 13:59:15 +0000 |
---|---|---|
committer | Balazs Keri <1.int32@gmail.com> | 2019-04-08 13:59:15 +0000 |
commit | a1f6b103f3964bcdf434e2c45428b4f097454cb6 (patch) | |
tree | 7fb055f9aa20b8398ca415a2be022692311ada1c /clang/lib/AST/ASTImporter.cpp | |
parent | 50c3b290ed8749b568439908adcfca85df33535d (diff) | |
download | bcm5719-llvm-a1f6b103f3964bcdf434e2c45428b4f097454cb6.tar.gz bcm5719-llvm-a1f6b103f3964bcdf434e2c45428b4f097454cb6.zip |
Changed every use of ASTImporter::Import to Import_New
Reviewers: a.sidorin, shafik, martong, a_sidorin
Reviewed By: a_sidorin
Subscribers: rnkovacs, dkrupp, martong, Szelethus, gamesh411, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D55049
llvm-svn: 357913
Diffstat (limited to 'clang/lib/AST/ASTImporter.cpp')
-rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index f1da65d2e38..e7f23cfe8fe 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -7792,9 +7792,10 @@ Expected<DeclContext *> ASTImporter::ImportContext(DeclContext *FromDC) { if (!FromDC) return FromDC; - auto *ToDC = cast_or_null<DeclContext>(Import(cast<Decl>(FromDC))); - if (!ToDC) - return nullptr; + ExpectedDecl ToDCOrErr = Import_New(cast<Decl>(FromDC)); + if (!ToDCOrErr) + return ToDCOrErr.takeError(); + auto *ToDC = cast<DeclContext>(*ToDCOrErr); // When we're using a record/enum/Objective-C class/protocol as a context, we // need it to have a definition. @@ -8590,10 +8591,16 @@ Decl *ASTImporter::MapImported(Decl *From, Decl *To) { bool ASTImporter::IsStructurallyEquivalent(QualType From, QualType To, bool Complain) { - llvm::DenseMap<const Type *, const Type *>::iterator Pos - = ImportedTypes.find(From.getTypePtr()); - if (Pos != ImportedTypes.end() && ToContext.hasSameType(Import(From), To)) - return true; + llvm::DenseMap<const Type *, const Type *>::iterator Pos = + ImportedTypes.find(From.getTypePtr()); + if (Pos != ImportedTypes.end()) { + if (ExpectedType ToFromOrErr = Import_New(From)) { + if (ToContext.hasSameType(*ToFromOrErr, To)) + return true; + } else { + llvm::consumeError(ToFromOrErr.takeError()); + } + } StructuralEquivalenceContext Ctx(FromContext, ToContext, NonEquivalentDecls, getStructuralEquivalenceKind(*this), false, |