[PATCH] D26904: [astimporter] Support importing CXXDependentScopeMemberExpr and FunctionTemplateDecl

Sean Callanan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 13:40:56 PST 2016


spyffe requested changes to this revision.
spyffe added a comment.
This revision now requires changes to proceed.

There are several missing imports here, as well as a few minor nits.
If the unit test cases aren't catching these, I'm a little concerned.  We should be catching this.
Also we should definitely test that bodies of function templates (in particular, bodies that use the template arguments) get imported properly.



================
Comment at: lib/AST/ASTImporter.cpp:2327
+void ASTNodeImporter::ImportAttributes(Decl *From, Decl *To) {
+  for (Decl::attr_iterator I = From->attr_begin(), E = From->attr_end(); I != E;
+       ++I) {
----------------
Would
```
for (Attr *A : From->atrs()) {
```
work in this case?


================
Comment at: lib/AST/ASTImporter.cpp:3564
+
+  FunctionTemplateDecl *ToFunc = FunctionTemplateDecl::Create(
+      Importer.getToContext(), DC, Loc, Name, Params, TemplatedFD);
----------------
You didn't import `TemplatedFD` before installing it in `ToFunc`.  This code is broken, and we should make sure the unit tests know to catch these cases.


================
Comment at: lib/AST/ASTImporter.cpp:6482
+  return CXXDependentScopeMemberExpr::Create(Importer.getToContext(),
+                                             Base, BaseType,
+                                             E->isArrow(),
----------------
You're installing `Base` and `BaseType` without importing them, as well as all the `Loc`s.


https://reviews.llvm.org/D26904





More information about the cfe-commits mailing list