summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Remember the type name's scope specifier in the DeclSpec.John McCall2009-12-121-1/+1
| | | | llvm-svn: 91215
* Implement access declarations. Most of the work here is parsing them, whichJohn McCall2009-12-111-1/+41
| | | | | | | | | | | | is difficult because they're so terribly, terribly ambiguous. We implement access declarations in terms of using declarations, which is quite reasonable. However, we should really persist the access/using distinction in the AST and use the appropriate name in diagnostics. This isn't a priority, so I'll just file a PR and hope someone else does it. :) llvm-svn: 91095
* fix incorrect parsing of bitfields pointed out by Doug. I choseChris Lattner2009-12-101-2/+7
| | | | | | | to use ColonProtectionRAIIObject in the C codepath even though it won't matter for consistency. llvm-svn: 91037
* refactor the 'ColonIsSacred' argument to ParseOptionalCXXScopeSpecifierChris Lattner2009-12-101-4/+8
| | | | | | | to be a bool in Parser that is twiddled by the ColonProtectionRAIIObject class. No functionality change. llvm-svn: 91014
* rename ExtensionRAIIObject.h -> RAIIObjectsForParser.hChris Lattner2009-12-101-1/+1
| | | | llvm-svn: 91008
* Fixes a bogus error when declaring an extern "C" array.Fariborz Jahanian2009-12-091-2/+3
| | | | | | (fixes radar 7457109). llvm-svn: 90986
* remove some defaulted params for consistency.Chris Lattner2009-12-071-3/+3
| | | | llvm-svn: 90731
* reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.Chris Lattner2009-12-071-4/+4
| | | | | | This time with a fix to bail out when in a dependent context. llvm-svn: 90730
* revert my previous patch, it is breaking something and I don't have timeChris Lattner2009-12-061-4/+4
| | | | | | to fix it ATM. llvm-svn: 90717
* implement PR4451, improving error recovery for a mistaken : where a :: wasChris Lattner2009-12-061-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | intended. On the first testcase in the bug, we now produce: cxx-decl.cpp:12:2: error: unexpected ':' in nested name specifier y:a a2; ^ :: instead of: t.cc:8:1: error: C++ requires a type specifier for all declarations x:a a2; ^ t.cc:8:2: error: invalid token after top level declarator x:a a2; ^ ; t.cc:9:11: error: use of undeclared identifier 'a2' x::a a3 = a2; ^ llvm-svn: 90713
* remove some extraneous syntax: sourceloc implicitly converts to sourcerange.Chris Lattner2009-12-061-2/+2
| | | | llvm-svn: 90710
* Fix attribute between function decl ')' and '{' or '=0'John Thompson2009-11-251-0/+7
| | | | llvm-svn: 89894
* Parse C++ member check attributes - base_check, hiding, and override.Alexis Hunt2009-11-251-2/+5
| | | | | | The attributes are currently ignored. llvm-svn: 89837
* Have the parser tell sema whether a member declaration is a function ↵Sebastian Redl2009-11-241-0/+1
| | | | | | definition. This allows sema to not emit spurious diagnostics in some invalid code. llvm-svn: 89816
* Added rudimentary C++0x attribute support.Alexis Hunt2009-11-211-26/+233
| | | | | | | | | | | | | | The following attributes are currently supported in C++0x attribute lists (and in GNU ones as well): - align() - semantics believed to be conformant to n3000, except for redeclarations and what entities it may apply to - final - semantics believed to be conformant to CWG issue 817's proposed wording, except for redeclarations - noreturn - semantics believed to be conformant to n3000, except for redeclarations - carries_dependency - currently ignored (this is an optimization hint) llvm-svn: 89543
* Incremental progress on using declarations. Split UnresolvedUsingDecl intoJohn McCall2009-11-181-1/+3
| | | | | | | | | | two classes, one for typenames and one for values; this seems to have some support from Doug if not necessarily from the extremely-vague-on-this-point standard. Track the location of the 'typename' keyword in a using-typename decl. Make a new lookup result for unresolved values and deal with it in most places. llvm-svn: 89184
* Improve parsing of template arguments to lay the foundation forDouglas Gregor2009-11-101-8/+2
| | | | | | | | | | | | | | | | | | | | | | handling template template parameters properly. This refactoring: - Parses template template arguments as id-expressions, representing the result of the parse as a template name (Action::TemplateTy) rather than as an expression (lame!). - Represents all parsed template arguments via a new parser-specific type, ParsedTemplateArgument, which stores the kind of template argument (type, non-type, template) along with all of the source information about the template argument. This replaces an ad hoc set of 3 vectors (one for a void*, which was either a type or an expression; one for a bit telling whether the first was a type or an expression; and one for a single source location pointing at the template argument). - Moves TemplateIdAnnotation into the new Parse/Template.h. It never belonged in the Basic library anyway. llvm-svn: 86708
* add some fixit hints.Chris Lattner2009-11-061-1/+2
| | | | llvm-svn: 86240
* Switch parsing of using declarations over to ParseUnqualifiedId.Douglas Gregor2009-11-041-34/+15
| | | | llvm-svn: 86027
* Change our basic strategy for avoiding deprecation warnings when the decl useJohn McCall2009-11-041-2/+4
| | | | | | | | | | | | appears in a deprecated context. In the new strategy, we emit the warnings as usual unless we're currently parsing a declaration, where "declaration" is restricted to mean a decl group or a few special cases in Objective C. If we *are* parsing a declaration, we queue up the deprecation warnings until the declaration has been completely parsed, and then emit them only if the decl is not deprecated. We also standardize the bookkeeping for deprecation so as to avoid special cases. llvm-svn: 85998
* Introduce a new class, UnqualifiedId, that provides a parsedDouglas Gregor2009-11-031-0/+1
| | | | | | | | | | | | | | | | representation of a C++ unqualified-id, along with a single parsing function (Parser::ParseUnqualifiedId) that will parse all of the various forms of unqualified-id in C++. Replace the representation of the declarator name in Declarator with the new UnqualifiedId class, simplifying declarator-id parsing considerably and providing more source-location information to Sema. In the future, I hope to migrate all of the other unqualified-id-parsing code over to this single representation, then begin to merge actions that are currently only different because we didn't have a unqualified notion of the name in the parser. llvm-svn: 85851
* Improved fix for PR3844, which recovers better for class templateDouglas Gregor2009-10-301-5/+19
| | | | | | partial specializations and explicit instantiations of non-templates. llvm-svn: 85620
* Improve diagnostics when parsing something likeDouglas Gregor2009-10-301-1/+38
| | | | | | | | template<> struct foo<int> { ... }; where "foo" does not refer to a template. Fixes PR3844. llvm-svn: 85616
* Simplify the handling of non-dependent friend class templateDouglas Gregor2009-09-261-1/+1
| | | | | | | | | | | | specializations such as: friend class std::vector<int>; by using the same code path as explicit specializations, customized to reference an existing ClassTemplateSpecializationDecl (or build a new "undeclared" one). llvm-svn: 82875
* Rework the Parse-Sema interaction for friends to better support friendDouglas Gregor2009-09-261-9/+17
| | | | | | | | | class templates. We now treat friend class templates much more like normal class templates, except that they still get special name lookup rules. Fixes PR5057 and eliminates a bunch of spurious diagnostics in <iostream>. llvm-svn: 82848
* Introduce four new code-completion hooks for C++:Douglas Gregor2009-09-181-0/+20
| | | | | | | | | | - after "using", show anything that can be a nested-name-specifier. - after "using namespace", show any visible namespaces or namespace aliases - after "namespace", show any namespace definitions in the current scope - after "namespace identifier = ", show any visible namespaces or namespace aliases llvm-svn: 82251
* Implement code completion for tags, e.g., code completion after "enum"Douglas Gregor2009-09-181-0/+6
| | | | | | | | | | | | | will provide the names of various enumerations currently visible. Introduced filtering of code-completion results when we build the result set, so that we can identify just the kinds of declarations we want. This implementation is incomplete for C++, since we don't consider that the token after the tag keyword could start a nested-name-specifier. llvm-svn: 82222
* Improved representation and support for friend class templates. Angst about ↵John McCall2009-09-161-6/+5
| | | | | | same. llvm-svn: 82088
* Skeletal support for friend class templates.John McCall2009-09-141-5/+2
| | | | llvm-svn: 81801
* Alter Action's friend interface to prepare for templated friend declarations andJohn McCall2009-09-111-7/+9
| | | | | | to stop making promises we can't currently keep. llvm-svn: 81571
* Just ignore friend templates for now so we won't crash.Anders Carlsson2009-09-111-3/+6
| | | | llvm-svn: 81536
* Support elaborated dependent types and diagnose tag mismatches.John McCall2009-09-111-22/+24
| | | | llvm-svn: 81504
* Remove tabs, and whitespace cleanups.Mike Stump2009-09-091-123/+122
| | | | llvm-svn: 81346
* Support templateids in friend declarations. Fixes bug 4859.John McCall2009-09-081-11/+12
| | | | llvm-svn: 81233
* Parse extern templates, pass that information all the way to Sema,Douglas Gregor2009-09-041-0/+2
| | | | | | then drop it on the floor. llvm-svn: 80989
* Introduce an egregious hack to fix PR4828.Douglas Gregor2009-09-041-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | The problem this change addresses is that we treat __is_pod and __is_empty as keywords in C++, because they are built-in type traits in GCC >= 4.3. However, GNU libstdc++ 4.2 (and possibly earlier versions) define implementation-detail struct templates named __is_pod and __is_empty. This commit solves the problem by recognizing struct __is_pod and struct __is_empty as special token sequences. When one of these token sequences is encountered, the keyword (__is_pod or __is_empty) is implicitly downgraded to an identifier so that parsing can continue. This is an egregious hack, but it has the virtue of "just working" whether someone is using libstdc++ 4.2 or not, without the need for special flags. llvm-svn: 80988
* Correctly handle elaborated template ids. Still not handled properly for ↵John McCall2009-09-041-1/+26
| | | | | | friends. llvm-svn: 80977
* Rewrite of our handling of name lookup in C++ member access expressions, e.g.,Douglas Gregor2009-09-021-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | x->Base::f We no longer try to "enter" the context of the type that "x" points to. Instead, we drag that object type through the parser and pass it into the Sema routines that need to know how to perform lookup within member access expressions. We now implement most of the crazy name lookup rules in C++ [basic.lookup.classref] for non-templated code, including performing lookup both in the context of the type referred to by the member access and in the scope of the member access itself and then detecting ambiguities when the two lookups collide (p1 and p4; p3 and p7 are still TODO). This change also corrects our handling of name lookup within template arguments of template-ids inside the nested-name-specifier (p6; we used to look into the scope of the object expression for them) and fixes PR4703. I have disabled some tests that involve member access expressions where the object expression has dependent type, because we don't yet have the ability to describe dependent nested-name-specifiers starting with an identifier. llvm-svn: 80843
* Set the access specifier for using decls.Anders Carlsson2009-08-291-3/+4
| | | | llvm-svn: 80435
* More work on using declarations.Anders Carlsson2009-08-281-1/+3
| | | | llvm-svn: 80333
* When we know that we are parsing a class-name, implicitly construct aDouglas Gregor2009-08-261-1/+2
| | | | | | | | | | | | | | TypenameType if getTypeName is looking at a member of an unknown specialization. This allows us to properly parse class templates that derived from type that could only otherwise be described by a typename type, e.g., template<class T> struct X {}; template<typename T> struct Y : public X<T>::X { }; Fixes PR4381. llvm-svn: 80123
* Improve support for out-of-line definitions of nested templates andDouglas Gregor2009-08-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | their members, including member class template, member function templates, and member classes and functions of member templates. To actually parse the nested-name-specifiers that qualify the name of an out-of-line definition of a member template, e.g., template<typename X> template<typename Y> X Outer<X>::Inner1<Y>::foo(Y) { return X(); } we need to look for the template names (e.g., "Inner1") as a member of the current instantiation (Outer<X>), even before we have entered the scope of the current instantiation. Since we can't do this in general (i.e., we should not be looking into all dependent nested-name-specifiers as if they were the current instantiation), we rely on the parser to tell us when it is parsing a declaration specifier sequence, and, therefore, when we should consider the current scope specifier to be a current instantiation. Printing of complicated, dependent nested-name-specifiers may be somewhat broken by this commit; I'll add tests for this issue and fix the problem (if it still exists) in a subsequent commit. llvm-svn: 80044
* Implement delayed parsing for member function templates. Fixes PR4608.Douglas Gregor2009-08-221-0/+1
| | | | llvm-svn: 79709
* Initial support for parsing and representation of member function templates.Douglas Gregor2009-08-201-6/+20
| | | | llvm-svn: 79570
* Argument-dependent lookup for friend declarations. Add a new decl type,John McCall2009-08-111-2/+3
| | | | | | | | | | | | 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-28/+24
| | | | llvm-svn: 78274
* Refactor methods on DeclSpec to take a diagnostic& parameter, and reflect thisJohn McCall2009-08-031-5/+7
| | | | | | | | elsewhere. Very slightly decouples DeclSpec users from knowing the exact diagnostics to report, and makes it easier to provide different diagnostics in some places. llvm-svn: 77990
* Rename Action::TagKind to Action::TagUseKind, which removes both a misnomerJohn McCall2009-07-311-14/+14
| | | | | | and a name collision. llvm-svn: 77658
* Implement support for out-of-line definitions of the class members of classDouglas Gregor2009-07-221-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | templates, e.g., template<typename T> struct Outer { struct Inner; }; template<typename T> struct Outer<T>::Inner { // ... }; Implementing this feature required some extensions to ActOnTag, which now takes a set of template parameter lists, and is the precursor to removing the ActOnClassTemplate function from the parser Action interface. The reason for this approach is simple: the parser cannot tell the difference between a class template definition and the definition of a member of a class template; both have template parameter lists, and semantic analysis determines what that template parameter list means. There is still some cleanup to do with ActOnTag and ActOnClassTemplate. This commit provides the basic functionality we need, however. llvm-svn: 76820
* Fix the parsing of default arguments for inline member function Eli Friedman2009-07-221-29/+34
| | | | | | | | definitions. I'm not very familiar with this code, so please review. llvm-svn: 76796
OpenPOWER on IntegriCloud