diff --git a/clang/include/clang/AST/ASTImportError.h b/clang/include/clang/AST/ASTImportError.h --- a/clang/include/clang/AST/ASTImportError.h +++ b/clang/include/clang/AST/ASTImportError.h @@ -18,7 +18,7 @@ namespace clang { -class ImportError : public llvm::ErrorInfo { +class ASTImportError : public llvm::ErrorInfo { public: /// \brief Kind of error when importing an AST component. enum ErrorKind { @@ -31,13 +31,13 @@ static char ID; - ImportError() : Error(Unknown) {} - ImportError(const ImportError &Other) : Error(Other.Error) {} - ImportError &operator=(const ImportError &Other) { + ASTImportError() : Error(Unknown) {} + ASTImportError(const ASTImportError &Other) : Error(Other.Error) {} + ASTImportError &operator=(const ASTImportError &Other) { Error = Other.Error; return *this; } - ImportError(ErrorKind Error) : Error(Error) {} + ASTImportError(ErrorKind Error) : Error(Error) {} std::string toString() const; diff --git a/clang/include/clang/AST/ASTImporter.h b/clang/include/clang/AST/ASTImporter.h --- a/clang/include/clang/AST/ASTImporter.h +++ b/clang/include/clang/AST/ASTImporter.h @@ -231,7 +231,7 @@ /// imported. The same declaration may or may not be included in /// ImportedDecls. This map is updated continuously during imports and never /// cleared (like ImportedDecls). - llvm::DenseMap ImportDeclErrors; + llvm::DenseMap ImportDeclErrors; /// Mapping from the already-imported declarations in the "to" /// context to the corresponding declarations in the "from" context. @@ -564,10 +564,10 @@ /// Return if import of the given declaration has failed and if yes /// the kind of the problem. This gives the first error encountered with /// the node. - llvm::Optional getImportDeclErrorIfAny(Decl *FromD) const; + llvm::Optional getImportDeclErrorIfAny(Decl *FromD) const; /// Mark (newly) imported declaration with error. - void setImportDeclError(Decl *From, ImportError Error); + void setImportDeclError(Decl *From, ASTImportError Error); /// Determine whether the given types are structurally /// equivalent. diff --git a/clang/include/clang/AST/ASTImporterSharedState.h b/clang/include/clang/AST/ASTImporterSharedState.h --- a/clang/include/clang/AST/ASTImporterSharedState.h +++ b/clang/include/clang/AST/ASTImporterSharedState.h @@ -36,7 +36,7 @@ /// imported. The same declaration may or may not be included in /// ImportedFromDecls. This map is updated continuously during imports and /// never cleared (like ImportedFromDecls). - llvm::DenseMap ImportErrors; + llvm::DenseMap ImportErrors; // FIXME put ImportedFromDecls here! // And from that point we can better encapsulate the lookup table. @@ -62,15 +62,15 @@ LookupTable->remove(ND); } - llvm::Optional getImportDeclErrorIfAny(Decl *ToD) const { + llvm::Optional getImportDeclErrorIfAny(Decl *ToD) const { auto Pos = ImportErrors.find(ToD); if (Pos != ImportErrors.end()) return Pos->second; else - return Optional(); + return Optional(); } - void setImportDeclError(Decl *To, ImportError Error) { + void setImportDeclError(Decl *To, ASTImportError Error) { ImportErrors[To] = Error; } }; diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -84,7 +84,7 @@ using ExpectedSLoc = llvm::Expected; using ExpectedName = llvm::Expected; - std::string ImportError::toString() const { + std::string ASTImportError::toString() const { // FIXME: Improve error texts. switch (Error) { case NameConflict: @@ -98,15 +98,13 @@ return "Invalid error code."; } - void ImportError::log(raw_ostream &OS) const { - OS << toString(); - } + void ASTImportError::log(raw_ostream &OS) const { OS << toString(); } - std::error_code ImportError::convertToErrorCode() const { + std::error_code ASTImportError::convertToErrorCode() const { llvm_unreachable("Function not implemented."); } - char ImportError::ID; + char ASTImportError::ID; template SmallVector @@ -1065,7 +1063,7 @@ ExpectedType ASTNodeImporter::VisitType(const Type *T) { Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node) << T->getTypeClassName(); - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } ExpectedType ASTNodeImporter::VisitAtomicType(const AtomicType *T){ @@ -1716,7 +1714,7 @@ if (RT && RT->getDecl() == D) { Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node) << D->getDeclKindName(); - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } } } @@ -2239,13 +2237,13 @@ ExpectedDecl ASTNodeImporter::VisitDecl(Decl *D) { Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node) << D->getDeclKindName(); - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } ExpectedDecl ASTNodeImporter::VisitImportDecl(ImportDecl *D) { Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node) << D->getDeclKindName(); - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } ExpectedDecl ASTNodeImporter::VisitEmptyDecl(EmptyDecl *D) { @@ -3704,7 +3702,7 @@ Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here) << FoundField->getType(); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } } @@ -3777,7 +3775,7 @@ Importer.ToDiag(FoundField->getLocation(), diag::note_odr_value_here) << FoundField->getType(); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } } @@ -3968,7 +3966,7 @@ Importer.ToDiag(FoundIvar->getLocation(), diag::note_odr_value_here) << FoundIvar->getType(); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } } @@ -4276,7 +4274,7 @@ diag::note_odr_objc_method_here) << D->isInstanceMethod() << Name; - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } // Check the number of parameters. @@ -4288,7 +4286,7 @@ diag::note_odr_objc_method_here) << D->isInstanceMethod() << Name; - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } // Check parameter types. @@ -4304,7 +4302,7 @@ Importer.ToDiag((*FoundP)->getLocation(), diag::note_odr_value_here) << (*FoundP)->getType(); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } } @@ -4317,7 +4315,7 @@ diag::note_odr_objc_method_here) << D->isInstanceMethod() << Name; - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } // FIXME: Any other bits we need to merge? @@ -5215,7 +5213,7 @@ Importer.FromDiag(D->getLocation(), diag::note_odr_objc_missing_superclass); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } } @@ -5254,7 +5252,7 @@ Importer.ToDiag(FoundProp->getLocation(), diag::note_odr_value_here) << FoundProp->getType(); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } // FIXME: Check property attributes, getters, setters, etc.? @@ -5359,7 +5357,7 @@ << D->getPropertyDecl()->getDeclName() << (D->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } // For @synthesize, check that we have the same @@ -5374,7 +5372,7 @@ diag::note_odr_objc_synthesize_ivar_here) << D->getPropertyIvarDecl()->getDeclName(); - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } // Merge the existing implementation with the new implementation. @@ -5704,7 +5702,7 @@ } } else { // ODR violation. // FIXME HandleNameConflict - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); } } @@ -6181,13 +6179,13 @@ ExpectedStmt ASTNodeImporter::VisitStmt(Stmt *S) { Importer.FromDiag(S->getBeginLoc(), diag::err_unsupported_ast_node) << S->getStmtClassName(); - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } ExpectedStmt ASTNodeImporter::VisitGCCAsmStmt(GCCAsmStmt *S) { if (Importer.returnWithErrorInTest()) - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); SmallVector Names; for (unsigned I = 0, E = S->getNumOutputs(); I != E; I++) { IdentifierInfo *ToII = Importer.Import(S->getOutputIdentifier(I)); @@ -6694,7 +6692,7 @@ ExpectedStmt ASTNodeImporter::VisitExpr(Expr *E) { Importer.FromDiag(E->getBeginLoc(), diag::err_unsupported_ast_node) << E->getStmtClassName(); - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } ExpectedStmt ASTNodeImporter::VisitSourceLocExpr(SourceLocExpr *E) { @@ -7356,7 +7354,7 @@ } default: llvm_unreachable("Cast expression of unsupported type!"); - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } } @@ -8217,7 +8215,7 @@ ToOperatorLoc, ToRParenLoc, ToAngleBrackets); } else { llvm_unreachable("Unknown cast type"); - return make_error(); + return make_error(); } } @@ -8412,7 +8410,7 @@ // FIXME: Handle BlockDecl when we implement importing BlockExpr in // ASTNodeImporter. - return make_error(ImportError::UnsupportedConstruct); + return make_error(ASTImportError::UnsupportedConstruct); } ExpectedTypePtr ASTImporter::Import(const Type *FromT) { @@ -8763,7 +8761,7 @@ // Check whether there was a previous failed import. // If yes return the existing error. if (auto Error = getImportDeclErrorIfAny(FromD)) - return make_error(*Error); + return make_error(*Error); // Check whether we've already imported this declaration. Decl *ToD = GetAlreadyImportedOrNull(FromD); @@ -8771,7 +8769,7 @@ // Already imported (possibly from another TU) and with an error. if (auto Error = SharedState->getImportDeclErrorIfAny(ToD)) { setImportDeclError(FromD, *Error); - return make_error(*Error); + return make_error(*Error); } // If FromD has some updated flags after last import, apply it. @@ -8823,9 +8821,9 @@ // Error encountered for the first time. // After takeError the error is not usable any more in ToDOrErr. // Get a copy of the error object (any more simple solution for this?). - ImportError ErrOut; + ASTImportError ErrOut; handleAllErrors(ToDOrErr.takeError(), - [&ErrOut](const ImportError &E) { ErrOut = E; }); + [&ErrOut](const ASTImportError &E) { ErrOut = E; }); setImportDeclError(FromD, ErrOut); // Set the error for the mapped to Decl, which is in the "to" context. if (Pos != ImportedDecls.end()) @@ -8860,7 +8858,7 @@ SavedImportPaths.erase(FromD); // Do not return ToDOrErr, error was taken out of it. - return make_error(ErrOut); + return make_error(ErrOut); } ToD = *ToDOrErr; @@ -8872,7 +8870,7 @@ if (!ToD) { auto Err = getImportDeclErrorIfAny(FromD); assert(Err); - return make_error(*Err); + return make_error(*Err); } // We could import from the current TU without error. But previously we @@ -8880,7 +8878,7 @@ // ASTImporter object) and with an error. if (auto Error = SharedState->getImportDeclErrorIfAny(ToD)) { setImportDeclError(FromD, *Error); - return make_error(*Error); + return make_error(*Error); } // Make sure that ImportImpl registered the imported decl. @@ -9345,7 +9343,7 @@ Cache->getBufferOrNone(FromContext.getDiagnostics(), FromSM.getFileManager(), SourceLocation{}); if (!FromBuf) - return llvm::make_error(ImportError::Unknown); + return llvm::make_error(ASTImportError::Unknown); std::unique_ptr ToBuf = llvm::MemoryBuffer::getMemBufferCopy(FromBuf->getBuffer(), @@ -9421,7 +9419,7 @@ *ToExprOrErr, *RParenLocOrErr); } else { // FIXME: assert? - return make_error(); + return make_error(); } } @@ -9750,7 +9748,7 @@ unsigned NumDecls) { if (ODRHandling == ODRHandlingType::Conservative) // Report error at any name conflict. - return make_error(ImportError::NameConflict); + return make_error(ASTImportError::NameConflict); else // Allow to create the new Decl with the same name. return Name; @@ -9810,16 +9808,16 @@ return To; } -llvm::Optional +llvm::Optional ASTImporter::getImportDeclErrorIfAny(Decl *FromD) const { auto Pos = ImportDeclErrors.find(FromD); if (Pos != ImportDeclErrors.end()) return Pos->second; else - return Optional(); + return Optional(); } -void ASTImporter::setImportDeclError(Decl *From, ImportError Error) { +void ASTImporter::setImportDeclError(Decl *From, ASTImportError Error) { auto InsertRes = ImportDeclErrors.insert({From, Error}); (void)InsertRes; // Either we set the error for the first time, or we already had set one and diff --git a/clang/lib/CrossTU/CrossTranslationUnit.cpp b/clang/lib/CrossTU/CrossTranslationUnit.cpp --- a/clang/lib/CrossTU/CrossTranslationUnit.cpp +++ b/clang/lib/CrossTU/CrossTranslationUnit.cpp @@ -735,20 +735,19 @@ auto ToDeclOrError = Importer.Import(D); if (!ToDeclOrError) { - handleAllErrors(ToDeclOrError.takeError(), - [&](const ImportError &IE) { - switch (IE.Error) { - case ImportError::NameConflict: - ++NumNameConflicts; - break; - case ImportError::UnsupportedConstruct: - ++NumUnsupportedNodeFound; - break; - case ImportError::Unknown: - llvm_unreachable("Unknown import error happened."); - break; - } - }); + handleAllErrors(ToDeclOrError.takeError(), [&](const ASTImportError &IE) { + switch (IE.Error) { + case ASTImportError::NameConflict: + ++NumNameConflicts; + break; + case ASTImportError::UnsupportedConstruct: + ++NumUnsupportedNodeFound; + break; + case ASTImportError::Unknown: + llvm_unreachable("Unknown import error happened."); + break; + } + }); return llvm::make_error(index_error_code::failed_import); } auto *ToDecl = cast(*ToDeclOrError); diff --git a/clang/unittests/AST/ASTImporterFixtures.h b/clang/unittests/AST/ASTImporterFixtures.h --- a/clang/unittests/AST/ASTImporterFixtures.h +++ b/clang/unittests/AST/ASTImporterFixtures.h @@ -276,9 +276,10 @@ auto Imported = importNode(FromAST.get(), ToAST.get(), Importer, ToImport); if (!Imported) { std::string ErrorText; - handleAllErrors( - Imported.takeError(), - [&ErrorText](const ImportError &Err) { ErrorText = Err.message(); }); + handleAllErrors(Imported.takeError(), + [&ErrorText](const ASTImportError &Err) { + ErrorText = Err.message(); + }); return testing::AssertionFailure() << "Import failed, error: \"" << ErrorText << "\"!"; } @@ -437,7 +438,7 @@ template ::testing::AssertionResult isImportError(llvm::Expected &ValOrErr, - ImportError::ErrorKind Kind) { + ASTImportError::ErrorKind Kind) { if (ValOrErr) { return ::testing::AssertionFailure() << "Expected<> is expected to contain " "error but does contain value \"" @@ -446,7 +447,7 @@ std::ostringstream OS; bool Result = false; auto Err = llvm::handleErrors( - ValOrErr.takeError(), [&OS, &Result, Kind](clang::ImportError &IE) { + ValOrErr.takeError(), [&OS, &Result, Kind](clang::ASTImportError &IE) { if (IE.Error == Kind) { Result = true; OS << "Expected<> contains an ImportError " << IE.toString(); diff --git a/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp b/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp --- a/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp +++ b/clang/unittests/AST/ASTImporterODRStrategiesTest.cpp @@ -290,7 +290,7 @@ // Check that a Decl was not imported because of NameConflict. static void CheckImportNameConflict(llvm::Expected &Result, Decl *ToTU, Decl *ToD) { - EXPECT_TRUE(isImportError(Result, ImportError::NameConflict)); + EXPECT_TRUE(isImportError(Result, ASTImportError::NameConflict)); EXPECT_EQ(DeclCounter().match(ToTU, getPattern()), 1u); } diff --git a/clang/unittests/AST/ASTImporterTest.cpp b/clang/unittests/AST/ASTImporterTest.cpp --- a/clang/unittests/AST/ASTImporterTest.cpp +++ b/clang/unittests/AST/ASTImporterTest.cpp @@ -3178,8 +3178,8 @@ auto ToBlockOrError = importOrError(FromBlock, Lang_CXX03); - const auto ExpectUnsupportedConstructError = [](const ImportError &Error) { - EXPECT_EQ(ImportError::UnsupportedConstruct, Error.Error); + const auto ExpectUnsupportedConstructError = [](const ASTImportError &Error) { + EXPECT_EQ(ASTImportError::UnsupportedConstruct, Error.Error); }; llvm::handleAllErrors(ToBlockOrError.takeError(), ExpectUnsupportedConstructError); @@ -5435,9 +5435,9 @@ // But an error is set to the counterpart in the "from" context. ASTImporter *Importer = findFromTU(FromSpec)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromSpec); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromSpec); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::NameConflict); + EXPECT_EQ(OptErr->Error, ASTImportError::NameConflict); } // Check a case when a new AST node is created but not linked to the AST before @@ -5459,9 +5459,9 @@ 0u); ASTImporter *Importer = findFromTU(FromFoo)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromFoo); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromFoo); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); } // Check a case when a new AST node is created and linked to the AST before @@ -5492,12 +5492,13 @@ // An error is set to the counterpart in the "from" context both for the fwd // decl and the definition. ASTImporter *Importer = findFromTU(FromProto)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromProto); + Optional OptErr = + Importer->getImportDeclErrorIfAny(FromProto); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); OptErr = Importer->getImportDeclErrorIfAny(FromDef); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); } // An error should be set for a class if we cannot import one member. @@ -5517,16 +5518,16 @@ // An error is set for X. EXPECT_FALSE(ImportedX); ASTImporter *Importer = findFromTU(FromX)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); // An error is set for f(). auto *FromF = FirstDeclMatcher().match( FromTU, cxxMethodDecl(hasName("f"))); OptErr = Importer->getImportDeclErrorIfAny(FromF); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); // And any subsequent import should fail. CXXMethodDecl *ImportedF = Import(FromF, Lang_CXX03); EXPECT_FALSE(ImportedF); @@ -5584,7 +5585,7 @@ // An error is set to the templated CXXRecordDecl of F. ASTImporter *Importer = findFromTU(FromFRD)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromFRD); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromFRD); EXPECT_TRUE(OptErr); // An error is set to A. @@ -5642,7 +5643,7 @@ // There is no error set for X. EXPECT_TRUE(ImportedX); ASTImporter *Importer = findFromTU(FromX)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); ASSERT_FALSE(OptErr); // An error is set for f(). @@ -5650,7 +5651,7 @@ FromTU, functionDecl(hasName("f"))); OptErr = Importer->getImportDeclErrorIfAny(FromF); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); // And any subsequent import should fail. FunctionDecl *ImportedF = Import(FromF, Lang_CXX03); EXPECT_FALSE(ImportedF); @@ -5721,18 +5722,18 @@ // An error is set for X ... EXPECT_FALSE(ImportedX); ASTImporter *Importer = findFromTU(FromX)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); } // ... but the node had been created. auto *ToXDef = FirstDeclMatcher().match( ToTU, cxxRecordDecl(hasName("X"), isDefinition())); // An error is set for "ToXDef" in the shared state. - Optional OptErr = + Optional OptErr = SharedStatePtr->getImportDeclErrorIfAny(ToXDef); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); auto *ToXFwd = FirstDeclMatcher().match( ToTU, cxxRecordDecl(hasName("X"), unless(isDefinition()))); @@ -5764,10 +5765,10 @@ // The import should fail. EXPECT_FALSE(ImportedX); ASTImporter *Importer = findFromTU(FromX)->Importer.get(); - Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromX); // And an error is set for this new X in the "from" ctx. ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); } } @@ -5804,9 +5805,9 @@ EXPECT_FALSE(Import(FromFooA, Lang_CXX11)); ASTImporter *Importer = findFromTU(FromFooA)->Importer.get(); auto CheckError = [&Importer](Decl *FromD) { - Optional OptErr = Importer->getImportDeclErrorIfAny(FromD); + Optional OptErr = Importer->getImportDeclErrorIfAny(FromD); ASSERT_TRUE(OptErr); - EXPECT_EQ(OptErr->Error, ImportError::UnsupportedConstruct); + EXPECT_EQ(OptErr->Error, ASTImportError::UnsupportedConstruct); }; CheckError(FromFooA); EXPECT_FALSE(Import(FromFooB, Lang_CXX11));