This is an archive of the discontinued LLVM Phabricator instance.

[AST] Fix the CXXFoldExpr source range when parentheses range is invalid.
ClosedPublic

Authored by hokein on Aug 10 2020, 6:11 AM.

Details

Summary

The CXXFoldExpr's range is invalid if the cxxfoldexpr is formed via the
Concept's TypeContraints (because the parentheses are not written in the
source code). We fallback to use the range from the pattern.

Diff Detail

Event Timeline

hokein created this revision.Aug 10 2020, 6:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 10 2020, 6:11 AM
hokein requested review of this revision.Aug 10 2020, 6:11 AM
nridge added inline comments.Aug 10 2020, 9:36 PM
clang/include/clang/AST/ExprCXX.h
4589

Wouldn't EllipsisLoc be more accurate?

clang/test/AST/ast-dump-concepts.cpp
16

naming suggestion: variadic_concept?

hokein updated this revision to Diff 284592.Aug 11 2020, 12:19 AM
hokein marked an inline comment as done.

address review comments.

clang/include/clang/AST/ExprCXX.h
4589

yeah, that sounds more reasonable.

nridge accepted this revision.Aug 11 2020, 10:34 PM
nridge added inline comments.
clang/include/clang/AST/ExprCXX.h
4582

Can this case (left fold and no parenthesis) ever happen? It would be interesting to see an example.

This revision is now accepted and ready to land.Aug 11 2020, 10:34 PM
hokein added inline comments.Aug 12 2020, 12:20 AM
clang/include/clang/AST/ExprCXX.h
4582

I think in theory it should not happen. Doing it here is for completeness, it seems a bit odd we only do the change for getEndLoc.