summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseExprCXX.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
* Make this error less specific but also less likely to cause confusion. FixesNick Lewycky2010-11-031-1/+1
| | | | | | PR7702. llvm-svn: 118181
* Teach the C++ simple-type-specifier parser and tentative parses aboutDouglas Gregor2010-10-211-1/+13
| | | | | | protocol-qualified types such as id<Protocol>. llvm-svn: 117081
* When we encounter a '==' in a context expecting a '=', assume the user made ↵Argyrios Kyrtzidis2010-10-081-2/+3
| | | | | | | | | | | | | a typo: t.c:1:7: error: invalid '==' at end of declaration; did you mean '='? int x == 0; ^~ = Implements rdar://8488464. llvm-svn: 116035
* Eliminate the comma locations from all of the Sema routines that dealDouglas Gregor2010-09-091-1/+1
| | | | | | | | with comma-separated lists. We never actually used the comma locations, nor did we store them in the AST, but we did manage to waste time during template instantiation to produce fake locations. llvm-svn: 113495
* Add proper type-source information to UnaryTypeTraitExpr, includingDouglas Gregor2010-09-091-1/+1
| | | | | | libclang visitation. llvm-svn: 113492
* Fix a few minor issues with parsing and semantic analysis of C++Douglas Gregor2010-09-081-4/+6
| | | | | | | | typeid expressions: - make sure we have a proper source location for the closing ')' - cache the declaration of std::type_info once we've found it llvm-svn: 113441
* Microsoft's __uuidof operator implementation part 1.Francois Pichet2010-09-081-0/+48
| | | | llvm-svn: 113356
* Provide proper type-source location information forDouglas Gregor2010-09-081-2/+1
| | | | | | | | CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the process. llvm-svn: 113319
* Propagate whether an id-expression is the immediate argument ofJohn McCall2010-08-271-15/+2
| | | | | | | | | | | | | | | | | | | an '&' expression from the second caller of ActOnIdExpression. Teach template argument deduction that an overloaded id-expression doesn't give a valid type for deduction purposes to a non-static member function unless the expression has the correct syntactic form. Teach ActOnIdExpression that it shouldn't try to create implicit member expressions for '&function', because this isn't a permitted form of use for member functions. Teach CheckAddressOfOperand to diagnose these more carefully. Some of these cases aren't reachable right now because earlier diagnostics interrupt them. llvm-svn: 112258
* One who seeks knowledge learns something new every day.John McCall2010-08-261-4/+4
| | | | | | | | | One who seeks the Tao unlearns something new every day. Less and less remains until you arrive at non-action. When you arrive at non-action, nothing will be left undone. llvm-svn: 112244
* OwningExprResult -> ExprResult. This patch brought to you byJohn McCall2010-08-241-32/+32
| | | | | | | M-x query-replace-regexp \(Sema::\|Action::\|Parser::\|\)Owning\(Expr\|Stmt\)Result -> \2Result llvm-svn: 111903
* Abstract out passing around types and kill off ActionBase.John McCall2010-08-241-26/+27
| | | | llvm-svn: 111901
* Kill off ExprArg (now just Expr*) and StmtArg (now just Stmt*).John McCall2010-08-231-9/+10
| | | | llvm-svn: 111863
* Push DeclGroupRefs and TemplateNames in an opaque but type-safe wayJohn McCall2010-08-231-1/+1
| | | | | | through the parser. llvm-svn: 111800
* Sundry incremental steps towards killing off Action.John McCall2010-08-231-4/+5
| | | | llvm-svn: 111795
* DeclPtrTy -> Decl *John McCall2010-08-211-2/+2
| | | | llvm-svn: 111733
* Another step in the process of making the parser depend on Sema:John McCall2010-08-201-2/+2
| | | | | | | | | - move DeclSpec &c into the Sema library - move ParseAST into the Parse library Reflect this change in a thousand different includes. Reflect this change in the link orders. llvm-svn: 111667
* Once code completion has completed, pass a "completion context" on toDouglas Gregor2010-08-111-1/+1
| | | | | | | the code-completion consumer. The consumer can use this information to augument, filter, or display the code-completion results. llvm-svn: 110858
* Template keyword should not be ignored building a QualifiedTemplateName.Abramo Bagnara2010-08-061-4/+8
| | | | llvm-svn: 110441
* Downgrade the "when type is in parentheses, array cannot have dynamicDouglas Gregor2010-07-131-8/+6
| | | | | | | | | | | | size" error for code like new (int [size]) to a warning, add a Fix-It to remove the parentheses, and make this diagnostic work properly when it occurs in a template instantiation. <rdar://problem/8018245>. llvm-svn: 108242
* Move the "current scope" state from the Parser into Action. ThisDouglas Gregor2010-07-021-29/+29
| | | | | | | | | | | | | | allows Sema some limited access to the current scope, which we only use in one way: when Sema is performing some kind of declaration that is not directly driven by the parser (e.g., due to template instantiatio or lazy declaration of a member), we can find the Scope associated with a DeclContext, if that DeclContext is still in the process of being parsed. Use this to make the implicit declaration of special member functions in a C++ class more "scope-less", rather than using the NULL Scope hack. llvm-svn: 107491
* Fix PR7180.Argyrios Kyrtzidis2010-06-221-6/+4
| | | | | | | | | | | For void f( a::b::c ); we would cache the tokens "a::b::" but then we would try to annotate them using the range "a::". Before annotating them with the (invalid) C++ scope spec, set it to the range of "a::b::". llvm-svn: 106536
OpenPOWER on IntegriCloud