summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add support for Microsoft __ptr32 keyword. Francois Pichet2011-08-251-2/+9
| | | | | | Patch by Chris Cudmore! llvm-svn: 138533
* Restore patch I reversed in r138040. Known buildbotFariborz Jahanian2011-08-221-0/+1
| | | | | | failures are resolved. llvm-svn: 138234
* Revers r138040. Need to look at a few buildbot failures.Fariborz Jahanian2011-08-191-1/+0
| | | | llvm-svn: 138049
* objective-c: Bring objective-c handling of decl contextFariborz Jahanian2011-08-191-0/+1
| | | | | | | | | | to modernity. Instead of passing down individual context objects from parser to sema, establish decl context in parser and have sema access current context as needed. I still need to take of Doug's comment for minor cleanups. llvm-svn: 138040
* Add support for MSVC __unaligned attribute. Necessary to parse MSVC headers ↵Francois Pichet2011-08-181-2/+9
| | | | | | | | in 64-bit mode (ie: when _M_IA64 or _M_AMD64 is defined) more info: http://msdn.microsoft.com/en-us/library/ms177389.aspx llvm-svn: 137935
* Thread Safety: Added basic argument parsing for all new attributes.Caitlin Sadowski2011-08-091-0/+80
| | | | | | | | | | | | This patch special cases the parser for thread safety attributes so that all attribute arguments are put in the argument list (instead of a special parameter) since arguments may not otherwise resolve correctly without two-token lookahead. This patch also adds checks to make sure that attribute arguments are lockable objects. llvm-svn: 137130
* Parsing of C++0x lambda expressions, from John Freeman with help fromDouglas Gregor2011-08-041-1/+4
| | | | | | David Blaikie! llvm-svn: 136876
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-11/+11
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* Add 'mutable' to the function declarator chunk, to be used whenDouglas Gregor2011-07-131-0/+1
| | | | | | parsing lambda expressions, from John Freeman! llvm-svn: 135090
* Properly protect colons when parsing a nested-name-specifier as partJohn McCall2011-07-061-11/+16
| | | | | | | of an enum specifier in dialects which permit fixed underlying types. Fixes the rejects-valid part of PR10264. llvm-svn: 134468
* Clean up and refactor ParseFunctionDeclarator to reduce codeDouglas Gregor2011-07-051-250/+188
| | | | | | repetition and better reflect the actual grammar, from John Freeman! llvm-svn: 134417
* Fix AST representations of alias-declarations which define tag types. Inside ↵Richard Smith2011-07-011-7/+13
| | | | | | 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
* Introduce DelayedCleanupPool useful for simplifying clean-up of certain ↵Argyrios Kyrtzidis2011-06-221-4/+2
| | | | | | | | | | 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
* Handle decltype keyword in Parser::isDeclarationSpecifier.Francois Pichet2011-06-191-0/+4
| | | | | | Fixes PR10154. Found by parsing MFC 2010 code with clang. llvm-svn: 133380
* Automatic Reference Counting.John McCall2011-06-151-1/+3
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Parse C++0x generalized initializers.Sebastian Redl2011-06-051-2/+25
| | | | llvm-svn: 132662
* Implement __underlying_type for libc++.Alexis Hunt2011-05-191-0/+8
| | | | llvm-svn: 131633
* Properly parse the 'default' and 'delete' keywords.Alexis Hunt2011-05-121-7/+10
| | | | | | | | | | | | | | | | | 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
* Don't fail at parsing __declspec(property(get=get_func_name)). Just skip ↵Francois Pichet2011-05-071-0/+8
| | | | | | everything inside property() for now while we wait for the BoostPro people to provide a complete patch. llvm-svn: 131053
* Per Richard's suggestion, rename DefLoc to DefaultLoc where it appears.Alexis Hunt2011-05-061-3/+1
| | | | llvm-svn: 131018
* Do defaulted constructors properly.Alexis Hunt2011-05-061-0/+4
| | | | | | | | 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-5/+0
| | | | | | | direction and not introduce things in the wrong place three different times. llvm-svn: 130968
* Implement some framework for defaulted constructors.Alexis Hunt2011-05-051-0/+5
| | | | | | There's some unused stuff for now. llvm-svn: 130912
* libstdc++ 4.4 uses __is_signed as an identifier, while Clang treats itDouglas Gregor2011-04-281-0/+18
| | | | | | | | | | | | | as a keyword for the __is_signed type trait. Cope with this conflict via some hackish recovery: if we see a declaration of the form static const bool __is_signed then we stop treating __is_signed as a keyword and instead treat it as an identifier. It's ugly, but it's better than making the __is_signed type trait conditional on some language flag. Fixes PR9804. llvm-svn: 130399
* Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin ↵Francois Pichet2011-04-281-0/+12
| | | | | | | | | | | | | | defines to real types. Otherwise statements like: __int64 var = __int64(0); would be expanded to: long long var = long long(0); and fail to compile. llvm-svn: 130369
* Clean out some cruft I introduced when adding Sema::ClassifyName()Douglas Gregor2011-04-271-22/+0
| | | | llvm-svn: 130295
* Simplify the parser's handling of Sema::ClassifyName() for types, byDouglas Gregor2011-04-271-3/+5
| | | | | | | creating a type-annotation token rather than jumping into the declaration parsing. llvm-svn: 130293
* Implement a new identifier-classification scheme where SemaDouglas Gregor2011-04-241-7/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | performs name lookup for an identifier and resolves it to a type/expression/template/etc. in the same step. This scheme is intended to improve both performance (by reducing the number of redundant name lookups for a given identifier token) and error recovery (by giving Sema a chance to correct type names before the parser has decided that the identifier isn't a type name). For example, this allows us to properly typo-correct type names at the beginning of a statement: t.c:6:3: error: use of undeclared identifier 'integer'; did you mean 'Integer'? integer *i = 0; ^~~~~~~ Integer t.c:1:13: note: 'Integer' declared here typedef int Integer; ^ Previously, we wouldn't give a Fix-It because the typo correction occurred after the parser had checked whether "integer" was a type name (via Sema::getTypeName(), which isn't allowed to typo-correct) and therefore decided to parse "integer * i = 0" as an expression. By typo-correcting earlier, we typo-correct to the type name Integer and parse this as a declaration. Moreover, in this context, we can also typo-correct identifiers to keywords, e.g., t.c:7:3: error: use of undeclared identifier 'vid'; did you mean 'void'? vid *p = i; ^~~ void and recover appropriately. Note that this is very much a work-in-progress. The new Sema::ClassifyName is only used for expression-or-declaration disambiguation in C at the statement level. The next steps will be to make this work for the same disambiguation in C++ (where functional-style casts make some trouble), then push it further into the parser to eliminate more redundant name lookups. Fixes <rdar://problem/7963833> for C and starts us down the path of <rdar://problem/8172000>. llvm-svn: 130082
* Fixit suggestion for adding missing tag name should have a space after the ↵Argyrios Kyrtzidis2011-04-211-6/+10
| | | | | | tag name. Fixes rdar://9295072 llvm-svn: 129917
* Avoid superfluous warning after an error is detcted and reported.Fariborz Jahanian2011-04-191-1/+4
| | | | | | // rdar://9132143 llvm-svn: 129822
* C1X: implement static assertsPeter Collingbourne2011-04-151-1/+5
| | | | llvm-svn: 129555
* Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith2011-04-141-17/+55
| | | | | | draft standard (N3291). llvm-svn: 129541
* Fix a bunch of major problems with __unknown_anytype and properly testJohn McCall2011-04-091-0/+4
| | | | | | for them. The only major missing feature is references. llvm-svn: 129234
* Extend the new 'availability' attribute with support for anDouglas Gregor2011-03-261-2/+39
| | | | | | | 'unavailable' argument, which specifies that the declaration to which the attribute appertains is unavailable on that platform. llvm-svn: 128329
* Insomniac refactoring: change how the parser allocates attributes so thatJohn McCall2011-03-241-89/+86
| | | | | | | | | 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
* Implement a new 'availability' attribute, that allows one to specifyDouglas Gregor2011-03-231-1/+239
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | which versions of an OS provide a certain facility. For example, void foo() __attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6))); says that the function "foo" was introduced in 10.2, deprecated in 10.4, and completely obsoleted in 10.6. This attribute ties in with the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that we want to deploy back to Mac OS X 10.1). There are several concrete behaviors that this attribute enables, as illustrated with the function foo() above: - If we choose a deployment target >= Mac OS X 10.4, uses of "foo" will result in a deprecation warning, as if we had placed attribute((deprecated)) on it (but with a better diagnostic) - If we choose a deployment target >= Mac OS X 10.6, uses of "foo" will result in an "unavailable" warning (in C)/error (in C++), as if we had placed attribute((unavailable)) on it - If we choose a deployment target prior to 10.2, foo() is weak-imported (if it is a kind of entity that can be weak imported), as if we had placed the weak_import attribute on it. Naturally, there can be multiple availability attributes on a declaration, for different platforms; only the current platform matters when checking availability attributes. The only platforms this attribute currently works for are "ios" and "macosx", since we already have -mxxxx-version-min flags for them and we have experience there with macro tricks translating down to the deprecated/unavailable/weak_import attributes. The end goal is to open this up to other platforms, and even extension to other "platforms" that are really libraries (say, through a #pragma clang define_system), but that hasn't yet been designed and we may want to shake out more issues with this narrower problem first. Addresses <rdar://problem/6690412>. As a drive-by bug-fix, if an entity is both deprecated and unavailable, we only emit the "unavailable" diagnostic. llvm-svn: 128127
* Add support for language-specific address spaces. On top of that,Peter Collingbourne2011-03-181-0/+130
| | | | | | | | | add support for the OpenCL __private, __local, __constant and __global address spaces, as well as the __read_only, _read_write and __write_only image access specifiers. Patch originally by ARM; language-specific address space support by myself. llvm-svn: 127915
* Use ElaboratedType also for C.Abramo Bagnara2011-03-161-7/+6
| | | | llvm-svn: 127755
* Disable 'auto' type deduction in Objective-C. It likes 'id' a bit tooDouglas Gregor2011-03-141-1/+1
| | | | | | much to be useful. llvm-svn: 127625
* Forgotten part of previous commit.Abramo Bagnara2011-03-121-9/+11
| | | | llvm-svn: 127536
* Add support for the OpenCL vec_step operator, by generalising andPeter Collingbourne2011-03-111-4/+2
| | | | | | | extending the existing support for sizeof and alignof. Original patch by Guy Benyei. llvm-svn: 127475
* Propagate new-style exception spec information to Declarator.Sebastian Redl2011-03-051-11/+8
| | | | llvm-svn: 127111
* Parser support for noexcept specifications.Sebastian Redl2011-03-051-40/+45
| | | | llvm-svn: 127086
* Push nested-name-specifier source-location information into dependentDouglas Gregor2011-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Retain complete source-location information for C++Douglas Gregor2011-02-241-2/+3
| | | | | | | | | | | | nested-name-specifiers throughout the parser, and provide a new class (NestedNameSpecifierLoc) that contains a nested-name-specifier along with its type-source information. Right now, this information is completely useless, because we don't actually store the source-location information anywhere in the AST. Call this Step 1/N. llvm-svn: 126391
* Tweak the CXXScopeSpec API a bit, so that we require theDouglas Gregor2011-02-241-2/+2
| | | | | | nested-name-specifier and source range to be set at the same time. llvm-svn: 126347
* Fix the behavior of -Wignored-qualifiers on return type qualifiers inChandler Carruth2011-02-231-1/+3
| | | | | | | | | | several ways. We now warn for more of the return types, and correctly locate the ignored ones. Also adds fix-it hints to remove the ignored qualifiers. Fixes much of PR9058, although not all of it. Patch by Hans Wennborg, a couple of minor style tweaks from me. llvm-svn: 126321
OpenPOWER on IntegriCloud