summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* 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
OpenPOWER on IntegriCloud