esakella created this revision. esakella added reviewers: rsmith, klimek, bkramer. esakella added subscribers: cfe-commits, karies.
Before this change the errors produced by the ASTImporter when trying to import an unsupported ASTNode where produced through the DiagnosticsEngine of the FromContext. However when running clang with the -verify option, (like in this test), the VerifyDiagnosticConsumer was expecting the DiagnosticsEngine from the ToContext. This was leading to a test like this one being considered successful despite emitting an error because the error was not being "caught". http://reviews.llvm.org/D17026 Files: lib/AST/ASTImporter.cpp test/ASTMerge/Inputs/accessSpecDeclImport1.cpp test/ASTMerge/Inputs/accessSpecDeclImport2.cpp test/ASTMerge/accessSpecDeclImport.cpp Index: test/ASTMerge/accessSpecDeclImport.cpp =================================================================== --- /dev/null +++ test/ASTMerge/accessSpecDeclImport.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/accessSpecDeclImport1.cpp +// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/accessSpecDeclImport2.cpp +// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -verify %s +// expected-no-diagnostics Index: test/ASTMerge/Inputs/accessSpecDeclImport2.cpp =================================================================== --- /dev/null +++ test/ASTMerge/Inputs/accessSpecDeclImport2.cpp @@ -0,0 +1,4 @@ +class B { + public: + int a; + }; Index: test/ASTMerge/Inputs/accessSpecDeclImport1.cpp =================================================================== --- /dev/null +++ test/ASTMerge/Inputs/accessSpecDeclImport1.cpp @@ -0,0 +1,4 @@ +class B { + public: + int a; + }; Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -1473,7 +1473,7 @@ //---------------------------------------------------------------------------- QualType ASTNodeImporter::VisitType(const Type *T) { - Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node) + Importer.ToDiag(SourceLocation(), diag::err_unsupported_ast_node) << T->getTypeClassName(); return QualType(); } @@ -2302,7 +2302,7 @@ } Decl *ASTNodeImporter::VisitDecl(Decl *D) { - Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node) + Importer.ToDiag(SourceLocation(), diag::err_unsupported_ast_node) << D->getDeclKindName(); return nullptr; }
Index: test/ASTMerge/accessSpecDeclImport.cpp =================================================================== --- /dev/null +++ test/ASTMerge/accessSpecDeclImport.cpp @@ -0,0 +1,4 @@ +// RUN: %clang_cc1 -emit-pch -o %t.1.ast %S/Inputs/accessSpecDeclImport1.cpp +// RUN: %clang_cc1 -emit-pch -o %t.2.ast %S/Inputs/accessSpecDeclImport2.cpp +// RUN: %clang_cc1 -ast-merge %t.1.ast -ast-merge %t.2.ast -fsyntax-only -verify %s +// expected-no-diagnostics Index: test/ASTMerge/Inputs/accessSpecDeclImport2.cpp =================================================================== --- /dev/null +++ test/ASTMerge/Inputs/accessSpecDeclImport2.cpp @@ -0,0 +1,4 @@ +class B { + public: + int a; + }; Index: test/ASTMerge/Inputs/accessSpecDeclImport1.cpp =================================================================== --- /dev/null +++ test/ASTMerge/Inputs/accessSpecDeclImport1.cpp @@ -0,0 +1,4 @@ +class B { + public: + int a; + }; Index: lib/AST/ASTImporter.cpp =================================================================== --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -1473,7 +1473,7 @@ //---------------------------------------------------------------------------- QualType ASTNodeImporter::VisitType(const Type *T) { - Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node) + Importer.ToDiag(SourceLocation(), diag::err_unsupported_ast_node) << T->getTypeClassName(); return QualType(); } @@ -2302,7 +2302,7 @@ } Decl *ASTNodeImporter::VisitDecl(Decl *D) { - Importer.FromDiag(D->getLocation(), diag::err_unsupported_ast_node) + Importer.ToDiag(SourceLocation(), diag::err_unsupported_ast_node) << D->getDeclKindName(); return nullptr; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits