summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
* [Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint ↵Saar Raz2020-03-192-1/+8
| | | | | | | | | | | | | annotates an invalid template-id TryAnnotateTypeConstraint could annotate a template-id which doesn't end up being a type-constraint, in which case control flow would incorrectly flow into ParseImplicitInt. Reenter the loop in this case. Enable relevant tests for C++20. This required disabling typo-correction during TryAnnotateTypeConstraint and changing a test case which is broken due to a separate bug (will be reported and handled separately). (cherry picked from commit 19fccc52ff2c1da1f93d9317c34769bd9bab8ac8)
* Revert "[Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint ↵Hans Wennborg2020-03-182-8/+1
| | | | | | | | | annotates an invalid template-id" We're not planning more release candidates for 10.0.0 at the moment, so reverting for now. This reverts commit 135744ce689569e7c64033bb5812572d3000239b.
* [Concepts] Fix incorrect control flow when TryAnnotateTypeConstraint ↵Saar Raz2020-03-172-1/+8
| | | | | | | | | | | | | annotates an invalid template-id TryAnnotateTypeConstraint could annotate a template-id which doesn't end up being a type-constraint, in which case control flow would incorrectly flow into ParseImplicitInt. Reenter the loop in this case. Enable relevant tests for C++20. This required disabling typo-correction during TryAnnotateTypeConstraint and changing a test case which is broken due to a separate bug (will be reported and handled separately). (cherry picked from commit 19fccc52ff2c1da1f93d9317c34769bd9bab8ac8)
* PR45083: Mark statement expressions as being dependent if they appear inRichard Smith2020-03-121-1/+2
| | | | | | | | | | | | | | | | a dependent context. This matches the GCC behavior. We track the enclosing template depth when determining whether a statement expression is within a dependent context; there doesn't appear to be any other reliable way to determine this. We previously assumed they were neither value- nor instantiation-dependent under any circumstances, which would lead to crashes and other misbehavior. (cherry picked from commit 5c845c1c50ac89a6f12557d1571678f3d1432478)
* Revert "PR45083: Mark statement expressions as being dependent if they ↵Hans Wennborg2020-03-121-2/+1
| | | | | | | | | appear in" This turned out to cause problems, and was reverted on master together with its follow-up change in 66addf8e803618758457e4d578c5084e322ca448. This reverts commit 3a843031a5ad83a00d2603f623881cb2b2bf719d.
* PR45083: Mark statement expressions as being dependent if they appear inRichard Smith2020-03-041-1/+2
| | | | | | | | | | dependent contexts. We previously assumed they were neither value- nor instantiation-dependent under any circumstances, which would lead to crashes and other misbehavior. (cherry picked from commit bdad0a1b79273733df9acc1be4e992fa5d70ec56)
* [Concepts] Add missing TPA commit to requires expression parsingSaar Raz2020-02-121-0/+1
| | | | | | | | | | If an error had occurred when annotating a scope spec during the tentative parse for a type-requirement, we would not revert nor commit the tentative parse, triggerring an assertion failure. Commit the TPA in this case and then do error recovery. (cherry picked from commit 271e495399170d69627c1acd591c9298cb0b5b4b)
* [Concepts] Fix isDeclarationSpecifier to detect type-constraints correctlySaar Raz2020-01-311-3/+8
| | | | | | | | | isDeclarationSpecifiers did not handle some cases of placeholder-type-specifiers with type-constraints, causing parsing bugs in abbreviated constructor templates. Add comprehensive handling of type-constraints to isDeclarationSpecifier. (cherry picked from commit b7ce85a130789d23c69156f4b899962458d1f05d)
* PR41991: Accept attributes on defaulted and deleted friends.Richard Smith2020-01-301-1/+1
| | | | | | | Attributes are permitted on friend definitions, but we only checked for a proper function body, not for the =default / =delete cases. (cherry picked from commit 5ae6554a1dcd2e39346030c06d364492901c9e8d)
* [Concepts] Fix parsing of scope specifier in compound-requirements, add more ↵Saar Raz2020-01-261-20/+6
| | | | | | | | | | | tests for scope specifiers in type-constraints The code for parsing of type-constraints in compound-requirements was not adapted for the new TryAnnotateTypeConstraint which caused compound-requirements with scope specifiers to ignore them. Also add regression tests for scope specifiers in type-constraints in more contexts. (cherry picked from commit 5043962dd3150c6ac72b75174b9460a510d1b5c3)
* [Concepts] Make constraint expressions unevaluated until satisfaction checkingSaar Raz2020-01-241-2/+2
| | | | | | | | | As per P1980R0, constraint expressions are unevaluated operands, and their constituent atomic constraints only become constant evaluated during satisfaction checking. Change the evaluation context during parsing and instantiation of constraints to unevaluated. (cherry picked from commit 73eaf62463b4a29adf4194685af12d1a5d172987)
* [Concepts] Deprecate -fconcepts-ts, enable Concepts under -std=c++2aSaar Raz2020-01-241-4/+3
| | | | | | | | | Now with concepts support merged and mostly complete, we do not need -fconcepts-ts (which was also misleading as we were not implementing the TS) and can enable concepts features under C++2a. A warning will be generated if users still attempt to use -fconcepts-ts. (cherry picked from commit 67c608a9695496cfc9d3fdf9d0b12b554ac6b4df)
* [Concepts] Placeholder constraints and abbreviated templatesSaar Raz2020-01-246-5/+124
| | | | | | | | | | | | | | | | | | | | | | | This patch implements P1141R2 "Yet another approach for constrained declarations". General strategy for this patch was: - Expand AutoType to include optional type-constraint, reflecting the wording and easing the integration of constraints. - Replace autos in parameter type specifiers with invented parameters in GetTypeSpecTypeForDeclarator, using the same logic previously used for generic lambdas, now unified with abbreviated templates, by: - Tracking the template parameter lists in the Declarator object - Tracking the template parameter depth before parsing function declarators (at which point we can match template parameters against scope specifiers to know if we have an explicit template parameter list to append invented parameters to or not). - When encountering an AutoType in a parameter context we check a stack of InventedTemplateParameterInfo structures that contain the info required to create and accumulate invented template parameters (fields that were already present in LambdaScopeInfo, which now inherits from this class and is looked up when an auto is encountered in a lambda context). Resubmit after fixing MSAN failures caused by incomplete initialization of AutoTypeLocs in TypeSpecLocFiller. Differential Revision: https://reviews.llvm.org/D65042 (cherry picked from commit b481f028144ca91c15d1db3649ce14f174259e7e)
* [Concepts] Fix incorrect recovery in TryAnnotateTypeConstraintSaar Raz2020-01-241-1/+4
| | | | | | | TryAnnotateTypeConstraint would not put the scope specifier back into the token stream when faced with a non-concept name after a scope specifier. (cherry picked from commit de51559fa68049da73b696a4e89468154b12852a)
* [Concepts] Fix name-type conflict compilation issuesSaar Raz2020-01-241-4/+4
| | | | | | | | D50360 caused some platforms to not compile due to a parameter with the name of a type. Rename the parameter. (cherry picked from commit e68c1e00eba4ae64d38e62eebebd581e3d3d6bd4)
* [Concepts] Requires ExpressionsSaar Raz2020-01-243-12/+338
| | | | | | | | | | Implement support for C++2a requires-expressions. Re-commit after compilation failure on some platforms due to alignment issues with PointerIntPair. Differential Revision: https://reviews.llvm.org/D50360 (cherry picked from commit a0f50d731639350c7a79f140f026c27a18215531)
* Remove redundant CXXScopeSpec from TemplateIdAnnotation.Richard Smith2020-01-247-112/+121
| | | | | | | | | | | | | | A TemplateIdAnnotation represents only a template-id, not a nested-name-specifier plus a template-id. Don't make a redundant copy of the CXXScopeSpec and store it on the template-id annotation. This slightly improves error recovery by more properly handling the case where we would form an invalid CXXScopeSpec while parsing a typename specifier, instead of accidentally putting the token stream into a broken "annot_template_id with a scope specifier, but with no preceding annot_cxxscope token" state. (cherry picked from commit a42fd84cff265b7e9faa3fe42885ee171393e4db)
* PR42694 Support explicit(bool) in older language modes as an extension.Richard Smith2020-01-173-12/+66
| | | | | | | | This needs somewhat careful disambiguation, as C++2a explicit(bool) is a breaking change. We only enable it in cases where the source construct could not possibly be anything else. (cherry picked from commit 45d70806f4386adfb62b0d75949a8aad58e0576f)
* [Concepts] Type ConstraintsSaar Raz2020-01-153-43/+212
| | | | | | | Add support for type-constraints in template type parameters. Also add support for template type parameters as pack expansions (where the type constraint can now contain an unexpanded parameter pack). Differential Revision: https://reviews.llvm.org/D44352
* Fix Wdocumentation warning. NFCI.Simon Pilgrim2020-01-101-2/+0
|
* [Concepts] Function trailing requires clausesSaar Raz2020-01-097-100/+435
| | | | | | Function trailing requires clauses now parsed, supported in overload resolution and when calling, referencing and taking the address of functions or function templates. Differential Revision: https://reviews.llvm.org/D43357
* [OPENMP]Allow comma in combiner expression.Alexey Bataev2020-01-081-3/+2
| | | | | Use ParseExpression() instead of ParseAssignmentExpression() to allow commas in combiner expressions.
* Disallow an empty string literal in an asm labelAaron Ballman2020-01-085-10/+18
| | | | | | | | An empty string literal in an asm label does not make a whole lot of sense. GCC does not diagnose such a construct, but it also generates code that cannot be assembled by gas should two symbols have an empty asm label within the same TU. This does not affect an asm statement with an empty string literal, which is still a useful construct.
* [OPENMP]Allow using of members in standalone declaration pragmas.Alexey Bataev2020-01-073-6/+85
| | | | | | | | | If standalone OpenMP declaration pragma, like declare mapper or declare reduction, is declared in the class context, it may reference a member (data or function) in its internal expressions/statements. So, the parsing of such pragmas must be dalayed just like the parsing of the member initializers/definitions before the completion of the class declaration.
* Add Triple::isX86()Fangrui Song2020-01-061-4/+1
| | | | | | Reviewed By: craig.topper, skan Differential Revision: https://reviews.llvm.org/D72247
* [Diagnostic] make Wmisleading-indendation not warn about labelsTyker2020-01-061-4/+6
| | | | | | | | | | Reviewers: aaron.ballman, xbolva00 Reviewed By: aaron.ballman Subscribers: nickdesaulniers, nathanchance Differential Revision: https://reviews.llvm.org/D72202
* [Diagnostic] Fixed add ftabstop to -Wmisleading-indentationTyker2020-01-031-3/+39
| | | | | | | | | | | | | | | | | Summary: this allow much better support of codebases like the linux kernel that mix tabs and spaces. -ftabstop=//Width// allow specifying how large tabs are considered to be. Reviewers: xbolva00, aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: mstorsjo, cfe-commits, jyknight, riccibruno, rsmith, nathanchance Tags: #clang Differential Revision: https://reviews.llvm.org/D71037
* [OPENMP] Restore allowing of braced initializers in the declare reductionAlexey Bataev2020-01-021-1/+1
| | | | | | init. Braced initializers were not accepted after the last fix in the initialier.Restored previous functionality.
* Revert "[Diagnostic] Add ftabstop to -Wmisleading-indentation"Martin Storsjö2019-12-311-38/+3
| | | | | | | | | This reverts commit b47b35ff51b355a446483777155290541ab64fae. This caused failed asserts (Assertion `FIDAndOffset.second > ColNo && "Column number smaller than file offset?"' failed.) on a source file with a single line containing "int main (void) { for( int i = 0; i < 9; i++ ); return 0; }".
* [Diagnostic] Add ftabstop to -Wmisleading-indentationTyker2019-12-301-3/+38
| | | | | | | | | | | | | | | Summary: this allow much better support of codebases like the linux kernel that mix tabs and spaces. -ftabstop=//Width// allow specifying how large tabs are considered to be. Reviewers: xbolva00, aaron.ballman, rsmith Reviewed By: aaron.ballman Subscribers: jyknight, riccibruno, rsmith, nathanchance Differential Revision: https://reviews.llvm.org/D71037
* [OPENMP]Add extra checks and initialization for clause modifier.Alexey Bataev2019-12-241-2/+7
| | | | | Added initialization of the extra modifier to silence sanitizer. Added extra checks to avoid such trouble in future.
* [OPENMP50]Basic support for conditional lastprivate.Alexey Bataev2019-12-241-26/+46
| | | | Added parsing/sema checks for conditional lastprivates.
* [OPENMP50]Add parsing/sema analysis for nontemporal clause.Alexey Bataev2019-12-171-0/+1
| | | | | Add basic support for parsing/sema analysis of the nontemporal clause in simd-based directives.
* [OPENMP]Fix skipping of functions body.Alexey Bataev2019-12-132-0/+6
| | | | | | When parsing the code with OpenMP and the function's body must be skipped, need to skip also OpenMP annotation tokens. Otherwise the counters for braces/parens are unbalanced and parsing fails.
* [Diagnsotics] Small Improvement on -Wmisleading-indentationTyker2019-12-121-4/+6
| | | | | | | | | | Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: xbolva00 Differential Revision: https://reviews.llvm.org/D71083
* [Support] Add TimeTraceScope constructor without detail argRussell Gallop2019-12-111-1/+1
| | | | | | | This simplifies code where no extra details are required Also don't write out detail when it is empty. Differential Revision: https://reviews.llvm.org/D71347
* [CodeComplete] Fix a crash in preferred type and signature helpIlya Biryukov2019-12-111-3/+6
| | | | | | | | | | | | | | Summary: Null type pointers could be dereferenced in some cases. Reviewers: kadircet, sammccall Reviewed By: sammccall Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71329
* [OPENMP50]Do not mark the function as used if referenced only in declareAlexey Bataev2019-12-101-3/+10
| | | | | | | | | variant directive. If the function is used only in declare variant directive as a variant function, it should not be marked as used to prevent emission of the target-specific functions. Build the reference in the unevaluated context.
* [OpenMP][NFCI] Introduce llvm/IR/OpenMPConstants.hJohannes Doerfert2019-12-102-14/+32
| | | | | | | | | | | | | | | | | | | Summary: The new OpenMPConstants.h is a location for all OpenMP related constants (and helpers) to live. This patch moves the directives there (the enum OpenMPDirectiveKind) and rewires Clang to use the new location. Initially part of D69785. Reviewers: kiranchandramohan, ABataev, RaviNarayanaswamy, gtbercea, grokos, sdmitriev, JonChesterfield, hfinkel, fghanim Subscribers: jholewinski, ppenzin, penzn, llvm-commits, cfe-commits, jfb, guansong, bollu, hiraditya, mgorny Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D69853
* [Parser] Don't crash on MS assembly if target desc/asm parser isn't linked in.Sam McCall2019-12-091-4/+24
| | | | | | | | | | | | | | | | | | Summary: Instead, emit a diagnostic and return an empty ASM node, as we do if the target is missing. Filter this diagnostic out in clangd, where it's not meaningful. Fixes https://github.com/clangd/clangd/issues/222 Reviewers: kadircet Subscribers: mgorny, ilya-biryukov, jkorous, arphaman, usaxena95, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D71189
* [OpenMP50] Add parallel master constructcchen2019-12-051-15/+16
| | | | | | | | | | | | Reviewers: ABataev, jdoerfert Reviewed By: ABataev Subscribers: rnk, jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem Tags: #clang Differential Revision: https://reviews.llvm.org/D70726
* Revert "[OpenMP50] Add parallel master construct, by Chi Chun Chen."Reid Kleckner2019-12-041-16/+15
| | | | | | This reverts commit 713dab21e27c987b9114547ce7136bac2e775de9. Tests do not pass on Windows.
* [OpenMP50] Add parallel master construct, by Chi Chun Chen.cchen2019-12-041-15/+16
| | | | | | | | | | | | Reviewers: ABataev, jdoerfert Reviewed By: ABataev Subscribers: jholewinski, guansong, arphaman, jfb, cfe-commits, sandoval, dreachem Tags: #clang Differential Revision: https://reviews.llvm.org/D70726
* [OpenCL] Allow addr space qualifiers on lambda call expressionsAnastasia Stulova2019-12-041-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | The addr space qualifier can be added optionally for lambdas after the attributes. They will alter the default addr space of lambda call operator that is in generic address space by default for OpenCL. Syntax: [ captures ] ( params ) specifiers exception attr opencl_addrspace -> ret { body } Example: [&] (int i) mutable __global { ... }; On the call into lambda a compatibility check will be performed to determine whether address space of lambda object and its call operator are compatible. This will follow regular addr space conversion rules and there will be no difference to how addr spaces work in method qualifiers. Tags: #clang Differential Revision: https://reviews.llvm.org/D70242
* Actually delay processing DelayedDllExportClasses until the outermost class ↵Hans Wennborg2019-12-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | is finished (PR40006) This was already the intention of DelayedDllExportClasses, but code such as this would break it: template<typename> struct Tmpl {}; struct Outer { struct Inner { __declspec(dllexport) Inner() = default; unsigned int x = 0; }; Tmpl<Inner> y; }; ActOnFinishCXXNonNestedClass() would get called when the instantiation of Templ<Inner> is finished, even though the compiler is still not finished with Outer, causing the compile fail. This hooks into Sema::{Push,Pop}ParsingClass() to avoid calling ActOnFinishCXXNonNestedClass() for template instantiations while a class is being parsed. Differential revision: https://reviews.llvm.org/D70905
* [Diagnostic] add a warning which warns about misleading indentationTyker2019-12-031-0/+72
| | | | | | | | | | | | | | Summary: Add a warning for misleading indentation similar to GCC's -Wmisleading-indentation Reviewers: aaron.ballman, xbolva00 Reviewed By: aaron.ballman, xbolva00 Subscribers: tstellar, cfe-commits, arphaman, Ka-Ka, thakis Tags: #clang Differential Revision: https://reviews.llvm.org/D70638
* Properly disambiguate between array declarators and array subscript expressions.Richard Smith2019-11-271-1/+13
|
* Revert "[Diagnostic] add a warning which warns about misleading indentation"Tom Stellard2019-11-251-35/+0
| | | | | | This reverts commit 7b86188b50bf6e537fe98b326f258fbd23108b83. This commit introduced bot falures for multi-stage bots with -Werror.
* [Diagnostic] add a warning which warns about misleading indentationTyker2019-11-251-0/+35
| | | | | | | | | | | | Summary: Add a warning for misleading indentation similar to GCC's -Wmisleading-indentation Reviewers: aaron.ballman, xbolva00 Reviewed By: aaron.ballman, xbolva00 Subscribers: arphaman, Ka-Ka, thakis Differential Revision: https://reviews.llvm.org/D70638
* Move vtordisp mode from Attr class to LangOptions.h, NFCReid Kleckner2019-11-221-1/+1
| | | | | This removes one of the two uses of Attr.h in DeclCXX.h, reducing the need to include Attr.h as widely. LangOptions is already very popular.
OpenPOWER on IntegriCloud