summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Added ParenType type node.Abramo Bagnara2010-12-101-2/+2
| | | | llvm-svn: 121488
* Added struct/class syntactic info for c++0x scoped enum.Abramo Bagnara2010-12-031-4/+7
| | | | llvm-svn: 120828
* After parsing a ':' in an enum-specifier within class context,Douglas Gregor2010-12-011-4/+50
| | | | | | | | | | disambiguate between an expression (for a bit-field width) and a type (for a fixed underlying type). Since the disambiguation can be expensive (due to tentative parsing), we perform a simplistic disambiguation based on one-token lookahead before going into the full-blown tentative parsing. Based on a patch by Daniel Wallin. llvm-svn: 120582
* Remove the other FIXME I added. This is covered by the Index test and not ↵Nico Weber2010-11-221-2/+0
| | | | | | testable via -ast-dump. llvm-svn: 119971
* Try to get the bots green after r119966.Nico Weber2010-11-221-2/+3
| | | | llvm-svn: 119968
* Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.Nico Weber2010-11-221-3/+6
| | | | llvm-svn: 119966
* When parsing something that looks like an ill-formedDouglas Gregor2010-11-191-5/+4
| | | | | | | | protocol-qualifier list without a leading type (e.g., <#blah#>), don't complain about it being an archaic protocol-qualifier list unless it actually parses as one. llvm-svn: 119805
* Emit a specific diagnostic when typedefing C++ bool, mirroring gcc.Argyrios Kyrtzidis2010-11-161-2/+10
| | | | | | Fixes rdar://8365458 llvm-svn: 119359
* Region-allocate all AttributeList objects from a factory object instead of ↵Ted Kremenek2010-11-101-48/+43
| | | | | | | | | | | | | | | | | | | | | | | | manually managing them using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675
* Diagnose attempst to template using declarations and using directives.John McCall2010-11-101-1/+2
| | | | | | Recover from the latter and fail early for the former. Fixes PR8022. llvm-svn: 118669
* fix PR8380, a crash on invalid due to an illogical DeclSpec SourceRange ↵Chris Lattner2010-11-091-0/+1
| | | | | | being constructed. llvm-svn: 118625
* Parse attributes on enumerators and instantiate attributes on enum decls.John McCall2010-10-221-1/+6
| | | | llvm-svn: 117182
* Teach the C++ simple-type-specifier parser and tentative parses aboutDouglas Gregor2010-10-211-58/+20
| | | | | | protocol-qualified types such as id<Protocol>. llvm-svn: 117081
* Add parsing support for Microsoft attributes. MS attributes will just be ↵Francois Pichet2010-10-111-0/+4
| | | | | | skipped and not inserted into the AST for now. llvm-svn: 116203
* Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked aDouglas Gregor2010-10-081-1/+41
| | | | | | bit by me). llvm-svn: 116122
* When we encounter a '==' in a context expecting a '=', assume the user made ↵Argyrios Kyrtzidis2010-10-081-1/+2
| | | | | | | | | | | | | a typo: t.c:1:7: error: invalid '==' at end of declaration; did you mean '='? int x == 0; ^~ = Implements rdar://8488464. llvm-svn: 116035
* Implement the C++0x "trailing return type" feature, e.g.,Douglas Gregor2010-10-011-5/+22
| | | | | | | | | | auto f(int) -> int from Daniel Wallin! (With a few minor bug fixes from me). llvm-svn: 115322
* vla expressions used in __typeof__ must be evaluated.Fariborz Jahanian2010-09-281-4/+11
| | | | | | Fixes rdar://8476159. llvm-svn: 114982
* Allow the use of C++0x deleted functions as an extension in C++98.Anders Carlsson2010-09-241-1/+5
| | | | llvm-svn: 114762
* Implement code completion for Objective-C class message sends that areDouglas Gregor2010-09-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | missing the opening bracket '[', e.g., NSArray <CC> at function scope. Previously, we would only give trivial completions (const, volatile, etc.), because we're in a "declaration name" scope. Now, we also provide completions for class methods of NSArray, e.g., alloc Note that we already had support for this after the first argument, e.g., NSArray method:x <CC> would get code completion for class methods of NSArray whose selector starts with "method:". This was already present because we recover as if NSArray method:x were a class message send missing the opening bracket (which was committed in r114057). llvm-svn: 114078
* Implement automatic bracket insertion for Objective-C class messageDouglas Gregor2010-09-161-1/+14
| | | | | | | | | | | | | | | | sends. These are far trickier than instance messages, because we typically have something like NSArray alloc] where it appears to be a declaration of a variable named "alloc" up until we see the ']' (or a ':'), and at that point we can't backtrace. So, we use a combination of syntactic and semantic disambiguation to treat this as a message send only when the type is an Objective-C type and it has the syntax of a class message send (which would otherwise be ill-formed). llvm-svn: 114057
* When parsing default function arguments, do not mark any declarationsDouglas Gregor2010-09-111-0/+5
| | | | | | | | | | | | | | | | | | | | | | used in the default function argument as "used". Instead, when we actually use the default argument, make another pass over the expression to mark any used declarations as "used" at that point. This addresses two kinds of related problems: 1) We were marking some declarations "used" that shouldn't be, because we were marking them too eagerly. 2) We were failing to mark some declarations as "used" when we should, if the first time it was instantiated happened to be an unevaluated context, we wouldn't mark them again at a later point. I've also added a potentially-handy visitor class template EvaluatedExprVisitor, which only visits the potentially-evaluated subexpressions of an expression. I bet this would have been useful for noexcept... Fixes PR5810 and PR8127. llvm-svn: 113700
* Eliminate the comma locations from all of the Sema routines that dealDouglas Gregor2010-09-091-1/+1
| | | | | | | | with comma-separated lists. We never actually used the comma locations, nor did we store them in the AST, but we did manage to waste time during template instantiation to produce fake locations. llvm-svn: 113495
* Improve recovery when a comma is missing between enumerators in anDouglas Gregor2010-09-071-0/+8
| | | | | | enumeration definition. Fixes <rdar://problem/7159693>. llvm-svn: 113201
* Add symantic support for the Pascal calling convention viaDawn Perchik2010-09-031-10/+47
| | | | | | | "__attribute((pascal))" or "__pascal" (and "_pascal" under -fborland-extensions). Support still needs to be added to llvm. llvm-svn: 112939
* Enable inline namespaces in C++03 as an extension.Sebastian Redl2010-08-311-2/+2
| | | | llvm-svn: 112566
* Parser support for inline namespacesSebastian Redl2010-08-271-0/+11
| | | | llvm-svn: 112320
* Suggest "const" and "volatile" code completions after a functionDouglas Gregor2010-08-271-0/+5
| | | | | | declarator, the very definition of "low-hanging fruit". llvm-svn: 112274
* One who seeks knowledge learns something new every day.John McCall2010-08-261-16/+16
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
* Reformatting.John McCall2010-08-251-3/+3
| | | | llvm-svn: 112018
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-12/+12
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* Abstract out passing around types and kill off ActionBase.John McCall2010-08-241-30/+32
| | | | llvm-svn: 111901
* Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).John McCall2010-08-231-2/+2
| | | | llvm-svn: 111863
* Introduce a new code-completion point when we're parsing aDouglas Gregor2010-08-231-15/+34
| | | | | | | | | declarator. Here, we can only see a few things (e.g., cvr-qualifiers, nested name specifiers) and we do not want to provide other non-macro completions. Previously, we would end up in recovery mode and would provide a large number of non-relevant completions. llvm-svn: 111818
* When complaining about a duplicate declspec, provide a Fix-It thatDouglas Gregor2010-08-231-1/+6
| | | | | | | removes the copy. Patch from Eelis van der Weegen, tweaked/updated by me. llvm-svn: 111807
* Sundry incremental steps towards killing off Action.John McCall2010-08-231-5/+5
| | | | llvm-svn: 111795
* DeclPtrTy -> Decl *John McCall2010-08-211-46/+45
| | | | llvm-svn: 111733
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-2/+2
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* Get rid of extra nesting when checking for invalid type,Fariborz Jahanian2010-08-171-5/+5
| | | | | | per Doug's comment. llvm-svn: 111328
* Diagnose if type of iboutletcollection attribute is a builtin type.Fariborz Jahanian2010-08-171-2/+4
| | | | llvm-svn: 111324
* Fix a crash when parsing malformed out-of-line member function Fariborz Jahanian2010-08-161-1/+4
| | | | | | definition. radar 8307865. llvm-svn: 111163
* Once code completion has completed, pass a "completion context" on toDouglas Gregor2010-08-111-5/+5
| | | | | | | the code-completion consumer. The consumer can use this information to augument, filter, or display the code-completion results. llvm-svn: 110858
* Introduce a new token kind 'cxx_defaultarg_end' to mark the end of C++ ↵Argyrios Kyrtzidis2010-08-061-1/+9
| | | | | | | | | | | | | | | | default arguments that were part of lexed method declarations. This avoid interference with tokens coming after the point where the default arg tokens were 'injected', e.g. for typedef struct Inst { void m(int x=0); } *InstPtr; when parsing '0' the next token would be '*' and things would be messed up. llvm-svn: 110436
* Reword the empty struct/union warning in C to note that such structs and ↵Douglas Gregor2010-07-291-2/+2
| | | | | | unions have size 0 in C, size 1 in C++. Put this warning under -Wc++-compat. llvm-svn: 109748
* Fix PR7617 by not entering ParseFunctionDefinition whenChris Lattner2010-07-111-4/+17
| | | | | | | | | | | | | | | | | | | | | a function prototype is followed by a declarator if we aren't parsing a K&R style identifier list. Also, avoid skipping randomly after a declaration if a semicolon is missing. Before we'd get: t.c:3:1: error: expected function body after function declarator void bar(); ^ Now we get: t.c:1:11: error: invalid token after top level declarator void foo() ^ ; llvm-svn: 108105
* add a const qualifier, refactor some code.Chris Lattner2010-07-111-6/+8
| | | | llvm-svn: 108104
* Move the "current scope" state from the Parser into Action. ThisDouglas Gregor2010-07-021-39/+39
| | | | | | | | | | | | | | allows Sema some limited access to the current scope, which we only use in one way: when Sema is performing some kind of declaration that is not directly driven by the parser (e.g., due to template instantiatio or lazy declaration of a member), we can find the Scope associated with a DeclContext, if that DeclContext is still in the process of being parsed. Use this to make the implicit declaration of special member functions in a C++ class more "scope-less", rather than using the NULL Scope hack. llvm-svn: 107491
* Make sure parens/braces/brackets are correctly balanced.Argyrios Kyrtzidis2010-06-171-0/+2
| | | | | | | | | | | In a line like: (; the semicolon leaves Parser:ParenCount unbalanced (it's 1 even though we stopped looking for a right paren). This may affect later parsing and result in bad recovery for parsing errors. llvm-svn: 106213
* Make the "extra ';' inside a struct or union" diagnostic moreDouglas Gregor2010-06-161-0/+1
| | | | | | precise. Fixes PR7336. llvm-svn: 106170
* Add some missing parentheses, from Anton YartsevDouglas Gregor2010-06-161-1/+1
| | | | llvm-svn: 106101
OpenPOWER on IntegriCloud