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

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
2048

VAT? Do you mean VLA?

lib/AST/Decl.cpp
3286

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

3569

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

lib/CodeGen/CGStmt.cpp
2195

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

Generally looks good. A few comments inline.

include/clang/AST/Stmt.h
1989

Leave a comma after the last enumerator, please.

lib/AST/Decl.cpp
3286

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.

3569

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
1989

Ok

2048

No, VAT. See above: VariableArrayType - VAT.

lib/AST/Decl.cpp
3286

Ok

3569

Ok, I'll rework this.

lib/CodeGen/CGStmt.cpp
2195

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

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).