diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:49 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:50:49 +0000 |
commit | 2298981669bf3bd63335a4be179bc0f96823a8f4 (patch) | |
tree | 1cbe2eb27f030d2d70b80ee5ca3c86bee7326a9f /lib/AST/StmtOpenMP.cpp | |
parent | 9a83721404652cea39e9f02ae3e3b5c964602a5c (diff) | |
download | src-2298981669bf3bd63335a4be179bc0f96823a8f4.tar.gz src-2298981669bf3bd63335a4be179bc0f96823a8f4.zip |
Vendor import of stripped clang trunk r366426 (just before thevendor/clang/clang-trunk-r366426
release_90 branch point):
https://llvm.org/svn/llvm-project/cfe/trunk@366426
Notes
Notes:
svn path=/vendor/clang/dist/; revision=351280
svn path=/vendor/clang/clang-trunk-r366426/; revision=351281; tag=vendor/clang/clang-trunk-r366426
Diffstat (limited to 'lib/AST/StmtOpenMP.cpp')
-rw-r--r-- | lib/AST/StmtOpenMP.cpp | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/AST/StmtOpenMP.cpp b/lib/AST/StmtOpenMP.cpp index 85a2daa0801a..4e829897cebe 100644 --- a/lib/AST/StmtOpenMP.cpp +++ b/lib/AST/StmtOpenMP.cpp @@ -1,9 +1,8 @@ //===--- StmtOpenMP.cpp - Classes for OpenMP directives -------------------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // @@ -23,6 +22,25 @@ void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) { std::copy(Clauses.begin(), Clauses.end(), getClauses().begin()); } +bool OMPExecutableDirective::isStandaloneDirective() const { + // Special case: 'omp target enter data', 'omp target exit data', + // 'omp target update' are stand-alone directives, but for implementation + // reasons they have empty synthetic structured block, to simplify codegen. + if (isa<OMPTargetEnterDataDirective>(this) || + isa<OMPTargetExitDataDirective>(this) || + isa<OMPTargetUpdateDirective>(this)) + return true; + return !hasAssociatedStmt() || !getAssociatedStmt(); +} + +const Stmt *OMPExecutableDirective::getStructuredBlock() const { + assert(!isStandaloneDirective() && + "Standalone Executable Directives don't have Structured Blocks."); + if (auto *LD = dyn_cast<OMPLoopDirective>(this)) + return LD->getBody(); + return getInnermostCapturedStmt()->getCapturedStmt(); +} + void OMPLoopDirective::setCounters(ArrayRef<Expr *> A) { assert(A.size() == getCollapsedNumber() && "Number of loop counters is not the same as the collapsed number"); |