summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* [c++1z] P0195R2: Allow multiple using-declarators in a single using-declaration.Richard Smith2016-12-161-145/+254
| | | | llvm-svn: 289905
* [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
* Fixes for r287241. Use placement new. Apply clang-format.Malcolm Parsons2016-11-171-1/+2
| | | | llvm-svn: 287258
* Use unique_ptr for cached tokens for default arguments in C++.Malcolm Parsons2016-11-171-1/+1
| | | | | | | | | | | | | | | | | Summary: This changes pointers to cached tokens for default arguments in C++ from raw pointers to unique_ptrs. There was a fixme in the code where the cached tokens are created about using a smart pointer. The change is straightforward, though I did have to track down and fix a memory corruption caused by the change. memcpy was being used to copy parameter information. This duplicated the unique_ptr, which led to the cached token buffer being deleted prematurely. Patch by David Tarditi! Reviewers: malcolm.parsons Subscribers: arphaman, malcolm.parsons, cfe-commits Differential Revision: https://reviews.llvm.org/D26435 llvm-svn: 287241
* Fix Clang-tidy readability-redundant-string-cstr warningsMalcolm Parsons2016-11-021-1/+1
| | | | | | | | | | Reviewers: aaron.ballman, mehdi_amini, dblaikie Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D26206 llvm-svn: 285799
* C++ Modules TS: Add parsing and some semantic analysis support forRichard Smith2016-09-081-0/+47
| | | | | | | export-declarations. These don't yet have an effect on name visibility; we still export everything by default. llvm-svn: 280999
* [ms] Add support for parsing uuid as a Microsoft attribute.Nico Weber2016-09-031-1/+99
| | | | | | | | | | | | | | | | | Some Windows SDK classes, for example Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling attributes: [uuid("....")] class IBufferByteAccess {}; To be able to use __uuidof() to grab the uuid off these types, clang needs to support uuid as a Microsoft attribute. There was already code to skip Microsoft attributes, extend that to look for uuid and parse it. Use the new "Microsoft" attribute type added in r280575 (and r280574, r280576) for this. Final part of https://reviews.llvm.org/D23895 llvm-svn: 280578
* Let Microsoft attributes apply to the type, not the variable.Nico Weber2016-09-031-1/+1
| | | | | | | | | | | | | There was already a function that moved attributes off the declspec into an attribute list for attributes applying to the type, teach that function to also move Microsoft attributes around and rename it to match its new broader role. Nothing uses Microsoft attributes yet, so no behavior change. Part of https://reviews.llvm.org/D23895 llvm-svn: 280576
* Move calls of MaybeParseMicrosoftAttributes() before ParseExternalDeclaration()Nico Weber2016-09-031-3/+0
| | | | | | | | into ParseDeclOrFunctionDefInternal() (which is called by MaybeParseMicrosoftAttributes()), so that the attributes can be stored in the DeclSpec. No behavior change yet, part of https://reviews.llvm.org/D23895 llvm-svn: 280574
* Remove two dos line endings.Nico Weber2016-08-231-2/+2
| | | | llvm-svn: 279558
* [GCC] Support for __final specifierAndrey Bokhanko2016-07-291-0/+12
| | | | | | | | | | | | | | As reported in bug 28473, GCC supports "final" functionality in pre-C++11 code using the __final keyword. Clang currently supports the "final" keyword in accordance with the C++11 specification, however it ALSO supports it in pre-C++11 mode, with a warning. This patch adds the "__final" keyword for compatibility with GCC in GCC Keywords mode (so it is enabled with existing flags), and issues a warning on its usage (suggesting switching to the C++11 keyword). This patch also adds a regression test for the functionality described. I believe this patch has minimal impact, as it simply adds a new keyword for existing behavior. This has been validated with check-clang to avoid regressions. Patch is created in reference to revisions 276665. Patch by Erich Keane. Differential Revision: https://reviews.llvm.org/D22919 llvm-svn: 277134
* [AST] Keep track of the left brace source location of a tag decl.Argyrios Kyrtzidis2016-07-151-2/+1
| | | | | | This is useful for source modification tools. There will be a follow-up commit using it. llvm-svn: 275590
* Using for attributes voted into C++17.Richard Smith2016-06-241-0/+27
| | | | llvm-svn: 273666
* Re-commit r273548, reverted in r273589, with a fix to not produceRichard Smith2016-06-231-3/+4
| | | | | | | | | | | | | | | | -Wfor-loop-analysis warnings for a for-loop with a condition variable. In such a case, the loop condition variable is modified on each iteration of the loop by definition. Original commit message: Rearrange condition handling so that semantic checks on a condition variable are performed before the other substatements of the construct are parsed, rather than deferring them until the end. This allows better error recovery from semantic errors in the condition, improves diagnostic order, and is a prerequisite for C++17 constexpr if. llvm-svn: 273600
* Revert r273548, "Rearrange condition handling so that semantic checks on a ↵Peter Collingbourne2016-06-231-4/+3
| | | | | | | | condition variable" as it caused a regression in -Wfor-loop-analysis. llvm-svn: 273589
* Rearrange condition handling so that semantic checks on a condition variableRichard Smith2016-06-231-3/+4
| | | | | | | | | are performed before the other substatements of the construct are parsed, rather than deferring them until the end. This allows better error recovery from semantic errors in the condition, improves diagnostic order, and is a prerequisite for C++17 constexpr if. llvm-svn: 273548
* [Parser] Handle __pragma(pack, etc. after type definitionsDavid Majnemer2016-06-141-0/+7
| | | | | | | | | Support certain MS pragmas right after the closing curly brace of a class. Clang did not expect __pragma in this position. This fixes PR28094. llvm-svn: 272628
* Clang support for __is_assignable intrinsicDavid Majnemer2016-05-231-0/+1
| | | | | | | | | | | | | | | | | | | MSVC now supports the __is_assignable type trait intrinsic, to enable easier and more efficient implementation of the Standard Library's is_assignable trait. As of Visual Studio 2015 Update 3, the VC Standard Library implementation uses the new intrinsic unconditionally. The implementation is pretty straightforward due to the previously existing is_nothrow_assignable and is_trivially_assignable. We handle __is_assignable via the same code as the other two except that we skip the extra checks for nothrow or triviality. Patch by Dave Bartolomeo! Differential Revision: http://reviews.llvm.org/D20492 llvm-svn: 270458
* [Concepts] Pass requires-clause to ActOnTemplateParameterList; NFCHubert Tong2016-04-291-1/+1
| | | | | | | | | | | | | | Summary: Prepare to store requires-clause expression for access via TemplateParameterList. Reviewers: aaron.ballman, faisalv, rsmith Subscribers: cfe-commits, nwilson Differential Revision: http://reviews.llvm.org/D19220 llvm-svn: 268081
* Remove redundant null-check; NFCHubert Tong2016-04-131-1/+1
| | | | llvm-svn: 266226
* [OPENMP 4.0] Initial support for '#pragma omp declare simd' directive.Alexey Bataev2016-03-301-1/+2
| | | | | | | | | | | | | | | | Initial parsing/sema/serialization/deserialization support for '#pragma omp declare simd' directive. The 'declare simd' construct can be applied to a function to enable the creation of one or more versions that can process multiple arguments using SIMD instructions from a single invocation from a SIMD loop. If the function has any declarations, then the declare simd construct for any declaration that has one must be equivalent to the one specified for the definition. Otherwise, the result is unspecified. This pragma can be applied many times to the same declaration. Internally this pragma is represented as an attribute. But we need special processing for this pragma because it must be used before function declaration, this directive is applied to. Differential Revision: http://reviews.llvm.org/D10599 llvm-svn: 264853
* clang-cl: support __cdecl-on-struct anachronismReid Kleckner2016-03-211-0/+9
| | | | | | | | | | | | | | | | | | | | | | Summary: The Microsoft compiler emits warning C4229: anachronism used : modifiers on data are ignored for struct {} __cdecl s; but ICU's gendict can generate such (and does when building LibreOffice), so accepting this in clang-cl too would be useful. Reviewers: rnk Patch by Stephan Bergmann Differential Revision: http://reviews.llvm.org/D16628 llvm-svn: 263947
* Implement support for [[maybe_unused]] in C++1z that is based off existing ↵Aaron Ballman2016-03-091-0/+2
| | | | | | support for unused, and treat it as an extension pre-C++1z. This also means extending the existing unused attribute so that it can be placed on an enum and enumerator, in addition to the other subjects. llvm-svn: 263025
* Silence duplicate diagnostics because parsing of a standards-based attribute ↵Aaron Ballman2016-03-081-0/+2
| | | | | | triggers parsing diagnostics that may also be picked up during semantic analysis. llvm-svn: 262960
* Implement support for [[nodiscard]] in C++1z that is based off existing ↵Aaron Ballman2016-03-071-1/+2
| | | | | | support for warn_unused_result, and treat it as an extension pre-C++1z. This also means extending the existing warn_unused_result attribute so that it can be placed on an enum as well as a class. llvm-svn: 262872
* [OPENMP 4.0] Initial support for 'omp declare reduction' construct.Alexey Bataev2016-03-031-1/+1
| | | | | | | | | | | | | | | | | Add parsing, sema analysis and serialization/deserialization for 'declare reduction' construct. User-defined reductions are defined as #pragma omp declare reduction( reduction-identifier : typename-list : combiner ) [initializer ( initializer-expr )] These custom reductions may be used in 'reduction' clauses of OpenMP constructs. The combiner specifies how partial results can be combined into a single value. The combiner can use the special variable identifiers omp_in and omp_out that are of the type of the variables being reduced with this reduction-identifier. Each of them will denote one of the values to be combined before executing the combiner. It is assumed that the special omp_out identifier will refer to the storage that holds the resulting combined value after executing the combiner. As the initializer-expr value of a user-defined reduction is not known a priori the initializer-clause can be used to specify one. Then the contents of the initializer-clause will be used as the initializer for private copies of reduction list items where the omp_priv identifier will refer to the storage to be initialized. The special identifier omp_orig can also appear in the initializer-clause and it will refer to the storage of the original variable to be reduced. Differential Revision: http://reviews.llvm.org/D11182 llvm-svn: 262582
* Include RecordDecls from anonymous unions in the AST.Nico Weber2016-01-281-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For void f() { union { int i; }; } clang used to omit the RecordDecl from the anonymous union from the AST. That's because the code creating it only called PushOnScopeChains(), which adds it to the current DeclContext, which here is the function's DeclContext. But RecursiveASTVisitor doesn't descent into all decls in a FunctionDecl. Instead, for DeclContexts that contain statements, return the RecordDecl so that it can be included in the DeclStmt containing the VarDecl for the union. Interesting bits from the AST before this change: |-FunctionDecl | `-CompoundStmt | |-DeclStmt | | `-VarDecl 0x589cd60 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit After this change: -FunctionDecl | `-CompoundStmt | |-DeclStmt | | |-CXXRecordDecl 0x4612e48 <col:3, col:18> col:3 union definition | | | |-FieldDecl 0x4612f70 <col:11, col:15> col:15 referenced i 'int' | | `-VarDecl 0x4613010 <col:3> col:3 implicit used 'union (anonymous at test.cc:3:3)' callinit This is now closer to how anonymous struct and unions are represented as members of structs. It also enabled deleting some one-off code in the template instantiation code. Finally, it fixes a crash with ASTMatchers, see the included test case (this fixes http://crbug.com/580749). llvm-svn: 259079
* Fix infinite loop when ::new or ::delete are found in member initializer ↵Alexey Bataev2016-01-201-12/+14
| | | | | | | | | list, by Denis Zobnin Fix for an infinite loop on parsing ::new or ::delete in member initializer list, found by fuzzing PR23057, comment #33. Skip the rest of the member initializers if the previous initializer was invalid. Differential Revision: http://reviews.llvm.org/D16216 llvm-svn: 258290
* OpaquePtr: Use nullptr construction for ParsedType OpaquePtr typedefDavid Blaikie2016-01-151-15/+14
| | | | llvm-svn: 257958
* OpaquePtr: Use nullptr construction for TemplateTy OpaquePtr typedefDavid Blaikie2016-01-151-5/+4
| | | | llvm-svn: 257957
* OpaquePtr: Use nullptr construction for DeclGroupPtrTy OpaquePtr typedefDavid Blaikie2016-01-151-23/+23
| | | | llvm-svn: 257956
* Properly track the end location of an exception specification.Aaron Ballman2016-01-121-1/+2
| | | | | | Patch by Adrian Zgorzałek llvm-svn: 257521
* [Sema] ArrayRef-ize ActOnBaseSpecifiers. NFCCraig Topper2015-12-271-1/+1
| | | | llvm-svn: 256478
* Revert r256399 "[Sema] ArrayRef-ize ActOnBaseSpecifiers. NFC"Craig Topper2015-12-251-1/+1
| | | | | | It broke lldb build. llvm-svn: 256403
* [Sema] ArrayRef-ize ActOnTemplateParameterList. NFCCraig Topper2015-12-241-2/+2
| | | | llvm-svn: 256400
* [Sema] ArrayRef-ize ActOnBaseSpecifiers. NFCCraig Topper2015-12-241-1/+1
| | | | llvm-svn: 256399
* Some minor correction based on David Blaikie post-commit code review for ↵Ekaterina Romanova2015-12-241-1/+1
| | | | | | r255281. llvm-svn: 256396
* Do not generate DW_TAG_imported_module for anonymous namespaces (even ↵Ekaterina Romanova2015-12-101-14/+19
| | | | | | | | | | nested) for all the platforms except PS4. For PS4, generate explicit import for anonymous namespaces and mark it by DW_AT_artificial attribute. Differential Revision: http://reviews.llvm.org/D12624 llvm-svn: 255281
* [MS] Fix for bug 25013 - #pragma vtordisp is unknown inside functions, by ↵Alexey Bataev2015-11-201-0/+5
| | | | | | | | | Denis Zobnin. This patch adds support of #pragma vtordisp inside functions in attempt to improve compatibility. Microsoft compiler appears to save the stack of vtordisp modes on entry of struct methods' bodies and restore it on exit (method-local vtordisp). Differential Revision: http://reviews.llvm.org/D14467 llvm-svn: 253650
* [modules] When a #include is mapped to a module import and appears somewhereRichard Smith2015-11-171-4/+4
| | | | | | | | | | | | | | other than the top level, we issue an error. This breaks a fair amount of C++ code wrapping C libraries, where the C library is #included within a namespace / extern "C" combination, because the C library (probably) includes C++ standard library headers which may be within modules. Without modules, this setup is harmless if (and *only* if) the corresponding standard library module was already included outside the namespace, so downgrade the error to a default-error extension in that case, so that it can be selectively disabled for such misbehaving libraries. llvm-svn: 253398
* Merge some similar diagnostics using %select.Craig Topper2015-11-141-4/+4
| | | | llvm-svn: 253136
* Fix 80 column violation. NFC.Craig Topper2015-11-141-2/+2
| | | | llvm-svn: 253134
* Fix Clang-tidy modernize-use-nullptr warnings in source directories; other ↵Hans Wennborg2015-10-061-7/+6
| | | | | | | | | | minor cleanups Patch by Eugene Zelenko! Differential Revision: http://reviews.llvm.org/D13406 llvm-svn: 249484
* SourceRanges are small and trivially copyable, don't them by reference.Craig Topper2015-10-041-1/+1
| | | | llvm-svn: 249259
* [Modules] More descriptive diagnostics for misplaced import directiveSerge Pavlov2015-09-191-3/+5
| | | | | | | | | | If an import directive was put into wrong context, the error message was obscure, complaining on misbalanced braces. To get more descriptive messages, annotation tokens related to modules are processed where they must not be seen. Differential Revision: http://reviews.llvm.org/D11844 llvm-svn: 248085
* Delay emitting members of dllexport classes until the class is fully parsed ↵Hans Wennborg2015-08-151-1/+1
| | | | | | | | | | | | | | | | | (PR23542) This enables Clang to correctly handle code such as: struct __declspec(dllexport) S { int x = 42; }; where it would otherwise error due to trying to generate the default constructor before the in-class initializer for x has been parsed. Differential Revision: http://reviews.llvm.org/D11850 llvm-svn: 245139
* Outline function Parser::ParseCXXClassMemberDeclarationWithPragmas(), NFC.Alexey Bataev2015-07-311-123/+122
| | | | | | Parsing of pragmas followed by a class member declaration is outlined into a separate function Parser::ParseCXXClassMemberDeclarationWithPragmas(). llvm-svn: 243739
* [MS Compat] Allow _Atomic(Type) and 'struct _Atomic' to coexistDavid Majnemer2015-07-221-0/+38
| | | | | | | | | | | | | | | | | | | | | | MSVC 2013 ships, as part of its STL implementation, a class named '_Atomic'. This is unfortunate because this keyword is in conflict with the C11 keyword with the same name. Our solution was to disable this keyword when targeting MSVC 2013 and reenable it for 2015. However, this makes it impossible for clang's headers to make use of _Atomic. This is problematic in the case of libc++ as it makes heavy use of this keyword. Let the keywordness of _Atomic float under certain circumstances: the body of a class named _Atomic, or a class with a base specifier named _Atomic, will not have the keyword variant of _Atomic for the duration of the class body. This is sufficient to allow us to correctly handle _Atomic in the STL while permitting us to use _Atomic as a keyword everywhere else. Differential Revision: http://reviews.llvm.org/D11233 llvm-svn: 242970
OpenPOWER on IntegriCloud