summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* [c++2a] Implement semantic restrictions for 'export' declarations.Richard Smith2019-04-221-1/+2
| | | | llvm-svn: 358932
* PR41192: fix cases where "missing ';' after class" error wouldRichard Smith2019-04-161-0/+2
| | | | | | incorrectly fire. llvm-svn: 358467
* Simplify diagnosis of misplaced attributes in module-declarations.Richard Smith2019-04-151-4/+3
| | | | | | No functional change intended. llvm-svn: 358463
* [c++20] Enable driver and frontend support for building and usingRichard Smith2019-04-141-1/+1
| | | | | | modules when -std=c++2a is specified. llvm-svn: 358355
* [c++20] Parsing support for module-declarations, import-declarations,Richard Smith2019-04-141-25/+177
| | | | | | | | | and the global and private module fragment. For now, the private module fragment introducer is ignored, but use of the global module fragment introducer should be properly enforced. llvm-svn: 358353
* Add support for attributes on @implementations in Objective-CErik Pilkington2019-04-112-8/+11
| | | | | | | | | We want to make objc_nonlazy_class apply to implementations, but ran into this. There doesn't seem to be any reason that this isn't supported. Differential revision: https://reviews.llvm.org/D60542 llvm-svn: 358200
* Adds `-ftime-trace` option to clang that produces Chrome `chrome://tracing` ↵Anton Afanasyev2019-03-303-0/+16
| | | | | | | | | | | | | | compatible JSON profiling output dumps. This change adds hierarchical "time trace" profiling blocks that can be visualized in Chrome, in a "flame chart" style. Each profiling block can have a "detail" string that for example indicates the file being processed, template name being instantiated, function being optimized etc. This is taken from GitHub PR: https://github.com/aras-p/llvm-project-20170507/pull/2 Patch by Aras Pranckevičius. Differential Revision: https://reviews.llvm.org/D58675 llvm-svn: 357340
* [PR41247] Fixed parsing of private keyword in C++.Anastasia Stulova2019-03-282-3/+14
| | | | | | | | | Fixed bug in C++ to prevent parsing 'private' as a valid address space qualifier. Differential Revision: https://reviews.llvm.org/D59874 llvm-svn: 357162
* [OPENMP]Initial support for 'allocate' clause.Alexey Bataev2019-03-271-2/+29
| | | | | | Added parsing/sema analysis of the allocate clause. llvm-svn: 357068
* [Sema][NFCI] Don't allocate storage for the various ↵Bruno Ricci2019-03-256-21/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CorrectionCandidateCallback unless we are going to do some typo correction The various CorrectionCandidateCallbacks are currently heap-allocated unconditionally. This was needed because of delayed typo correction. However these allocations represent currently 15.4% of all allocations (number of allocations) when parsing all of Boost (!), mostly because of ParseCastExpression, ParseStatementOrDeclarationAfterAttrtibutes and isCXXDeclarationSpecifier. Note that all of these callback objects are small. Let's not do this. Instead initially allocate the callback on the stack, and only do a heap allocation if we are going to do some typo correction. Do this by: 1. Adding a clone function to each callback, which will do a polymorphic clone of the callback. This clone function is required to be implemented by every callback (of which there is a fair amount). Make sure this is the case by making it pure virtual. 2. Use this clone function when we are going to try to correct a typo. This additionally cut the time of -fsyntax-only on all of Boost by 0.5% (not that much, but still something). No functional changes intended. Differential Revision: https://reviews.llvm.org/D58827 Reviewed By: rnk llvm-svn: 356925
* [OpenCL] Allow addr space spelling without __ prefix in C++.Anastasia Stulova2019-03-253-2/+12
| | | | | | | | | | | | | | For backwards compatibility we allow alternative spelling of address spaces - 'private', 'local', 'global', 'constant', 'generic'. In order to accept 'private' correctly, parsing has been changed to understand different use cases - access specifier vs address space. Fixes PR40707 and PR41011! Differential Revision: https://reviews.llvm.org/D59603 llvm-svn: 356888
* Un-revert "[coroutines][PR40978] Emit error for co_yield within catch block"Brian Gesiak2019-03-251-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: https://reviews.llvm.org/D59076 added a new coroutine error that prevented users from using 'co_await' or 'co_yield' within a exception handler. However, it was reverted in https://reviews.llvm.org/rC356774 because it caused a regression in nested scopes in C++ catch statements, as documented by https://bugs.llvm.org/show_bug.cgi?id=41171. The issue was due to an incorrect use of a `clang::ParseScope`. To fix: 1. Add a regression test for catch statement parsing that mimics the bug report from https://bugs.llvm.org/show_bug.cgi?id=41171. 2. Re-apply the coroutines error patch from https://reviews.llvm.org/D59076, but this time with the correct ParseScope behavior. Reviewers: GorNishanov, tks2103, rsmith, riccibruno, jbulow Reviewed By: riccibruno Subscribers: EricWF, jdoerfert, lewissbaker, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59752 llvm-svn: 356865
* Revert "[coroutines][PR40978] Emit error for co_yield within catch block"Brian Gesiak2019-03-221-5/+3
| | | | | | | | The commit https://reviews.llvm.org/rC356296 is causing a regression in nested catch scopes, https://bugs.llvm.org/show_bug.cgi?id=41171. Revert this change for now in order to un-break that problem report. llvm-svn: 356774
* [coroutines][PR40978] Emit error for co_yield within catch blockBrian Gesiak2019-03-151-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As reported in https://bugs.llvm.org/show_bug.cgi?id=40978, it's an error to use the `co_yield` or `co_await` keywords outside of a valid "suspension context" as defined by [expr.await]p2 of http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/n4775.pdf. Whether or not the current scope was in a function-try-block's (https://en.cppreference.com/w/cpp/language/function-try-block) handler could be determined using scope flag `Scope::FnTryCatchScope`. No such flag existed for a simple C++ catch statement, so this commit adds one. Reviewers: GorNishanov, tks2103, rsmith Reviewed By: GorNishanov Subscribers: EricWF, jdoerfert, cfe-commits, lewissbaker Tags: #clang Differential Revision: https://reviews.llvm.org/D59076 llvm-svn: 356296
* Objective-C++11: Support static_assert() in @interface/@implementation ivar ↵Nico Weber2019-03-142-0/+27
| | | | | | | | | | | | | | | | | | | | | | lists and method declarations This adds support for static_assert() (and _Static_assert()) in @interface/@implementation ivar lists and in @interface method declarations. It was already supported in @implementation blocks outside of the ivar lists. The assert AST nodes are added at file scope, matching where other (non-Objective-C) declarations at @interface / @implementation level go (cf `allTUVariables`). Also add a `__has_feature(objc_c_static_assert)` that's true in C11 (and `__has_extension(objc_c_static_assert)` that's always true) and `__has_feature(objc_cxx_static_assert)` that's true in C++11 modea fter this patch, so it's possible to check if this is supported. Differential Revision: https://reviews.llvm.org/D59223 llvm-svn: 356148
* [Parse] Parse '#pragma clang attribute' as an external-declarationErik Pilkington2019-03-131-4/+3
| | | | | | | | | | | Previously, we parsed it only in the top level, which excludes namespaces and extern "C" blocks. rdar://problem/48818890 Differential revision: https://reviews.llvm.org/D59282 llvm-svn: 356075
* [OPENMP 5.0]Initial support for 'allocator' clause.Alexey Bataev2019-03-121-18/+80
| | | | | | | Added parsing/sema analysis/serialization/deserialization for the 'allocator' clause of the 'allocate' directive. llvm-svn: 355952
* [OPENMP 5.0]Add initial support for 'allocate' directive.Alexey Bataev2019-03-073-12/+70
| | | | | | | Added parsing/sema analysis/serialization/deserialization support for 'allocate' directive. llvm-svn: 355614
* [CodeComplete] Propagate preferred type for function arguments in more casesIlya Biryukov2019-02-265-89/+72
| | | | | | | | | | | | | | | | | | | | | Summary: See the added test for some new cases. This change also removes special code completion calls inside the ParseExpressionList function now that we properly propagate expected type to the function responsible for parsing elements of the expression list (ParseAssignmentExpression). Reviewers: kadircet Reviewed By: kadircet Subscribers: xbolva00, jdoerfert, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58541 llvm-svn: 354864
* [MS] Fix for Bug 8446, template instantiation without a 'typename' keywordReid Kleckner2019-02-261-0/+11
| | | | | | | | Patch by Zahira Ammarguellat! Differential Revision: https://reviews.llvm.org/D41950 llvm-svn: 354838
* [OpenMP 5.0] Parsing/sema support for from clause with mapper modifier.Michael Kruse2019-02-251-6/+13
| | | | | | | | | | | | | | | | | | | | This patch implements the parsing and sema support for the OpenMP 'from'-clause with potential user-defined mappers attached. User-defined mappers are a new feature in OpenMP 5.0. A 'from'-clause can have an explicit or implicit associated mapper, which instructs the compiler to generate and use customized mapping functions. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target update from(mapper(id): ss) // use the mapper with name 'id' to map ss from device Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D58638 llvm-svn: 354817
* [OpenMP 5.0] Parsing/sema support for to clause with mapper modifier.Michael Kruse2019-02-221-29/+59
| | | | | | | | | | | | | | | | | | | This patch implements the parsing and sema support for OpenMP to clause with potential user-defined mappers attached. User defined mapper is a new feature in OpenMP 5.0. A to/from clause can have an explicit or implicit associated mapper, which instructs the compiler to generate and use customized mapping functions. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target update to(mapper(id): ss) // use the mapper with name 'id' to map ss to device Contributed-by: <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D58523 llvm-svn: 354698
* [OpenMP 5.0] Parsing/sema support for map clause with mapper modifier.Michael Kruse2019-02-191-26/+57
| | | | | | | | | | | | | | | | | | | This patch implements the parsing and sema support for OpenMP map clauses with potential user-defined mapper attached. User defined mapper is a new feature in OpenMP 5.0. A map clause can have an explicit or implicit associated mapper, which instructs the compiler to generate extra data mapping. An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(id: struct S s) map(s, s.d[0:s.len]) struct S ss; #pragma omp target map(mapper(id) tofrom: ss) // use the mapper with name 'id' to map ss Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D58074 llvm-svn: 354347
* [OpenCL][PR40707] Allow OpenCL C types in C++ mode.Anastasia Stulova2019-02-153-13/+20
| | | | | | Allow all OpenCL types to be parsed in C++ mode. llvm-svn: 354121
* PR40642: Fix determination of whether the final statement of a statementRichard Smith2019-02-153-54/+78
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* [OpenCL][PR40603] In C++ preserve compatibility with OpenCL C v2.0Anastasia Stulova2019-02-071-5/+4
| | | | | | | | | | Valid OpenCL C code should still compile in C++ mode. This change enables extensions and OpenCL types. Differential Revision: https://reviews.llvm.org/D57824 llvm-svn: 353431
* [X86] Change MS inline asm clobber list filter to check for 'fpsr' instead ↵Craig Topper2019-02-051-1/+1
| | | | | | | | | | | | | | | | | | of 'fpsw' after D57641. Summary: The backend used to print the x87 FPSW register as 'fpsw', but gcc inline asm uses 'fpsr'. After D57641, the backend now uses 'fpsr' to match. Reviewers: rnk Reviewed By: rnk Subscribers: eraman, cfe-commits, llvm-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D57642 llvm-svn: 353142
* [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive.Michael Kruse2019-02-011-1/+170
| | | | | | | | | | | | | | | | | This patch implements parsing and sema for "omp declare mapper" directive. User defined mapper, i.e., declare mapper directive, is a new feature in OpenMP 5.0. It is introduced to extend existing map clauses for the purpose of simplifying the copy of complex data structures between host and device (i.e., deep copy). An example is shown below: struct S { int len; int *d; }; #pragma omp declare mapper(struct S s) map(s, s.d[0:s.len]) // Memory region that d points to is also mapped using this mapper. Contributed-by: Lingda Li <lildmh@gmail.com> Differential Revision: https://reviews.llvm.org/D56326 llvm-svn: 352906
* [CodeComplete] Propagate preferred types through parser in more casesIlya Biryukov2019-01-314-19/+46
| | | | | | | | | | | | | | Preferred types are used by code completion for ranking. This commit considerably increases the number of points in code where those types are propagated. In order to avoid complicating signatures of Parser's methods, a preferred type is kept as a member variable in the parser and updated during parsing. Differential revision: https://reviews.llvm.org/D56723 llvm-svn: 352788
* Rename getTypeQualifiers to getMethodQualifiers.Anastasia Stulova2019-01-281-1/+1
| | | | | | | | Use more descriptive name for the method qualifiers getter. Differential Revision: https://reviews.llvm.org/D56792 llvm-svn: 352349
* [OpenCL] Allow address spaces as method qualifiers.Anastasia Stulova2019-01-211-0/+14
| | | | | | | | | | | | | | | Methods can now be qualified with address spaces to prevent undesirable conversions to generic or to provide custom implementation to be used if the object is located in certain memory segments. This commit extends parsing and standard C++ overloading to work for an address space of a method (i.e. implicit 'this' parameter). Differential Revision: https://reviews.llvm.org/D55850 llvm-svn: 351747
* Update the file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-1915-60/+45
| | | | | | | | | | | | | | | | | to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
* Emit !callback metadata and introduce the callback attributeJohannes Doerfert2019-01-191-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | With commit r351627, LLVM gained the ability to apply (existing) IPO optimizations on indirections through callbacks, or transitive calls. The general idea is that we use an abstraction to hide the middle man and represent the callback call in the context of the initial caller. It is described in more detail in the commit message of the LLVM patch r351627, the llvm::AbstractCallSite class description, and the language reference section on callback-metadata. This commit enables clang to emit !callback metadata that is understood by LLVM. It does so in three different cases: 1) For known broker functions declarations that are directly generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel. 2) For known broker functions that are identified by their name and source location through the builtin detection, e.g., pthread_create from the POSIX thread API. 3) For user annotated functions that carry the "callback(callee, ...)" attribute. The attribute has to include the name, or index, of the callback callee and how the passed arguments can be identified (as many as the callback callee has). See the callback attribute documentation for detailed information. Differential Revision: https://reviews.llvm.org/D55483 llvm-svn: 351629
* Use DeclSpec for quals in DeclaratorChunk::FunctionTypeInfo.Anastasia Stulova2019-01-094-49/+19
| | | | | | | | | | Rather than duplicating data fields, use DeclSpec directly to store the qualifiers for the functions/methods. This change doesn't handle attributes yet and has to be extended further. Differential revision: https://reviews.llvm.org/D55948 llvm-svn: 350703
* Add two new pragmas for controlling software pipelining optimizations.Aaron Ballman2019-01-041-12/+24
| | | | | | | | This patch adds #pragma clang loop pipeline and #pragma clang loop pipeline_initiation_interval for debugging or reducing compile time purposes. It is possible to disable SWP for concrete loops to save compilation time or to find bugs by not doing SWP to certain loops. It is possible to set value of initiation interval to concrete number to save compilation time by not doing extra pipeliner passes or to check created schedule for specific initiation interval. Patch by Alexey Lapshin. llvm-svn: 350414
* Refactor the way we handle diagnosing unused expression results.Aaron Ballman2019-01-043-11/+31
| | | | | | | | Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement. This patch fixes PR39837. llvm-svn: 350404
* Add support for namespaces on #pragma clang attributeErik Pilkington2018-12-201-6/+40
| | | | | | | | | | | | | | | | Namespaces are introduced by adding an "identifier." before a push/pop directive. Pop directives with namespaces can only pop a attribute group that was pushed with the same namespace. Push and pop directives that don't opt into namespaces have the same semantics. This is necessary to prevent a pitfall of using multiple #pragma clang attribute directives spread out in a large file, particularly when macros are involved. It isn't easy to see which pop corripsonds to which push, so its easy to inadvertently pop the wrong group. Differential revision: https://reviews.llvm.org/D55628 llvm-svn: 349845
* [OPENMP] parsing and sema support for 'close' map-type-modifierKelvin Li2018-12-181-75/+93
| | | | | | | | | | | | A map clause with the close map-type-modifier is a hint to prefer that the variables are mapped using a copy into faster memory. Patch by Ahsan Saghir (saghir) Differential Revision: https://reviews.llvm.org/D55719 llvm-svn: 349551
* Fix up diagnostics.Richard Trieu2018-12-142-2/+0
| | | | | | | | | | | Move some diagnostics around between Diagnostic*Kinds.td files. Diagnostics used in multiple places were moved to DiagnosticCommonKinds.td. Diagnostics listed in the wrong place (ie, Sema diagnostics listed in DiagnosticsParseKinds.td) were moved to the correct places. One diagnostic split into two so that the diagnostic string is in the .td file instead of in code. Cleaned up the diagnostic includes after all the changes. llvm-svn: 349125
* [CodeComplete] Fill preferred type on binary expressionsIlya Biryukov2018-12-131-4/+5
| | | | | | | | | | | | Reviewers: kadircet Reviewed By: kadircet Subscribers: arphaman, cfe-commits Differential Revision: https://reviews.llvm.org/D55648 llvm-svn: 349053
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-133-10/+11
| | | | | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Note: This recommits the previously reverted patch, but now it is commited together with a fix for lldb. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 349019
* Revert "[OpenCL] Add generic AS to 'this' pointer"Mikael Nilsson2018-12-123-11/+10
| | | | | | Reverting because the patch broke lldb. llvm-svn: 348931
* [OpenCL] Add generic AS to 'this' pointerMikael Nilsson2018-12-123-10/+11
| | | | | | | | | | Address spaces are cast into generic before invoking the constructor. Added support for a trailing Qualifiers object in FunctionProtoType. Differential Revision: https://reviews.llvm.org/D54862 llvm-svn: 348927
* Misc typos fixes in ./lib folderRaphael Isemann2018-12-101-1/+1
| | | | | | | | | | | | | | Summary: Found via `codespell -q 3 -I ../clang-whitelist.txt -L uint,importd,crasher,gonna,cant,ue,ons,orign,ned` Reviewers: teemperor Reviewed By: teemperor Subscribers: teemperor, jholewinski, jvesely, nhaehnle, whisperity, jfb, cfe-commits Differential Revision: https://reviews.llvm.org/D55475 llvm-svn: 348755
* [CodeComplete] Cleanup access checking in code completionIlya Biryukov2018-12-031-13/+14
| | | | | | | | | | | | | | Summary: Also fixes a crash (see the added 'accessibility-crash.cpp' test). Reviewers: ioeric, kadircet Reviewed By: kadircet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55124 llvm-svn: 348135
* Move LoopHint.h from Sema to ParseRichard Trieu2018-11-282-2/+2
| | | | | | | | struct LoopHint was only used within Parse and not in any of the Sema or Codegen files. In the non-Parse files where it was included, it either wasn't used or LoopHintAttr was used, so its inclusion did nothing. llvm-svn: 347728
* [OPENMP] remove redundant ColonExpected flag in ParseOpenMP.cpp (NFC)Kelvin Li2018-11-281-3/+0
| | | | | | | | | | | The flag ColonExpected is not changed after being initialized to false at declaration. Patch by Ahsan Saghir Differential Revision: https://reviews.llvm.org/D54958 llvm-svn: 347723
* [MS] Push outermost class DeclContexts only in -fdelayed-template-parsingReid Kleckner2018-11-271-12/+23
| | | | | | | This is more or less a complete rewrite of r347627, and it fixes PR38460 I added a reduced test case to DelayedTemplateParsing.cpp. llvm-svn: 347713
* Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"Reid Kleckner2018-11-271-7/+2
| | | | | | | | | | | It broke the Windows self-host: http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio I can build lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to repro. llvm-svn: 347630
* [MS] Push fewer DeclContexts for delayed template parsingReid Kleckner2018-11-271-2/+7
| | | | | | | | | | | | | Only push the outermost record as a DeclContext when parsing a function body. See the comments in Sema::getContainingDC about the way the parser pushes contexts. This is intended to match the behavior the parser normally displays where it parses all method bodies from all nested classes at the end of the outermost class, when all nested classes are complete. Fixes PR38460. llvm-svn: 347627
OpenPOWER on IntegriCloud