summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
...
* Prefix all attribute enumerators with attr_ for consistency.Francois Pichet2011-01-071-7/+7
| | | | llvm-svn: 122992
* Do not use cdecl, fastcall, stdcall etc.. as identifier name. They are ↵Francois Pichet2011-01-071-6/+6
| | | | | | reserved keywords at least on MSVC. llvm-svn: 122991
* Implement template argument deduction from a call to a functionDouglas Gregor2011-01-062-4/+16
| | | | | | | | | | | | template whose last parameter is a parameter pack. This allows us to form a call to, e.g., template<typename ...Args1, typename ...Args2> void f(std::pair<Args1, Args2> ...pairs); given zero or more instances of "pair". llvm-svn: 122973
* Introduce an AttributedType, but don't actually use it anywhere yet.John McCall2011-01-064-1/+114
| | | | | | | | | | The initial TreeTransform is a cop-out, but it's more-or-less equivalent to what we were doing before, or rather what we're doing now and might eventually stop doing in favor of using this type. I am simultaneously intrigued by the possibilities of rebuilding a dependent Attri llvm-svn: 122942
* When default-initializing a TemplateArgumentLocInfo, make sure that weDouglas Gregor2011-01-061-1/+9
| | | | | | | | | | initialize *all* of the bits to zero. Also, when the pattern of a template argument pack expansion, make sure to set the ellipsis location along all paths. This should clear up the valgrind failure that popped up in Clang. llvm-svn: 122931
* Add Decl::isParameterPack(), which covers both function and templateDouglas Gregor2011-01-053-5/+13
| | | | | | | | parameter packs, along with ParmVarDecl::isParameterPack(), which looks for function parameter packs. Use these routines to fix some obvious FIXMEs. llvm-svn: 122904
* Replace the representation of template template argument packDouglas Gregor2011-01-056-43/+80
| | | | | | | | | | | | | expansions with something that is easier to use correctly: a new template argment kind, rather than a bit on an existing kind. Update all of the switch statements that deal with template arguments, fixing a few latent bugs in the process. I"m happy with this representation, now. And, oh look! Template instantiation and deduction work for template template argument pack expansions. llvm-svn: 122896
* Add semantic analysis for the creation of and an AST representationDouglas Gregor2011-01-052-33/+42
| | | | | | | | | | | | | | | | | | | | | for template template argument pack expansions. This allows fun such as: template<template<class> class ...> struct apply_impl { /*...*/ }; template<template<class> class ...Metafunctions> struct apply { typedef typename apply_impl<Metafunctions...>::type type; }; However, neither template argument deduction nor template instantiation is implemented for template template argument packs, so this functionality isn't useful yet. I'll probably replace the encoding of template template argument pack expansions in TemplateArgument so that it's harder to accidentally forget about the expansion. However, this is a step in the right general direction. llvm-svn: 122890
* Implement support for template template parameter packs, e.g.,Douglas Gregor2011-01-056-9/+20
| | | | | | | template<template<class> class ...Metafunctions> struct apply_to_each; llvm-svn: 122874
* Refactor the application of type attributes so that attributes fromJohn McCall2011-01-051-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | the declaration-specifiers and on the declarator itself are moved to the appropriate declarator chunk. This permits a greatly simplified model for how to apply these attributes, as well as allowing a much more efficient query for the GC attribute. Now all qualifier queries follow the same basic strategy of "local qualifiers, local qualifiers on the canonical type, then look through arrays". This can be easily optimized by changing the canonical qualified-array-type representation. Do not process type attributes as decl attributes on declarations with declarators. When computing the type of a block, synthesize a prototype function declarator chunk if the decl-spec type was not a function. This simplifies the logic for building block signatures. Change the logic which inserts an objc_read_weak on a block literal to only fire if the block has a __weak __block variable, rather than if the return type of the block is __weak qualified, which is not actually a sensible thing to ask. llvm-svn: 122871
* Implement the sizeof...(pack) expression to compute the length of aDouglas Gregor2011-01-045-2/+32
| | | | | | | | | parameter pack. Note that we're missing proper libclang support for the new SizeOfPackExpr expression node. llvm-svn: 122813
* When creating the injected-class-name for a class template involving aDouglas Gregor2011-01-041-1/+5
| | | | | | | non-type template parameter pack, make sure to create a pack expansion for the corresponding template argument. llvm-svn: 122799
* Implement pack expansion of base initializers, so that we canDouglas Gregor2011-01-041-5/+6
| | | | | | | initialize those lovely mixins that come from pack expansions of base specifiers. llvm-svn: 122793
* Implement pack expansions whose pattern is a base-specifier.Douglas Gregor2011-01-032-2/+8
| | | | llvm-svn: 122782
* Refactor the tree transform's many loops over sets of expressionsDouglas Gregor2011-01-031-4/+4
| | | | | | | | | | | (transforming each in turn) into calls into one central routine (TransformExprs) that transforms a list of expressions. This refactoring is preparatory work for pack expansions whose in an expression-list. No functionality change. llvm-svn: 122761
* Implement support for pack expansions whose pattern is a non-typeDouglas Gregor2011-01-036-6/+37
| | | | | | | | | | | | | | | | | template argument (described by an expression, of course). For example: template<int...> struct int_tuple { }; template<int ...Values> struct square { typedef int_tuple<(Values*Values)...> type; }; It also lays the foundation for pack expansions in an initializer-list. llvm-svn: 122751
* Expose Objective-C type encodings of declarations to libclang users. This ↵David Chisnall2010-12-301-0/+36
| | | | | | also adds a method in ASTContext which encodes FunctionDecls using the same encoding format that is used for Objective-C methods. llvm-svn: 122639
* Fix PR8796.Rafael Espindola2010-12-291-3/+5
| | | | | | | | The problem was that we were asserting the we never added an empty class to the same offset twice. This is not true for unions, where two members, empty or not, can have the some offset. llvm-svn: 122633
* Fix for PR8695.David Chisnall2010-12-261-1/+4
| | | | llvm-svn: 122564
* The -fshort-wchar option causes wchar_t to become unsigned, in addition to beingChris Lattner2010-12-254-17/+34
| | | | | | | 16-bits in size. Implement this by splitting WChar into two enums, like we have for char. This fixes a miscompmilation of XULRunner, PR8856. llvm-svn: 122558
* Refactor how we collect attributes during parsing, and add slots for attributesJohn McCall2010-12-241-2/+2
| | | | | | | 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
* When instantiating a non-type template parameter pack, be sure toDouglas Gregor2010-12-242-0/+4
| | | | | | | | extract the appropriate argument from the argument pack (based on the current substitution index, of course). Simple instantiation of pack expansions involving non-type template parameter packs now works. llvm-svn: 122532
* Add an AST representation for non-type template parameterDouglas Gregor2010-12-235-6/+16
| | | | | | | | | | | | | | packs, e.g., template<typename T, unsigned ...Dims> struct multi_array; along with semantic analysis support for finding unexpanded non-type template parameter packs in types, expressions, and so on. Template instantiation involving non-type template parameter packs probably doesn't work yet. That'll come soon. llvm-svn: 122527
* When forming the injected-class-name of a variadic template, theDouglas Gregor2010-12-231-9/+26
| | | | | | | | | template argument corresponding to a template parameter pack is an argument pack of a pack expansion of that template parameter pack. Implements C++0x [temp.dep.type]p2 (at least, as much of it as we can). llvm-svn: 122498
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-232-13/+13
| | | | | | | | | new gcc warning that complains on self-assignments and self-initializations. Fix one bug found by the warning, in which one clang::OverloadCandidate constructor failed to initialize its FunctionTemplate member. llvm-svn: 122459
* Implement template argument deduction for pack expansions whoseDouglas Gregor2010-12-221-0/+22
| | | | | | | | | | | pattern is a template argument, which involves repeatedly deducing template arguments using the pattern of the pack expansion, then bundling the resulting deductions into an argument pack. We can now handle a variety of simple list-handling metaprograms using variadic templates. See, e.g., the new "count" metaprogram. llvm-svn: 122439
* Complain on missing property getter method onlyFariborz Jahanian2010-12-221-3/+7
| | | | | | | if property-dot expression is decidedly an rvalue. // rdar://8155806. llvm-svn: 122430
* Redesign the way anonymous fields are handled in designated-initializers.Francois Pichet2010-12-221-11/+0
| | | | | | Previously designated anonymous fields were found via name lookup. This redesign uses the fact that an IndirectFieldDecl declaration will always follow an anonymous implicit field to remove the special case of name lookup. llvm-svn: 122387
* Add a hack to work around the lack of proper type-source info in a pack ↵Douglas Gregor2010-12-211-1/+8
| | | | | | expansion TypeLoc llvm-svn: 122367
* Implement BlockDecl::getSourceRange(). The bogus source-rangeDouglas Gregor2010-12-211-0/+3
| | | | | | | information caused token-annotation to fail in funny ways. Fixes <rdar://problem/8595386>. llvm-svn: 122338
* Fix the noreturn conversion to only strip off a single level of indirection.John McCall2010-12-211-52/+10
| | | | | | | Apply the noreturn attribute while creating a builtin function's type. Remove the getNoReturnType() API. llvm-svn: 122295
* Clean up the printing of template argument packs; previously, we wereDouglas Gregor2010-12-201-7/+20
| | | | | | getting extra "<>" delimiters around template argument packs. llvm-svn: 122280
* Implement basic support for template instantiation of pack expansionsDouglas Gregor2010-12-201-0/+64
| | | | | | | | | | | | | | | | | whose patterns are template arguments. We can now instantiate, e.g., typedef tuple<pair<OuterTypes, InnerTypes>...> type; where OuterTypes and InnerTypes are template type parameter packs. There is a horrible inefficiency in TemplateArgumentLoc::getPackExpansionPattern(), where we need to create copies of TypeLoc data because our interfaces traffic in TypeSourceInfo pointers where they should traffic in TypeLocs instead. I've isolated in efficiency in this one routine; once we refactor our interfaces to traffic in TypeLocs, we can eliminate it. llvm-svn: 122278
* Clean up the handling of template argument packs, especially in theDouglas Gregor2010-12-204-46/+91
| | | | | | | area of printing template arguments. The functionality changes here are limited to cases of variadic templates that aren't yet enabled. llvm-svn: 122250
* Introduce a new type, PackExpansionType, to capture types that areDouglas Gregor2010-12-203-2/+41
| | | | | | | | | | | | | | | | | | | | pack expansions, e.g. given template<typename... Types> struct tuple; template<typename... Types> struct tuple_of_refs { typedef tuple<Types&...> types; }; the type of the "types" typedef is a PackExpansionType whose pattern is Types&. This commit introduces support for creating pack expansions for template type arguments, as above, but not for any other kind of pack expansion, nor for any form of instantiation. llvm-svn: 122223
* Motions towards simplifying how we deal with attribute-qualified function types.John McCall2010-12-191-25/+21
| | | | llvm-svn: 122162
* Apply attributes to explicit specializations. Specializations whichJohn McCall2010-12-181-14/+34
| | | | | | | don't provide their own explicit visibility attributes should get them from the template. Fixes rdar://problem/8778497. llvm-svn: 122136
* Microsoft's __uuidof operator returns a lvalue.Francois Pichet2010-12-171-1/+1
| | | | llvm-svn: 122021
* Check for unexpanded parameter packs in various kinds ofDouglas Gregor2010-12-151-1/+8
| | | | | | | | declarations. This is a work in progress, as I go through the C++ declaration grammar to identify where unexpanded parameter packs can occur. llvm-svn: 121912
* Silence GCC warning about control reaching the end of the function and ↵Chandler Carruth2010-12-151-0/+2
| | | | | | explicitly mark that all cases are handled. llvm-svn: 121855
* Variadic templates: extend the Expr class with a bit that specifiesDouglas Gregor2010-12-155-159/+378
| | | | | | | | | | | | | | | | | | whether the expression contains an unexpanded parameter pack, in the same vein as the changes to the Type hierarchy. Compute this bit within all of the Expr subclasses. This change required a bunch of reshuffling of dependency calculations, mainly to consolidate them inside the constructors and to fuse multiple loops that iterate over arguments to determine type dependence, value dependence, and (now) containment of unexpanded parameter packs. Again, testing is painfully sparse, because all of the diagnostics will change and it is more important to test the to-be-written visitor that collects unexpanded parameter packs. llvm-svn: 121831
* Function types are compatible (in the C sense) if their regparms are identical.John McCall2010-12-151-16/+20
| | | | llvm-svn: 121821
* Added missing IgnoreParens().Abramo Bagnara2010-12-142-5/+10
| | | | llvm-svn: 121795
* Rewrite ComplexExprEvaluator::VisitCastExpr to use cast kinds, and fixJohn McCall2010-12-141-78/+109
| | | | | | | the basic casting logic to insert intermediate casts and preserve the exact complex-cast design. Fixes a crash in the test suite. llvm-svn: 121776
* Restore r121752 without modification.John McCall2010-12-144-103/+99
| | | | llvm-svn: 121763
* Pull out r121752 in case it's causing the selfhost breakage.John McCall2010-12-144-99/+103
| | | | llvm-svn: 121759
* Factor out most of the extra state in a FunctionProtoType into a separateJohn McCall2010-12-144-103/+99
| | | | | | | class to be passed around. The line between argument and return types and everything else is kindof vague, but I think it's justifiable. llvm-svn: 121752
* Variadic templates: extend Type, NestedNameSpecifier, TemplateName,Douglas Gregor2010-12-134-10/+143
| | | | | | | | | | | | | | | | | | | | | | | | and TemplateArgument with an operation that determines whether there are any unexpanded parameter packs within that construct. Use this information to diagnose the appearance of the names of parameter packs that have not been expanded (C++ [temp.variadic]p5). Since this property is checked often (every declaration, ever expression statement, etc.), we extend Type and Expr with a bit storing the result of this computation, rather than walking the AST each time to determine whether any unexpanded parameter packs occur. This commit is deficient in several ways, which will be remedied with future commits: - Expr has a bit to store the presence of an unexpanded parameter pack, but it is never set. - The error messages don't point out where the unexpanded parameter packs were named in the type/expression, but they should. - We don't check for unexpanded parameter packs in all of the places where we should. - Testing is sparse, pending the resolution of the above three issues. llvm-svn: 121724
* Skip ParenType on function instantiations.Abramo Bagnara2010-12-131-0/+8
| | | | llvm-svn: 121720
* Improved complex constants evaluation.Abramo Bagnara2010-12-111-2/+100
| | | | llvm-svn: 121616
OpenPOWER on IntegriCloud