summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseCXXInlineMethods.cpp
Commit message (Collapse)AuthorAgeFilesLines
* When parsing an out-of-line member function declaration, we must delayJohn McCall2011-02-141-1/+3
| | | | | | | | | | | | | | | | | | | | | | access-control diagnostics which arise from the portion of the declarator following the scope specifier, just in case access is granted by friending the individual method. This can also happen with in-line member function declarations of class templates due to templated-scope friend declarations. We were really playing fast-and-loose before with this sort of thing, and it turned out to work because *most* friend functions are in file scope. Making us delay regardless of context exposed several bugs with how we were manipulating delay. I ended up needing a concept of a context that's independent of the declarations in which it appears, and then I actually had to make some things save contexts correctly, but delay should be much cleaner now. I also encapsulated all the delayed-diagnostics machinery in a single subobject of Sema; this is a pattern we might want to consider rolling out to other components of Sema. llvm-svn: 125485
* PR9037: Allow override, final, and new as an extension on inline members.Nico Weber2011-01-281-4/+12
| | | | llvm-svn: 124477
* Pass the VirtSpecifiers along to Sema::ActOnCXXMemberDeclarator.Anders Carlsson2011-01-201-1/+2
| | | | llvm-svn: 123878
* Added ParenType type node.Abramo Bagnara2010-12-101-2/+1
| | | | llvm-svn: 121488
* Parse default arguments within member functions in source order, fromDouglas Gregor2010-10-121-134/+160
| | | | | | Manuel Klimek! Fixes PR7715. llvm-svn: 116311
* 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
* One who seeks knowledge learns something new every day.John McCall2010-08-261-1/+1
| | | | | | | | | 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
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-1/+1
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).John McCall2010-08-231-2/+2
| | | | llvm-svn: 111863
* DeclPtrTy -> Decl *John McCall2010-08-211-3/+2
| | | | 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
* Change warning about incomplete parsing of C++ default arg to error and ↵Argyrios Kyrtzidis2010-08-091-6/+2
| | | | | | provide a test case; thanks Doug! llvm-svn: 110603
* Replace a parser assertion with a warning, suggestion by Doug.Argyrios Kyrtzidis2010-08-091-3/+8
| | | | llvm-svn: 110568
* Introduce a new token kind 'cxx_defaultarg_end' to mark the end of C++ ↵Argyrios Kyrtzidis2010-08-061-1/+5
| | | | | | | | | | | | | | | | 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
* Move the "current scope" state from the Parser into Action. ThisDouglas Gregor2010-07-021-13/+13
| | | | | | | | | | | | | | 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
* Cure for Doug's insomnia.Argyrios Kyrtzidis2010-06-191-3/+3
| | | | llvm-svn: 106394
* Make sure the caching mechanism in Parser::ParseLexedMethodDefs is robust ↵Argyrios Kyrtzidis2010-06-171-4/+16
| | | | | | against the parser reading too few tokens. llvm-svn: 106214
* Per conversation with Doug, remove two assertions in ParseLexedMethodDefs() thatTed Kremenek2010-06-171-5/+3
| | | | | | didn't indicate violated invariants but that we weren't recovering well. llvm-svn: 106195
* Make Parser::ConsumeAndStoreUntil() more consistent with Parser::SkipUntil().Argyrios Kyrtzidis2010-04-231-15/+13
| | | | | | | | | ConsumeAndStoreUntil would stop at tok::unknown when caching an inline method definition while SkipUntil would go past it while parsing the method. Fixes PR 6903. llvm-svn: 102214
* Fix 80-cols violtaionsAlexis Hunt2010-04-141-4/+7
| | | | llvm-svn: 101311
* Diagnose misordered initializers in constructor templates immediately instead ofJohn McCall2010-04-101-3/+8
| | | | | | | | | | when they're instantiated. Merge the note into the -Wreorder warning; it doesn't really contribute much, and it was splitting a thought across diagnostics anyway. Don't crash in the parser when a constructor's initializers end in a comma and there's no body; the recovery here is still terrible, but anything's better than a crash. llvm-svn: 100922
* Add a few asserts to be on the safe side.Argyrios Kyrtzidis2010-03-311-0/+13
| | | | llvm-svn: 99973
* When "delayed parsing" C++ default arguments, if there is an error, there ↵Argyrios Kyrtzidis2010-03-301-0/+12
| | | | | | | | | | | | may be tokens left in the token stream that will interfere (they will be parsed as if they are after the class' '}') and a crash will occur because the CachedTokens that holds them will be deleted while the lexer is still using them. Make sure that the tokens of default args are removed from the token stream. Fixes PR6647. llvm-svn: 99939
* Refactor to remove more dependencies on PreDeclaratorDC. I seem to have madeJohn McCall2009-12-191-2/+8
| | | | | | | the redeclaration problems in the [temp.explicit]p3 testcase worse, but I can live with that; they'll need to be fixed more holistically anyhow. llvm-svn: 91771
* Have the parser tell sema whether a member declaration is a function ↵Sebastian Redl2009-11-241-1/+2
| | | | | | definition. This allows sema to not emit spurious diagnostics in some invalid code. llvm-svn: 89816
* Alter Action's friend interface to prepare for templated friend declarations andJohn McCall2009-09-111-1/+1
| | | | | | to stop making promises we can't currently keep. llvm-svn: 81571
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-9/+9
| | | | llvm-svn: 81346
* Make sure to adjust function template declarations to their templatedDouglas Gregor2009-08-241-1/+1
| | | | | | | declarations (e.g., FunctionTemplateDecl -> CXXConstructorDecl) before performing semantic analysis on the declarations. Fixes PR4761. llvm-svn: 79911
* Implement delayed parsing for member function templates. Fixes PR4608.Douglas Gregor2009-08-221-3/+12
| | | | llvm-svn: 79709
* Initial support for parsing and representation of member function templates.Douglas Gregor2009-08-201-3/+9
| | | | llvm-svn: 79570
* Argument-dependent lookup for friend declarations. Add a new decl type,John McCall2009-08-111-1/+1
| | | | | | | | | | | | FriendFunctionDecl, and create instances as appropriate. The design of FriendFunctionDecl is still somewhat up in the air; you can befriend arbitrary types of functions --- methods, constructors, etc. --- and it's not clear that this representation captures that very well. We'll have a better picture when we start consuming this data in access control. llvm-svn: 78653
* First pass at friend semantics.John McCall2009-08-061-1/+5
| | | | llvm-svn: 78274
* Fix the parsing of default arguments for inline member function Eli Friedman2009-07-221-0/+2
| | | | | | | | definitions. I'm not very familiar with this code, so please review. llvm-svn: 76796
* Patch to accomodate Doug's comment on defaultFariborz Jahanian2009-07-211-1/+1
| | | | | | destruction of base/members for each destructor AST. llvm-svn: 76663
* Added ASTs to destructor decl AST for default destruction of object'sFariborz Jahanian2009-07-151-1/+1
| | | | | | base/members. llvm-svn: 75849
* Build AST for default ctor-initializer when constructor hasFariborz Jahanian2009-07-141-2/+1
| | | | | | out of line definition. llvm-svn: 75668
* Patch to build AST for ctor's initializer list according toFariborz Jahanian2009-07-141-0/+4
| | | | | | semantics of order of construction [class.init]. llvm-svn: 75649
* Reimplement much of the way that we track nested classes in theDouglas Gregor2009-05-271-11/+36
| | | | | | | | | | | | | parser. Rather than placing all of the delayed member function declarations and inline definitions into a single bucket corresponding to the top-level class, we instead mirror the nesting structure of the nested classes and place the delayed member functions into their appropriate place. Then, when we actually parse the delayed member function declarations, set up the scope stack the same way as it was when we originally saw the declaration, so that we can find, e.g., template parameters that are in scope. llvm-svn: 72502
* The mysterious bug turns out to be an incredibly bone-headed mistake.Sebastian Redl2009-04-261-1/+1
| | | | llvm-svn: 70160
* Implement function-try-blocks. However, there's a very subtle bug that I ↵Sebastian Redl2009-04-261-7/+20
| | | | | | can't track down. llvm-svn: 70155
* Push DeclGroup much farther throughout the compiler. Now the variousChris Lattner2009-03-291-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | productions (except the already broken ObjC cases like @class X,Y;) in the parser that can produce more than one Decl return a DeclGroup instead of a Decl, etc. This allows elimination of the Decl::NextDeclarator field, and exposes various clients that should look at all decls in a group, but which were only looking at one (such as the dumper, printer, etc). These have been fixed. Still TODO: 1) there are some FIXME's in the code about potentially using DeclGroup for better location info. 2) ParseObjCAtDirectives should return a DeclGroup due to @class etc. 3) I'm not sure what is going on with StmtIterator.cpp, or if it can be radically simplified now. 4) I put a truly horrible hack in ParseTemplate.cpp. I plan to bring up #3/4 on the mailing list, but don't plan to tackle #1/2 in the short term. llvm-svn: 68002
* Introduce a new OpaquePtr<N> struct type, which is a simple POD wrapper for aChris Lattner2009-03-281-2/+3
| | | | | | | | | | | | | | | | | | | | pointer. Its purpose in life is to be a glorified void*, but which does not implicitly convert to void* or other OpaquePtr's with a different UID. Introduce Action::DeclPtrTy which is a typedef for OpaquePtr<0>. Change the entire parser/sema interface to use DeclPtrTy instead of DeclTy*. This makes the C++ compiler enforce that these aren't convertible to other opaque types. We should also convert ExprTy, StmtTy, TypeTy, AttrTy, BaseTy, etc, but I don't plan to do that in the short term. The one outstanding known problem with this patch is that we lose the bitmangling optimization where ActionResult<DeclPtrTy> doesn't know how to bitmangle the success bit into the low bit of DeclPtrTy. I will rectify this with a subsequent patch. llvm-svn: 67952
* Convert a bunch of actions to smart pointers, and also bring ↵Sebastian Redl2009-03-151-1/+1
| | | | | | PrintParserCallbacks a bit more in line with reality. llvm-svn: 67029
* Simplify the interface to ParseFunctionStatementBody to not take Chris Lattner2009-03-051-2/+2
| | | | | | | locations that are the current tok loc. Note that inline C++ methods have a big fixme that could cause a crash. llvm-svn: 66113
* move library-specific diagnostic headers into library private dirs. ReduceChris Lattner2009-01-291-1/+1
| | | | | | redundant #includes. Patch by Anders Johnsen! llvm-svn: 63271
* 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
* When we see a reference to a struct, class, or union like "struct X"Douglas Gregor2009-01-091-1/+2
| | | | | | | | | | | | | | | | 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
* Delay parsing of default arguments of member functions until the classDouglas Gregor2008-12-161-17/+71
| | | | | | | | | | is completely defined (C++ [class.mem]p2). Reverse the order in which we process the definitions of member functions specified inline. This way, we'll get diagnostics in the order in which the member functions were declared in the class. llvm-svn: 61103
* 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
* Improve parser error recovery after a constructor initializerDouglas Gregor2008-11-101-2/+22
| | | | llvm-svn: 58989
OpenPOWER on IntegriCloud