summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDeclCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* PR10359: Template declarations which define classes are not permitted to ↵Richard Smith2011-07-141-0/+5
| | | | | | | | | | | | also contain declarators. Previously we would accept code like this: template<typename T> struct S { } f() { return 0; } This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template. Treat this llvm-svn: 135195
* Fix AST representations of alias-declarations which define tag types. Inside ↵Richard Smith2011-07-011-4/+7
| | | | | | classes, the tag types need to have an associated access specifier, and inside function definitions, they need to be included in the declarations of the DeclStmt. These issues manifested as assertions during template instantiation, and also in a WIP constexpr patch. llvm-svn: 134250
* When deciding how to parse "= something" as part of a memberDouglas Gregor2011-06-251-2/+2
| | | | | | | | | declaration, determine whether the declaration will end up declaring a function using semantic criteria (e.g., it will have function type) rather than purely syntactic criteria (e.g., it has the form of a function declarator). Fixes <rdar://problem/9670557>. llvm-svn: 133854
* Introduce DelayedCleanupPool useful for simplifying clean-up of certain ↵Argyrios Kyrtzidis2011-06-221-10/+3
| | | | | | | | | | resources that, while their lifetime is well-known and restricted, cleaning them up manually is easy to miss and cause a leak. Use it to plug the leaking of TemplateIdAnnotation objects. rdar://9634138. llvm-svn: 133610
* Don't assert on initialized typedef declarations in classes:Richard Smith2011-06-121-1/+3
| | | | | | | | | | | | struct { typedef int A = 0; }; According to the C++11 standard, this is not ill-formed, but does not have any ascribed meaning. We can't reasonably accept it, so treat it as ill-formed. Also switch C++ from an incorrect 'fields can only be initialized in constructors' diagnostic for this case to C's 'illegal initializer (only variables can be initialized)' llvm-svn: 132890
* Implement support for C++11 in-class initialization of non-static data members.Richard Smith2011-06-111-42/+120
| | | | llvm-svn: 132878
* Parse C++0x generalized initializers.Sebastian Redl2011-06-051-21/+28
| | | | llvm-svn: 132662
* Silence sign compare warning.Benjamin Kramer2011-05-261-4/+4
| | | | llvm-svn: 132146
* Add a fix-it and better error recovery for improperly nested namespaces. ↵Richard Trieu2011-05-261-7/+86
| | | | | | This will give a better error message for cases such as "namespace foo::bar::baz {}" and a suggested fix-it of "namespace foo { namespace bar { namespace baz {} } }" llvm-svn: 132138
* Add support for Microsoft __if_exists, __if_not_exists extension at class scope.Francois Pichet2011-05-251-0/+67
| | | | | | | | | | | | | | | | Example: typedef int TYPE; class C { __if_exists(TYPE) { TYPE a; } __if_not_exists(TYPE) { this will never be parsed. } }; llvm-svn: 132052
* Implement a new type node, UnaryTransformType, designed to represent aAlexis Hunt2011-05-241-1/+1
| | | | | | | | type that turns one type into another. This is used as the basis to implement __underlying_type properly - with TypeSourceInfo and proper behavior in the face of templates. llvm-svn: 132017
* Implement __underlying_type for libc++.Alexis Hunt2011-05-191-0/+36
| | | | llvm-svn: 131633
* Properly parse the 'default' and 'delete' keywords.Alexis Hunt2011-05-121-22/+29
| | | | | | | | | | | | | | | | | They are actually grammatically considered definitions and parsed accordingly. This fixes the outstanding bugs regarding defaulting functions after their declarations. We now really nicely diagnose the following construct (try it!) int foo() = delete, bar; Still todo: Defaulted functions other than default constructors Test cases (including for the above construct) llvm-svn: 131228
* In Microsoft mode, allow pure specifier (=0) on inline functions declared at ↵Francois Pichet2011-05-111-2/+13
| | | | | | | | | | | | | class scope. This removes 2 errors when parsing MFC code with clang Example: class A { virtual void f() = 0 { } } llvm-svn: 131175
* Per Richard's suggestion, rename DefLoc to DefaultLoc where it appears.Alexis Hunt2011-05-061-6/+6
| | | | llvm-svn: 131018
* Do defaulted constructors properly.Alexis Hunt2011-05-061-1/+10
| | | | | | | | Explictly defaultedness is correctly reflected on the AST, but there are no changes to how that affects the definition of functions or much else really. llvm-svn: 130974
* Revert r130912 in order to approach defaulted functions from the otherAlexis Hunt2011-05-061-13/+1
| | | | | | | direction and not introduce things in the wrong place three different times. llvm-svn: 130968
* Slight tweak to alias template error handling: don't guess that a ↵Richard Smith2011-05-051-1/+2
| | | | | | template-id in an alias declaration was meant to be a specialization. Use a generic, but more accurate, diagnostic. llvm-svn: 130961
* Implement support for C++0x alias templates.Richard Smith2011-05-051-11/+37
| | | | llvm-svn: 130953
* Implement some framework for defaulted constructors.Alexis Hunt2011-05-051-1/+13
| | | | | | There's some unused stuff for now. llvm-svn: 130912
* When parsing a template friend declaration we dropped the templateChandler Carruth2011-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | parameters on the floor in certain cases: class X { template <typename T> friend typename A<T>::Foo; }; This was parsed as a *non* template friend declaration some how, and received an ExtWarn. Fixing the parser to actually provide the template parameters to the freestanding declaration parse triggers the code which specifically looks for such constructs and hard errors on them. Along the way, this prevents us from trying to instantiate constructs like the above inside of a outer template. This is important as loosing the template parameters means we don't have a well formed declaration and template instantiation will be unable to rebuild the AST. That fixes a crash in the GCC test suite. llvm-svn: 130772
* Fixed source range for extern linkage specification without braces.Abramo Bagnara2011-05-011-0/+5
| | | | llvm-svn: 130660
* White-list yet more type trait names, since they're used asDouglas Gregor2011-04-291-10/+20
| | | | | | identifiers in libc++. llvm-svn: 130508
* libstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our ↵Douglas Gregor2011-04-291-1/+2
| | | | | | new type trait __is_same llvm-svn: 130468
* Parsing/AST support for Structured Exception HandlingJohn Wiegley2011-04-281-0/+2
| | | | | | | | Patch authored by Sohail Somani. Provide parsing and AST support for Windows structured exception handling. llvm-svn: 130366
* t/clang/type-traitsJohn Wiegley2011-04-271-16/+13
| | | | | | | | | | Patch authored by John Wiegley. These type traits are used for parsing code that employs certain features of the Embarcadero C++ compiler. Several of these constructs are also desired by libc++, according to its project pages (such as __is_standard_layout). llvm-svn: 130342
* Make the invalid declarator recovery when parsing members work the same as ↵Sebastian Redl2011-04-241-1/+1
| | | | | | when parsing global decls. It's still rather broken (skipping much too far when the declarator belongs to a function definition), but at least not so broken as to mismatch braces. Tested by the removal of the fixme in the template test case. llvm-svn: 130101
* Support for C++11 (non-template) alias declarations.Richard Smith2011-04-151-10/+44
| | | | llvm-svn: 129567
* fix a bunch of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129559
* C1X: implement static assertsPeter Collingbourne2011-04-151-5/+13
| | | | llvm-svn: 129555
* Parse an '@' in an Objective-C++ class member specification,Douglas Gregor2011-04-141-0/+11
| | | | | | | diagnosing it as an error rather than looping infinitely. Also, explicitly disallow @defs in Objective-C++. Fixes <rdar://problem/9260136>. llvm-svn: 129521
* Fixup comments.Anders Carlsson2011-03-251-1/+1
| | | | llvm-svn: 128280
* Remove the last of ClassVirtSpecifiers.Anders Carlsson2011-03-251-53/+14
| | | | llvm-svn: 128279
* Replace the call to ParseOptionalCXX0XClassVirtSpecifierSeq with code to ↵Anders Carlsson2011-03-251-5/+18
| | | | | | only parse an optional 'final' keyword. llvm-svn: 128278
* Get rid of handling of the 'explicit' keyword from class-head. We still ↵Anders Carlsson2011-03-251-1/+4
| | | | | | parse it though, although that will change shortly. llvm-svn: 128277
* Remove 'new' from virt-specifier since it's going to be removed in the next ↵Anders Carlsson2011-03-251-4/+0
| | | | | | C++0x draft llvm-svn: 128271
* Insomniac refactoring: change how the parser allocates attributes so thatJohn McCall2011-03-241-19/+17
| | | | | | | | | AttributeLists do not accumulate over the lifetime of parsing, but are instead reused. Also make the arguments array not require a separate allocation, and make availability attributes store their stuff in augmented memory, too. llvm-svn: 128209
* Use ElaboratedType also for C.Abramo Bagnara2011-03-161-7/+5
| | | | llvm-svn: 127755
* Propagate the new exception information to FunctionProtoType.Sebastian Redl2011-03-121-3/+8
| | | | | | | | Change the interface to expose the new information and deal with the enormous fallout. Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications. Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support. llvm-svn: 127537
* Add support for the OpenCL vec_step operator, by generalising andPeter Collingbourne2011-03-111-2/+2
| | | | | | | extending the existing support for sizeof and alignof. Original patch by Guy Benyei. llvm-svn: 127475
* Fixed source range for StaticAssertDecl and LinkageSpecDecl. Fixed source ↵Abramo Bagnara2011-03-081-4/+5
| | | | | | range for declarations using postfix types. llvm-svn: 127251
* Fixed NamespaceDecl source range.Abramo Bagnara2011-03-081-2/+2
| | | | llvm-svn: 127242
* Parser support for noexcept specifications.Sebastian Redl2011-03-051-17/+84
| | | | llvm-svn: 127086
* Push nested-name-specifier source-location information into dependentDouglas Gregor2011-03-021-19/+19
| | | | | | | | | | | | | | | | | | | | | | | | template specialization types. This also required some parser tweaks, since we were losing track of the nested-name-specifier's source location information in several places in the parser. Other notable changes this required: - Sema::ActOnTagTemplateIdType now type-checks and forms the appropriate type nodes (+ source-location information) for an elaborated-type-specifier ending in a template-id. Previously, we used a combination of ActOnTemplateIdType and ActOnTagTemplateIdType that resulted in an ElaboratedType wrapped around a DependentTemplateSpecializationType, which duplicated the keyword ("class", "struct", etc.) and nested-name-specifier storage. - Sema::ActOnTemplateIdType now gets a nested-name-specifier, which it places into the returned type-source location information. - Sema::ActOnDependentTag now creates types with source-location information. llvm-svn: 126808
* Reinstate the introduction of source-location information forDouglas Gregor2011-03-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | nested-name-speciciers within elaborated type names, e.g., enum clang::NestedNameSpecifier::SpecifierKind Fixes in this iteration include: (1) Compute the type-source range properly for a dependent template specialization type that starts with "template template-id ::", as in a member access expression dep->template f<T>::f() This is a latent bug I triggered with this change (because now we're checking the computed source ranges for dependent template specialization types). But the real problem was... (2) Make sure to set the qualifier range on a dependent template specialization type appropriately. This will go away once we push nested-name-specifier locations into dependent template specialization types, but it was the source of the valgrind errors on the buildbots. llvm-svn: 126765
* Revert r126748, my second attempt at nested-name-specifier sourceDouglas Gregor2011-03-011-3/+1
| | | | | | location information for elaborated types. *sigh* llvm-svn: 126753
* Reinstate r126737, extending the generation of type-source locationDouglas Gregor2011-03-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | information for qualifier type names throughout the parser to address several problems. The commit message from r126737: Push nested-name-specifier source location information into elaborated name types, e.g., "enum clang::NestedNameSpecifier::SpecifierKind". Aside from the normal changes, this also required some tweaks to the parser. Essentially, when we're looking at a type name (via getTypeName()) specifically for the purpose of creating an annotation token, we pass down the flag that asks for full type-source location information to be stored within the returned type. That way, we retain source-location information involving nested-name-specifiers rather than trying to reconstruct that information later, long after it's been lost in the parser. With this change, test/Index/recursive-cxx-member-calls.cpp is showing much improved results again, since that code has lots of nested-name-specifiers. llvm-svn: 126748
* When parsing an out-of-line member function declaration, we must delayJohn McCall2011-02-141-2/+6
| | | | | | | | | | | | | | | | | | | | | | 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-2/+5
| | | | llvm-svn: 124477
* Get rid of [[hiding]], [[override]] and [[base_check]].Anders Carlsson2011-01-231-4/+1
| | | | llvm-svn: 124087
OpenPOWER on IntegriCloud