summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/Parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Put the invalid flag of OwningResult into the Action pointer.Sebastian Redl2009-02-051-1/+1
| | | | | | | | 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
* Basic representation of C++ class templates, from Andrew Sutton.Douglas Gregor2009-02-041-1/+0
| | | | llvm-svn: 63750
* Diagnose ambiguities in getTypeName. Fixes ↵Douglas Gregor2009-02-041-1/+1
| | | | | | http://llvm.org/bugs/show_bug.cgi?id=3475 llvm-svn: 63737
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+1
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* Name change (isTypeName->getTypeName).Steve Naroff2009-01-281-3/+3
| | | | | | Since it doesn't return a bool, is shouldn't be prefixed with 'is'. llvm-svn: 63226
* Split the single monolithic DiagnosticKinds.def file into oneChris Lattner2009-01-271-1/+1
| | | | | | | | | .def file for each library. This means that adding a diagnostic to sema doesn't require all the other libraries to be rebuilt. Patch by Anders Johnsen! llvm-svn: 63111
* Handle any undeclared parameters in a K&R-style function with aDouglas Gregor2009-01-231-0/+1
| | | | | | | | | special action, inside function prototype scope. This avoids confusion when we try to inject these parameters into the scope of the function body before the function itself has been added to the surrounding scope. Fixes <rdar://problem/6097326>. llvm-svn: 62849
* Rename move_convert to move_arg and move_res. The new names are less ↵Sebastian Redl2009-01-181-2/+1
| | | | | | misleading (and shorter). llvm-svn: 62466
* When we see a reference to a struct, class, or union like "struct X"Douglas Gregor2009-01-091-1/+1
| | | | | | | | | | | | | | | | that is neither a definition nor a forward declaration and where X has not yet been declared as a tag, introduce a declaration into the appropriate scope (which is likely *not* to be the current scope). The rules for the placement of the declaration differ slightly in C and C++, so we implement both and test the various corner cases. This implementation isn't 100% correct due to some lingering issues with the function prototype scope (for a function parameter list) not being the same scope as the scope of the function definition. Testcase is FIXME'd; this probably isn't an important issue. Addresses <rdar://problem/6484805>. llvm-svn: 62014
* rename MaybeParseCXXScopeSpecifier -> ParseOptionalCXXScopeSpecifier and Chris Lattner2009-01-061-2/+2
| | | | | | MaybeParseTypeSpecifier -> ParseOptionalTypeSpecifier. llvm-svn: 61796
* rename tok::annot_qualtypename -> tok::annot_typename, which is bothChris Lattner2009-01-061-1/+1
| | | | | | shorter and more accurate. The type name might not be qualified. llvm-svn: 61788
* remove optimization to avoid looking ahead for cases like ::foo. ThisChris Lattner2009-01-051-2/+2
| | | | | | isn't worth the complexity and the code already does a ton of lookahead. llvm-svn: 61671
* Rearrange some code in TryAnnotateTypeOrScopeToken to make it Chris Lattner2009-01-051-23/+26
| | | | | | early exit for C and avoid template lookup for C. llvm-svn: 61667
* TryAnnotateTypeOrScopeToken and TryAnnotateCXXScopeToken can Chris Lattner2009-01-051-7/+6
| | | | | | | only be called when they might be needed now, so make them assert that their current token is :: or identifier. llvm-svn: 61662
* ParseCXXSimpleTypeSpecifier can only be called on things that areChris Lattner2009-01-051-0/+6
| | | | | | | | | | | | verified to be simple type specifiers, so there is no need for it to call TryAnnotateTypeOrScopeToken. Make MaybeParseCXXScopeSpecifier reject ::new and ::delete with a hard error now that it may never be transitively called in a context where these are legal. This allows me to start disentangling things more. llvm-svn: 61659
* sink a call to TryAnnotateCXXScopeToken down into theChris Lattner2009-01-051-4/+6
| | | | | | applicable cases in ParseDeclarationSpecifiers. llvm-svn: 61657
* my previous patch caused sema to drop the global qualifier, makeChris Lattner2009-01-041-5/+8
| | | | | | | sure to pass it down. This makes the code a bit gross, I will clean it up in subsequent commits. llvm-svn: 61650
* use early exits to reduce nesting.Chris Lattner2009-01-041-32/+33
| | | | llvm-svn: 61642
* Parser support for C++ using directives, from Piotr RakDouglas Gregor2008-12-301-0/+16
| | | | llvm-svn: 61486
* Keep track of template arguments when we parse them. Right now, we don't ↵Douglas Gregor2008-12-241-3/+7
| | | | | | actually do anything with the template arguments, but they'll be used to create template declarations llvm-svn: 61413
* Ultrasimplistic sketch for the parsing of C++ template-ids. This won'tDouglas Gregor2008-12-181-14/+31
| | | | | | | | become useful or correct until we (1) parse template arguments correctly, (2) have some way to turn template-ids into types, declarators, etc., and (3) have a real representation of templates. llvm-svn: 61208
* Some utilities for using the smart pointers in Actions, especially Sema. ↵Sebastian Redl2008-12-131-1/+2
| | | | | | Convert a few functions. llvm-svn: 60983
* Convert a big bunch of expression parsers to use smart pointers.Sebastian Redl2008-12-111-1/+1
| | | | llvm-svn: 60906
* 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-6/+3
| | | | | | explicitly calling EnterScope/ExitScope llvm-svn: 60830
* Modify the move emulation according to the excellent design of Howard ↵Sebastian Redl2008-12-101-10/+10
| | | | | | 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
* Kick out the proof-of-concept ASTOwner and replace it with ASTOwningResultSebastian Redl2008-12-091-4/+3
| | | | llvm-svn: 60791
* Lay the groundwork for converting the entire parser-sema chain to smart ↵Sebastian Redl2008-12-091-0/+3
| | | | | | pointers. llvm-svn: 60782
* Consistently use smart pointers for stmt and expr nodes in parser local ↵Sebastian Redl2008-12-091-9/+10
| | | | | | variables. llvm-svn: 60761
* Fix PR3172: if we see an eof or } at the top level, reject it.Chris Lattner2008-12-081-0/+9
| | | | | | | This is important because ParseDeclarationOrFunctionDefinition skips to, but does not consume, an } on error. llvm-svn: 60719
* Representation of template type parameters and non-type templateDouglas Gregor2008-12-051-1/+1
| | | | | | | | | | | | | | | parameters, with some semantic analysis: - Template parameters are introduced into template parameter scope - Complain about template parameter shadowing (except in Microsoft mode) Note that we leak template parameter declarations like crazy, a problem we'll remedy once we actually create proper declarations for templates. Next up: dependent types and value-dependent/type-dependent expressions. llvm-svn: 60597
* Basic support for parsing templates, from Andrew SuttonDouglas Gregor2008-12-011-0/+2
| | | | llvm-svn: 60384
* Improve error recovery when parsing a function definition failsDouglas Gregor2008-12-011-1/+1
| | | | llvm-svn: 60380
* Add some comments.Argyrios Kyrtzidis2008-11-261-0/+9
| | | | llvm-svn: 60119
* Implement some suggestions by Daniel:Argyrios Kyrtzidis2008-11-261-6/+8
| | | | | | | | -Change Parser::ParseCXXScopeSpecifier to MaybeParseCXXScopeSpecifier -Remove Parser::isTokenCXXScopeSpecifier and fold it into MaybeParseCXXScopeSpecifier -Rename Parser::TryAnnotateScopeToken to TryAnnotateCXXScopeToken and only allow it to be called when in C++ llvm-svn: 60117
* Remove an empty if and add a reminder for when we implement C++ try-catch.Sebastian Redl2008-11-241-4/+1
| | | | llvm-svn: 59987
* make the 'to match this' diagnostic a note.Chris Lattner2008-11-231-1/+1
| | | | llvm-svn: 59921
* Split the DiagnosticInfo class into two disjoint classes:Chris Lattner2008-11-221-2/+2
| | | | | | | | | | one for building up the diagnostic that is in flight (DiagnosticBuilder) and one for pulling structured information out of the diagnostic when formatting and presenting it. There is no functionality change with this patch. llvm-svn: 59849
* Tiny fix to the parsing of linkage-specificationsDouglas Gregor2008-11-211-2/+2
| | | | llvm-svn: 59820
* Fix this:Argyrios Kyrtzidis2008-11-191-6/+12
| | | | | | | | | | | | With this snippet: void f(a::b); An assert is hit: Assertion failed: CachedTokens[CachedLexPos-1].getLocation() == Tok.getAnnotationEndLoc() && "The annotation should be until the most recent cached token", file ..\..\lib\Lex\PPCaching.cpp, line 98 Introduce Preprocessor::RevertCachedTokens that reverts a specific number of tokens when backtracking is enabled. llvm-svn: 59636
* remove uses of IdentifierInfo::getName()Chris Lattner2008-11-191-2/+2
| | | | llvm-svn: 59607
* remove the last couple obsolete forms of Parser::Diag.Chris Lattner2008-11-181-12/+0
| | | | llvm-svn: 59510
* Change a couple of the Parser::Diag methods to return DiagnosticInfoChris Lattner2008-11-181-12/+14
| | | | | | | | | and let the clients push whatever they want into the DiagnosticInfo instead of hard coding a few forms. Also switch various clients to use Diag(Tok, ...) instead of Diag(Tok.getLocation(), ...) as the canonical form to simplify the code a bit. llvm-svn: 59509
* This reworks some of the Diagnostic interfaces a bit to change how diagnosticsChris Lattner2008-11-181-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | are formed. In particular, a diagnostic with all its strings and ranges is now packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a ton of random stuff. This has the benefit of simplifying the interface, making it more extensible, and allowing us to do more checking for things like access past the end of the various arrays passed in. In addition to introducing DiagnosticInfo, this also substantially changes how Diagnostic::Report works. Instead of being passed in all of the info required to issue a diagnostic, Report now takes only the required info (a location and ID) and returns a fresh DiagnosticInfo *by value*. The caller is then free to stuff strings and ranges into the DiagnosticInfo with the << operator. When the dtor runs on the DiagnosticInfo object (which should happen at the end of the statement), the diagnostic is actually emitted with all of the accumulated information. This is a somewhat tricky dance, but it means that the accumulated DiagnosticInfo is allowed to keep pointers to other expression temporaries without those pointers getting invalidated. This is just the minimal change to get this stuff working, but this will allow us to eliminate the zillions of variant "Diag" methods scattered throughout (e.g.) sema. For example, instead of calling: Diag(BuiltinLoc, diag::err_overload_no_match, typeNames, SourceRange(BuiltinLoc, RParenLoc)); We will soon be able to just do: Diag(BuiltinLoc, diag::err_overload_no_match) << typeNames << SourceRange(BuiltinLoc, RParenLoc)); This scales better to support arbitrary types being passed in (not just strings) in a type-safe way. Go operator overloading?! llvm-svn: 59502
* Change the diagnostics interface to take an array of pointers to Chris Lattner2008-11-181-2/+4
| | | | | | | | strings instead of array of strings. This reduces string copying in some not-very-important cases, but paves the way for future improvements. llvm-svn: 59494
* Eliminate all of the placeholder identifiers used for constructors,Douglas Gregor2008-11-171-1/+1
| | | | | | | | | destructors, and conversion functions. The placeholders were used to work around the fact that the parser and some of Sema really wanted declarators to have simple identifiers; now, the code that deals with declarators will use DeclarationNames. llvm-svn: 59469
* Implement support for C++ nested-name-specifiers ('foo::bar::x') in the ↵Argyrios Kyrtzidis2008-11-081-0/+71
| | | | | | | | Parser side. No Sema functionality change, just the signatures of the Action/Sema methods. llvm-svn: 58913
* Initial implementation of parsing, semantic analysis, and AST-buildingDouglas Gregor2008-11-051-4/+17
| | | | | | | | | | | | | for constructor initializations, e.g., class A { }; class B : public A { int m; public: B() : A(), m(17) { }; }; llvm-svn: 58749
* eliminate ObjCPropertyAttrs an corresponding enums, just useChris Lattner2008-10-201-12/+0
| | | | | | strcmp when needed. llvm-svn: 57817
* remove extraneous bracesChris Lattner2008-10-201-3/+2
| | | | llvm-svn: 57814
OpenPOWER on IntegriCloud