summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Implement basic parsing and semantic analysis for explicitDouglas Gregor2009-02-171-3/+71
| | | | | | | | | | | | | | | | | | specialization of class templates, e.g., template<typename T> class X; template<> class X<int> { /* blah */ }; Each specialization is a different *Decl node (naturally), and can have different members. We keep track of forward declarations and definitions as for other class/struct/union types. This is only the basic framework: we still have to deal with checking the template headers properly, improving recovery when there are failures, handling nested name specifiers, etc. llvm-svn: 64848
* diagnose uses of deprecated typenames and tags.Chris Lattner2009-02-161-2/+1
| | | | | | We now pass all the deprecation tests in the objc.dg suite. llvm-svn: 64679
* Implement Declarator::getSourceRange().Sebastian Redl2009-02-091-7/+13
| | | | llvm-svn: 64151
* Semantic checking for class template declarations andDouglas Gregor2009-02-061-10/+20
| | | | | | | | | | | | | | | redeclarations. For example, checks that a class template redeclaration has the same template parameters as previous declarations. Detangled class-template checking from ActOnTag, whose logic was getting rather convoluted because it tried to handle C, C++, and C++ template semantics in one shot. Made some inroads toward eliminating extraneous "declaration does not declare anything" errors by adding an "error" type specifier. llvm-svn: 63973
* Basic representation of C++ class templates, from Andrew Sutton.Douglas Gregor2009-02-041-6/+6
| | | | llvm-svn: 63750
* Diagnose ambiguities in getTypeName. Fixes ↵Douglas Gregor2009-02-041-1/+2
| | | | | | 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-1/+1
| | | | | | 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
* Some micro-optimizations for DISABLE_SMART_POINTERS:Douglas Gregor2009-01-261-4/+4
| | | | | | | | | | | | | | | | | - When it's safe, ActionResult uses the low bit of the pointer for the "invalid" flag rather than a separate "bool" value. This keeps GCC from generating some truly awful code, for a > 3x speedup in the result-passing microbenchmark. - When DISABLE_SMART_POINTERS is defined, store an ActionResult within ASTOwningResult rather than an ASTOwningPtr. Brings the performance benefits of the above to smart pointers with DISABLE_SMART_POINTERS defined. Sadly, these micro-benchmark performance improvements don't seem to make much of a difference on Cocoa.h right now. However, they're harmless and might help with future optimizations. llvm-svn: 63061
* When we see a reference to a struct, class, or union like "struct X"Douglas Gregor2009-01-091-3/+3
| | | | | | | | | | | | | | | | 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
* Unify the code for defining tags in C and C++, so that we alwaysDouglas Gregor2009-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce a Scope for the body of a tag. This reduces the number of semantic differences between C and C++ structs and unions, and will help with other features (e.g., anonymous unions) in C. Some important points: - Fields are now in the "member" namespace (IDNS_Member), to keep them separate from tags and ordinary names in C. See the new test in Sema/member-reference.c for an example of why this matters. In C++, ordinary and member name lookup will find members in both the ordinary and member namespace, so the difference between IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but only in C++!). - We always introduce a Scope and push a DeclContext when we're defining a tag, in both C and C++. Previously, we had different actions and different Scope/CurContext behavior for enums, C structs/unions, and C++ structs/unions/classes. Now, it's one pair of actions. (Yay!) There's still some fuzziness in the handling of struct/union/enum definitions within other struct/union/enum definitions in C. We'll need to do some more cleanup to eliminate some reliance on CurContext before we can solve this issue for real. What we want is for something like this: struct X { struct T { int x; } t; }; to introduce T into translation unit scope (placing it at the appropriate point in the IdentifierResolver chain, too), but it should still have struct X as its lexical declaration context. PushOnScopeChains isn't smart enough to do that yet, though, so there's a FIXME test in nested-redef.c llvm-svn: 61940
* - Various comment typo fixes in Sema.hChris Lattner2009-01-061-16/+14
| | | | | | | | | - Simplify ParseDeclCXX to use early exit on error instead of nesting. - Change ParseDeclCXX to using the 'skip on error' form of ExpectAndConsume. - If we don't see the ; in a using directive, still call the action, for hopefully better error recovery. llvm-svn: 61801
* rename MaybeParseCXXScopeSpecifier -> ParseOptionalCXXScopeSpecifier and Chris Lattner2009-01-061-3/+3
| | | | | | MaybeParseTypeSpecifier -> ParseOptionalTypeSpecifier. llvm-svn: 61796
* minor code cleanups, reduce indentation since 'if' block can't fall through.Chris Lattner2009-01-061-7/+5
| | | | llvm-svn: 61795
* Introduce support for "transparent" DeclContexts, which areDouglas Gregor2009-01-051-13/+14
| | | | | | | | | | | | | | | | | | | | | | DeclContexts whose members are visible from enclosing DeclContexts up to (and including) the innermost enclosing non-transparent DeclContexts. Transparent DeclContexts unify the mechanism to be used for various language features, including C enumerations, anonymous unions, C++0x inline namespaces, and C++ linkage specifications. Please refer to the documentation in the Clang internals manual for more information. Only enumerations and linkage specifications currently use transparent DeclContexts. Still to do: use transparent DeclContexts to implement anonymous unions and GCC's anonymous structs extension, and, later, the C++0x features. We also need to tighten up the DeclContext/ScopedDecl link to ensure that every ScopedDecl is in a single DeclContext, which will ensure that we can then enforce ownership and reduce the memory footprint of DeclContext. llvm-svn: 61735
* Parser support for C++ using directives, from Piotr RakDouglas Gregor2008-12-301-0/+85
| | | | llvm-svn: 61486
* Add explicit "fuzzy" parse support for Microsoft declspec.Steve Naroff2008-12-241-0/+4
| | | | | | Remove previous __declspec macro that would effectively erase the construct prior to parsing. llvm-svn: 61422
* Keep track of template arguments when we parse them. Right now, we don't ↵Douglas Gregor2008-12-241-3/+9
| | | | | | actually do anything with the template arguments, but they'll be used to create template declarations llvm-svn: 61413
* implement PR3177 - "__extension__ union" not supported in C++ modeChris Lattner2008-12-181-0/+10
| | | | llvm-svn: 61180
* Make linkage-specifications hold on to all of their declarationsDouglas Gregor2008-12-161-12/+14
| | | | llvm-svn: 61110
* Delay parsing of default arguments of member functions until the classDouglas Gregor2008-12-161-2/+39
| | | | | | | | | | 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/+4
| | | | | | explicitly calling EnterScope/ExitScope llvm-svn: 60830
* Modify the move emulation according to the excellent design of Howard ↵Sebastian Redl2008-12-101-2/+2
| | | | | | 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/+4
| | | | llvm-svn: 60791
* Consistently use smart pointers for stmt and expr nodes in parser local ↵Sebastian Redl2008-12-091-12/+10
| | | | | | variables. llvm-svn: 60761
* Parse the exception-specification throw(...), a Microsoft extensionDouglas Gregor2008-12-011-5/+16
| | | | llvm-svn: 60359
* Implement some suggestions by Daniel:Argyrios Kyrtzidis2008-11-261-4/+2
| | | | | | | | -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
* Use RAII objects to ensure proper destruction of expression and statement ↵Sebastian Redl2008-11-251-6/+7
| | | | | | 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-0/+33
| | | | llvm-svn: 60005
* Tiny fix to the parsing of linkage-specificationsDouglas Gregor2008-11-211-2/+2
| | | | llvm-svn: 59820
* Change a couple of the Parser::Diag methods to return DiagnosticInfoChris Lattner2008-11-181-13/+12
| | | | | | | | | 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-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-6/+15
| | | | | | | | Parser side. No Sema functionality change, just the signatures of the Action/Sema methods. llvm-svn: 58913
* Parsing, representation, and preliminary semantic analysis of destructors.Douglas Gregor2008-11-051-17/+36
| | | | | | | | | | | 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
* Initial implementation of parsing, semantic analysis, and AST-buildingDouglas Gregor2008-11-051-1/+96
| | | | | | | | | | | | | for constructor initializations, e.g., class A { }; class B : public A { int m; public: B() : A(), m(17) { }; }; llvm-svn: 58749
* Made the mechanism of defining preprocessor defs for maxint, ptrdiff_t, wcharSanjiv Gupta2008-10-311-4/+4
| | | | | | | | | | etc more generic. For some targets, long may not be equal to pointer size. For example: PIC16 has int as i16, ptr as i16 but long as i32. Also fixed a few build warnings in assert() functions in CFRefCount.cpp, CGDecl.cpp, SemaDeclCXX.cpp and ParseDeclCXX.cpp. llvm-svn: 58501
* Add representation of base classes in the AST, and verify that weDouglas Gregor2008-10-221-7/+17
| | | | | | | | don't have duplicated direct base classes. Seriliazation of base class specifiers is not yet implemented. llvm-svn: 57991
* Passing right brace location to ActOnFinishCXXClassDef is redundant, since ↵Argyrios Kyrtzidis2008-08-091-1/+1
| | | | | | it gets passed to ActOnFinishCXXMemberSpecification too. llvm-svn: 54567
* Wherever a type is used/returned from the Action module, use TypeTy instead ↵Argyrios Kyrtzidis2008-08-011-1/+1
| | | | | | | | of DeclTy or void. No functionality change. llvm-svn: 54265
* Add Sema support for C++ classes.Argyrios Kyrtzidis2008-07-011-6/+8
| | | | llvm-svn: 52956
* Handle unnamed bitfields when parsing C++ classes.Argyrios Kyrtzidis2008-06-281-26/+30
| | | | llvm-svn: 52855
* Add parsing support for C++ classes.Argyrios Kyrtzidis2008-06-241-1/+266
| | | | | | | Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place. Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass. llvm-svn: 52694
* Convert CRLF to LF.Argyrios Kyrtzidis2008-05-011-3/+3
| | | | llvm-svn: 50542
* Call ExitScope before ActOnFinishNamespaceDef.Argyrios Kyrtzidis2008-04-271-2/+3
| | | | | | This is the same for functions and it's preferable to have the namespace as DeclContext during ActOnPopScope. llvm-svn: 50322
* Parsing of namespaces:Argyrios Kyrtzidis2008-04-271-6/+14
| | | | | | | | | -NamespaceDecl for the AST -Checks for name clashes between namespaces and tag/normal declarations. This commit doesn't implement proper name lookup for namespaces. llvm-svn: 50321
* Make Parser::getAccessSpecifierIfPresent const, since it does not modify the ↵Douglas Gregor2008-04-141-2/+2
| | | | | | state llvm-svn: 49629
* This patch adds very basic support for parsing and type-checking classDouglas Gregor2008-04-131-1/+232
| | | | | | | | | | | inheritance in C++. It'll parse the base-specifier list, e.g., class D : public B1, virtual public B2 { }; and do some of the simpler semantic checks (B1 and B2 are classes; they aren't unions or incomplete types, etc). llvm-svn: 49623
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+119
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud