[cfe-commits] r95706 - in /cfe/trunk: include/clang/Basic/DiagnosticASTKinds.td lib/AST/ASTImporter.cpp

Douglas Gregor dgregor at apple.com
Tue Feb 9 14:48:33 PST 2010


Author: dgregor
Date: Tue Feb  9 16:48:33 2010
New Revision: 95706

URL: http://llvm.org/viewvc/llvm-project?rev=95706&view=rev
Log:
Complain about types and declarations that we don't know how to import.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
    cfe/trunk/lib/AST/ASTImporter.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td?rev=95706&r1=95705&r2=95706&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticASTKinds.td Tue Feb  9 16:48:33 2010
@@ -34,4 +34,5 @@
   "external variable %0 defined in multiple translation units">;
 def note_odr_value_here : Note<"declared here with type %0">;
 def note_odr_defined_here : Note<"also defined here">;
+def err_unsupported_ast_node: Error<"cannot import unsupported AST node %0">;
 }

Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=95706&r1=95705&r2=95706&view=diff

==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Tue Feb  9 16:48:33 2010
@@ -33,6 +33,7 @@
     using DeclVisitor<ASTNodeImporter, Decl *>::Visit;
 
     // Importing types
+    QualType VisitType(Type *T);
     QualType VisitBuiltinType(BuiltinType *T);
     QualType VisitComplexType(ComplexType *T);
     QualType VisitPointerType(PointerType *T);
@@ -68,6 +69,7 @@
     QualType VisitObjCObjectPointerType(ObjCObjectPointerType *T);
                             
     // Importing declarations
+    Decl *VisitDecl(Decl *D);
     Decl *VisitVarDecl(VarDecl *D);
   };
 }
@@ -76,6 +78,12 @@
 // Import Types
 //----------------------------------------------------------------------------
 
+QualType ASTNodeImporter::VisitType(Type *T) {
+  Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node)
+    << T->getTypeClassName();
+  return QualType();
+}
+
 QualType ASTNodeImporter::VisitBuiltinType(BuiltinType *T) {
   switch (T->getKind()) {
   case BuiltinType::Void: return Importer.getToContext().VoidTy;
@@ -435,6 +443,12 @@
 //----------------------------------------------------------------------------
 // Import Declarations
 //----------------------------------------------------------------------------
+Decl *ASTNodeImporter::VisitDecl(Decl *D) {
+  Importer.FromDiag(SourceLocation(), diag::err_unsupported_ast_node)
+    << D->getDeclKindName();
+  return 0;
+}
+
 Decl *ASTNodeImporter::VisitVarDecl(VarDecl *D) {
   // Import the context of this declaration.
   DeclContext *DC = Importer.ImportContext(D->getDeclContext());





More information about the cfe-commits mailing list