summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
Commit message (Collapse)AuthorAgeFilesLines
* Refactor the tree transform's many loops over sets of expressionsDouglas Gregor2011-01-031-122/+98
| | | | | | | | | | | (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
* Guard lazy synthesis of provisional ivars under the newFariborz Jahanian2011-01-032-3/+6
| | | | | | -fobjc-default-synthesize-properties flag. llvm-svn: 122757
* Implement support for pack expansions whose pattern is a non-typeDouglas Gregor2011-01-033-10/+39
| | | | | | | | | | | | | | | | | 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
* When we attempt to create a built-in that involves a library type weDouglas Gregor2011-01-032-7/+16
| | | | | | | | | don't have access to (e.g., fprintf, which needs the library type FILE), fail with a warning and forget about the builtin entirely. Previously, we would actually provide an error, which breaks autoconf's super-lame checks for fprintf, longjmp, etc. Fixes PR8316. llvm-svn: 122744
* Funciton -> FunctionPeter Collingbourne2011-01-021-3/+3
| | | | llvm-svn: 122709
* Unkown -> UnknownPeter Collingbourne2011-01-022-5/+5
| | | | llvm-svn: 122708
* Remove obsolete comments.Francois Pichet2011-01-021-7/+0
| | | | llvm-svn: 122686
* Produce a better error message for invalid register names.Rafael Espindola2011-01-011-1/+5
| | | | llvm-svn: 122670
* MSVC doesn't require an accessible copy-constructor when binding a temporary ↵Francois Pichet2010-12-311-1/+1
| | | | | | | | | | class object to a const-reference. Note: this is not a C++0x behavior change, it was already like that in MSVC 2003. This fixes a compile error when parsing MSVC header files with clang. llvm-svn: 122644
* Canonicalize types before possible cast.Abramo Bagnara2010-12-281-1/+2
| | | | llvm-svn: 122592
* More __uuidof validation:Francois Pichet2010-12-271-18/+23
| | | | | | | 1. Do not validate for uuid attribute if the type is template dependent. 2. Search every class declaration and definition for the uuid attribute. llvm-svn: 122578
* Refactor how we collect attributes during parsing, and add slots for attributesJohn McCall2010-12-245-8/+11
| | | | | | | 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
* Fix a thinko in a helper routine for template argument deduction thatDouglas Gregor2010-12-241-4/+4
| | | | | | | | caused an assertion when dealing with non-type template parameter packs. Add some tests for deduction and instantiation of non-type template parameter packs. llvm-svn: 122534
* Non-type template parameter packs cannot have default arguments.Douglas Gregor2010-12-241-0/+8
| | | | llvm-svn: 122533
* When instantiating a non-type template parameter pack, be sure toDouglas Gregor2010-12-242-5/+15
| | | | | | | | 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-234-13/+25
| | | | | | | | | | | | | | 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
* Implement parsing of function parameter packs and non-type templateDouglas Gregor2010-12-234-17/+163
| | | | | | | | | | | | 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
* Add -fobjc-default-synthesized-properties flagTed Kremenek2010-12-231-2/+4
| | | | | | | | | | | | to allow us to explicitly control whether or not Objective-C properties are default synthesized. Currently this feature only works when using the -fobjc-non-fragile-abi2 flag (so there is no functionality change), but we can now turn off this feature without turning off all the features coupled with -fobjc-non-fragile-abi2. llvm-svn: 122519
* Reimplement the comparison of a class template partialDouglas Gregor2010-12-231-83/+26
| | | | | | | | | | | specialization's template arguments against the primary template's template arguments using the obvious, correct method of checking the injected-class-name type (C++ [temp.class.spec]p9b3). The previous incarnation of this comparison attempted to use its own formulation of the injected-class-name, which is redudant and, with the introduction of variadic templates, became wrong (again). llvm-svn: 122508
* Implement the part of C++0x [temp.arg.explicit]p3 that pertains toDouglas Gregor2010-12-231-1/+11
| | | | | | | | | | | | parameter packs. In particular, a parameter pack not otherwise deduced is deduced to an empty parameter pack. The C++0x wording here is a bit unfortunate; this should really only apply to function templates, and it mentions "trailing" parameter packs, which doesn't really make sense in the context of function templates. Will file a core issue separately. llvm-svn: 122463
* Implement the rest of C++0x [temp.deduct.type]p9, which specifies thatDouglas Gregor2010-12-231-3/+57
| | | | | | | | the presence of a pack expansion anywhere except at the end of a template-argument-list causes the entire template-argument-list to be a non-deduced context. llvm-svn: 122461
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-232-2/+2
| | | | | | | | | 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
* Be paranoid about NULL size expressions in dependently-sized array typesDouglas Gregor2010-12-221-3/+4
| | | | llvm-svn: 122454
* Unify the consistency checking for deduced template arguments into aDouglas Gregor2010-12-221-125/+212
| | | | | | | | | single routine. Extend that routine to handle consistency checking for template argument packs, so that we can compare the deduced packs for template parameter packs across different pack expansions. llvm-svn: 122452
* Implement template argument deduction for pack expansions whoseDouglas Gregor2010-12-224-42/+171
| | | | | | | | | | | 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-222-6/+20
| | | | | | | if property-dot expression is decidedly an rvalue. // rdar://8155806. llvm-svn: 122430
* When performing template argument deduction where the argument is aDouglas Gregor2010-12-221-12/+15
| | | | | | | | | | dependent template specialization type, the number of template arguments need not match precisely. Rather than checking the number of arguments eagerly (which does not consider argument packs), let the deduction routine for template argument lists cope with too many/too few arguments. llvm-svn: 122425
* Implicitly expand argument packs when performing template argumentDouglas Gregor2010-12-221-33/+98
| | | | | | | | | | | | deduction. Unify all of the looping over template arguments for deduction purposes into a single place, where argument pack expansion occurs; this is also the hook for deducing from pack expansions, which itself is not yet implemented. For now, at least we can handle a basic "count" metafunction written with variadics. See the new test for the formulation that works. llvm-svn: 122418
* Redesign the way anonymous fields are handled in designated-initializers.Francois Pichet2010-12-221-67/+31
| | | | | | 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
* Tweak the checking of class template partial specialization argumentsDouglas Gregor2010-12-211-4/+16
| | | | | | | | to cope with parameter packs. This is a band-aid I will be revisiting this section when I implement declaration matching semantics for variadic templates. llvm-svn: 122369
* Add some const qualifiersDouglas Gregor2010-12-211-2/+2
| | | | llvm-svn: 122365
* For member pointer conversions potentially involving derived-to-baseDouglas Gregor2010-12-211-2/+3
| | | | | | | | | conversions, make sure that the (possibly) derived type is complete before looking for base classes. Finishes the fix for PR8801. llvm-svn: 122363
* When searching for the instantiation of a locally-scoped tagDouglas Gregor2010-12-211-5/+15
| | | | | | | declaration, also look for an instantiation of its previous declarations. Fixes PR8801. llvm-svn: 122361
* In C++, if the user redeclares a builtin function with a type that isDouglas Gregor2010-12-211-0/+12
| | | | | | | | | | | | | | | inconsistent with the type that the builtin *should* have, forget about the builtin altogether: we don't want subsequence analyses, CodeGen, etc., to think that we have a proper builtin function. C is protected from errors here because it allows one to use a library builtin without having a declaration, and detects inconsistent (re-)declarations of builtins during declaration merging. C++ was unprotected, and therefore would crash. Fixes PR8839. llvm-svn: 122351
* Fix a major inconsistency in the representation of Objective-CDouglas Gregor2010-12-212-40/+7
| | | | | | | | | | | | | | | | | | | | classes, categories, protocols, and class extensions, where the methods and properties of these entities would be inserted into the DeclContext in an ordering that doesn't necessarily reflect source order. The culprits were Sema::ActOnMethodDeclaration(), which did not perform the insertion of the just-created method declaration into the DeclContext for these Objective-C entities, and Sema::ActOnAtEnd(), which inserted all method declarations at the *end* of the DeclContext. With this fix in hand, clean up the code-completion actions for property setters/getters that worked around this brokenness in the AST. Fixes <rdar://problem/8062781>, where this problem manifested as poor token-annotation information, but this would have struck again in many other places. llvm-svn: 122347
* A class template partial specialization cannot be a friend. Fixes PR8649.Douglas Gregor2010-12-211-0/+6
| | | | llvm-svn: 122325
* When checking a using declaration, make sure that the context we'reDouglas Gregor2010-12-211-0/+4
| | | | | | looking in is complete. Fixes PR8756. llvm-svn: 122323
* Don't try to compute the value of a value-dependent expression whenDouglas Gregor2010-12-211-0/+3
| | | | | | checking trivial comparisons. Fixes PR8795. llvm-svn: 122322
* Implement instantiation of pack expansions whose pattern is a type-idDouglas Gregor2010-12-214-77/+145
| | | | | | in an exception specification. llvm-svn: 122297
* Fix the noreturn conversion to only strip off a single level of indirection.John McCall2010-12-212-8/+37
| | | | | | | Apply the noreturn attribute while creating a builtin function's type. Remove the getNoReturnType() API. llvm-svn: 122295
* Warn when message is sent to receiver ofFariborz Jahanian2010-12-214-13/+40
| | | | | | | | unknown type and there is a possibility that at runtime method is resolved to a deprecated or unavailable method. Addreses // rdar://8769853 llvm-svn: 122294
* Further refactoring of the tree transformation for template argumentDouglas Gregor2010-12-201-42/+164
| | | | | | | | | | | | | lists, so that all such transformations go through a single, iterator-based transformation function. This is the only place where we need to implement the logic for transforming pack expansions whose pattern is a template argument. Unfortunately, the new cases this refactoring brings into the fold can't be meaningfully tested yet. We need template argument deduction to work well enough for variadic function templates first. llvm-svn: 122289
* Give the RecursiveASTVisitor a configuration functionDouglas Gregor2010-12-201-0/+2
| | | | | | | | | | | shouldWalkTypesOfTypeLocs() that determines whether it should walk the Types within TypeLocs. This walk is redundant, but perhaps required for some clients. Disabling this redundant walk in the unexpanded parameter pack finder produces better results, because we get parameter packs with source location info *unless* such source location information isn't available. llvm-svn: 122287
* Handle instantiation of template type parameter packs that occur asDouglas Gregor2010-12-201-2/+18
| | | | | | | the first qualifier in scope. We can't adequately test this test, unfortunately. llvm-svn: 122283
* Implement basic support for template instantiation of pack expansionsDouglas Gregor2010-12-205-34/+290
| | | | | | | | | | | | | | | | | 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
* Remove unused variableMatt Beaumont-Gay2010-12-201-2/+0
| | | | llvm-svn: 122257
* Finish refactoring the transformation of template argument lists,Douglas Gregor2010-12-201-15/+40
| | | | | | centralizing the transformation into two routines. No functionality change. llvm-svn: 122253
* Refactor the transformation of template argument lists to centralizeDouglas Gregor2010-12-201-37/+58
| | | | | | the list traversal. Part 1, no functionality change. llvm-svn: 122252
* When checking a template argument list against a template containingDouglas Gregor2010-12-201-12/+45
| | | | | | | | | | | | a parameter pack, check the parameter pack against each of the template arguments it corresponds to, then pack the converted arguments into a template argument pack. Allows us to use variadic class templates so long as instantiation isn't required, e.g., template<typename... Types> struct Tuple; Tuple<int, float> *t2; llvm-svn: 122251
* Clean up the handling of template argument packs, especially in theDouglas Gregor2010-12-202-72/+14
| | | | | | | area of printing template arguments. The functionality changes here are limited to cases of variadic templates that aren't yet enabled. llvm-svn: 122250
OpenPOWER on IntegriCloud