summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert selected expression parsers to use smart pointers.Sebastian Redl2008-12-111-7/+6
| | | | llvm-svn: 60900
* Unifies the name-lookup mechanisms used in various parts of the ASTDouglas Gregor2008-12-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and separates lexical name lookup from qualified name lookup. In particular: * Make DeclContext the central data structure for storing and looking up declarations within existing declarations, e.g., members of structs/unions/classes, enumerators in C++0x enums, members of C++ namespaces, and (later) members of Objective-C interfaces/implementations. DeclContext uses a lazily-constructed data structure optimized for fast lookup (array for small contexts, hash table for larger contexts). * Implement C++ qualified name lookup in terms of lookup into DeclContext. * Implement C++ unqualified name lookup in terms of qualified+unqualified name lookup (since unqualified lookup is not purely lexical in C++!) * Limit the use of the chains of declarations stored in IdentifierInfo to those names declared lexically. * Eliminate CXXFieldDecl, collapsing its behavior into FieldDecl. (FieldDecl is now a ScopedDecl). * Make RecordDecl into a DeclContext and eliminates its Members/NumMembers fields (since one can just iterate through the DeclContext to get the fields). llvm-svn: 60878
* Use a scoped object to manage entry/exit from a parser scope rather than ↵Douglas Gregor2008-12-101-2/+2
| | | | | | explicitly calling EnterScope/ExitScope llvm-svn: 60830
* Modify the move emulation according to the excellent design of Howard ↵Sebastian Redl2008-12-101-11/+11
| | | | | | 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-10/+11
| | | | llvm-svn: 60791
* Consistently use smart pointers for stmt and expr nodes in parser local ↵Sebastian Redl2008-12-091-36/+35
| | | | | | variables. llvm-svn: 60761
* Handle new by passing the Declaration to the Action, not a processed type.Sebastian Redl2008-12-021-4/+2
| | | | llvm-svn: 60413
* Basic support for parsing templates, from Andrew SuttonDouglas Gregor2008-12-011-3/+11
| | | | llvm-svn: 60384
* Attempt to unravel the if/else mess in Parser::ParseDirectDeclarator.Argyrios Kyrtzidis2008-11-261-44/+74
| | | | llvm-svn: 60124
* Implement some suggestions by Daniel:Argyrios Kyrtzidis2008-11-261-5/+4
| | | | | | | | -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
* Only call TryAnnotateScopeToken when parsing C++.Daniel Dunbar2008-11-251-1/+2
| | | | | | | - This improves -parse-noop of Carbon.h by +2%, and I believe compensates for the majority of the performance regression in r58913. llvm-svn: 60063
* Use RAII objects to ensure proper destruction of expression and statement ↵Sebastian Redl2008-11-251-8/+10
| | | | | | AST nodes in the parser in most cases, even on error. llvm-svn: 60057
* Simple parsing of exception specifications, with no semantic analysis yetDouglas Gregor2008-11-251-3/+9
| | | | llvm-svn: 60005
* Convert IdentifierInfo's to be printed the same as DeclarationNames Chris Lattner2008-11-231-1/+1
| | | | | | | | | | | | | | | | | | | | | with implicit quotes around them. This has a bunch of follow-on effects and requires tweaking to a whole lot of code. This causes a regression in two tests (xfailed) by causing it to emit things like: Line 10: duplicate interface declaration for category 'MyClass1' ('Category1') instead of: Line 10: duplicate interface declaration for category 'MyClass1(Category1)' I will fix this in a follow-up commit. As part of this, I had to start switching stuff to use ->getDeclName() instead of Decl::getName() for consistency. This is good, but I was planning to do this as an independent patch. There will be several follow-on patches to clean up some of the mess, but this patch is already too big. llvm-svn: 59917
* Implementation of new and delete parsing and sema.Sebastian Redl2008-11-211-13/+18
| | | | | | This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first. llvm-svn: 59835
* remove uses of IdentifierInfo::getName()Chris Lattner2008-11-191-5/+9
| | | | llvm-svn: 59603
* Extend DeclarationName to support C++ overloaded operators, e.g.,Douglas Gregor2008-11-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | operator+, directly, using the same mechanism as all other special names. Removed the "special" identifiers for the overloaded operators from the identifier table and IdentifierInfo data structure. IdentifierInfo is back to representing only real identifiers. Added a new Action, ActOnOperatorFunctionIdExpr, that builds an expression from an parsed operator-function-id (e.g., "operator +"). ActOnIdentifierExpr used to do this job, but operator-function-ids are no longer represented by IdentifierInfo's. Extended Declarator to store overloaded operator names. Sema::GetNameForDeclarator now knows how to turn the operator name into a DeclarationName for the overloaded operator. Except for (perhaps) consolidating the functionality of ActOnIdentifier, ActOnOperatorFunctionIdExpr, and ActOnConversionFunctionExpr into a common routine that builds an appropriate DeclRefExpr by looking up a DeclarationName, all of the work on normalizing declaration names should be complete with this commit. llvm-svn: 59526
* Change a couple of the Parser::Diag methods to return DiagnosticInfoChris Lattner2008-11-181-36/+34
| | | | | | | | | 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
* Eliminate all of the placeholder identifiers used for constructors,Douglas Gregor2008-11-171-7/+3
| | | | | | | | | 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
* Some cleanups for C++ operator overloadingDouglas Gregor2008-11-171-1/+1
| | | | llvm-svn: 59443
* Implement parsing and semantic checking of the 'mutable' keyword.Sebastian Redl2008-11-141-0/+4
| | | | | | Thanks to Doug for the review. Actual effects of mutable to follow. llvm-svn: 59331
* Don't build identifiers for C++ constructors, destructors, orDouglas Gregor2008-11-121-16/+7
| | | | | | | | | | | | | | conversion functions. Instead, we just use a placeholder identifier for these (e.g., "<constructor>") and override NamedDecl::getName() to provide a human-readable name. This is one potential solution to the problem; another solution would be to replace the use of IdentifierInfo* in NamedDecl with a different class that deals with identifiers better. I'm also prototyping that to see how it compares, but this commit is better than what we had previously. llvm-svn: 59193
* Fix PR3031 by silencing follow-on errors in invalid declarations.Chris Lattner2008-11-111-0/+1
| | | | llvm-svn: 59027
* Implement support for C++ nested-name-specifiers ('foo::bar::x') in the ↵Argyrios Kyrtzidis2008-11-081-27/+101
| | | | | | | | Parser side. No Sema functionality change, just the signatures of the Action/Sema methods. llvm-svn: 58913
* Revert r58880, it breaks test/SemaCXX/constructor.cppArgyrios Kyrtzidis2008-11-081-2/+1
| | | | llvm-svn: 58904
* In a declarator, consider an identifier a constructor only if it is followed ↵Argyrios Kyrtzidis2008-11-081-1/+2
| | | | | | | | | | | | by '('. Previously: class C { int C; // Declarator::SetConstructor was called here. }; llvm-svn: 58880
* Changes in preparation for nested-name-specifiers.Argyrios Kyrtzidis2008-11-071-17/+22
| | | | | | | -When parsing declarators, don't depend on "CurScope->isCXXClassScope() == true" for constructors/destructors -For C++ member declarations, don't depend on "Declarator.getContext() == Declarator::MemberContext" llvm-svn: 58866
* Parsing, ASTs, and semantic analysis for the declaration of conversionDouglas Gregor2008-11-071-7/+25
| | | | | | | | | | | | | functions in C++, e.g., struct X { operator bool() const; }; Note that these conversions don't actually do anything, since we don't yet have the ability to use them for implicit or explicit conversions. llvm-svn: 58860
* Separate the parsing of type-specifiers from other declaration specifiers, ↵Douglas Gregor2008-11-071-112/+182
| | | | | | so that we can parse a C++ type-specifier-seq llvm-svn: 58854
* Parsing, ASTs, and semantic analysis for the declaration of overloadedDouglas Gregor2008-11-061-0/+9
| | | | | | | | | operators in C++. Overloaded operators can be called directly via their operator-function-ids, e.g., "operator+(foo, bar)", but we don't yet implement the semantics of operator overloading to handle, e.g., "foo + bar". llvm-svn: 58817
* Parsing, representation, and preliminary semantic analysis of destructors.Douglas Gregor2008-11-051-6/+43
| | | | | | | | | | | Implicit declaration of destructors (when necessary). Extended Declarator to store information about parsed constructors and destructors; this will be extended to deal with declarators that name overloaded operators (e.g., "operator +") and user-defined conversion operators (e.g., "operator int"). llvm-svn: 58767
* Implement C++ DR 106 and C++ DR 540, both of which deal withDouglas Gregor2008-11-031-0/+13
| | | | | | | | | | | reference-collapsing. Implement diagnostic for formation of a reference to cv void. Drop cv-qualifiers added to a reference type when the reference type comes from a typedef. llvm-svn: 58612
* Add support for parsing and representing C++ constructor declarations.Douglas Gregor2008-10-311-2/+33
| | | | | | | | | | | | | | | Notes: - Constructors are never found by name lookup, so they'll never get pushed into any scope. Instead, they are stored as an OverloadedFunctionDecl in CXXRecordDecl for easy overloading. - There's a new action isCurrentClassName that determines whether an identifier is the name of the innermost class currently being defined; we use this to identify the declarator-id grammar rule that refers to a type-name. - MinimalAction does *not* support parsing constructors. - We now handle virtual and explicit function specifiers. llvm-svn: 58499
* Implement initialization of a reference (C++ [dcl.init.ref]) as partDouglas Gregor2008-10-291-0/+2
| | | | | | | | | | | | | | | | | | | of copy initialization. Other pieces of the puzzle: - Try/Perform-ImplicitConversion now handles implicit conversions that don't involve references. - Try/Perform-CopyInitialization uses CheckSingleAssignmentConstraints for C. PerformCopyInitialization is now used for all argument passing and returning values from a function. - Diagnose errors with declaring references and const values without an initializer. (Uses a new Action callback, ActOnUninitializedDecl). We do not yet have implicit conversion sequences for reference binding, which means that we don't have any overloading support for reference parameters yet. llvm-svn: 58353
* -Add support for cv-qualifiers after function declarators.Argyrios Kyrtzidis2008-10-241-10/+32
| | | | | | -Add withConst/withVolatile/withRestrict methods to QualType class, that return the QualType plus the respective qualifier. llvm-svn: 58120
* implement a couple fixme's by implementing __extension__ properly.Chris Lattner2008-10-201-4/+6
| | | | llvm-svn: 57806
* Support attributes in *yet another* place. Is there any place you Chris Lattner2008-10-201-0/+11
| | | | | | can't stick an attributes? llvm-svn: 57795
* Fix a parser bug where we let attributes interfere with our disambiguationChris Lattner2008-10-201-20/+70
| | | | | | | | | | | | | | | | | | | of whether a '(' was a grouping paren or the start of a function declarator. This is PR2796. Now we eat the attribute before deciding whether the paren is grouping or not, then apply it to the resultant decl or to the first argument as needed. One somewhat surprising aspect of this is that attributes interact with implicit int in cases like this: void a(x, y) // k&r style function void b(__attribute__(()) x, y); // function with two implicit int arguments void c(x, __attribute__(()) y); // error, can't have attr in identifier list. Fun stuff. llvm-svn: 57790
* Remove an implemented fixme, only treat < as a type specifierChris Lattner2008-10-201-3/+4
| | | | | | when ObjC is turned on. llvm-svn: 57787
* Just do a diagIfAmbiguous -> warnIfAmbiguous rename.Argyrios Kyrtzidis2008-10-171-2/+2
| | | | | | No functionality change. llvm-svn: 57746
* Issue a warning when there's an ambiguous function declarator (that could be ↵Argyrios Kyrtzidis2008-10-151-1/+4
| | | | | | | | a direct initializer for a variable defition). Idea originated from here: http://thread.gmane.org/gmane.comp.gcc.devel/101524 llvm-svn: 57609
* In ParseParenDeclarator match "D.setGroupingParens(true);" with another ↵Argyrios Kyrtzidis2008-10-071-0/+3
| | | | | | | | | setGroupingParens call after the ')' is parsed. Fixes this bug: int (x)(0); // error, expected function declarator where the '(0)' initializer is llvm-svn: 57241
* Implement support for C++ direct initializers in declarations, e.g. "int x(1);".Argyrios Kyrtzidis2008-10-061-0/+34
| | | | | | | | | | | | | | | This is how this kind of initializers appear in the AST: -The Init expression of the VarDecl is a functional type construction (of the VarDecl's type). -The new VarDecl::hasCXXDirectInitializer() returns true. e.g, for "int x(1);": -VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr). -hasCXXDirectInitializer() of VarDecl 'x' returns true. A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code. Note that codegening works now for "int x(1);" without any changes to CodeGen. llvm-svn: 57178
* Allow variadic arguments without named ones for C++, e.g. "void(...);"Argyrios Kyrtzidis2008-10-061-1/+2
| | | | llvm-svn: 57143
* Handle ambiguities between expressions and type-ids that occur inside ↵Argyrios Kyrtzidis2008-10-051-1/+1
| | | | | | | | | parentheses, e.g.: sizeof(int()) -> "int()" is type-id sizeof(int()+1) -> "int()+1" is expression. llvm-svn: 57131
* Remove a FIXME.Daniel Dunbar2008-10-031-1/+1
| | | | llvm-svn: 57015
* Pass postfix attributes to ActOnFields.Daniel Dunbar2008-10-031-4/+5
| | | | llvm-svn: 56992
* Fix http://llvm.org/bugs/show_bug.cgi?id=2816.Steve Naroff2008-09-221-6/+6
| | | | llvm-svn: 56433
* Fold Parser::ParseTag into Parser::ParseEnumSpecifier, as suggested in this ↵Argyrios Kyrtzidis2008-09-111-48/+39
| | | | | | | | post: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2008-September/002721.html llvm-svn: 56081
* Support "typeof unary-expression" (GNU C++ extension).Argyrios Kyrtzidis2008-09-051-4/+22
| | | | llvm-svn: 55833
OpenPOWER on IntegriCloud