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
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
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
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
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
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
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
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
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.
==
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
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
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
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,
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
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
15 matches
Mail list logo