summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add support for the __has_trivial_constructor type trait.Anders Carlsson2009-04-161-1/+2
| | | | llvm-svn: 69245
* Fixup whitespacing.Mike Stump2009-04-141-1/+1
| | | | llvm-svn: 69055
* Improve error recovery for calls, fixing:Chris Lattner2009-04-131-3/+8
| | | | | | PR3972: Poor diagnostic with missing ')' llvm-svn: 68932
* Fix http://llvm.org/bugs/show_bug.cgi?id=3907.Steve Naroff2009-04-021-1/+2
| | | | llvm-svn: 68338
* Initial implementation of parsing, semantic analysis, and templateDouglas Gregor2009-03-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | instantiation for C++ typename-specifiers such as typename T::type The parsing of typename-specifiers is relatively easy thanks to annotation tokens. When we see the "typename", we parse the typename-specifier and produce a typename annotation token. There are only a few places where we need to handle this. We currently parse the typename-specifier form that terminates in an identifier, but not the simple-template-id form, e.g., typename T::template apply<U, V> Parsing of nested-name-specifiers has a similar problem, since at this point we don't have any representation of a class template specialization whose template-name is unknown. Semantic analysis is only partially complete, with some support for template instantiation that works for simple examples. llvm-svn: 67875
* Fix rdar://6719156 - clang should emit a better error when blocks are ↵Chris Lattner2009-03-271-12/+8
| | | | | | | | | disabled but are used anyway by changing blocks from being disabled in the parser to being disabled in Sema. llvm-svn: 67816
* improve error recovery for when type parsing fails.Chris Lattner2009-03-241-1/+5
| | | | llvm-svn: 67626
* Keep track of whether a class is abstract or not. This is currently only ↵Anders Carlsson2009-03-221-0/+1
| | | | | | used for the __is_abstract type trait. llvm-svn: 67461
* Convert a bunch of actions to smart pointers, and also bring ↵Sebastian Redl2009-03-151-8/+6
| | | | | | PrintParserCallbacks a bit more in line with reality. llvm-svn: 67029
* Implement property '.' notation on Factory/Class objects. Parser changes ↵Steve Naroff2009-03-091-0/+22
| | | | | | | | aren't very pretty:-( This fixes <rdar://problem/6496506> Implement class setter/getter for properties. llvm-svn: 66465
* if we crash while parsing a block literal, include it.Chris Lattner2009-03-051-1/+5
| | | | llvm-svn: 66150
* Implemented access check for ivars accessed insideFariborz Jahanian2009-03-041-1/+2
| | | | | | c-style functions declared inside objc @implementations. llvm-svn: 66087
* Introduce code modification hints into the diagnostics system. When weDouglas Gregor2009-02-261-2/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | know how to recover from an error, we can attach a hint to the diagnostic that states how to modify the code, which can be one of: - Insert some new code (a text string) at a particular source location - Remove the code within a given range - Replace the code within a given range with some new code (a text string) Right now, we use these hints to annotate diagnostic information. For example, if one uses the '>>' in a template argument in C++98, as in this code: template<int I> class B { }; B<1000 >> 2> *b1; we'll warn that the behavior will change in C++0x. The fix is to insert parenthese, so we use code insertion annotations to illustrate where the parentheses go: test.cpp:10:10: warning: use of right-shift operator ('>>') in template argument will require parentheses in C++0x B<1000 >> 2> *b1; ^ ( ) Use of these annotations is partially implemented for HTML diagnostics, but it's not (yet) producing valid HTML, which may be related to PR2386, so it has been #if 0'd out. In this future, we could consider hooking this mechanism up to the rewriter to actually try to fix these problems during compilation (or, after a compilation whose only errors have fixes). For now, however, I suggest that we use these code modification hints whenever we can, so that we get better diagnostics now and will have better coverage when we find better ways to use this information. This also fixes PR3410 by placing the complaint about missing tokens just after the previous token (rather than at the location of the next token). llvm-svn: 65570
* Cope with use of the token '>>' inside a template argument list, e.g.,Douglas Gregor2009-02-251-9/+25
| | | | | | | | | | | | | vector<vector<double>> Matrix; In C++98/03, this token always means "right shift". However, if we're in a context where we know that it can't mean "right shift", provide a friendly reminder to put a space between the two >'s and then treat it as two >'s as part of recovery. In C++0x, this token is always broken into two '>' tokens. llvm-svn: 65484
* rip out __builtin_overloadChris Lattner2009-02-181-34/+0
| | | | llvm-svn: 64961
* Update Parser::ParseTypeName to return a TypeResult, which also tellsDouglas Gregor2009-02-181-14/+30
| | | | | | | | us whether there was an error in trying to parse a type-name (type-id in C++). This allows propagation of errors further in the compiler, suppressing more bogus error messages. llvm-svn: 64922
* Allow "overloadable" functions in C to be declared as variadic withoutDouglas Gregor2009-02-181-1/+2
| | | | | | | | | | | | | | | any named parameters, e.g., this is accepted in C: void f(...) __attribute__((overloadable)); although this would be rejected: void f(...); To do this, moved the checking of the "ellipsis without any named arguments" condition from the parser into Sema (where it belongs anyway). llvm-svn: 64902
* Implement Sebastian's idea for simplifying our handling of the greater-than ↵Douglas Gregor2009-02-091-1/+1
| | | | | | operator/delimiter. Also, clean up after ourselves following a failed parse of a template-argument-list llvm-svn: 64166
* Start processing template-ids as types when the template-name refersDouglas Gregor2009-02-091-6/+15
| | | | | | | | | | | | | | | | | | | | | to a class template. For example, the template-id 'vector<int>' now has a nice, sugary type in the type system. What we can do now: - Parse template-ids like 'vector<int>' (where 'vector' names a class template) and form proper types for them in the type system. - Parse icky template-ids like 'A<5>' and 'A<(5 > 0)>' properly, using (sadly) a bool in the parser to tell it whether '>' should be treated as an operator or not. This is a baby-step, with major problems and limitations: - There are currently two ways that we handle template arguments (whether they are types or expressions). These will be merged, and, most likely, TemplateArg will disappear. - We don't have any notion of the declaration of class template specializations or of template instantiations, so all template-ids are fancy names for 'int' :) llvm-svn: 64153
* Implement Declarator::getSourceRange().Sebastian Redl2009-02-091-3/+12
| | | | llvm-svn: 64151
* Implement dereferencing of pointers-to-member.Sebastian Redl2009-02-071-15/+24
| | | | llvm-svn: 63983
* Put the invalid flag of OwningResult into the Action pointer.Sebastian Redl2009-02-051-19/+16
| | | | | | | | This shrinks OwningResult by one pointer. Since it is no longer larger than OwningPtr, merge the two. This leads to simpler client code and speeds up my benchmark by 2.7%. For some reason, this exposes a previously hidden bug, causing a regression in SemaCXX/condition.cpp. llvm-svn: 63867
* Add support for blocks with explicit return types.Mike Stump2009-02-041-6/+28
| | | | llvm-svn: 63784
* Allow taking the address of data members, resulting in a member pointer.Sebastian Redl2009-02-031-7/+18
| | | | | | Pointers to functions don't work yet, and pointers to overloaded functions even less. Also, far too much illegal code is accepted. llvm-svn: 63655
* Formatting fix.Mike Stump2009-02-021-2/+1
| | | | llvm-svn: 63573
* Fix for PR3418: make sure to handle the RHS of expressions starting with Eli Friedman2009-01-271-0/+19
| | | | | | __extension__. This sort of construct shows up in the gcc source code. llvm-svn: 63100
* Optimize Declarator to avoid malloc/free traffic for the argument list of aChris Lattner2009-01-201-1/+2
| | | | | | | | | | | | | | | | function DeclaratorChunk in common cases. This uses a fixed array in Declarator when it is small enough for the first function declarator chunk in a declarator. This eliminates all malloc/free traffic from DeclaratorChunk::getFunction when running on Cocoa.h except for five functions: signal/bsd_signal/sigset, which have multiple Function DeclChunk's, and CFUUIDCreateWithBytes/CFUUIDGetConstantUUIDWithBytes, which take more than 16 arguments. This patch was pair programmed with Steve. llvm-svn: 62599
* Convert more expression actions to smart pointers.Sebastian Redl2009-01-191-9/+9
| | | | llvm-svn: 62537
* Convert more expression actions to smart pointers.Sebastian Redl2009-01-191-13/+11
| | | | | | Fix type of logical negation for C++. llvm-svn: 62475
* Convert a few expression actions to smart pointers.Sebastian Redl2009-01-181-2/+2
| | | | | | These actions are extremely widely used (identifier expressions and literals); still no performance regression. llvm-svn: 62468
* Patch to keep clang honest that it does not yet supportFariborz Jahanian2009-01-141-0/+5
| | | | | | explicit return type on block literals. llvm-svn: 62240
* rename tok::annot_qualtypename -> tok::annot_typename, which is bothChris Lattner2009-01-061-2/+2
| | | | | | shorter and more accurate. The type name might not be qualified. llvm-svn: 61788
* PODness and Type TraitsSebastian Redl2009-01-051-0/+29
| | | | | | | | | | | | | | | Make C++ classes track the POD property (C++ [class]p4) Track the existence of a copy assignment operator. Implicitly declare the copy assignment operator if none is provided. Implement most of the parsing job for the G++ type traits extension. Fully implement the low-hanging fruit of the type traits: __is_pod: Whether a type is a POD. __is_class: Whether a type is a (non-union) class. __is_union: Whether a type is a union. __is_enum: Whether a type is an enum. __is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1). llvm-svn: 61746
* remove optimization to avoid looking ahead for cases like ::foo. ThisChris Lattner2009-01-051-14/+10
| | | | | | isn't worth the complexity and the code already does a ton of lookahead. llvm-svn: 61671
* TryAnnotateTypeOrScopeToken and TryAnnotateCXXScopeToken can Chris Lattner2009-01-051-1/+2
| | | | | | | only be called when they might be needed now, so make them assert that their current token is :: or identifier. llvm-svn: 61662
* code simplificationChris Lattner2009-01-041-5/+2
| | | | llvm-svn: 61654
* my previous patch caused sema to drop the global qualifier, makeChris Lattner2009-01-041-17/+18
| | | | | | | sure to pass it down. This makes the code a bit gross, I will clean it up in subsequent commits. llvm-svn: 61650
* sink the call to TryAnnotateTypeOrScopeToken in Chris Lattner2009-01-041-15/+24
| | | | | | | | ParseCastExpression into the switch. This gets it out of the hot path through ParseCastExpression for all the non-identifier and non-:: tokens. llvm-svn: 61643
* simplify control flow by removing a goto.Chris Lattner2009-01-041-7/+8
| | | | llvm-svn: 61641
* eliminate lookahead when parsing ::new / ::delete.Chris Lattner2009-01-041-9/+13
| | | | llvm-svn: 61638
* Don't explicitly represent OverloadedFunctionDecls withinDouglas Gregor2008-12-231-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | DeclContext. Instead, just keep the list of currently-active declarations and only build the OverloadedFunctionDecl when we absolutely need it. This is a half-step toward eliminating the need to explicitly build OverloadedFunctionDecls that store sets of overloaded functions. This was suggested by Argiris a while back, and it's a good thing for several reasons: first, it eliminates the messy logic that currently tries to keep the OverloadedFunctionDecl in sync with the declarations that are being added. Second, it will (eventually) eliminate the need to allocate memory for overload sets, which could help performance. Finally, it helps set us up for when name lookup can return multiple (possibly ambiguous) results, as can happen with lookup of class members in C++. Next steps: make the IdentifierResolver store overloads as separate entries in its list rather than replacing them with an OverloadedFunctionDecl now, then see how far we can go toward eliminating OverloadedFunctionDecl entirely. llvm-svn: 61357
* Convert remaining expression parsers to smart pointers. Now on to the Action ↵Sebastian Redl2008-12-131-19/+19
| | | | | | connection. llvm-svn: 60982
* fix a buggy fall through that caused a crash-on-invalid. rdar://6248081Chris Lattner2008-12-121-5/+5
| | | | llvm-svn: 60961
* minor refactoring of ParseParenExpressionChris Lattner2008-12-121-13/+16
| | | | llvm-svn: 60928
* Convert a big bunch of expression parsers to use smart pointers.Sebastian Redl2008-12-111-11/+11
| | | | llvm-svn: 60906
* Convert some more expression parsers to use smart pointers.Sebastian Redl2008-12-111-78/+77
| | | | llvm-svn: 60904
* Convert selected expression parsers to use smart pointers.Sebastian Redl2008-12-111-84/+83
| | | | llvm-svn: 60900
* Convert a number of statement parsers to smart pointers.Sebastian Redl2008-12-111-2/+2
| | | | llvm-svn: 60888
* Use a scoped object to manage entry/exit from a parser scope rather than ↵Douglas Gregor2008-12-101-4/+2
| | | | | | explicitly calling EnterScope/ExitScope llvm-svn: 60830
* Modify the move emulation according to the excellent design of Howard ↵Sebastian Redl2008-12-101-72/+74
| | | | | | Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers. llvm-svn: 60809
OpenPOWER on IntegriCloud