aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/ParseOpenMP.cpp
AgeCommit message (Collapse)AuthorFilesLines
2023-01-20Add Parse/Sema for iterator for map clause.Doru Bercea1-2/+21
2023-01-14[clang] Use std::optional instead of llvm::Optional (NFC)Kazu Hirata1-4/+4
This patch replaces (llvm::|)Optional< with std::optional<. I'll post a separate patch to remove #include "llvm/ADT/Optional.h". This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2023-01-14[clang] Add #include <optional> (NFC)Kazu Hirata1-0/+1
This patch adds #include <optional> to those files containing llvm::Optional<...> or Optional<...>. I'll post a separate patch to actually replace llvm::Optional with std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-17llvm::Optional::value => operator*/operator->Fangrui Song1-9/+9
std::optional::value() has undesired exception checking semantics and is unavailable in older Xcode (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS). The call sites block std::optional migration. This makes `ninja clang` work in the absence of llvm::Optional::value.
2022-12-12[OpenMP] Basic parse and sema support for modifiers in order clauseChi Chun Chen1-3/+33
This patch gives basic parsing and semantic support for "modifiers" of order clause introduced in OpenMP 5.1 ( section 2.11.3 ) Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D127855
2022-12-03[clang] Use std::nullopt instead of None (NFC)Kazu Hirata1-2/+2
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional. This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-11-21parse: process GNU and standard attributes on top-level declsSaleem Abdulrasool1-1/+2
We would previously reject valid input where GNU attributes preceded the standard attributes on top-level declarations. A previous attribute handling change had begun rejecting this whilst GCC does honour this layout. In practice, this breaks use of `extern "C"` attributed functions which use both standard and GNU attributes as experienced by the Swift runtime. Objective-C deserves an honourable mention for requiring some additional special casing. Because attributes on declarations and definitions differ in semantics, we need to replicate some of the logic for detecting attributes to declarations to which they appertain cannot be attributed. This should match the existing case for the application of GNU attributes to interfaces, protocols, and implementations. Take the opportunity to split out the tooling tests into two cases: ones which process macros and ones which do not. Special thanks to Aaron Ballman for the many hints and extensive rubber ducking that was involved in identifying the various places where we accidentally dropped attributes. Differential Revision: https://reviews.llvm.org/D137979 Fixes: #58229 Reviewed By: aaron.ballman, arphaman
2022-11-18[OPENMP5.1] Initial support for message clause.Jennifer Yu1-0/+3
2022-11-18[OpenMP] Initial parsing/sema for 'strict' modifier with 'num_tasks' clauseFazlay Rabbi1-2/+29
This patch gives basic parsing and semantic analysis support for 'strict' modifier with 'num_tasks' clause of 'taskloop' construct introduced in OpenMP 5.1 (section 2.12.2) Differential Revision: https://reviews.llvm.org/D138328
2022-11-18[Clang][OpenMP] Add support for default to/from map types on target ↵Doru Bercea1-0/+6
enter/exit data
2022-11-17[OpenMP] Initial parsing/sema for 'strict' modifier with 'grainsize' clauseFazlay Rabbi1-1/+31
This patch gives basic parsing and semantic analysis support for 'strict' modifier with 'grainsize' clause of 'taskloop' construct introduced in OpenMP 5.1 (section 2.12.2) Differential Revision: https://reviews.llvm.org/D138217
2022-11-18[clang][Parse][NFC] Remove unused CommaLocs parametersTimm Bäder1-5/+1
2022-11-17[OPENMP5.1] Initial support for severity clauseJennifer Yu1-1/+3
Differential Revision:https://reviews.llvm.org/D138227
2022-11-17Fix declare target implementation to support enter.Doru Bercea1-10/+29
2022-11-15[OPENMP]Initial support for at clauseJennifer Yu1-1/+51
Error directive is allowed in both declared and executable contexts. The function ActOnOpenMPAtClause is called in both places during the parsers. Adding a param "bool InExContext" to identify context which is used to emit error massage. Differential Revision: https://reviews.llvm.org/D137851
2022-11-02[OPENMP]Initial support for error directive.Jennifer Yu1-2/+4
Differential Revision: https://reviews.llvm.org/D137209
2022-08-22[OpenMP][NFC] Use OMPInteropInfo in the OMPDeclareVariantAttr attributeMike Rice1-16/+6
In preparation for allowing the prefer_type list in the append_args clause, use the OMPInteropInfo in the attribute for 'declare variant'. This requires adding a new Argument kind to the attribute code. This change adds a specific attribute to pass an array of OMPInteropInfo. It implements new tablegen needed to handle the interop-type part of the structure. When prefer_type is added, more work will be needed to dump, instantiate, and serialize the PreferTypes field in OMPInteropInfo. Differential Revision: https://reviews.llvm.org/D132270
2022-08-20Use range-based for loops (NFC)Kazu Hirata1-4/+4
2022-08-18[OpenMP][NFC] Refactor code for interop parts of 'init' and 'append_args' ↵Mike Rice1-109/+105
clauses The 'init' clause allows an interop-modifier of prefer_type(list) and and interop-types 'target' and 'targetsync'. The 'append_args' clause uses an append-op that also includes interop-types ('target' and 'targetsync') and will allow a prefer_type list in the next OpenMP version. This change adds a helper struct OMPInteropInfo and uses it in the parsing of both the 'init' and 'append_args' clauses. One OMPInteropInfo object represents the info in a single 'init' clause. Since 'append_args' allows a variable number of interop items it will require an array of OMPInteropInfo objects once that is supported. Differential Revision: https://reviews.llvm.org/D132171
2022-08-08[clang] LLVM_FALLTHROUGH => [[fallthrough]]. NFCFangrui Song1-4/+4
With C++17 there is no Clang pedantic warning or MSVC C5051. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D131346
2022-07-13[clang] Use value instead of getValue (NFC)Kazu Hirata1-9/+9
2022-07-01[OpenMP] Initial parsing and semantic support for 'parallel masked taskloop ↵Fazlay Rabbi1-1/+5
simd' construct This patch gives basic parsing and semantic support for "parallel masked taskloop simd" construct introduced in OpenMP 5.1 (section 2.16.10) Differential Revision: https://reviews.llvm.org/D128946
2022-06-30[OpenMP] Initial parsing and sema support for 'parallel masked taskloop' ↵Fazlay Rabbi1-0/+3
construct This patch gives basic parsing and semantic support for "parallel masked taskloop" construct introduced in OpenMP 5.1 (section 2.16.9) Differential Revision: https://reviews.llvm.org/D128834
2022-06-29[OpenMP] Add variant extension that applies to declarationsJoseph Huber1-0/+4
This patch adds a new extension to the `omp begin / end declare variant` support that causes it to apply to function declarations as well. This is explicitly not done in the standard, but can be useful in some situations so we should provide it as an extension. This will allow us to uniquely bind and overload existing definitions with a simple declaration using variants. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D124624
2022-06-28[OpenMP] Initial parsing and sema support for 'masked taskloop simd' constructFazlay Rabbi1-0/+3
This patch gives basic parsing and semantic support for "masked taskloop simd" construct introduced in OpenMP 5.1 (section 2.16.8) Differential Revision: https://reviews.llvm.org/D128693
2022-06-26[clang] Don't use Optional::hasValue (NFC)Kazu Hirata1-3/+3
This patch replaces x.hasValue() with x where x is contextually convertible to bool.
2022-06-25[clang] Don't use Optional::hasValue (NFC)Kazu Hirata1-1/+1
This patch replaces Optional::hasValue with the implicit cast to bool in conditionals only.
2022-06-25Revert "Don't use Optional::hasValue (NFC)"Kazu Hirata1-12/+15
This reverts commit aa8feeefd3ac6c78ee8f67bf033976fc7d68bc6d.
2022-06-25Don't use Optional::hasValue (NFC)Kazu Hirata1-15/+12
2022-06-24[OpenMP] Initial parsing and sema support for 'masked taskloop' constructFazlay Rabbi1-0/+3
This patch gives basic parsing and semantic support for "masked taskloop" construct introduced in OpenMP 5.1 (section 2.16.7) Differential Revision: https://reviews.llvm.org/D128478
2022-06-20[clang] Don't use Optional::getValue (NFC)Kazu Hirata1-2/+2
2022-06-20[clang] Don't use Optional::hasValue (NFC)Kazu Hirata1-2/+2
2022-06-16[OpenMP] Initial parsing and sema for 'parallel masked' constructJennifer Yu1-0/+3
Differential Revision: https://reviews.llvm.org/D127454
2022-06-15[clang] Reject non-declaration C++11 attributes on declarationsMartin Boehme1-1/+1
For backwards compatiblity, we emit only a warning instead of an error if the attribute is one of the existing type attributes that we have historically allowed to "slide" to the `DeclSpec` just as if it had been specified in GNU syntax. (We will call these "legacy type attributes" below.) The high-level changes that achieve this are: - We introduce a new field `Declarator::DeclarationAttrs` (with appropriate accessors) to store C++11 attributes occurring in the attribute-specifier-seq at the beginning of a simple-declaration (and other similar declarations). Previously, these attributes were placed on the `DeclSpec`, which made it impossible to reconstruct later on whether the attributes had in fact been placed on the decl-specifier-seq or ahead of the declaration. - In the parser, we propgate declaration attributes and decl-specifier-seq attributes separately until we can place them in `Declarator::DeclarationAttrs` or `DeclSpec::Attrs`, respectively. - In `ProcessDeclAttributes()`, in addition to processing declarator attributes, we now also process the attributes from `Declarator::DeclarationAttrs` (except if they are legacy type attributes). - In `ConvertDeclSpecToType()`, in addition to processing `DeclSpec` attributes, we also process any legacy type attributes that occur in `Declarator::DeclarationAttrs` (and emit a warning). - We make `ProcessDeclAttribute` emit an error if it sees any non-declaration attributes in C++11 syntax, except in the following cases: - If it is being called for attributes on a `DeclSpec` or `DeclaratorChunk` - If the attribute is a legacy type attribute (in which case we only emit a warning) The standard justifies treating attributes at the beginning of a simple-declaration and attributes after a declarator-id the same. Here are some relevant parts of the standard: - The attribute-specifier-seq at the beginning of a simple-declaration "appertains to each of the entities declared by the declarators of the init-declarator-list" (https://eel.is/c++draft/dcl.dcl#dcl.pre-3) - "In the declaration for an entity, attributes appertaining to that entity can appear at the start of the declaration and after the declarator-id for that declaration." (https://eel.is/c++draft/dcl.dcl#dcl.pre-note-2) - "The optional attribute-specifier-seq following a declarator-id appertains to the entity that is declared." (https://eel.is/c++draft/dcl.dcl#dcl.meaning.general-1) The standard contains similar wording to that for a simple-declaration in other similar types of declarations, for example: - "The optional attribute-specifier-seq in a parameter-declaration appertains to the parameter." (https://eel.is/c++draft/dcl.fct#3) - "The optional attribute-specifier-seq in an exception-declaration appertains to the parameter of the catch clause" (https://eel.is/c++draft/except.pre#1) The new behavior is tested both on the newly added type attribute `annotate_type`, for which we emit errors, and for the legacy type attribute `address_space` (chosen somewhat randomly from the various legacy type attributes), for which we emit warnings. Depends On D111548 Reviewed By: aaron.ballman, rsmith Differential Revision: https://reviews.llvm.org/D126061
2022-05-25Revert "[OpenMP] atomic compare fail : Parser & AST support"Aaron Ballman1-45/+1
This reverts commit 232bf8189ef7d574a468bd5bfd1e84e962f7f16e. It broke the sanitize buildbot: https://lab.llvm.org/buildbot/#/builders/5/builds/24074 It also reproduces on Windows debug builds as a crash.
2022-05-24[Clang][OpenMP] Support for omp nothingSunil Kuravinakop1-0/+10
Patch to support "#pragma omp nothing" Reviewed By: tianshilei1992 Differential Revision: https://reviews.llvm.org/D123286
2022-05-24[OpenMP] atomic compare fail : Parser & AST supportSunil Kuravinakop1-1/+45
This is a support for " #pragma omp atomic compare fail ". It has Parser & AST support for now. Reviewed By: tianshilei1992 Differential Revision: https://reviews.llvm.org/D123235
2022-05-24[OpenMP] Add parsing/sema support for omp_all_memory reserved locatorMike Rice1-21/+45
Adds support for the reserved locator 'omp_all_memory' for use in depend clauses with 'out' or 'inout' dependence-types. Differential Revision: https://reviews.llvm.org/D125828
2022-05-19[Clang][[OpenMP5.1] Initial parser/sema for default(private) clauseJennifer Yu1-5/+9
This implements the default(private) clause as defined in OMP5.1 Differential Revision: https://reviews.llvm.org/D125912
2022-04-08[clang][OpenMP5.1] Initial parsing/sema for has_device_addrJennifer Yu1-1/+5
Added basic parsing/sema/ support for the 'has_device_addr' clause. Differential Revision: https://reviews.llvm.org/D123402
2022-03-24[OpenMP] Initial parsing/sema for the 'omp target parallel loop' constructMike Rice1-0/+3
Adds basic parsing/sema/serialization support for the #pragma omp target parallel loop directive. Differential Revision: https://reviews.llvm.org/D122359
2022-03-24[clang][parse] Move source range into ParsedAttibutesViewTimm Bäder1-1/+1
Move the SourceRange from the old ParsedAttributesWithRange into ParsedAttributesView, so we have source range information available everywhere we use attributes. This also removes ParsedAttributesWithRange (replaced by simply using ParsedAttributes) and ParsedAttributesVieWithRange (replaced by using ParsedAttributesView). Differential Revision: https://reviews.llvm.org/D121201
2022-03-22[OpenMP] Initial parsing/sema for the 'omp parallel loop' constructMike Rice1-0/+3
Adds basic parsing/sema/serialization support for the #pragma omp parallel loop directive. Differential Revision: https://reviews.llvm.org/D122247
2022-03-18[OpenMP] Initial parsing/sema for the 'omp target teams loop' constructMike Rice1-0/+3
Adds basic parsing/sema/serialization support for the #pragma omp target teams loop directive. Differential Revision: https://reviews.llvm.org/D122028
2022-03-16[OpenMP] Initial parsing/sema for the 'omp teams loop' constructMike Rice1-0/+3
Adds basic parsing/sema/serialization support for the #pragma omp teams loop directive. Differential Revision: https://reviews.llvm.org/D121713
2022-02-14[OpenMP]Fix parsing of OpenMP directive nested in a metadirectiveMike Rice1-6/+5
Differential Revision: https://reviews.llvm.org/D119761
2022-02-08Enable inoutset dependency-type in depend clause.David Pagan1-1/+2
Done in manner similar to mutexinoutset (see https://reviews.llvm.org/D57576) Runtime support already exists in LLVM OpenMP runtime (see https://reviews.llvm.org/D97085). The value used to identify an inoutset dependency type in the LLVM OpenMP runtime is 8. Some tests updated due to change in dependency type error messages that now include new dependency type. Also updated test/OpenMP/task_codegen.cpp to verify we emit the right code.
2022-01-27[clang-format] Format ParseOpenMP.cpp changesSaiyedul Islam1-12/+12
Properly format D116549.
2022-01-26Revert "Rename llvm::array_lengthof into llvm::size to match std::size from ↵Benjamin Kramer1-1/+1
C++17" This reverts commit ef8206320769ad31422a803a0d6de6077fd231d2. - It conflicts with the existing llvm::size in STLExtras, which will now never be called. - Calling it without llvm:: breaks C++17 compat
2022-01-26Rename llvm::array_lengthof into llvm::size to match std::size from C++17serge-sans-paille1-1/+1
As a conquence move llvm::array_lengthof from STLExtras.h to STLForwardCompat.h (which is included by STLExtras.h so no build breakage expected).