summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Bug Fix: Template explicit instantiations should not have definitions ↵Larisse Voufo2013-06-211-0/+1
| | | | | | (FixIts yet to be tested.) llvm-svn: 184503
* C++11: don't warn about the deprecated 'register' keyword if it's combined withRichard Smith2013-06-171-7/+0
| | | | | | an asm label. llvm-svn: 184069
* Suppress the c++11 -Wdeprecated warning for 'register' if it is expanded from aRichard Smith2013-06-141-1/+5
| | | | | | macro defined in a system header. glibc uses it in macros, apparently. llvm-svn: 184005
* Add -Wdeprecated warnings and fixits for things deprecated in C++11:Richard Smith2013-06-131-0/+3
| | | | | | | | | - 'register' storage class - dynamic exception specifications Only the former check is enabled by default for now (the latter might be quite noisy). llvm-svn: 183881
* Recognition of empty structures and unions is moved to semantic stageSerge Pavlov2013-06-081-6/+0
| | | | | | Differential Revision: http://llvm-reviews.chandlerc.com/D586 llvm-svn: 183609
* PR16243: Use CXXThisOverride during template instantiation, and fix up theRichard Smith2013-06-071-3/+2
| | | | | | | | places which weren't setting it up properly. This allows us to get the right cv-qualifiers for 'this' when it appears outside a method body in a class template. llvm-svn: 183483
* Adding in parsing and the start of semantic support for __sptr and __uptr ↵Aaron Ballman2013-05-221-1/+8
| | | | | | | | | | pointer type qualifiers. This patch also fixes the correlated __ptr32 and __ptr64 pointer qualifiers so that they are truly type attributes instead of declaration attributes. For more information about __sptr and __uptr, see MSDN: http://msdn.microsoft.com/en-us/library/aa983399.aspx Patch reviewed by Richard Smith. llvm-svn: 182535
* Use only explicit bool conversion operatorDavid Blaikie2013-05-151-1/+1
| | | | | | | | | | | | | | | | | | | The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. DiagnosticBuilder kept its implicit conversion operator owing to the prevalent use of it in return statements. One bug was found in ExprConstant.cpp involving a comparison of two PointerUnions (PointerUnion did not previously have an operator==, so instead both operands were converted to bool & then compared). A test is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix (adding operator== to PointerUnion in LLVM). llvm-svn: 181869
* Properly parsing __declspec(safebuffers), though there is no semantic ↵Aaron Ballman2013-05-041-0/+1
| | | | | | hookup. For more information about safebuffers, see MSDN: http://msdn.microsoft.com/en-us/library/dd778695(v=vs.110).aspx llvm-svn: 181123
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. llvm-svn: 180973
* Revert r180970; it's causing breakage.Douglas Gregor2013-05-021-10/+0
| | | | llvm-svn: 180972
* Use attribute argument information to determine when to parse attribute ↵Douglas Gregor2013-05-021-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | arguments as expressions. This change partly addresses a heinous problem we have with the parsing of attribute arguments that are a lone identifier. Previously, we would end up parsing the 'align' attribute of this as an expression "(Align)": template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align((Align)))) char storage[Size]; }; while this would parse as a "parameter name" 'Align': template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align(Align))) char storage[Size]; }; The code that handles the alignment attribute would completely ignore the parameter name, so the while the first of these would do what's expected, the second would silently be equivalent to template<unsigned Size, unsigned Align> class my_aligned_storage { __attribute__((align)) char storage[Size]; }; i.e., use the maximal alignment rather than the specified alignment. Address this by sniffing the "Args" provided in the TableGen description of attributes. If the first argument is "obviously" something that should be treated as an expression (rather than an identifier to be matched later), parse it as an expression. Fixes <rdar://problem/13700933>. llvm-svn: 180970
* Fix PR15845: apparently MSVC does not support implicit int in C++ mode.Richard Smith2013-04-301-3/+2
| | | | llvm-svn: 180822
* ArrayRef'ize Sema::ActOnEnumBody. No functionality change.Dmitri Gribenko2013-04-271-2/+2
| | | | | | Patch by Robert Wilhelm. llvm-svn: 180682
* Implement C++1y decltype(auto).Richard Smith2013-04-261-2/+1
| | | | llvm-svn: 180610
* Warn that scoped enumerations are a C++11 extenstion when compiling inRichard Trieu2013-04-231-3/+3
| | | | | | | C++98 mode. This improves on the previous diagnostic message of: error: expected identifier or '{' llvm-svn: 180076
* The 'constexpr implies const' rule for non-static member functions is gone inRichard Smith2013-04-211-1/+2
| | | | | | | | | C++1y, so stop adding the 'const' there. Provide a compatibility warning for code relying on this in C++11, with a fix-it hint. Update our lazily-written tests to add the const, except for those ones which were testing our implementation of this rule. llvm-svn: 179969
* [Parser] Handle #pragma pack/align inside C structs.Argyrios Kyrtzidis2013-04-181-0/+10
| | | | | | Fixes PR13580. Patch by Serge Pavlov! llvm-svn: 179743
* Fix PR4296: Add parser detection/error recovery for nested functions, from ↵Douglas Gregor2013-04-161-20/+27
| | | | | | Serve Pavlov! llvm-svn: 179603
* Basic support for Microsoft property declarations andJohn McCall2013-04-161-10/+112
| | | | | | | | references thereto. Patch by Tong Shen! llvm-svn: 179585
* Parsing support for thread_local and _Thread_local. We give them the sameRichard Smith2013-04-121-4/+18
| | | | | | semantics as __thread for now. llvm-svn: 179424
* <rdar://problem/13540921> Fix a crasher when an Objective-C for-in loop gets ↵Douglas Gregor2013-04-081-7/+16
| | | | | | a non-variable iteration declaration. llvm-svn: 179053
* Enable use of _Static_assert inside structs and unions in C11 mode (as per ↵Andy Gibbs2013-04-031-0/+7
| | | | | | C11 6.7.2.1p1). llvm-svn: 178632
* Assert that Parser::ParseStructUnionBody is not called for C++ code.Andy Gibbs2013-04-031-3/+3
| | | | llvm-svn: 178631
* PR15633: Note that we are EnteringContext when parsing the nested nameRichard Smith2013-04-011-1/+1
| | | | | | | specifier for an enumeration. Also fix a crash-on-invalid if a non-dependent name specifier is used to declare an enum template. llvm-svn: 178502
* Support C11 _Atomic type qualifier. This is more-or-less just syntactic ↵Richard Smith2013-03-281-11/+32
| | | | | | sugar for the _Atomic type specifier. llvm-svn: 178210
* [Parser] Don't code-complete twice.Argyrios Kyrtzidis2013-03-271-1/+1
| | | | | | | | | | | | | | | When we are consuming the current token just to enter a new token stream, we push the current token in the back of the stream so that we get it again. Unfortunately this had the effect where if the current token is a code-completion one, we would code-complete once during consuming it and another time after the stream ended. Fix this by making sure that, in this case, ConsumeAnyToken() will consume a code-completion token without invoking code-completion. rdar://12842503 llvm-svn: 178199
* PR15290: 'this' is not permitted in the declaration of a friend function,Richard Smith2013-03-151-4/+6
| | | | | | | therefore references to members should not be transformed into implicit uses of 'this'. Patch by Ismail Pazarbasi! llvm-svn: 177134
* Remove unused variable.Benjamin Kramer2013-03-081-1/+0
| | | | llvm-svn: 176704
* Add support for the OpenCL attribute 'vec_type_hint'.Joey Gouly2013-03-081-10/+37
| | | | | | Patch by Murat Bolat! llvm-svn: 176686
* Don't accidentally and silently accept C++11 attributes in decl-specifier-seqsRichard Smith2013-02-221-1/+1
| | | | | | in C++98. llvm-svn: 175879
* Per the grammar in [dcl.dcl]p1, a simple-declaration can only have attributesRichard Smith2013-02-221-2/+3
| | | | | | if it has declarators. We were missing the check for this in a couple of places. llvm-svn: 175876
* Handle alignas(foo...) pack expansions.Richard Smith2013-02-221-10/+4
| | | | llvm-svn: 175875
* PR15311: Finish implementation of the suggested resolution of core issue 1488,Richard Smith2013-02-201-0/+7
| | | | | | | | which allows grouping parens in an abstract-pack-declarator. This was already mostly implemented, but missed some cases. Add an ExtWarn for use of this extension until CWG ratifies it. llvm-svn: 175660
* Process and handle attributes on conditions and for loop variables. Process andRichard Smith2013-02-201-1/+4
| | | | | | | diagnose attributes on alias declarations, using directives, and attribute declarations. llvm-svn: 175649
* Don't repeat the function name in the comment.Richard Smith2013-02-201-4/+4
| | | | llvm-svn: 175586
* PR15300: Support C++11 attributes on base-specifiers. We don't support any suchRichard Smith2013-02-191-0/+19
| | | | | | | | attributes yet, so just issue the appropriate diagnostics. Also generalize the fixit for attributes-in-the-wrong-place code and reuse it here, if attributes are placed after the access-specifier or 'virtual' in a base specifier. llvm-svn: 175575
* Accept over-qualified constructor in MSVC emulation modeDmitri Gribenko2013-02-121-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSVC accepts this: class A { A::A(); }; Clang accepts regular member functions with extra qualification as an MS extension, but not constructors. This changes the parser to defer rejecting qualified constructors so that the same Sema logic can apply to constructors as regular member functions. This also improves the error message when MS extensions are disabled (in my opinion). Before it was: /Users/jason/Desktop/test.cpp:2:8: error: expected member name or ';' after declaration specifiers A::A(); ~~~~ ^ 1 error generated. After: /Users/jason/Desktop/test.cpp:2:6: error: extra qualification on member 'A' A::A(); ~~~^ 1 error generated. Patch by Jason Haslam. llvm-svn: 174980
* Excise <cctype> from Clang (except clang-tblgen) in favor of CharInfo.h.Jordan Rose2013-02-081-3/+4
| | | | | | | Nearly all of these changes are one-to-one replacements; the few that aren't have to do with custom identifier validation. llvm-svn: 174768
* Thread safety analysis: make sure that expressions in attributes are parsedDeLesley Hutchins2013-02-071-0/+1
| | | | | | in an unevaluated context. llvm-svn: 174644
* Add OpenCL samplers as Clang builtin types and check sampler related ↵Guy Benyei2013-02-071-0/+7
| | | | | | restrictions. llvm-svn: 174601
* Downgrade 'attribute ignored when parsing type' from error to warning, to matchRichard Smith2013-01-291-1/+1
| | | | | | | | | the diagnostic's warn_ name. Switch some places (notably C++11 attributes) which really wanted an error over to a different diagnostic. Finally, suppress the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing diagnostics in important system headers. llvm-svn: 173788
* Implement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.Richard Smith2013-01-291-0/+3
| | | | llvm-svn: 173779
* Treat alignas and _Alignas as keyword attributes. This allows us toRichard Smith2013-01-291-10/+6
| | | | | | | pretty-print them properly (modulo the more general badness in alignment attribute printing). llvm-svn: 173752
* Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelledRichard Smith2013-01-291-5/+7
| | | | | | | | | as a keyword. Rationalize existing attributes to use it as appropriate, and to not lie about some __declspec attributes being GNU attributes. In passing, remove a gross hack which was discarding attributes which we could handle. This results in us actually respecting the __pascal keyword again. llvm-svn: 173746
* Finish semantic analysis for [[carries_dependency]] attribute.Richard Smith2013-01-281-2/+7
| | | | | | | | | | This required plumbing through a new flag to determine whether a ParmVarDecl is actually a parameter of a function declaration (as opposed to a function typedef etc, where the attribute is prohibited). Weirdly, this attribute (just like [[noreturn]]) cannot be applied to a function type, just to a function declaration (and its parameters). llvm-svn: 173726
* Give a more informative error message when the dot or arrow operator is usedRichard Trieu2013-01-261-3/+6
| | | | | | | on a type. Currently, it gives a generic "expected unqualified-id" error. The new error message is "cannot use (dot|arrow) operator on a type". llvm-svn: 173556
* Implement OpenCL event_t as Clang builtin type, including event_t related ↵Guy Benyei2013-01-201-0/+7
| | | | | | OpenCL restrictions (OpenCL 1.2 spec 6.9) llvm-svn: 172973
* Parsing support for C11's _Noreturn keyword. No semantics yet.Richard Smith2013-01-171-0/+6
| | | | llvm-svn: 172761
* Implement C++11 semantics for [[noreturn]] attribute. This required splittingRichard Smith2013-01-171-0/+2
| | | | | | | | it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as affecting the function type, whereas [[noreturn]] does not). llvm-svn: 172691
OpenPOWER on IntegriCloud