summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix parsing of type-specifier-seq's. Types are syntactically allowed to beRichard Smith2012-03-121-16/+1
| | | | | | | | | | | | | | | | | | defined here, but not semantically, so new struct S {}; is always ill-formed, even if there is a struct S in scope. We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being under-loved (due to it only being used in a few places) so merge it into ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this required improving ParseDeclarationSpecifiers' diagnostics in some cases. This also required teaching ParseSpecifierQualifierList about constexpr... which incidentally fixes an issue where we'd allow the constexpr specifier in other bad places. llvm-svn: 152549
* Unify naming of LangOptions variable/get function across the Clang stack ↵David Blaikie2012-03-111-15/+15
| | | | | | | | | | (Lex to AST). The member variable is always "LangOpts" and the member function is always "getLangOpts". Reviewed by Chris Lattner llvm-svn: 152536
* Fix a couple of issues with literal-operator-id parsing, and provide recoveryRichard Smith2012-03-081-11/+56
| | | | | | | | | | | | for a few kinds of error. Specifically: Since we're after translation phase 6, the "" token might be formed by multiple source-level string literals. Checking the token width is not a correct way of detecting empty string literals, due to escaped newlines. Diagnose and recover from a missing space between "" and suffix, and from string literals other than "", which are followed by a suffix. llvm-svn: 152348
* User-defined literals: reject string and character UDLs in all places where theRichard Smith2012-03-061-1/+6
| | | | | | | | | | 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
* Implement a new type trait __is_trivially_constructible(T, Args...)Douglas Gregor2012-02-241-0/+60
| | | | | | | | | | | | | | | | 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
* Accept braced-init-lists in conditions, and, in passing, dramatically improveRichard Smith2012-02-221-8/+27
| | | | | | the diagnostic for using a parenthesized direct-initializer in a condition. llvm-svn: 151137
* In the conflict between C++11 [expr.prim.general]p4, which declaresDouglas Gregor2012-02-211-2/+4
| | | | | | | | | | | that 'this' can be used in the brace-or-equal-initializer of a non-static data member, and C++11 [expr.prim.lambda]p9, which says that lambda expressions not in block scope can have no captures, side fully with C++11 [expr.prim.general]p4 by allowing 'this' to be captured within these initializers. This seems to be the intent of non-static data member initializers. llvm-svn: 151101
* Basic support for name mangling of C++11 lambda expressions. BecauseDouglas Gregor2012-02-201-2/+1
| | | | | | | | | | | | | | | name mangling in the Itanium C++ ABI for lambda expressions is so dependent on context, we encode the number used to encode each lambda as part of the lambda closure type, and maintain this value within Sema. Note that there are a several pieces still missing: - We still get the linkage of lambda expressions wrong - We aren't properly numbering or mangling lambda expressions that occur in default function arguments or in data member initializers. - We aren't (de-)serializing the lambda numbering tables llvm-svn: 150982
* Set the location of the template keyword when allocating a new ↵Benjamin Kramer2012-02-191-0/+1
| | | | | | | | TemplateIdAnnotation. Found by valgrind. llvm-svn: 150940
* 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
* Improve recovery for lambda expressions that have 'mutable' or aDouglas Gregor2012-02-161-0/+46
| | | | | | | trailing return type but not a '()'. Recover by inserting the parentheses. Thanks to Xeo on IRC for the example. llvm-svn: 150727
* Revert "Revert "Make CXXNewExpr contain only a single initialier, and not ↵Sebastian Redl2012-02-161-8/+10
| | | | | | | | hold the used constructor itself."" This reintroduces commit r150682 with a fix for the Bullet benchmark crash. llvm-svn: 150685
* Revert "Make CXXNewExpr contain only a single initialier, and not hold the ↵Sebastian Redl2012-02-161-10/+8
| | | | | | | | | | used constructor itself." It leads to a compiler crash in the Bullet benchmark. This reverts commit r12014. llvm-svn: 150684
* Make CXXNewExpr contain only a single initialier, and not hold the used ↵Sebastian Redl2012-02-161-8/+10
| | | | | | | | | | constructor itself. Holding the constructor directly makes no sense when list-initialized arrays come into play. The constructor is now held in a CXXConstructExpr, if construction is what is done. The new design can also distinguish properly between list-initialization and direct-initialization, as well as implicit default-initialization constructors and explicit value-initialization constructors. Finally, doing it this way removes redundance from the AST because CXXNewExpr doesn't try to handle both the allocation and the initialization responsibilities. This breaks the static analysis of new expressions. I've filed PR12014 to track this. llvm-svn: 150682
* Implement code completion support for lambda capture lists.Douglas Gregor2012-02-151-4/+31
| | | | llvm-svn: 150583
* Implement support for lambda capture pack expansions, e.g.,Douglas Gregor2012-02-141-2/+6
| | | | | | [&values...] { print(values...); } llvm-svn: 150497
* Proper initializer list support for new expressions and type construct ↵Sebastian Redl2012-02-121-4/+7
| | | | | | expressions. Array new still missing. llvm-svn: 150346
* Fix parsing new expressions using init lists. Probably still do the wrong ↵Sebastian Redl2012-02-111-2/+4
| | | | | | | | thing in cases involving array new. Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis. llvm-svn: 150316
* Allow implicit capture of 'this' in a lambda even when the captureDouglas Gregor2012-02-101-2/+2
| | | | | | | | | | | | default is '=', and reword the warning about explicitly capturing 'this' in such lambdas to indicate that only explicit capture is banned. Introduce Fix-Its for this and other "save the programmer from themself" rules regarding what can be explicitly captured and what must be implicitly captured. llvm-svn: 150256
* Added location for template keyword in TemplateSpecializationTypeLoc. In the ↵Abramo Bagnara2012-02-061-1/+2
| | | | | | process removed some naming ambiguities. llvm-svn: 149870
* Added source location for the template keyword in AST template-id expressions.Abramo Bagnara2012-01-271-49/+55
| | | | llvm-svn: 149127
* Avoid redundant NNS qualification in constructor/destructor names.Abramo Bagnara2012-01-271-15/+17
| | | | llvm-svn: 149124
* Avoid correcting unknown identifiers to types where types aren't allowed.Kaelyn Uhrain2012-01-251-1/+1
| | | | | | | | 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-1/+4
| | | | | | | This makes all sorts of fun examples work with decltype. Reviewed by Richard Smith. llvm-svn: 148787
* More dead code removal (using -Wunreachable-code)David Blaikie2012-01-201-1/+1
| | | | llvm-svn: 148577
* Remove PotentiallyPotentiallyEvaluated, and replace it with a much simpler ↵Eli Friedman2012-01-201-4/+4
| | | | | | and less error-prone way of handling the relevant cases. Towards marking of whether a declaration is used more accurately. llvm-svn: 148522
* Extend the error of invalid token after declarations to include fixits for Richard Trieu2012-01-191-5/+1
| | | | | | !=, %=, ^=, &=, *=, -=, |=, /=, <<=, <=, >=, and >>= to =. llvm-svn: 148499
* Change the error when a '+=' follows a declaration to suggest a fixit to '=' ↵Richard Trieu2012-01-181-2/+6
| | | | | | | | | | | | | | | | | | | instead of just suggesting a ';'. Old error: plusequaldeclare1.cc:3:8: error: expected ';' at end of declaration int x += 6; ^ ; New error: plusequaldeclare1.cc:3:9: error: invalid '+=' at end of declaration; did you mean '='? int x += 6; ^~ = llvm-svn: 148433
* Remove unnecessary default cases in switches over enums.David Blaikie2012-01-171-2/+0
| | | | | | This allows -Wswitch-enum to find switches that need updating when these enums are modified. llvm-svn: 148281
* More lambda work. Fixes a minor bug Richard pointed out, makes lookup for ↵Eli Friedman2012-01-061-5/+6
| | | | | | lambda parameters work correctly, recording more information into the AST. llvm-svn: 147650
* More lambda work. Tweak the Sema interface slightly. Start adding the ↵Eli Friedman2012-01-051-5/+2
| | | | | | pieces to build the lambda class and its call operator. Create an actual scope for the lambda body. llvm-svn: 147595
* Add an explicit LambdaExprContext to Declarator, to parallel ↵Eli Friedman2012-01-041-1/+1
| | | | | | BlockLiteralContext. Use it to ensure semantic analysis of types isn't confused by the lack of a type specifier. llvm-svn: 147522
* Fix messed-up indentation in r147515.Eli Friedman2012-01-041-7/+7
| | | | llvm-svn: 147517
* Stub out the Sema interface for lambda expressions, and change the parser to ↵Eli Friedman2012-01-041-17/+42
| | | | | | use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet. llvm-svn: 147515
* Remove unused variables.Rafael Espindola2011-12-251-1/+1
| | | | llvm-svn: 147260
* Silence gcc warnings.Benjamin Kramer2011-12-181-1/+1
| | | | llvm-svn: 146847
* Support decltype in pseudo destructors and dependent destructor calls.David Blaikie2011-12-161-0/+11
| | | | | | Reviewed by Eli Friedman. llvm-svn: 146738
* Decltype in non-pseudo (& non-dependent) dtor calls.David Blaikie2011-12-081-0/+10
| | | | llvm-svn: 146155
* Support decltype in nested-name-specifiers.David Blaikie2011-12-041-0/+16
| | | | llvm-svn: 145785
* Implement support for the __is_final type trait, to determine whetherDouglas Gregor2011-12-031-0/+1
| | | | | | | a class is marked 'final', from Alberto Ganesh Barbati! Fixes PR11462. llvm-svn: 145775
* Tighten up the conditions under which we consider ourselves to beDouglas Gregor2011-11-071-1/+1
| | | | | | | entering the context of a nested-name-specifier. Fixes <rdar://problem/10397846>. llvm-svn: 143967
* Remove duplicate word & unnecessary conditional.David Blaikie2011-11-071-3/+2
| | | | llvm-svn: 143907
* Improve the warning for cv-qualifiers on free functions, from Ahmed Charles!Douglas Gregor2011-10-191-0/+2
| | | | llvm-svn: 142478
* Implement -Wc++98-compat warnings for the parser.Richard Smith2011-10-151-0/+5
| | | | llvm-svn: 142056
* Don't warn about use of 'final' in ill-formed C++98 code which didn't useRichard Smith2011-10-151-1/+1
| | | | | | | 'final', and don't accept (then silently discard) braced init lists in C++98 new-expressions. llvm-svn: 142048
* Provide half floating point support as a storage only type.Anton Korobeynikov2011-10-141-0/+4
| | | | | | Lack of half FP was a regression compared to llvm-gcc. llvm-svn: 142016
* Introduce BalancedDelimiterTracker, to better track open/closeDouglas Gregor2011-10-121-105/+126
| | | | | | | delimiter pairs and detect when we exceed the implementation limit for nesting depth, from Aaron Ballman! llvm-svn: 141782
* Catch placeholder types in DefaultLvalueConversionJohn McCall2011-10-111-8/+0
| | | | | | | | | | | and DefaultFunctionArrayLvalueConversion. To prevent significant regression for should-this-be-a-call fixits, and to repair some such regression from the introduction of bound member placeholders, make those placeholder checks try to build calls appropriately. Harden the build-a-call logic while we're at it. llvm-svn: 141738
* Removing a bunch of dead returns/breaks after llvm_unreachables.David Blaikie2011-09-231-3/+1
| | | | llvm-svn: 140407
OpenPOWER on IntegriCloud