[cfe-commits] r96516 - /cfe/trunk/lib/AST/ASTImporter.cpp

Douglas Gregor dgregor at apple.com
Wed Feb 17 13:22:52 PST 2010


Author: dgregor
Date: Wed Feb 17 15:22:52 2010
New Revision: 96516

URL: http://llvm.org/viewvc/llvm-project?rev=96516&view=rev
Log:
Implement AST importing of ImplicitParamDecls, despite the sad fact
that we can't test it yet.

Modified:
    cfe/trunk/lib/AST/ASTImporter.cpp

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

==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Wed Feb 17 15:22:52 2010
@@ -92,6 +92,7 @@
     Decl *VisitFieldDecl(FieldDecl *D);
     Decl *VisitObjCIvarDecl(ObjCIvarDecl *D);
     Decl *VisitVarDecl(VarDecl *D);
+    Decl *VisitImplicitParamDecl(ImplicitParamDecl *D);
     Decl *VisitParmVarDecl(ParmVarDecl *D);
     Decl *VisitObjCMethodDecl(ObjCMethodDecl *D);
     Decl *VisitObjCProtocolDecl(ObjCProtocolDecl *D);
@@ -1989,6 +1990,32 @@
   return ToVar;
 }
 
+Decl *ASTNodeImporter::VisitImplicitParamDecl(ImplicitParamDecl *D) {
+  // Parameters are created in the translation unit's context, then moved
+  // into the function declaration's context afterward.
+  DeclContext *DC = Importer.getToContext().getTranslationUnitDecl();
+  
+  // Import the name of this declaration.
+  DeclarationName Name = Importer.Import(D->getDeclName());
+  if (D->getDeclName() && !Name)
+    return 0;
+  
+  // Import the location of this declaration.
+  SourceLocation Loc = Importer.Import(D->getLocation());
+  
+  // Import the parameter's type.
+  QualType T = Importer.Import(D->getType());
+  if (T.isNull())
+    return 0;
+  
+  // Create the imported parameter.
+  ImplicitParamDecl *ToParm
+    = ImplicitParamDecl::Create(Importer.getToContext(), DC,
+                                Loc, Name.getAsIdentifierInfo(),
+                                T);
+  return Importer.Imported(D, ToParm);
+}
+
 Decl *ASTNodeImporter::VisitParmVarDecl(ParmVarDecl *D) {
   // Parameters are created in the translation unit's context, then moved
   // into the function declaration's context afterward.





More information about the cfe-commits mailing list