[PATCH] D17026: Changed ASTImporter DiagnosticsEngine from FromDiag to ToDiag for unsupported ASTNodes Import.
Elisavet Sakellari via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 9 06:49:55 PST 2016
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;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17026.47313.patch
Type: text/x-patch
Size: 1709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160209/bbe20e30/attachment.bin>
More information about the cfe-commits
mailing list