summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Properly implement the scope restriction on the NRVO forDouglas Gregor2011-07-061-2/+2
| | | | | | | | | | | | throw-expressions, such that we don't consider the NRVO when the non-volatile automatic object comes from outside the innermost try scope (C++0x [class.copymove]p13). In C++98/03, our ASTs were incorrect but it didn't matter because IR generation doesn't actually apply the NRVO here. In C++0x, however, we were moving from an object when in fact we should have copied from it. Fixes PR10142 / <rdar://problem/9714312>. llvm-svn: 134548
* [ARC] When casting from a pointer to an objective-c object with known ↵Argyrios Kyrtzidis2011-07-011-7/+12
| | | | | | | | | | | | ownership, if the cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type to the cast type: id x; (NSString**)&x; // Casting as (__strong NSString**). llvm-svn: 134275
* [ARC] When casting from a pointer to an objective-c object with known ↵Argyrios Kyrtzidis2011-07-011-3/+10
| | | | | | | | | | | | | | ownership, if the cast type has no ownership specified, implicitly "transfer" the ownership of the cast'ed type to the cast type: id x; static_cast<NSString**>(&x); // Casting as (__strong NSString**). This currently only works for C++ named casts, C casts to follow. llvm-svn: 134273
* Introduce Declarator::CXXNewContext and remove 'AutoAllowedInTypeName' parameterArgyrios Kyrtzidis2011-06-281-1/+1
| | | | | | from Sema::GetTypeForDeclarator. No functionality change. llvm-svn: 133987
* Introduce DelayedCleanupPool useful for simplifying clean-up of certain ↵Argyrios Kyrtzidis2011-06-221-9/+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
* Parse C++0x generalized initializers.Sebastian Redl2011-06-051-22/+38
| | | | llvm-svn: 132662
* Implement __underlying_type for libc++.Alexis Hunt2011-05-191-0/+1
| | | | llvm-svn: 131633
* Implement the __is_trivially_copyable type traitAlexis Hunt2011-05-131-0/+1
| | | | llvm-svn: 131270
* Rename "hasTrivialConstructor" to "hasTrivialDefaultConstructor" andAlexis Hunt2011-05-091-1/+2
| | | | | | | modify the semantics slightly to accomodate default constructors (I hope). llvm-svn: 131087
* Fix a double free when parsing malformed code. Fixes rdar://9173693.Argyrios Kyrtzidis2011-05-031-2/+5
| | | | llvm-svn: 130775
* Remove the type traits UTT_IsLvalueExpr and UTT_IsRvalueExpr.Chandler Carruth2011-05-011-2/+0
| | | | | | | | | | | As might be surmised from their names, these aren't type traits, they're expression traits. Amazingly enough, they're expression traits that we have, and fully implement. These "type" traits are even parsed from the same tokens as the expression traits. Luckily, the parser only tried the expression trait parsing for these tokens, so this was all just a pile of dead code. llvm-svn: 130643
* Upgrade Microsoft's __int8, __int16, __int32 and __int64 types from builtin ↵Francois Pichet2011-04-281-0/+4
| | | | | | | | | | | | | | 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
* Implementation of Embarcadero array type traitsJohn Wiegley2011-04-281-0/+52
| | | | | | | | | | Patch authored by John Wiegley. These are array type traits used for parsing code that employs certain features of the Embarcadero C++ compiler: __array_rank(T) and __array_extent(T, Dim). llvm-svn: 130351
* t/clang/type-traitsJohn Wiegley2011-04-271-4/+31
| | | | | | | | | | 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
* Simplify the parser's handling of Sema::ClassifyName() for types, byDouglas Gregor2011-04-271-2/+1
| | | | | | | creating a type-annotation token rather than jumping into the declaration parsing. llvm-svn: 130293
* t/clang/expr-traitsJohn Wiegley2011-04-251-0/+30
| | | | | | | | | Patch authored by David Abrahams. These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for parsing code that employs certain features of the Embarcadero C++ compiler. llvm-svn: 130122
* Add support for '__is_literal_type' spelling of the existingChandler Carruth2011-04-241-0/+1
| | | | | | | | '__is_literal' type trait for GCC compatibility. At least one relased version if libstdc++ uses this name for the trait despite it not being documented anywhere. llvm-svn: 130078
* Implement basic __is_trivial type-trait support, enough to close PR9472.Chandler Carruth2011-04-231-0/+1
| | | | | | | | | | | | | | | | | | This introduces a few APIs on the AST to bundle up the standard-based logic so that programmatic clients have access to exactly the same behavior. There is only one serious FIXME here: checking for non-trivial move constructors and move assignment operators. Those bits need to be added to the declaration and accessors provided. This implementation should be enough for the uses of __is_trivial in libstdc++ 4.6's C++98 library implementation. Ideas for more thorough test cases or any edge cases missing would be appreciated. =D llvm-svn: 130057
* Sort the type traits in a few places where they weren't previouslyChandler Carruth2011-04-231-1/+1
| | | | | | sorted in order to prepare for adding some new ones. llvm-svn: 130056
* Fix an assertion when code-completing, rdar://9288730 & http://llvm.org/PR9728.Argyrios Kyrtzidis2011-04-231-1/+6
| | | | llvm-svn: 130042
* For consistency, change suffix from war_ to warn_ for some Microsoft ↵Francois Pichet2011-04-221-1/+1
| | | | | | warnings I introduced lately. llvm-svn: 129986
* Parse GNU-style attributes prior to the type-id/new-type-id in a C++Douglas Gregor2011-04-151-0/+4
| | | | | | "new" expression. This matches GCC's parser. Test is forthcoming. llvm-svn: 129592
* Detect when the string "<::" is found in code after a cast or template name ↵Richard Smith2011-04-141-0/+79
| | | | | | | | and is interpreted as "[:" because of the digraph "<:". When found, give an error with a fix-it to add whitespace between the "<" and "::". Patch by Richard Trieu! Plus a small tweak from me to deal with one of the tokens coming from a macro. llvm-svn: 129540
* Improve recovery (error + fix-it) when parsing type dependent template name ↵Francois Pichet2011-03-271-3/+8
| | | | | | | | | | | without the "template" keyword. For example: typename C1<T>:: /*template*/ Iterator<0> pos; Also the error is downgraded to an ExtWarn in Microsoft mode. llvm-svn: 128387
* Insomniac refactoring: change how the parser allocates attributes so thatJohn McCall2011-03-241-5/+7
| | | | | | | | | 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
* Fixes for some more expressions containing function templateids thatDouglas Gregor2011-03-121-1/+9
| | | | | | should be resolvable, from Faisal Vali! llvm-svn: 127521
* Teach Sema::ActOnCXXNestedNameSpecifier and Sema::CheckTemplateIdTypeDouglas Gregor2011-03-041-34/+29
| | | | | | | | to cope with non-type templates by providing appropriate errors. Previously, we would either assert, crash, or silently build a dependent type when we shouldn't. Fixes PR9226. llvm-svn: 127037
* Push nested-name-specifier source-location information into dependentDouglas Gregor2011-03-021-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | 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-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-6/+2
| | | | | | location information for elaborated types. *sigh* llvm-svn: 126753
* Reinstate r126737, extending the generation of type-source locationDouglas Gregor2011-03-011-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix some regressions in the GCC testsuite due to bad souce-locationDouglas Gregor2011-03-011-2/+6
| | | | | | information. Fixes <rdar://problem/9063643>. llvm-svn: 126721
* When we encounter a dependent template name within aDouglas Gregor2011-02-281-16/+19
| | | | | | | | | | | | nested-name-specifier, e.g., T::template apply<U>:: represent the dependent template name specialization as a DependentTemplateSpecializationType, rather than a TemplateSpecializationType with a dependent TemplateName. llvm-svn: 126593
* Make sure to give CXXScopeSpec::SetInvalid() a valid sourceDouglas Gregor2011-02-251-1/+3
| | | | | | range. Fixes four new failures in the GCC testsuite. llvm-svn: 126495
* Retain complete source-location information for C++Douglas Gregor2011-02-241-5/+4
| | | | | | | | | | | | 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
* Teach CXXScopeSpec to handle the extension of a nested-name-specifierDouglas Gregor2011-02-241-23/+19
| | | | | | | | | with another component in the nested-name-specifiers, updating its representation (a NestedNameSpecifier) and source-location information (currently a SourceRange) simultaneously. This is groundwork for adding source-location information to nested-name-specifiers. llvm-svn: 126346
* 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
* Implement the C++0x deduced 'auto' feature.Richard Smith2011-02-201-1/+2
| | | | | | This fixes PR 8738, 9060 and 9132. llvm-svn: 126069
* Implement the Microsoft __is_convertible_to type trait, modeling theDouglas Gregor2011-01-271-0/+1
| | | | | | | | | | semantics after the C++0x is_convertible type trait. This implementation is not 100% complete, because it allows access errors to be hard errors (rather than just evaluating false). Original patch by Steven Watanabe! llvm-svn: 124425
* Implement support for non-type template parameter packs whose type isDouglas Gregor2011-01-191-2/+5
| | | | | | | | | | | | | | | | | | | | | a pack expansion, e.g., the parameter pack Values in: template<typename ...Types> struct Outer { template<Types ...Values> struct Inner; }; This new implementation approach introduces the notion of an "expanded" non-type template parameter pack, for which we have already expanded the types of the parameter pack (to, say, "int*, float*", for Outer<int*, float*>) but have not yet expanded the values. Aside from creating these expanded non-type template parameter packs, this patch updates template argument checking and non-type template parameter pack instantiation to make use of the appropriate types in the parameter pack. llvm-svn: 123845
* Fix warnings found by gcc-4.6, from -Wunused-but-set-variable andJeffrey Yasskin2011-01-181-1/+1
| | | | | | -Wint-to-pointer-cast. llvm-svn: 123719
* When we're inside a functional cast, '>' is an operator. Fixes PR8912.Douglas Gregor2011-01-111-0/+3
| | | | llvm-svn: 123201
* Refactor how we collect attributes during parsing, and add slots for attributesJohn McCall2010-12-241-7/+4
| | | | | | | 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
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-081-1/+2
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* Fix enumerator not handled in switch warnings.Francois Pichet2010-12-071-2/+2
| | | | llvm-svn: 121084
* Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet2010-12-071-1/+45
| | | | | | New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. llvm-svn: 121074
* Remove one I just added, add a more focused test for why the current code is ↵Nico Weber2010-11-221-2/+0
| | | | | | correct. llvm-svn: 119969
* Try to get the bots green after r119966.Nico Weber2010-11-221-2/+4
| | | | llvm-svn: 119968
* Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.Nico Weber2010-11-221-2/+2
| | | | llvm-svn: 119966
OpenPOWER on IntegriCloud