summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP50]Add device/kind context selector support.Alexey Bataev2019-11-211-0/+89
| | | | | | | | | | | | Summary: Added basic parsing/sema support for device/kind context selector. Reviewers: jdoerfert Subscribers: rampitec, aheejin, fedor.sergeev, simoncook, guansong, s.egerton, hfinkel, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70245
* Fix parser bug that permitted 'private' as a (no-op) decl-specifier even ↵Richard Smith2019-11-201-1/+6
| | | | outside OpenCL.
* [OPENMP50]Add if clause in simd directive.Alexey Bataev2019-11-191-1/+2
| | | | | | According to OpenMP 5.0, if clause can be used in simd directive. If condition in the if clause if false, the non-vectorized version of the loop must be executed.
* Implement __attribute__((objc_direct)), __attribute__((objc_direct_members))Pierre Habouzit2019-11-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __attribute__((objc_direct)) is an attribute on methods declaration, and __attribute__((objc_direct_members)) on implementation, categories or extensions. A `direct` property specifier is added (@property(direct) type name) These attributes / specifiers cause the method to have no associated Objective-C metadata (for the property or the method itself), and the calling convention to be a direct C function call. The symbol for the method has enforced hidden visibility and such direct calls are hence unreachable cross image. An explicit C function must be made if so desired to wrap them. The implicit `self` and `_cmd` arguments are preserved, however to maintain compatibility with the usual `objc_msgSend` semantics, 3 fundamental precautions are taken: 1) for instance methods, `self` is nil-checked. On arm64 backends this typically adds a single instruction (cbz x0, <closest-ret>) to the codegen, for the vast majority of the cases when the return type is a scalar. 2) for class methods, because the class may not be realized/initialized yet, a call to `[self self]` is emitted. When the proper deployment target is used, this is optimized to `objc_opt_self(self)`. However, long term we might want to emit something better that the optimizer can reason about. When inlining kicks in, these calls aren't optimized away as the optimizer has no idea that a single call is really necessary. 3) the calling convention for the `_cmd` argument is changed: the caller leaves the second argument to the call undefined, and the selector is loaded inside the body when it's referenced only. As far as error reporting goes, the compiler refuses: - making any overloads direct, - making an overload of a direct method, - implementations marked as direct when the declaration in the interface isn't (the other way around is allowed, as the direct attribute is inherited from the declaration), - marking methods required for protocol conformance as direct, - messaging an unqualified `id` with a direct method, - forming any @selector() expression with only direct selectors. As warnings: - any inconsistency of direct-related calling convention when @selector() or messaging is used, - forming any @selector() expression with a possibly direct selector. Lastly an `objc_direct_members` attribute is added that can decorate `@implementation` blocks and causes methods only declared there (and in no `@interface`) to be automatically direct. When decorating an `@interface` then all methods and properties declared in this block are marked direct. Radar-ID: rdar://problem/2684889 Differential Revision: https://reviews.llvm.org/D69991 Reviewed-By: John McCall
* [OpenMP 5.0] - Extend defaultmap, by Chi Chun Chen.cchen2019-11-151-5/+10
| | | | | | | | | | | | | | | | | Summary: For the extended defaultmap, most of the work is inside sema. The only difference for codegen is to set different initial maptype for different implicit-behavior. Reviewers: jdoerfert, ABataev Reviewed By: ABataev Subscribers: dreachem, sandoval, cfe-commits Tags: #clang, #openmp Differential Revision: https://reviews.llvm.org/D69204
* [OPENMP]Use copy constructors instead of assignment operators in declareAlexey Bataev2019-11-121-9/+4
| | | | | | | reduction initializers. Better to use copy constructor at the initialization of the declare reduction construct rather than assignment operator.
* [OPENMP50]Generalize handling of context matching/scoring.Alexey Bataev2019-11-111-45/+26
| | | | | | | | | | | | | | Summary: Untie context matching/scoring from the attribute for declare variant directive to simplify future uses in other context-dependent directives. Reviewers: jdoerfert Subscribers: guansong, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69952
* [Parser] Warn when ScopeDepthOrObjCQuals overflowsMark de Wever2019-11-091-0/+13
| | | | | | | | | Before when the overflow occured an assertion was triggered. Now check whether the maximum has been reached and warn properly. This patch fixes the original submission of PR19607. Differential Revision: https://reviews.llvm.org/D63975
* [OPENMP50]Simplify processing of context selector scores.Alexey Bataev2019-11-051-6/+1
| | | | | | If the context selector score was not specified, its value must be set to 0. Simplify the processing of unspecified scores + save memory in attribute representation.
* [OPENMP50]Add support for parallel master taskloop simd directive.Alexey Bataev2019-10-301-10/+15
| | | | Added full support for parallel master taskloop simd directive.
* [clangd] Do not insert parentheses when completing a using declarationIlya Biryukov2019-10-282-9/+9
| | | | | | | | | | | | | | | | | | Summary: Would be nice to also fix this in clang, but that looks like more work if we want to preserve signatures in informative chunks. Fixes https://github.com/clangd/clangd/issues/118 Reviewers: kadircet Reviewed By: kadircet Subscribers: merge_guards_bot, MaskRay, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69382
* [Mips] Use appropriate private label prefix based on Mips ABIMirko Brkusanin2019-10-231-3/+4
| | | | | | | | | | MipsMCAsmInfo was using '$' prefix for Mips32 and '.L' for Mips64 regardless of -target-abi option. By passing MCTargetOptions to MCAsmInfo we can find out Mips ABI and pick appropriate prefix. Tags: #llvm, #clang, #lldb Differential Revision: https://reviews.llvm.org/D66795
* [c++2a] Allow comparison functions to be explicitly defaulted.Richard Smith2019-10-222-2/+4
| | | | | | This adds some initial syntactic checking that only the appropriate function signatures can be defaulted. No implicit definitions are generated yet.
* [OPENMP50]Add support for master taskloop simd.Alexey Bataev2019-10-181-10/+13
| | | | | | Added trsing/semantics/codegen for combined construct master taskloop simd. llvm-svn: 375255
* Include leading attributes in DeclStmt's SourceRangeStephan Bergmann2019-10-171-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D68581 llvm-svn: 375104
* Added support for "#pragma clang section relro=<name>"Dmitry Mikulin2019-10-151-1/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D68806 llvm-svn: 374934
* [Concepts] Concept Specialization ExpressionsSaar Raz2019-10-151-7/+5
| | | | | | | | | | Part of C++20 Concepts implementation effort. Added Concept Specialization Expressions that are created when a concept is refe$ D41217 on Phabricator. (recommit after fixing failing Parser test on windows) llvm-svn: 374903
* Revert 374882 "[Concepts] Concept Specialization Expressions"Nico Weber2019-10-151-5/+7
| | | | | | | | | | This reverts commit ec87b003823d63f3342cf648f55a134c1522e612. The test fails on Windows, see e.g. http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/11533/steps/stage%201%20check/logs/stdio Also revert follow-up r374893. llvm-svn: 374899
* [Concepts] Concept Specialization ExpressionsSaar Raz2019-10-151-7/+5
| | | | | | Part of C++20 Concepts implementation effort. Added Concept Specialization Expressions that are created when a concept is referenced with arguments, and tests thereof. llvm-svn: 374882
* PR43080: Do not build context-sensitive expressions during name classification.Richard Smith2019-10-146-40/+106
| | | | | | | | | | | | | | | | | | | | | | | Summary: We don't know what context to use until the classification result is consumed by the parser, which could happen in a different semantic context. So don't build the expression that results from name classification until we get to that point and can handle it properly. This covers everything except C++ implicit class member access, which is a little awkward to handle properly in the face of the protected member access check. But it at least fixes all the currently-filed instances of PR43080. Reviewers: efriedma Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68896 llvm-svn: 374826
* [OPENMP50]Add support for 'parallel master taskloop' construct.Alexey Bataev2019-10-141-12/+15
| | | | | | | | | Added parsing/sema/codegen support for 'parallel master taskloop' constructs. Some of the clauses, like 'grainsize', 'num_tasks', 'final' and 'priority' are not supported in full, only constant expressions can be used currently in these clauses. llvm-svn: 374791
* [OPENMP50]Support for 'master taskloop' directive.Alexey Bataev2019-10-101-7/+9
| | | | | | Added full support for master taskloop directive. llvm-svn: 374437
* [OPENMP50]Register vendor name only once in vendor context selector.Alexey Bataev2019-10-101-5/+6
| | | | | | | No need to store multiple copies of the same vendor names in the context selector, keep only single copy. llvm-svn: 374363
* [OPENMP50]Multiple vendors in vendor context must be treated as logicalAlexey Bataev2019-10-081-6/+12
| | | | | | | | | | | | | and of vendors, not or. If several vendors are provided in the same vendor context trait, the context shall match only if all vendors are matching, not one of them. This is per OpenMP 5.0, 2.3.3 Matching and Scoring Context Selectors, all selectors in the construct, device, and implementation sets of the context selector appear in the corresponding trait set of the OpenMP context. llvm-svn: 374107
* [OPENMP50]Do not allow multiple same context traits in the same contextAlexey Bataev2019-10-081-12/+29
| | | | | | | | | | selector. According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each trait-selector-name can only be specified once. Added check for this restriction. llvm-svn: 374093
* [OPENMP50]Prohibit multiple context selector sets in context selectors.Alexey Bataev2019-10-081-0/+11
| | | | | | | | According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each trait-set-selector-name can only be specified once. Added check to implement this restriction. llvm-svn: 374072
* [OPENMP50]Treat range-based for as canonical loop.Alexey Bataev2019-10-071-0/+2
| | | | | | | According to OpenMP 5.0, range-based for is also considered as a canonical form of loops. llvm-svn: 373939
* [OPENMP50]Suppport for multiple vendors in the same vendor contextAlexey Bataev2019-10-041-21/+33
| | | | | | | | | selector. According to OpenMP 5.0, multiple vendors could be specified in the vendor context selector via ',' as a separator. llvm-svn: 373756
* [OPENMP50]Add parsing/sema analysis for declare variant score.Alexey Bataev2019-10-021-0/+26
| | | | | | | | Context selectors may include optional score clause in format `score(<expr>):`, where `<expr>` must be a constant integer expression. Added parsing/sema analysis only. llvm-svn: 373502
* [clang] Make handling of unnamed template params similar to function paramsKadir Cetinkaya2019-10-011-4/+4
| | | | | | | | | | | | | | | | | | | | | Summary: Clang uses the location identifier should be inserted for declarator decls when a decl is unnamed. But for type template and template template paramaters it uses the location of "typename/class" keyword, which makes it hard for tooling to insert/change parameter names. This change tries to unify these two cases by making template parameter parsing and sourcerange operations similar to function params/declarator decls. Reviewers: ilya-biryukov Subscribers: arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68143 llvm-svn: 373340
* [OPENMP50]Parsing/sema support for 'implementation/vendor' contextAlexey Bataev2019-09-251-12/+89
| | | | | | | | | selector. Added basic parsing/semantic support for 'implementation={vendor(<vendor>)}' context selector. llvm-svn: 372917
* [OPENMP]Use standard parsing for 'match' clause, NFC.Alexey Bataev2019-09-231-4/+9
| | | | | | | Reused standard clauses parsing scheme for parsing/matching 'match' clause in 'declare variant' directive. llvm-svn: 372635
* Model converted constant expressions as full-expressions.Richard Smith2019-09-191-1/+3
| | | | | | | | | | This is groundwork for C++20's P0784R7, where non-trivial destructors can be constexpr, so we need ExprWithCleanups markers in constant expressions. No functionality change intended. llvm-svn: 372359
* [OPENMP5.0]Allow multiple context selectors in the context selectorAlexey Bataev2019-09-181-67/+86
| | | | | | | | | sets. According to OpenMP 5.0, context selector set might include several context selectors, separated with commas. Patch fixes this problem. llvm-svn: 372235
* [OPENMP5.0]Add basic support for declare variant directive.Alexey Bataev2019-09-131-6/+120
| | | | | | | Added basic support for declare variant directive and its match clause with user context selector. llvm-svn: 371892
* [NFCI]Create CommonAttributeInfo Type as base type of *Attr and ParsedAttr.Erich Keane2019-09-135-13/+13
| | | | | | | | | | | | In order to enable future improvements to our attribute diagnostics, this moves info from ParsedAttr into CommonAttributeInfo, then makes this type the base of the *Attr and ParsedAttr types. Quite a bit of refactoring took place, including removing a bunch of redundant Spelling Index propogation. Differential Revision: https://reviews.llvm.org/D67368 llvm-svn: 371875
* Diagnose _Atomic as a C11 extension.Aaron Ballman2019-09-041-0/+5
| | | | llvm-svn: 370982
* [c++20] P1143R2: Add support for the C++20 'constinit' keyword.Richard Smith2019-09-043-5/+10
| | | | | | | | | | | | | This is mostly the same as the [[clang::require_constant_initialization]] attribute, but has a couple of additional syntactic and semantic restrictions. In passing, I added a warning for the attribute form being added after we have already seen the initialization of the variable (but before we see the definition); that case previously slipped between the cracks and the attribute was silently ignored. llvm-svn: 370972
* [c++20] Add support for designated direct-list-initialization syntax.Richard Smith2019-08-311-0/+25
| | | | | | This completes the implementation of P0329R4. llvm-svn: 370558
* Diagnose _Bool as a C99 extension.Aaron Ballman2019-08-271-0/+3
| | | | llvm-svn: 370108
* Diagnose both _Complex and _Imaginary as C99 extensions.Aaron Ballman2019-08-271-0/+4
| | | | llvm-svn: 370100
* Replace some custom C11 extension warnings with the generic warning.Aaron Ballman2019-08-273-5/+4
| | | | llvm-svn: 370066
* PR42587: diagnose unexpanded uses of a pack parameter of a genericRichard Smith2019-08-261-0/+1
| | | | | | | | | | | | | | | | | lambda from within the lambda-declarator. Instead of trying to reconstruct whether a parameter pack was declared inside a lambda (which we can't do correctly in general because we might not have attached parameters to their declaration contexts yet), track the set of parameter packs introduced in each live lambda scope, and require only those parameters to be immediately expanded when they appear inside that lambda. In passing, fix incorrect disambiguation of a lambda-expression starting with an init-capture pack in a braced-init-list. We previously incorrectly parsed that as a designated initializer. llvm-svn: 369985
* Diagnose use of _Thread_local as an extension when not in C11 mode.Aaron Ballman2019-08-262-2/+4
| | | | llvm-svn: 369954
* Do a sweep of symbol internalization. NFC.Benjamin Kramer2019-08-231-2/+2
| | | | llvm-svn: 369803
* [OPENMP5.0]Add support for device_type clause in declare targetAlexey Bataev2019-08-231-29/+111
| | | | | | | | | | construct. OpenMP 5.0 introduced new clause for declare target directive, device_type clause, which may accept values host, nohost, and any. Host means that the function must be emitted only for the host, nohost - only for the device, and any - for both, device and the host. llvm-svn: 369775
* [Attr] Support _attribute__ ((fallthrough))Nathan Huckleberry2019-08-202-14/+36
| | | | | | | | | | | | | | | | Summary: Fixed extraneous matches of non-NullStmt Reviewers: aaron.ballman, rsmith, efriedma, xbolva00 Reviewed By: aaron.ballman, rsmith, xbolva00 Subscribers: riccibruno, arphaman, ziangwan, ojeda, xbolva00, nickdesaulniers, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64838 llvm-svn: 369414
* Stop abusing SuppressAllDiagnostics when speculatively determiningRichard Smith2019-08-161-3/+3
| | | | | | whether an expression would be valid during error recovery. llvm-svn: 369145
* [clang] Loop pragma parsing. NFC.Sjoerd Meijer2019-08-151-18/+13
| | | | | | | | Just a refactoring and a tidy up. Differential Revision: https://reviews.llvm.org/D64564 llvm-svn: 368976
* [Clang] Migrate llvm::make_unique to std::make_uniqueJonas Devlieghere2019-08-145-49/+49
| | | | | | | | | | Now that we've moved to C++14, we no longer need the llvm::make_unique implementation from STLExtras.h. This patch is a mechanical replacement of (hopefully) all the llvm::make_unique instances across the monorepo. Differential revision: https://reviews.llvm.org/D66259 llvm-svn: 368942
OpenPOWER on IntegriCloud