martong added inline comments.

================
Comment at: lib/AST/ASTImporter.cpp:2858
+
+  // Templated declarations should never appear in the enclosing DeclContext.
+  if (!D->getDescribedVarTemplate())
----------------
In case of class templates, the explicit instantiation is the member of the 
DeclContext. It does not belong to the DeclContext only in case of implicit 
instantiations.
I suppose the same is true for template variables as well.
In our code base we fixed it by checking on the TSK_ kind, see 
https://github.com/Ericsson/clang/pull/270/files.

@xazax.hun perhaps we should open source some of our fixes as well?


================
Comment at: lib/AST/ASTImporter.cpp:4455
     D2->setLexicalDeclContext(LexicalDC);
     LexicalDC->addDeclInternal(D2);
+
----------------
This is related to my other comment, perhaps we should not add `D2` to the 
DeclContext unconditionnally. I think only implicit instantiations should be 
added. See
https://github.com/Ericsson/clang/pull/270/files


Repository:
  rC Clang

https://reviews.llvm.org/D43012



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to