[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-12-16 Thread Akira Hatanaka via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL289990: [Sema] Transform the default arguments of a lambda expression when the (authored by ahatanak). Changed prior to commit: https://reviews.llvm.org/D23096?vs=81171&id=81787#toc Repository: rL LL

[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-12-13 Thread Serge Pavlov via Phabricator via cfe-commits
sepavloff accepted this revision. sepavloff added a comment. This revision is now accepted and ready to land. Looks good. Thank you! https://reviews.llvm.org/D23096 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bi

[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-12-12 Thread Akira Hatanaka via Phabricator via cfe-commits
ahatanak updated this revision to Diff 81171. ahatanak added a comment. Rebase and ping. https://reviews.llvm.org/D23096 Files: lib/Sema/SemaTemplate.cpp lib/Sema/SemaTemplateInstantiate.cpp lib/Sema/TreeTransform.h test/SemaCXX/vartemplate-lambda.cpp test/SemaTemplate/default-expr-ar

[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-11-11 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 77691. ahatanak added a comment. - Transform uninstantiated default arguments Exprs in TreeTransform::TransformLambdaExpr. - In default-expr-arguments-3.cpp, check that there are no crashes or diagnostics emitted instead of printing the AST. https://revie

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-11-10 Thread Serge Pavlov via cfe-commits
I don't see any reason why we should adhere particular solution. If you can solve the problem with another approach, please go forward. Thanks, --Serge 2016-11-10 10:12 GMT+07:00 Akira Hatanaka : > ahatanak added a comment. > > Do you think we can transform the Exprs for the uninstantiated defau

[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-11-09 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. Do you think we can transform the Exprs for the uninstantiated default arguments in TreeTransform::TransformLambdaExpr? I guess it would be much simpler than trying to make getTemplateInstantiationArgs return the correct template arguments. https://reviews.llvm.org/D

[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-10-05 Thread Serge Pavlov via cfe-commits
sepavloff added a comment. IIUC, the problem is observed because `Sema::getTemplateInstantiationArgs` does not handle the case of variable templates properly. Classes and functions are declaration contexts and implementation of the aforementioned function (and probably others) relies on this fa

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-09-23 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 72356. ahatanak added a comment. I agree that extending the logic of getTemplateInstantiationArgs seems like a better approach. I changed Sema::getTemplateInstantiationArgs to search for the template arguments twice, first for the initializer's template arg

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-09-06 Thread Serge Pavlov via cfe-commits
sepavloff added inline comments. Comment at: include/clang/Sema/Sema.h:6619 @@ -6618,1 +6618,3 @@ + ArrayRef varTemplateArguments() const; + I would propose to use something like 'getVarTemplateArguments' to make the name more similar to other methods. ==

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-08-15 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 68078. ahatanak added a comment. Fix Sema::getTemplateInstantiationArgs to return the template instantiation args when variable templates are being instantiated. https://reviews.llvm.org/D23096 Files: include/clang/Sema/Sema.h lib/Sema/SemaTemplate.cp

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-08-10 Thread Akira Hatanaka via cfe-commits
ahatanak updated this revision to Diff 67623. ahatanak added a comment. Handle the case in which the enum is declared inside a member function and add test cases. The variable template test case still crashes. It looks like it crashes whenever the lambda expression takes a default argument: te

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-08-03 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. In each of these cases, "foo::a" is a non-dependent type, so it seems that clang shouldn't use DependentScopeDeclRefExpr or CXXDependentScopeMemberExpr in the AST when the template definitions are parsed. https://reviews.llvm.org/D23096

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-08-03 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment. OK, I'll add the test. When I apply this patch and compile your test, I see DependentScopeDeclRefExpr gets converted to DeclRefExpr when the function is instantiated. This doesn't happen without this patch, but somehow clang still manages to emit the same code. Also,

Re: [PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-08-03 Thread Serge Pavlov via cfe-commits
sepavloff added inline comments. Comment at: test/SemaTemplate/default-expr-arguments-3.cpp:20 @@ +19,2 @@ + } +} Please add the following test to the patch: ``` template void f1() { enum class foo { a, b }; struct S { int g1(foo n = foo::a); }; } temp

[PATCH] D23096: [Sema] Pass CombineWithOuterScope = true to constructor of LocalInstantiationScope

2016-08-02 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision. ahatanak added reviewers: rsmith, sepavloff. ahatanak added a subscriber: cfe-commits. This fixes PR28795. https://llvm.org/bugs/show_bug.cgi?id=28795 Sema wasn't replacing DependentScopeDeclRefExpr with DeclRefExpr during template instantiation of the default ar