summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse
Commit message (Collapse)AuthorAgeFilesLines
...
* More fixes for places where 'decltype(auto)' is permitted in the C++ grammar ↵Richard Smith2017-02-081-1/+2
| | | | | | but makes no sense. llvm-svn: 294509
* Don't crash on 'decltype(auto)::'. Rather than treating it as a meaninglessRichard Smith2017-02-081-1/+4
| | | | | | | | nested-name-specifier (as the standard appears to require), treat it as the type specifier 'decltype(auto)' followed by a nested-name-specifier starting with '::'. llvm-svn: 294506
* Fix constructor declarator detection for the case when the name is followed byRichard Smith2017-02-081-3/+13
| | | | | | an attribute-specifier-seq. (Also fixes the same problem for deduction-guides.) llvm-svn: 294396
* P0091R3: Implement basic parsing support for C++17 deduction-guides.Richard Smith2017-02-077-13/+53
| | | | | | | | | | | We model deduction-guides as functions with a new kind of name that identifies the template whose deduction they guide; the bulk of this patch is adding the new name kind. This gives us a clean way to attach an extensible list of guides to a class template in a way that doesn't require any special handling in AST files etc (and we're going to need these functions we come to performing deduction). llvm-svn: 294266
* [X86][MS]Adjacent comments within multi-line inline assembly statementCoby Tayree2017-02-051-0/+5
| | | | | | | | Allowing adjacent comments within MS inline assembly multi-line statement Differential Revision: https://reviews.llvm.org/D28989 llvm-svn: 294120
* Fix hole in our enforcement of rule requiring 'typename' prior to a dependentRichard Smith2017-02-012-8/+15
| | | | | | | | | | | name. If the dependent name happened to end in a template-id (X<T>::Y<U>), we would fail to notice that the 'typename' keyword is missing when resolving it to a type. It turns out that GCC has a similar bug. If this shows up in much real code, we can easily downgrade this to an ExtWarn. llvm-svn: 293815
* Support '#pragma clang __debug dump' within C++ classes.Richard Smith2017-01-281-0/+3
| | | | llvm-svn: 293355
* Convert sequence of 'if's on the same value to a switch. No functionality ↵Richard Smith2017-01-281-31/+23
| | | | | | change intended. llvm-svn: 293354
* PR0091R3: Implement parsing support for using templates as types.Richard Smith2017-01-264-10/+15
| | | | | | | | | | | | | | | This change adds a new type node, DeducedTemplateSpecializationType, to represent a type template name that has been used as a type. This is modeled around AutoType, and shares a common base class for representing a deduced placeholder type. We allow deduced class template types in a few more places than the standard does: in conditions and for-range-declarators, and in new-type-ids. This is consistent with GCC and with discussion on the core reflector. This patch does not yet support deduced class template types being named in typename specifiers. llvm-svn: 293207
* Revert r292508 given that we intend to remove driver options for cxx modules.Manman Ren2017-01-201-4/+1
| | | | llvm-svn: 292639
* Finish implementation of C++ DR1310 (http://wg21.link/cwg1310).Richard Smith2017-01-201-22/+18
| | | | | | | Diagnose the case when a dependent template name instantiates to an injected-class-name outside a nested-name-specifier. llvm-svn: 292545
* PR13403 (+duplicates): implement C++ DR1310 (http://wg21.link/cwg1310).Richard Smith2017-01-194-57/+28
| | | | | | | | | | | | | | | | | | | | | | Under this defect resolution, the injected-class-name of a class or class template cannot be used except in very limited circumstances (when declaring a constructor, in a nested-name-specifier, in a base-specifier, or in an elaborated-type-specifier). This is apparently done to make parsing easier, but it's a pain for us since we don't know whether a template-id using the injected-class-name is valid at the point when we annotate it (we don't yet know whether the template-id will become part of an elaborated-type-specifier). As a tentative resolution to a perceived language defect, mem-initializer-ids are added to the list of exceptions here (they generally follow the same rules as base-specifiers). When the reference to the injected-class-name uses the 'typename' or 'template' keywords, we permit it to be used to name a type or template as an extension; other compilers also accept some cases in this area. There are also a couple of corner cases with dependent template names that we do not yet diagnose, but which will also get this treatment. llvm-svn: 292518
* Module: Improve diagnostic message when cxx modules are disabled and @import ↵Manman Ren2017-01-191-1/+4
| | | | | | | | is used in Objective CXX. rdar://problem/19399671 llvm-svn: 292508
* [code-completion] Fix crash when trying to do postfix completion of instance ↵Argyrios Kyrtzidis2017-01-151-3/+4
| | | | | | member inside a static function. llvm-svn: 292052
* Tracking exception specification source locationsMalcolm Parsons2017-01-121-1/+1
| | | | | | | | | | | | | | | | | | | | Summary: We do not currently track the source locations for exception specifications such that their source range can be queried through the AST. This leads to trying to write more complex code to determine the source range for uses like FixItHints (see D18575 for an example). In addition to use within tools like clang-tidy, I think this information may become more important to track as exception specifications become more integrated into the type system. Patch by Don Hinton. Reviewers: rsmith Subscribers: malcolm.parsons, sbarzowski, alexfh, hintonda, cfe-commits Differential Revision: https://reviews.llvm.org/D20428 llvm-svn: 291771
* Remove redundant passing around of a "ContainsAutoType" flag.Richard Smith2017-01-124-16/+11
| | | | | | | | | | | | This flag serves no purpose other than to prevent us walking through a type to check whether it contains an 'auto' specifier; this duplication of information is error-prone, does not appear to provide any performance benefit, and will become less practical once we support C++1z deduced class template types and eventually constrained types from the Concepts TS. No functionality change intended. llvm-svn: 291737
* Remove repeated word in comment (NFC)Malcolm Parsons2017-01-111-1/+1
| | | | llvm-svn: 291667
* Remove dead code.Richard Smith2017-01-101-5/+0
| | | | llvm-svn: 291610
* Remove a couple of parameters that are always false.Richard Smith2017-01-101-21/+14
| | | | llvm-svn: 291608
* [OpenMP] Sema and parsing for 'target teams distribute simd’ pragmaKelvin Li2017-01-101-2/+6
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute simd’ pragma. Differential Revision: https://reviews.llvm.org/D28252 llvm-svn: 291579
* [NFC] Rename RAII ExpressionEvaluationContext variable from Unevaluated to ↵Faisal Vali2017-01-101-1/+1
| | | | | | | | ConstantEvaluated when parsing a constant expression. This renaming makes it consistent with the context it actually sets: Sema::ConstantEvaluated. llvm-svn: 291525
* Consistently use a ConstantEvaluated context for expressions in attributes,Richard Smith2017-01-071-3/+4
| | | | | | except for those with the "attributes are unevaluated contexts" flag. llvm-svn: 291358
* PR23135: Don't instantiate constexpr functions referenced in unevaluated ↵Richard Smith2017-01-071-0/+4
| | | | | | | | | | | | | | | | | | | | | operands where possible. This implements something like the current direction of DR1581: we use a narrow syntactic check to determine the set of places where a constant expression could be evaluated, and only instantiate a constexpr function or variable if it's referenced in one of those contexts, or is odr-used. It's not yet clear whether this is the right set of syntactic locations; we currently consider all contexts within templates that would result in odr-uses after instantiation, and contexts within list-initialization (narrowing conversions take another victim...), as requiring instantiation. We could in principle restrict the former cases more (only const integral / reference variable initializers, and contexts in which a constant expression is required, perhaps). However, this is sufficient to allow us to accept libstdc++ code, which relies on GCC's behavior (which appears to be somewhat similar to this approach). llvm-svn: 291318
* [OpenCL] Re-enable supported core extensions based on opencl version when ↵Konstantin Zhuravlyov2017-01-061-2/+4
| | | | | | | | disabling all extensions using pragma Differential Revision: https://reviews.llvm.org/D28257 llvm-svn: 291243
* [ObjC] The declarator for a block literal should be a definitionAlex Lorenz2017-01-061-0/+2
| | | | | | | | | | | This change avoids the -Wstrict-prototypes warning for block literals with an empty argument list or without argument lists. rdar://15060615 Differential Revision: https://reviews.llvm.org/D28296 llvm-svn: 291231
* [Parse] Don't ignore attributes after a late-parsed attr.George Burgess IV2017-01-041-2/+6
| | | | | | | | Without this, we drop everything after the first late-parsed attribute in a single __attribute__. (Where "drop" means "stuff everything into LA->Toks.") llvm-svn: 291020
* [OpenMP] Sema and parsing for 'target teams distribute parallel for simd’ ↵Kelvin Li2017-01-031-3/+7
| | | | | | | | | | pragma This patch is to implement sema and parsing for 'target teams distribute parallel for simd’ pragma. Differential Revision: https://reviews.llvm.org/D28202 llvm-svn: 290862
* [OpenMP] Sema and parsing for 'target teams distribute parallel for’ pragmaKelvin Li2016-12-291-5/+11
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute parallel for’ pragma. Differential Revision: https://reviews.llvm.org/D28160 llvm-svn: 290725
* [OpenMP] Sema and parsing for 'target teams distribute' pragmaKelvin Li2016-12-251-3/+7
| | | | | | | | This patch is to implement sema and parsing for 'target teams distribute' pragma. Differential Revision: https://reviews.llvm.org/D28015 llvm-svn: 290508
* [c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith2016-12-201-63/+16
| | | | | | | | | | | | | | This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. This is a re-commit of r290080 (reverted in r290092) with a fix for a use-after-lifetime bug. llvm-svn: 290203
* [OPENMP] Fix for PR31428: variable named like directive name modifierAlexey Bataev2016-12-201-5/+9
| | | | | | | | Directive name modifiers in 'if' clause are allowed only for OpenMP 4.5 and higher + in OpenMP 4.5 parsing procedure emits error message if ':' is not found after directive name modifier. llvm-svn: 290175
* [Parser] Correct typo after lambda capture initializer is parsed.Akira Hatanaka2016-12-201-0/+2
| | | | | | | | | | | | | | | | This patch fixes an assertion that is triggered when RecordLayoutBuilder tries to compute the size of a field (for capture "name" in the test case) whose type hasn't been deduced. The patch fixes the bug by correcting the typo of the capture initializer after the initializer is parsed and before setting the expression for the annotation token. Fixes PR30566. rdar://problem/23380132 Differential Revision: https://reviews.llvm.org/D25206 llvm-svn: 290156
* Revert "[c++1z] P0195R2: Support pack-expansion of using-declarations."Daniel Jasper2016-12-191-16/+63
| | | | | | | This reverts commit r290080 as it leads to many Clang crashes, e.g.: http://lab.llvm.org:8011/builders/clang-cmake-aarch64-quick/builds/1814 llvm-svn: 290092
* [c++1z] P0195R2: Support pack-expansion of using-declarations.Richard Smith2016-12-191-63/+16
| | | | | | | | | | | This change introduces UsingPackDecl as a marker for the set of UsingDecls produced by pack expansion of a single (unresolved) using declaration. This is not strictly necessary (we just need to be able to map from the original using declaration to its expansions somehow), but it's useful to maintain the invariant that each declaration reference instantiates to refer to one declaration. llvm-svn: 290080
* Recommit r289979 [OpenCL] Allow disabling types and declarations associated ↵Yaxun Liu2016-12-182-42/+57
| | | | | | | | with extensions Fixed undefined behavior due to cast integer to bool in initializer list. llvm-svn: 290056
* [OpenMP] Sema and parsing for 'target teams' pragmaKelvin Li2016-12-171-3/+6
| | | | | | | | This patch is to implement sema and parsing for 'target teams' pragma. Differential Revision: https://reviews.llvm.org/D27818 llvm-svn: 290038
* Revert r289979 due to regressionsYaxun Liu2016-12-162-57/+42
| | | | llvm-svn: 289991
* [OpenCL] Allow disabling types and declarations associated with extensionsYaxun Liu2016-12-162-42/+57
| | | | | | | | | | | | | | | | | | Added a map to associate types and declarations with extensions. Refactored existing diagnostic for disabled types associated with extensions and extended it to declarations for generic situation. Fixed some bugs for types associated with extensions. Allow users to use pragma to declare types and functions for supported extensions, e.g. #pragma OPENCL EXTENSION the_new_extension_name : begin // declare types and functions associated with the extension here #pragma OPENCL EXTENSION the_new_extension_name : end Differential Revision: https://reviews.llvm.org/D21698 llvm-svn: 289979
* [c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.Richard Smith2016-12-163-155/+264
| | | | llvm-svn: 289905
* Remove special error recovery for ::(id)Reid Kleckner2016-12-091-46/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The code pattern used to implement the token rewriting hack doesn't interact well with token caching in the pre-processor. As a result, clang would crash on 'int f(::(id));' while doing a tenative parse of the contents of the outer parentheses. The original code from PR11852 still doesn't crash the compiler. This error recovery also often does the wrong thing with member function pointers. The test case from the original PR doesn't recover the right way either: void S::(*pf)() = S::f; // should be 'void (S::*pf)()' Instead we were recovering as 'void S::*pf()', which is still wrong. If we still think that users mistakenly parenthesize identifiers in nested name specifiers, we should change clang to intentionally parse that form with an error, rather than doing a token rewrite. Fixes PR26623, but I think there will be many more bugs like this around token rewriting in the parser. Reviewers: rsmith, rtrieu Differential Revision: https://reviews.llvm.org/D25882 llvm-svn: 289273
* Store decls in prototypes on the declarator instead of in the ASTReid Kleckner2016-12-093-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This saves two pointers from FunctionDecl that were being used for some rare and questionable C-only functionality. The DeclsInPrototypeScope ArrayRef was added in r151712 in order to parse this kind of C code: enum e {x, y}; int f(enum {y, x} n) { return x; // should return 1, not 0 } The challenge is that we parse 'int f(enum {y, x} n)' it its own function prototype scope that gets popped before we build the FunctionDecl for 'f'. The original change was doing two questionable things: 1. Saving all tag decls introduced in prototype scope on a TU-global Sema variable. This is problematic when you have cases like this, where 'x' and 'y' shouldn't be visible in 'f': void f(void (*fp)(enum { x, y } e)) { /* no x */ } This patch fixes that, so now 'f' can't see 'x', which is consistent with GCC. 2. Storing the decls in FunctionDecl in ActOnFunctionDeclarator so that they could be used in ActOnStartOfFunctionDef. This is just an inefficient way to move information around. The AST lives forever, but the list of non-parameter decls in prototype scope is short lived. Moving these things to the Declarator solves both of these issues. Reviewers: rsmith Subscribers: jmolloy, cfe-commits Differential Revision: https://reviews.llvm.org/D27279 llvm-svn: 289225
* [OpenMP] Sema and parsing for 'teams distribute parallel for' pragmaKelvin Li2016-12-091-4/+6
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute parallel for' pragma. Differential Revision: https://reviews.llvm.org/D27345 llvm-svn: 289179
* [CodeCompletion] Provide Objective-C class property completion resultsAlex Lorenz2016-12-081-1/+7
| | | | | | | | | | | | This commit provides class property code completion results. It supports explicit and implicit class properties, but the special block completion is done only for explicit properties right now. rdar://25636195 Differential Revision: https://reviews.llvm.org/D27053 llvm-svn: 289058
* [c++1z] P0003R5: Removing dynamic exception specifications.Richard Smith2016-12-081-1/+5
| | | | | | | | | | | | | | | | | | We continue to support dynamic exception specifications in C++1z as an extension, but produce an error-by-default warning when we encounter one. This allows users to opt back into the feature with a warning flag, and implicitly opts system headers back into the feature should they happen to use it. There is one semantic change implied by P0003R5 but not implemented here: violating a throw() exception specification should now call std::terminate directly instead of calling std::unexpected(), but since P0003R5 also removes std::unexpected() and std::set_unexpected, and the default unexpected handler calls std::terminate(), a conforming C++1z program cannot tell that we are still calling it. The upside of this strategy is perfect backwards compatibility; the downside is that we don't get the more efficient 'noexcept' codegen for 'throw()'. llvm-svn: 289019
* [ObjC++] Don't enter a C++ declarator scope when the current context isAlex Lorenz2016-12-071-0/+8
| | | | | | | | | | | | | | | an Objective-C declaration This commit ensures that Sema won't enter a C++ declarator scope when the current context is an Objective-C declaration. This prevents an assertion failure in EnterDeclaratorContext that's used to ensure that current context will be restored correctly after exiting the declarator context. rdar://20560175 Differential Revision: https://reviews.llvm.org/D26922 llvm-svn: 288893
* [modules] Use the "redundant #include" diagnostic rather than the "moduleRichard Smith2016-12-061-6/+21
| | | | | | | | import can't appear here" diagnostic if an already-visible module is textually entered (because we have the module map but not the AST file) within a function/namespace scope. llvm-svn: 288737
* More diagnostic name fixups: w_ -> warn_, warning_ -> warn_, not_ -> note_.Richard Smith2016-12-021-3/+3
| | | | | | In passing, add a warning group for "ignored qualifier in inline assembly" warnings. llvm-svn: 288548
* Mass-rename the handful of error_* diagnostics to err_*.Richard Smith2016-12-021-1/+1
| | | | llvm-svn: 288545
* [ObjC] Avoid a @try/@finally/@autoreleasepool fixit when parsing an expressionAlex Lorenz2016-12-011-1/+6
| | | | | | | | | | | | This patch ensures that the typo fixit for the @try/@finally/@autoreleasepool {} directive is shown only when we're parsing an actual statement where such directives can actually be present. rdar://19669565 Differential Revision: https://reviews.llvm.org/D26916 llvm-svn: 288334
* [OpenMP] Sema and parsing for 'teams distribute parallel for simd' pragmaKelvin Li2016-11-301-4/+12
| | | | | | | | This patch is to implement sema and parsing for 'teams distribute parallel for simd' pragma. Differential Revision: https://reviews.llvm.org/D27084 llvm-svn: 288294
OpenPOWER on IntegriCloud