summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Provide Fixit warning when 'auto' is intended as storageFariborz Jahanian2011-02-221-3/+13
| | | | | | | specifier in legacy code. Patch is reviewed offline by Doug. // rdar://9036633. llvm-svn: 126261
* Enable enumeration types with a fixed underlying type, e.g.,Douglas Gregor2011-02-221-2/+8
| | | | | | | | | enum X : long { Value = 0x100000000 }; when in Microsoft-extension mode (-fms-extensions). This (now C++0x) feature has been supported since Microsoft Visual Studio .NET 2003. llvm-svn: 126243
* Fix a little bug in the handling of enumeration types with a fixedDouglas Gregor2011-02-221-2/+12
| | | | | | | underlying type: we weren't parsing unnamed enumeration types with a fixed underlying type. llvm-svn: 126184
* Tweaks to C++0x deduced auto type support:Richard Smith2011-02-211-0/+2
| | | | | | | | * Flag indicating 'we're parsing this auto typed variable's initializer' moved from VarDecl to Sema * Temporary template parameter list for auto deduction is now allocated on the stack. * Deduced 'auto' types are now uniqued. llvm-svn: 126139
* Turn on 'auto' in plain objc mode.Fariborz Jahanian2011-02-211-1/+1
| | | | llvm-svn: 126134
* Implement the C++0x deduced 'auto' feature.Richard Smith2011-02-201-6/+9
| | | | | | This fixes PR 8738, 9060 and 9132. llvm-svn: 126069
* When code-completing within a list of declaration specifiers,Douglas Gregor2011-02-151-1/+3
| | | | | | | | separately handle the case of a local declaration-specifier list, including all types in the set of options. Fixes <rdar://problem/8790735> and <rdar://problem/8662831>. llvm-svn: 125594
* OpenCL: add support for __kernel, kernel keywords and EXTENSION,Peter Collingbourne2011-02-141-0/+16
| | | | | | FP_CONTRACT pragmas. Patch originally by ARM. llvm-svn: 125475
* Reject forbidden storage class specifiers in OpenCL. Patch by George Russell!Peter Collingbourne2011-02-111-7/+7
| | | | llvm-svn: 125399
* Implement the suggested resolution to core issue 547, extended to alsoDouglas Gregor2011-01-311-2/+3
| | | | | | | | | allow ref-qualifiers on function types used as template type arguments. GNU actually allows cv-qualifiers on function types in many places where it shouldn't, so we currently categorize this as a GNU extension. llvm-svn: 124584
* Allow Microsoft attributes in a constructor's parameter list.Francois Pichet2011-01-311-0/+4
| | | | | | This fixes a few compile errors when parsing <regex> from MSVC 2008 with clang. llvm-svn: 124573
* Improve the extension warning for the use of ref-qualifiers, toDouglas Gregor2011-01-261-2/+2
| | | | | | | distinguish them from rvalue references. Using the rvalue-references warning was weird when the ref-qualifier was '&'. llvm-svn: 124316
* Rvalue references for *this: parse ref-qualifiers.Douglas Gregor2011-01-261-2/+31
| | | | llvm-svn: 124276
* Downgrade the error about rvalue references to an extension warningDouglas Gregor2011-01-251-1/+1
| | | | | | | | and turn on __has_feature(cxx_rvalue_references). The core rvalue references proposal seems to be fully implemented now, pending lots more testing. llvm-svn: 124169
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-181-1/+0
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* Fix an embarrassing think in the disambiguation logic for the ellipsis in a ↵Douglas Gregor2011-01-051-1/+0
| | | | | | parameter-type-list llvm-svn: 122924
* Refactor how we collect attributes during parsing, and add slots for attributesJohn McCall2010-12-241-169/+128
| | | | | | | on array and function declarators. This is pretty far from complete, and I'll revisit it later if someone doesn't beat me to it. llvm-svn: 122535
* Implement parsing of function parameter packs and non-type templateDouglas Gregor2010-12-231-1/+16
| | | | | | | | | | | | parameter packs (C++0x [dcl.fct]p13), including disambiguation between unnamed function parameter packs and varargs (C++0x [dcl.fct]p14) for cases like void f(T...) where T may or may not contain unexpanded parameter packs. llvm-svn: 122520
* Added ParenType type node.Abramo Bagnara2010-12-101-2/+2
| | | | llvm-svn: 121488
* Added struct/class syntactic info for c++0x scoped enum.Abramo Bagnara2010-12-031-4/+7
| | | | llvm-svn: 120828
* After parsing a ':' in an enum-specifier within class context,Douglas Gregor2010-12-011-4/+50
| | | | | | | | | | disambiguate between an expression (for a bit-field width) and a type (for a fixed underlying type). Since the disambiguation can be expensive (due to tentative parsing), we perform a simplistic disambiguation based on one-token lookahead before going into the full-blown tentative parsing. Based on a patch by Daniel Wallin. llvm-svn: 120582
* Remove the other FIXME I added. This is covered by the Index test and not ↵Nico Weber2010-11-221-2/+0
| | | | | | testable via -ast-dump. llvm-svn: 119971
* Try to get the bots green after r119966.Nico Weber2010-11-221-2/+3
| | | | llvm-svn: 119968
* Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.Nico Weber2010-11-221-3/+6
| | | | llvm-svn: 119966
* When parsing something that looks like an ill-formedDouglas Gregor2010-11-191-5/+4
| | | | | | | | protocol-qualifier list without a leading type (e.g., <#blah#>), don't complain about it being an archaic protocol-qualifier list unless it actually parses as one. llvm-svn: 119805
* Emit a specific diagnostic when typedefing C++ bool, mirroring gcc.Argyrios Kyrtzidis2010-11-161-2/+10
| | | | | | Fixes rdar://8365458 llvm-svn: 119359
* Region-allocate all AttributeList objects from a factory object instead of ↵Ted Kremenek2010-11-101-48/+43
| | | | | | | | | | | | | | | | | | | | | | | | manually managing them using new/delete and OwningPtrs. After memory profiling Clang, I witnessed periodic leaks of these objects; digging deeper into the code, it was clear that our management of these objects was a mess. The ownership rules were murky at best, and not always followed. Worse, there are plenty of error paths where we could screw up. This patch introduces AttributeList::Factory, which is a factory class that creates AttributeList objects and then blows them away all at once. While conceptually simple, most of the changes in this patch just have to do with migrating over to the new interface. Most of the changes have resulted in some nice simplifications. This new strategy currently holds on to all AttributeList objects during the lifetime of the Parser object. This is easily tunable. If we desire to have more bound the lifetime of AttributeList objects more precisely, we can have the AttributeList::Factory object (in Parser) push/pop its underlying allocator as we enter/leave key methods in the Parser. This means that we get simple memory management while still having the ability to finely control memory use if necessary. Note that because AttributeList objects are now BumpPtrAllocated, we may reduce malloc() traffic in many large files with attributes. This fixes the leak reported in: <rdar://problem/8650003> llvm-svn: 118675
* Diagnose attempst to template using declarations and using directives.John McCall2010-11-101-1/+2
| | | | | | Recover from the latter and fail early for the former. Fixes PR8022. llvm-svn: 118669
* fix PR8380, a crash on invalid due to an illogical DeclSpec SourceRange ↵Chris Lattner2010-11-091-0/+1
| | | | | | being constructed. llvm-svn: 118625
* Parse attributes on enumerators and instantiate attributes on enum decls.John McCall2010-10-221-1/+6
| | | | llvm-svn: 117182
* Teach the C++ simple-type-specifier parser and tentative parses aboutDouglas Gregor2010-10-211-58/+20
| | | | | | protocol-qualified types such as id<Protocol>. llvm-svn: 117081
* Add parsing support for Microsoft attributes. MS attributes will just be ↵Francois Pichet2010-10-111-0/+4
| | | | | | skipped and not inserted into the AST for now. llvm-svn: 116203
OpenPOWER on IntegriCloud