This is an archive of the discontinued LLVM Phabricator instance.

Improved capturing variable-length array types in CapturedStmt.
ClosedPublic

Authored by ABataev on Aug 28 2014, 6:11 AM.

Details

Summary

An updated implemnentation of VLA types capturing based on previously committed solution for Lambdas.
This version captures the whole VLA type instead of particular variables which are part of VLA size expression and allows to use previusly calculated size of VLA type in captured regions. Required for OpenMP.

Diff Detail

Repository
rL LLVM

Event Timeline

ABataev updated this revision to Diff 13030.Aug 28 2014, 6:11 AM
ABataev retitled this revision from to Improved capturing variable-length array types in CapturedStmt..
ABataev updated this object.
ABataev edited the test plan for this revision. (Show Details)
ABataev added a subscriber: Unknown Object (MLST).
hfinkel added inline comments.Oct 7 2014, 7:33 AM
include/clang/AST/Stmt.h
2044 ↗(On Diff #13030)

VAT? Do you mean VLA?

lib/AST/Decl.cpp
3274 ↗(On Diff #13030)

Calling this function here seems confusing because this has nothing to do with VLAs.

3564 ↗(On Diff #13030)

Is testing the source location really necessary here? That seems fragile.

lib/CodeGen/CGStmt.cpp
2161 ↗(On Diff #13030)

Why not use Loc (S.getLocStart()) as the source location?

Generally looks good. A few comments inline.

include/clang/AST/Stmt.h
1985 ↗(On Diff #13030)

Leave a comma after the last enumerator, please.

lib/AST/Decl.cpp
3274 ↗(On Diff #13030)

It's because we're reusing the same member to store

  • C++11 in-class initializer expressions
  • bitfield width expressions
  • lambda and captured-statement captured VariableArrayType*s

However, this is getting out of hand. Querying this should be efficient. I'm committing a patch to fix this; you'll have to rebase some of this patch on top of that.

3564 ↗(On Diff #13030)

I agree, there is absolutely no reason to be doing this. If you need a bit to store that this is a capture record, find a bit to use. Or set an attribute.

Hal, John, Many thanks for the review!

include/clang/AST/Stmt.h
1985 ↗(On Diff #13030)

Ok

2044 ↗(On Diff #13030)

No, VAT. See above: VariableArrayType - VAT.

lib/AST/Decl.cpp
3274 ↗(On Diff #13030)

Ok

3564 ↗(On Diff #13030)

Ok, I'll rework this.

lib/CodeGen/CGStmt.cpp
2161 ↗(On Diff #13030)

Ok

ABataev updated this revision to Diff 15134.Oct 19 2014, 11:30 PM

Fixed after reviews

This looks great; one minor suggestion and it's good to go.

lib/AST/Decl.cpp
3572 ↗(On Diff #15134)

We don't actually need or want to support removing this, so there's no point in taking a parameter.

Ok, will remove it

Best regards,

Alexey Bataev

Software Engineer
Intel Compiler Team

20.10.2014 22:09, John McCall пишет:

This looks great; one minor suggestion and it's good to go.

Comment at: lib/AST/Decl.cpp:3572
@@ +3571,3 @@
+
+void RecordDecl::setCapturedRecord(bool CapRec) {

+ if (CapRec)

We don't actually need or want to support removing this, so there's no point in taking a parameter.

http://reviews.llvm.org/D5099

ABataev updated this revision to Diff 15164.Oct 20 2014, 8:22 PM

Removed parameter from setCapturedRecord() method.

ABataev closed this revision.Oct 29 2014, 5:32 AM
ABataev updated this revision to Diff 15546.

Closed by commit rL220850 (authored by @ABataev).