summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Introduce ObjCMessageExpr::getReceiverRange() to get the source range of the ↵Argyrios Kyrtzidis2010-12-101-1/+17
| | | | | | receiver. llvm-svn: 121517
* Keep the source location of the selector in ObjCMessageExpr.Argyrios Kyrtzidis2010-12-101-10/+16
| | | | llvm-svn: 121516
* Added ParenType type node.Abramo Bagnara2010-12-105-1/+58
| | | | llvm-svn: 121488
* It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall2010-12-105-143/+126
| | | | | | | | | | space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. llvm-svn: 121478
* Move the "volatile" bit into QualType's "fast" qualifier set,Douglas Gregor2010-12-101-11/+0
| | | | | | | | increasing the required type alignment from 8 to 16. This provides a 2.5% speedup for -fsyntax-only on a token-cached Cocoa.h, while only increasing memory consumption in the ASTContext by 0.8%. llvm-svn: 121474
* Treat visibility on an enclosing namespace as a non-explicit source ofJohn McCall2010-12-101-0/+14
| | | | | | | | | | | visibility. Fixes PR8713. I've disabled a test which was testing that you can #pragma pop visibility to get out of a namespace's visibility attribute. We should probably just diagnose that as an error unless it's instrumental to someone's system headers. llvm-svn: 121459
* When an "inline" declaration was followed by a definition not markedDouglas Gregor2010-12-091-19/+18
| | | | | | | | | | | | | "inline", we weren't giving the definition weak linkage because the "inline" bit wasn't propagated. This was a longstanding FIXME that, somehow, hadn't triggered a bug in the wild. Fix this problem by tracking whether any declaration was marked "inline", and clean up the semantics of GNU's "extern inline" semantics calculation based on this change. Fixes <rdar://problem/8740363>. llvm-svn: 121373
* Fix another unnecessary-struct-padding issue.Argyrios Kyrtzidis2010-12-091-1/+10
| | | | llvm-svn: 121352
* Before determining the effect the alignment of base struct will have in the ↵Argyrios Kyrtzidis2010-12-091-2/+9
| | | | | | | | | | aligment of the sub-struct, take into account if the sub-struct is packed and its maximum field alignment. Fixes rdar://8745206 llvm-svn: 121335
* Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet2010-12-086-42/+2
| | | | | | BinaryTypeTraitExpr. llvm-svn: 121298
* Fix two thinkos and add a test for importing the AST of a categoryDouglas Gregor2010-12-081-2/+3
| | | | | | implementation. llvm-svn: 121263
* Implement AST import for Objective-C property implementationsDouglas Gregor2010-12-071-0/+82
| | | | | | (@synthesize and @dynamic). llvm-svn: 121159
* Cast CachedLinkage to linkage to avoid "comparison between signed and ↵Benjamin Kramer2010-12-071-5/+3
| | | | | | unsigned integer" warnings. llvm-svn: 121143
* Implement ASTImporter support for Objective-C category implementations.Douglas Gregor2010-12-071-0/+36
| | | | llvm-svn: 121139
OpenPOWER on IntegriCloud