Commit Graph

6 Commits

Author SHA1 Message Date
Richard Smith a6e8d5e554 PR40642: Fix determination of whether the final statement of a statement
expression is a discarded-value expression.

Summary:
We used to get this wrong in three ways:

1) During parsing, an expression-statement followed by the }) ending a
   statement expression was always treated as producing the value of the
   statement expression. That's wrong for ({ if (1) expr; })
2) During template instantiation, various kinds of statement (most
   statements not appearing directly in a compound-statement) were not
   treated as discarded-value expressions, resulting in missing volatile
   loads (etc).
3) In all contexts, an expression-statement with attributes was not
   treated as producing the value of the statement expression, eg
   ({ [[attr]] expr; }).

Also fix incorrect enforcement of OpenMP rule that directives can "only
be placed in the program at a position where ignoring or deleting the
directive would result in a program with correct syntax". In particular,
a label (be it goto, case, or default) should not affect whether
directives are permitted.

Reviewers: aaron.ballman, rjmccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D57984

llvm-svn: 354090
2019-02-15 00:27:53 +00:00
Alexey Bataev 185e88d997 [OPENMP]Fix PR40191: Do not allow orphaned cancellation constructs.
Prohibited use of the orphaned cancellation directives.

llvm-svn: 350634
2019-01-08 15:53:42 +00:00
Alexey Bataev a8a9153a37 [OPENMP] Support for -fopenmp-simd option with compilation of simd loops
only.

Added support for -fopenmp-simd option that allows compilation of
simd-based constructs without emission of OpenMP runtime calls.

llvm-svn: 321560
2017-12-29 18:07:07 +00:00
Jonas Hahnfeld 64a9e3c530 [OpenMP] Generate better diagnostics for cancel and cancellation point
checkNestingOfRegions uses CancelRegion to determine whether cancel and
cancellation point are valid in the given nesting. This leads to unuseful
diagnostics if CancelRegion is invalid. The given test case has produced:
  region cannot be closely nested inside 'parallel' region

As a solution, introduce checkCancelRegion and call it first to get the
expected error:
  one of 'for', 'parallel', 'sections' or 'taskgroup' is expected

Differential Revision: https://reviews.llvm.org/D30135

llvm-svn: 295808
2017-02-22 06:49:10 +00:00
Alexey Bataev c4fad65bfc [OPENMP] Fix for declarative/standalone directives use.
Fixes processing of declarative directives and standalone executable directives. Declarative directives should not be allowed as an immediate statements and standalone executable directives are allowed to be used in case-stmt constructs.

llvm-svn: 257586
2016-01-13 11:18:54 +00:00
Alexey Bataev 6d4ed05830 [OPENMP 4.0] Initial support for 'omp cancellation point' construct.
Add parsing and sema analysis for 'omp cancellation point' directive.

llvm-svn: 241145
2015-07-01 06:57:41 +00:00