This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL348923: [ASTImporter] Remove import of definition from GetAlreadyImportedOrNull (authored by martong, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D53755?vs=175639&id=177834#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D53755/new/ https://reviews.llvm.org/D53755 Files: cfe/trunk/include/clang/AST/ASTImporter.h cfe/trunk/lib/AST/ASTImporter.cpp Index: cfe/trunk/include/clang/AST/ASTImporter.h =================================================================== --- cfe/trunk/include/clang/AST/ASTImporter.h +++ cfe/trunk/include/clang/AST/ASTImporter.h @@ -209,7 +209,7 @@ /// Return the copy of the given declaration in the "to" context if /// it has already been imported from the "from" context. Otherwise return /// NULL. - Decl *GetAlreadyImportedOrNull(Decl *FromD); + Decl *GetAlreadyImportedOrNull(const Decl *FromD) const; /// Import the given declaration context from the "from" /// AST context into the "to" AST context. Index: cfe/trunk/lib/AST/ASTImporter.cpp =================================================================== --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -1580,6 +1580,9 @@ return Err; ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D)); + if (ToD) + if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(D, ToD)) + return Err; return Error::success(); } @@ -7745,17 +7748,12 @@ return ToAttr; } -Decl *ASTImporter::GetAlreadyImportedOrNull(Decl *FromD) { - llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(FromD); - if (Pos != ImportedDecls.end()) { - Decl *ToD = Pos->second; - // FIXME: move this call to ImportDeclParts(). - if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(FromD, ToD)) - llvm::consumeError(std::move(Err)); - return ToD; - } else { +Decl *ASTImporter::GetAlreadyImportedOrNull(const Decl *FromD) const { + auto Pos = ImportedDecls.find(FromD); + if (Pos != ImportedDecls.end()) + return Pos->second; + else return nullptr; - } } Expected<Decl *> ASTImporter::Import_New(Decl *FromD) {
Index: cfe/trunk/include/clang/AST/ASTImporter.h =================================================================== --- cfe/trunk/include/clang/AST/ASTImporter.h +++ cfe/trunk/include/clang/AST/ASTImporter.h @@ -209,7 +209,7 @@ /// Return the copy of the given declaration in the "to" context if /// it has already been imported from the "from" context. Otherwise return /// NULL. - Decl *GetAlreadyImportedOrNull(Decl *FromD); + Decl *GetAlreadyImportedOrNull(const Decl *FromD) const; /// Import the given declaration context from the "from" /// AST context into the "to" AST context. Index: cfe/trunk/lib/AST/ASTImporter.cpp =================================================================== --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -1580,6 +1580,9 @@ return Err; ToD = cast_or_null<NamedDecl>(Importer.GetAlreadyImportedOrNull(D)); + if (ToD) + if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(D, ToD)) + return Err; return Error::success(); } @@ -7745,17 +7748,12 @@ return ToAttr; } -Decl *ASTImporter::GetAlreadyImportedOrNull(Decl *FromD) { - llvm::DenseMap<Decl *, Decl *>::iterator Pos = ImportedDecls.find(FromD); - if (Pos != ImportedDecls.end()) { - Decl *ToD = Pos->second; - // FIXME: move this call to ImportDeclParts(). - if (Error Err = ASTNodeImporter(*this).ImportDefinitionIfNeeded(FromD, ToD)) - llvm::consumeError(std::move(Err)); - return ToD; - } else { +Decl *ASTImporter::GetAlreadyImportedOrNull(const Decl *FromD) const { + auto Pos = ImportedDecls.find(FromD); + if (Pos != ImportedDecls.end()) + return Pos->second; + else return nullptr; - } } Expected<Decl *> ASTImporter::Import_New(Decl *FromD) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits