This is an archive of the discontinued LLVM Phabricator instance.

[clang][OpenMP5.1] Initial parsing/sema for 'indirect' clause
ClosedPublic

Authored by jyu2 on Jan 6 2022, 12:37 PM.

Details

Summary

Added basic parsing/sema/ support for the 'indirect' clause.

Diff Detail

Event Timeline

jyu2 created this revision.Jan 6 2022, 12:37 PM
Herald added a project: Restricted Project. · View Herald Transcript
jyu2 requested review of this revision.Jan 6 2022, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 6 2022, 12:37 PM
ABataev added inline comments.Jan 6 2022, 2:02 PM
clang/include/clang/Sema/Sema.h
10338

Can you use Optional<Expr *> instead of Expr * and bool?

clang/lib/Parse/ParseOpenMP.cpp
1862

/*ParseOnly=*/

3427

I assume it shall be set only if Actions.ActOnOpenMPIndirectClause is successful.

clang/lib/Sema/SemaOpenMP.cpp
15732

I assume it shall return ExprResult

15747–15748

Is this correct? Does Sema::ActOnOpenMPIndirectClause is supposed to be failed if Result is false?

jyu2 updated this revision to Diff 398043.Jan 6 2022, 8:24 PM

Address Alexey's comments.

jyu2 added a comment.Jan 6 2022, 8:25 PM

Thanks Alexey for the code review.

clang/include/clang/Sema/Sema.h
10338

Good to know. Changed. Thank you so much!!!!

clang/lib/Parse/ParseOpenMP.cpp
1862

Sorry changed.

3427

The IdirectExpr is user Expression and use for AST dump. Indirect is one which is set after ActOpenMPIndirectClause.

BTW the indirect[(invoked-by-fptr)]
where invoked-by-fptr is a constant boolean expression that evaluates to true or false at compile time.

clang/lib/Sema/SemaOpenMP.cpp
15732

Add check inside ParseOpenMPIndirectClause instead.

15747–15748

This is only set for IsIndirect for DTCI which is for Indirect(true). The original expression is passed in IndirectExpr.
Since you suggest using optional<Expr *>, Rewrite it move the code inside ParseOpenMPIndirectClause

ABataev accepted this revision.Jan 7 2022, 7:05 AM

LG with a nit

clang/lib/Parse/ParseOpenMP.cpp
1844

Formatting

This revision is now accepted and ready to land.Jan 7 2022, 7:05 AM
jyu2 updated this revision to Diff 398249.Jan 7 2022, 3:05 PM

Fix format problem.