summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add the Microsoft __is_interface_class type trait.John McCall2012-09-251-0/+1
| | | | | | Patch by Andy Gibbs! llvm-svn: 164591
* If a comma operator is followed by a token which unambiguously indicates theRichard Smith2012-09-181-0/+22
| | | | | | | | start of a statement or the end of a compound-statement, diagnose the comma as a typo for a semicolon. Patch by Ahmed Bougacha! Additional test cases and minor refactoring by me. llvm-svn: 164085
* Remove unused macro definitionDouglas Gregor2012-09-111-2/+0
| | | | llvm-svn: 163598
* Extend the "__is_pod" hack, which demotes various type trait keywordsDouglas Gregor2012-08-301-1/+50
| | | | | | | | | (__is_pod, __is_signed, etc.) to normal identifiers if they are encountered in certain places in the grammar where we know that prior versions of libstdc++ or libc++ use them, to still allow the use of these keywords as type traits. Fixes <rdar://problem/9836262> and PR10184. llvm-svn: 162937
* Remove ASTOwningVector, it doesn't own anything and provides no value over ↵Benjamin Kramer2012-08-231-5/+5
| | | | | | SmallVector. llvm-svn: 162492
* Rip out remnants of move semantic emulation and smart pointers in Sema.Benjamin Kramer2012-08-231-30/+30
| | | | | | | These were nops for quite a while and only lead to confusion. ASTMultiPtr now behaves like a proper dumb array reference. llvm-svn: 162475
* Improvements to vexing-parse warnings. Make the no-parameters case moreRichard Smith2012-07-301-1/+1
| | | | | | | | | | | | | accurate by asking the parser whether there was an ambiguity rather than trying to reverse-engineer it from the DeclSpec. Make the with-parameters case have better diagnostics by using semantic information to drive the warning, improving the diagnostics and adding a fixit. Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for declarations of the form 'T (*x)(...)', which seem to have a very high false positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'. llvm-svn: 160998
* Add support for the C11 _Alignof keyword.Jordan Rose2012-06-301-9/+17
| | | | | | | This behaves like the existing GNU __alignof and C++11 alignof keywords; most of the patch is simply adding the third token spelling to various places. llvm-svn: 159494
* Support L__FUNCTION__ in microsoft mode, PR11789Nico Weber2012-06-231-0/+1
| | | | | | | | | | Heavily based on a patch from Aaron Wishnick <aaron.s.wishnick@gmail.com>. I'll clean up the duplicated function in CodeGen as a follow-up, later today or tomorrow. llvm-svn: 159060
* Documentation cleanup: fixing file headers to use Doxygen \file markup whileJames Dennett2012-06-191-1/+3
| | | | | | also being sufficiently conformant to LLVM's coding standards. llvm-svn: 158739
* Documentation cleanup:James Dennett2012-06-171-43/+65
| | | | | | | * Added \file, \brief and \verbatim...\endverbatim markup, particularly around documentation of subset of the grammars that are being parsed. llvm-svn: 158628
* Check the parameter lists and return type of both blocks and lambdasDouglas Gregor2012-06-151-5/+5
| | | | | | | for unexpanded parameter packs. Fixes the crash-on-invalid in PR13117. llvm-svn: 158525
* Documentation cleanup: escape Objective-C @ symbols in Doxygen comments.James Dennett2012-06-151-5/+5
| | | | llvm-svn: 158495
* Whenever we have a BalancedDelimiterTracker, we have a 'nested' scopeDouglas Gregor2012-06-061-1/+0
| | | | | | | where '>' is going to behave as an operator (and not as a '>' closing a template argument list). llvm-svn: 158111
* Revert most of r154844, which was disabled in r155975. Keep around theRichard Smith2012-05-021-1/+1
| | | | | | | refactorings in that revision, and some of the subsequent bugfixes, which seem to be relevant even without delayed exception specification parsing. llvm-svn: 156031
* Implement the last part of C++ [class.mem]p2, delaying the parsing ofDouglas Gregor2012-04-161-1/+1
| | | | | | | | | exception specifications on member functions until after the closing '}' for the containing class. This allows, for example, a member function to throw an instance of its own class. Fixes PR12564 and a fairly embarassing oversight in our C++98/03 support. llvm-svn: 154844
* Add an AttributedStmt type to represent a statement with C++11 attributesRichard Smith2012-04-141-3/+1
| | | | | | | | | attached. Since we do not support any attributes which appertain to a statement (yet), testing of this is necessarily quite minimal. Patch by Alexander Kornienko! llvm-svn: 154723
* Disambiguation of '[[':Richard Smith2012-04-101-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject array sizes and array indexes which begin with a lambda-expression. Recover by parsing the lambda as a lambda. * In Objective-C++11, either '[' could be the start of a message-send. Fully disambiguate this case: it turns out that the grammars of message-sends, lambdas and attributes do not actually overlap. Accept any occurrence of '[[' where either '[' starts a message send, but reject a lambda in an array index just like in C++11 mode. Implement a couple of changes to the attribute wording which occurred after our attributes implementation landed: * In a function-declaration, the attributes go after the exception specification, not after the right paren. * A reference type can have attributes applied. * An 'identifier' in an attribute can also be a keyword. Support for alternative tokens (iso646 keywords) in attributes to follow. And some bug fixes: * Parse attributes after declarator-ids, even if they are not simple identifiers. * Do not accept attributes after a parenthesized declarator. * Accept attributes after an array size in a new-type-id. * Partially disamiguate 'delete' followed by a lambda. More work is required here for the case where the lambda-introducer is '[]'. llvm-svn: 154369
* For PR11916: Add support for g++'s __int128 keyword. Unlike __int128_t, this isRichard Smith2012-04-041-0/+1
| | | | | | | | | | a type specifier and can be combined with unsigned. This allows libstdc++4.7 to be used with clang in c++98 mode. Several other changes are still required for libstdc++4.7 to work with clang in c++11 mode. llvm-svn: 153999
* Enter an expression evaluation context when parsingJohn McCall2012-04-041-1/+7
| | | | | | | statement-expressions. Prevents cleanups and such from being claimed by the first full-expression in the block. llvm-svn: 153989
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-32/+32
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Support for raw and template forms of numeric user-defined literals,Richard Smith2012-03-091-9/+4
| | | | | | and lots of tidying up. llvm-svn: 152392
* Streamline BalancedDelimiterTracker, by eliminating the duplicateDouglas Gregor2012-03-081-6/+11
| | | | | | | | paren/brace/bracket tracking (the Consume* functions already did it), removing the use of ConsumeAnyToken(), and moving the hot paths inline with the error paths out-of-line. llvm-svn: 152274
* Add clang support for new Objective-C literal syntax for NSDictionary, NSArray,Ted Kremenek2012-03-061-0/+13
| | | | | | | | | | | | | NSNumber, and boolean literals. This includes both Sema and Codegen support. Included is also support for new Objective-C container subscripting. My apologies for the large patch. It was very difficult to break apart. The patch introduces changes to the driver as well to cause clang to link in additional runtime support when needed to support the new language features. Docs are forthcoming to document the implementation and behavior of these features. llvm-svn: 152137
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-061-8/+15
| | | | | | | | | | grammar requires a string-literal and not a user-defined-string-literal. The two constructs are still represented by the same TokenKind, in order to prevent a combinatorial explosion of different kinds of token. A flag on Token tracks whether a ud-suffix is present, in order to prevent clients from needing to look at the token's spelling. llvm-svn: 152098
* Avoid examining the AST from the parser, and simplify somewhat.Richard Smith2012-03-011-15/+13
| | | | llvm-svn: 151805
* Reject 'a = {0} = {0}' rather than parsing it as '(a = {0}) = {0}'. AlsoRichard Smith2012-03-011-12/+28
| | | | | | | improve the diagnostics for some attempts to use initializer lists in expressions. llvm-svn: 151794
* Make the odr-use logic work correctly for constant-expressions. PR12006.Eli Friedman2012-02-291-1/+2
| | | | llvm-svn: 151699
* Half of PR12088: parse braced-init-lists on the RHS of assignment operators.Richard Smith2012-02-261-3/+14
| | | | | | | | If the assignment operator is a scalar type, we continue to incorrectly reject the initializer, but semantic analysis (and codegen) is correct for overloaded operators. llvm-svn: 151508
* ArrayRef'ize various functions in the AST/Parser/Sema.Ahmed Charles2012-02-251-4/+4
| | | | llvm-svn: 151447
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-241-0/+3
| | | | | | | | | | | | | | | | that provides the behavior of the C++11 library trait std::is_trivially_constructible<T, Args...>, which can't be implemented purely as a library. Since __is_trivially_constructible can have zero or more arguments, I needed to add Yet Another Type Trait Expression Class, this one handling arbitrary arguments. The next step will be to migrate UnaryTypeTrait and BinaryTypeTrait over to this new, more general TypeTrait class. Fixes the Clang side of <rdar://problem/10895483> / PR12038. llvm-svn: 151352
* Provide the __is_trivially_assignable type trait, which providesDouglas Gregor2012-02-231-0/+1
| | | | | | | compiler support for the std::is_trivially_assignable library type trait. llvm-svn: 151240
* Fix typo correction of template arguments to once again allow type names.Kaelyn Uhrain2012-02-221-2/+2
| | | | llvm-svn: 151112
* Change wording of warning about using __bridge casts in non-ARC.Ted Kremenek2012-02-181-1/+1
| | | | llvm-svn: 150868
* Reject continue/break statements within members of local functions nested withinRichard Smith2012-02-171-1/+0
| | | | | | | | | | | | | | | loop and switch statements, by teaching Scope that a function scope never has a continue/break parent for the purposes of control flow. Remove the hack in block and lambda expressions which worked around this by pretending that such expressions were continue/break scopes. Remove Scope::ControlParent, since it's unused. In passing, teach default statements to recover properly from a missing ';', and add a fixit for same to both default and case labels (the latter already recovered correctly). llvm-svn: 150776
* In Objective-C++, allow the keyword 'class' to be used as a propertyDouglas Gregor2012-02-161-6/+20
| | | | | | | | name for dot syntax, e.g., NSObject.class or foo.class. For other C++-keywords-as-method-names, use message send syntax. Fixes <rdar://problem/10794452>. llvm-svn: 150710
* Represent C++ direct initializers as ParenListExprs before semantic analysisSebastian Redl2012-02-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | instead of having a special-purpose function. - ActOnCXXDirectInitializer, which was mostly duplication of AddInitializerToDecl (leading e.g. to PR10620, which Eli fixed a few days ago), is dropped completely. - MultiInitializer, which was an ugly hack I added, is dropped again. - We now have the infrastructure in place to distinguish between int x = {1}; int x({1}); int x{1}; -- VarDecl now has getInitStyle(), which indicates which of the above was used. -- CXXConstructExpr now has a flag to indicate that it represents list- initialization, although this is not yet used. - InstantiateInitializer was renamed to SubstInitializer and simplified. - ActOnParenOrParenListExpr has been replaced by ActOnParenListExpr, which always produces a ParenListExpr. Placed that so far failed to convert that back to a ParenExpr containing comma operators have been fixed. I'm pretty sure I could have made a crashing test case before this. The end result is a (I hope) considerably cleaner design of initializers. More importantly, the fact that I can now distinguish between the various initialization kinds means that I can get the tricky generalized initializer test cases Johannes Schaub supplied to work. (This is not yet done.) This commit passed self-host, with the resulting compiler passing the tests. I hope it doesn't break more complicated code. It's a pretty big change, but one that I feel is necessary. llvm-svn: 150318
* Make parsing of objc @implementations more robust.Argyrios Kyrtzidis2012-02-071-1/+2
| | | | | | | | | | | | | | | | | | | Parsing of @implementations was based on modifying global state from the parser; the logic for late parsing of methods was spread in multiple places making it difficult to have a robust error recovery. -it was difficult to ensure that we don't neglect parsing the lexed methods. -it was difficult to setup the original objc container context for parsing the lexed methods after completing ParseObjCAtImplementationDeclaration and returning to top level context. Enhance parsing of @implementations by centralizing it in Parser::ParseObjCAtImplementationDeclaration(). ParseObjCAtImplementationDeclaration now returns only after an @implementation is fully parsed; all the data and logic for late parsing of methods is now in one place. This allows us to provide code-completion for late parsed methods with mis-matched braces. rdar://10775381 llvm-svn: 149987
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-7/+8
| | | | llvm-svn: 149127
* Avoid correcting unknown identifiers to types where types aren't allowed.Kaelyn Uhrain2012-01-251-10/+39
| | | | | | | | Pass a typo correction callback object from ParseCastExpr to Sema::ActOnIdExpression to be a bit more selective about what kinds of corrections will be allowed for unknown identifiers. llvm-svn: 148973
* Support decltype as a simple-type-specifier.David Blaikie2012-01-241-0/+1
| | | | | | | This makes all sorts of fun examples work with decltype. Reviewed by Richard Smith. llvm-svn: 148787
* Make clang's AST model sizeof and typeof with potentially-evaluated operands ↵Eli Friedman2012-01-211-16/+2
| | | | | | correctly, similar to what we already do with typeid. llvm-svn: 148610
* For Lexer's isAt[Start/End]OfMacroExpansion add an out parameter for the macroArgyrios Kyrtzidis2012-01-191-2/+2
| | | | | | | | | start/end location. It is commonly needed after calling the function; with this way we avoid recalculating it. llvm-svn: 148479
* Stub out the Sema interface for lambda expressions, and change the parser to ↵Eli Friedman2012-01-041-1/+6
| | | | | | use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet. llvm-svn: 147515
* Mass rename C1x references to C11. The name hasn't proliferated like "C++0x" ↵Benjamin Kramer2011-12-231-8/+8
| | | | | | | | so this patch is surprisingly small. Also drop -Wc1x-extensions in favor of -Wc11-extensions. I don't think we need to keep this around for compatibility. llvm-svn: 147221
* Fix a parser bug that prevented it from correctly parsing explicit construct ↵Sebastian Redl2011-12-221-1/+2
| | | | | | expressoins of the form T{args}. llvm-svn: 147155
* Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.Richard Smith2011-12-201-7/+8
| | | | | | | | | | | | | | | | | | | | | | Split out a new ExpressionEvaluationContext flag for this case, and don't treat it as unevaluated in C++11. This fixes some crash-on-invalids where we would allow references to class members in potentially-evaluated constant expressions in static member functions, and also fixes half of PR10177. The fix to PR10177 exposed a case where template instantiation failed to provide a source location for a diagnostic, so TreeTransform has been tweaked to supply source locations when transforming a type. The source location is still not very good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to improve it further. Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for static data members of class templates which are used in constant expressions. This fixes a link-time problem, but we still incorrectly treat the member as non-constant. The rest of the fix for that issue is blocked on PCH support for early-instantiated static data members, which will be added in a subsequent patch. llvm-svn: 146955
* Refine error diagnostic for using bridged casts when not using ARC.Ted Kremenek2011-12-201-3/+4
| | | | llvm-svn: 146938
* objc-arc: bridge casts in non-arc mode are nowFariborz Jahanian2011-12-191-1/+1
| | | | | | error. // rdar://10597832 llvm-svn: 146918
* objc-arc: bridge casts in non-objc-arc mode are ignord.Fariborz Jahanian2011-12-191-6/+16
| | | | | | But, warn too. // rdar://10597832 llvm-svn: 146904
OpenPOWER on IntegriCloud