]> granicus.if.org Git - clang/log
clang
13 years agoWhen default-initializing a TemplateArgumentLocInfo, make sure that we
Douglas Gregor [Thu, 6 Jan 2011 00:33:28 +0000 (00:33 +0000)]
When default-initializing a TemplateArgumentLocInfo, make sure that we
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122931 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFast-path an arity check when performing template argument deduction that compares...
Douglas Gregor [Wed, 5 Jan 2011 23:23:17 +0000 (23:23 +0000)]
Fast-path an arity check when performing template argument deduction that compares two parameter-type-lists. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122928 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate an unnecessary dance where we tried to cope with the lack of
Douglas Gregor [Wed, 5 Jan 2011 23:16:57 +0000 (23:16 +0000)]
Eliminate an unnecessary dance where we tried to cope with the lack of
TypeSourceInfo when transforming a function parameter. The callees of
this routine already assume that TypeSourceInfo will be present, and
we want to always be sure that it exists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122927 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoInitial implementation of function parameter packs. This implementation allows:
Douglas Gregor [Wed, 5 Jan 2011 23:12:31 +0000 (23:12 +0000)]
Initial implementation of function parameter packs. This implementation allows:

  1) Declaration of function parameter packs
  2) Instantiation of function parameter packs within function types.
  3) Template argument deduction of function parameter packs when
  matching two function types.

We're missing all of the important template-instantiation logic for
function template definitions, along with template argument deduction
from the argument list of a function call, so don't even think of
trying to use these for real yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122926 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix an embarrassing think in the disambiguation logic for the ellipsis in a parameter...
Douglas Gregor [Wed, 5 Jan 2011 23:06:07 +0000 (23:06 +0000)]
Fix an embarrassing think in the disambiguation logic for the ellipsis in a parameter-type-list

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122924 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDon't warn on missing 'copy' attribute on a 'block'
Fariborz Jahanian [Wed, 5 Jan 2011 23:00:04 +0000 (23:00 +0000)]
Don't warn on missing 'copy' attribute on a 'block'
property when it is 'readonly'. // rdar://8820813

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122923 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agohasInit() -> hasDefaultArg()
Douglas Gregor [Wed, 5 Jan 2011 21:14:17 +0000 (21:14 +0000)]
hasInit() -> hasDefaultArg()

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122905 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd Decl::isParameterPack(), which covers both function and template
Douglas Gregor [Wed, 5 Jan 2011 21:11:38 +0000 (21:11 +0000)]
Add Decl::isParameterPack(), which covers both function and template
parameter packs, along with ParmVarDecl::isParameterPack(), which
looks for function parameter packs. Use these routines to fix some
obvious FIXMEs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122904 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPropagate the "deduced from array bound" bit when comparing deduced
Douglas Gregor [Wed, 5 Jan 2011 21:00:53 +0000 (21:00 +0000)]
Propagate the "deduced from array bound" bit when comparing deduced
template argument packs. Plus, remove a FIXME that I fixed yesterday.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122903 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen we're converting deduced template arguments to the type of the
Douglas Gregor [Wed, 5 Jan 2011 20:52:18 +0000 (20:52 +0000)]
When we're converting deduced template arguments to the type of the
corresponding template parameter, make sure that prior converted
template arguments are available for substitution.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122902 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse the proper enum as parameter, instead of unsigned. No functionality change.
Argyrios Kyrtzidis [Wed, 5 Jan 2011 20:09:36 +0000 (20:09 +0000)]
Use the proper enum as parameter, instead of unsigned. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122900 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate two "unsupported" errors relating to variadic templates: one
Douglas Gregor [Wed, 5 Jan 2011 19:06:29 +0000 (19:06 +0000)]
Eliminate two "unsupported" errors relating to variadic templates: one
for template template argument pack expansions (which was no longer
used) and another that was a placeholder for an llvm_unreachable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122898 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoReplace the representation of template template argument pack
Douglas Gregor [Wed, 5 Jan 2011 18:58:31 +0000 (18:58 +0000)]
Replace the representation of template template argument pack
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122896 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agofix a -Wself-assign warning
Chris Lattner [Wed, 5 Jan 2011 18:41:53 +0000 (18:41 +0000)]
fix a -Wself-assign warning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122894 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd semantic analysis for the creation of and an AST representation
Douglas Gregor [Wed, 5 Jan 2011 17:40:24 +0000 (17:40 +0000)]
Add semantic analysis for the creation of and an AST representation
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122890 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoParse template template argument pack expansions. They're still not
Douglas Gregor [Wed, 5 Jan 2011 17:33:50 +0000 (17:33 +0000)]
Parse template template argument pack expansions. They're still not
implemented, however.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122888 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUpdate C++ [temp.param]p11 citation to reflect the changes in C++0x. No functionality...
Douglas Gregor [Wed, 5 Jan 2011 16:21:17 +0000 (16:21 +0000)]
Update C++ [temp.param]p11 citation to reflect the changes in C++0x. No functionality change

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122878 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement C++0x [temp.param]p11 for non-type and template template
Douglas Gregor [Wed, 5 Jan 2011 16:19:19 +0000 (16:19 +0000)]
Implement C++0x [temp.param]p11 for non-type and template template
parameter packs. Also, the "no template parameters after a template
parameter pack" rule only applies to primary class templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122877 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement proper parameter pack matching for non-type template
Douglas Gregor [Wed, 5 Jan 2011 16:01:49 +0000 (16:01 +0000)]
Implement proper parameter pack matching for non-type template
parameters and template template parameters.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122875 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement support for template template parameter packs, e.g.,
Douglas Gregor [Wed, 5 Jan 2011 15:48:55 +0000 (15:48 +0000)]
Implement support for template template parameter packs, e.g.,

  template<template<class> class ...Metafunctions>
    struct apply_to_each;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122874 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix the -Asserts build.
John McCall [Wed, 5 Jan 2011 12:34:30 +0000 (12:34 +0000)]
Fix the -Asserts build.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122872 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRefactor the application of type attributes so that attributes from
John McCall [Wed, 5 Jan 2011 12:14:39 +0000 (12:14 +0000)]
Refactor the application of type attributes so that attributes from
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122871 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse Parser::ExpectAndConsume() uniformly to eat semicolons after
Douglas Gregor [Wed, 5 Jan 2011 01:10:06 +0000 (01:10 +0000)]
Use Parser::ExpectAndConsume() uniformly to eat semicolons after
Objective-C declarations and statements. Fixes
<rdar://problem/8814576> (wrong source line for diagnostics about
missing ';'), and now we actually consume the ';' at the end of a
@compatibility_alias directive!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122855 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMany of the built-in operator candidates introduced into overload
Douglas Gregor [Wed, 5 Jan 2011 00:13:17 +0000 (00:13 +0000)]
Many of the built-in operator candidates introduced into overload
resolution require that the pointed-to type be an object type, but we
weren't filtering out non-object types. Do so, fixing PR7851.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122853 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEliminate some completely useless code that attempted to perform some
Douglas Gregor [Tue, 4 Jan 2011 23:42:36 +0000 (23:42 +0000)]
Eliminate some completely useless code that attempted to perform some
conversions on the substituted non-type template arguments of a class
template partial specialization. C++ [temp.class.spec]p8 actually
prohibits all of the cases where this code would have fired.

Hey, it's better than having to deal with variadic templates here!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122852 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove our handling of non-type template parameters in partial
Douglas Gregor [Tue, 4 Jan 2011 23:35:54 +0000 (23:35 +0000)]
Improve our handling of non-type template parameters in partial
specializations. We weren't dealing with any of the cases where the
type of the non-type template argument differs from the type of the
corresponding template parameter in the primary template. We would
think that the template parameter in the partial specialization was
not deducible (and warn about it, incorrectly), then fail to convert a
deduced parameter to the type of the template parameter in the partial
specialization (which may involve truncation, among other
things). Fixes PR8905.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122851 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTweak test for portability
Douglas Gregor [Tue, 4 Jan 2011 22:41:29 +0000 (22:41 +0000)]
Tweak test for portability

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122850 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove an unnecessary FIXME for variadic templates
Douglas Gregor [Tue, 4 Jan 2011 22:26:51 +0000 (22:26 +0000)]
Remove an unnecessary FIXME for variadic templates

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122848 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMinor cleanups for template argument deduction in the presence of
Douglas Gregor [Tue, 4 Jan 2011 22:23:38 +0000 (22:23 +0000)]
Minor cleanups for template argument deduction in the presence of
variadic templates. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122847 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix wording for err_invalid_use_of_bound_member_func
Matt Beaumont-Gay [Tue, 4 Jan 2011 22:22:07 +0000 (22:22 +0000)]
Fix wording for err_invalid_use_of_bound_member_func

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122846 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplistic test case for mangling of variadic templates. There is more to be done...
Douglas Gregor [Tue, 4 Jan 2011 22:16:00 +0000 (22:16 +0000)]
Simplistic test case for mangling of variadic templates. There is more to be done in this area

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122845 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove the checking of deduced template arguments stored within template argument...
Douglas Gregor [Tue, 4 Jan 2011 22:13:36 +0000 (22:13 +0000)]
Improve the checking of deduced template arguments stored within template argument packs when finishing template argument deduction for a function template

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122843 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFold -fobjc-nonfragile-abi2 into -fobjc-nonfragile-abi.
Fariborz Jahanian [Tue, 4 Jan 2011 20:05:20 +0000 (20:05 +0000)]
Fold -fobjc-nonfragile-abi2 into -fobjc-nonfragile-abi.
// rdar://8818375

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122831 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoTest commit; added blank line to TODO.txt
Marshall Clow [Tue, 4 Jan 2011 19:19:20 +0000 (19:19 +0000)]
Test commit; added blank line to TODO.txt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122824 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement name mangling for sizeof...(pack), to silence the last of
Douglas Gregor [Tue, 4 Jan 2011 18:56:13 +0000 (18:56 +0000)]
Implement name mangling for sizeof...(pack), to silence the last of
the switch-enum warnings. Test is forthcoming, once I've dealt with
some template argument deduction issues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122820 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThere is nothing interesting to analyze with a sizeof...(pack) expression
Douglas Gregor [Tue, 4 Jan 2011 18:46:34 +0000 (18:46 +0000)]
There is nothing interesting to analyze with a sizeof...(pack) expression

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122818 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement the sizeof...(pack) expression to compute the length of a
Douglas Gregor [Tue, 4 Jan 2011 17:33:58 +0000 (17:33 +0000)]
Implement the sizeof...(pack) expression to compute the length of a
parameter pack.

Note that we're missing proper libclang support for the new
SizeOfPackExpr expression node.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122813 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoPrefer getAs<ComplexType> rather than cast<ComplexType> on canonical type. Suggestion...
Abramo Bagnara [Tue, 4 Jan 2011 09:50:03 +0000 (09:50 +0000)]
Prefer getAs<ComplexType> rather than cast<ComplexType> on canonical type. Suggestion by Douglas Gregor!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122807 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement -Wself-assign, which warns on code such as:
Chandler Carruth [Tue, 4 Jan 2011 06:52:15 +0000 (06:52 +0000)]
Implement -Wself-assign, which warns on code such as:

  int x = 42;
  x = x;  // Warns here.

The warning avoids macro expansions, templates, user-defined assignment
operators, and volatile types, so false positives are expected to be low.

The common (mis-)use of this code pattern is to silence unused variable
warnings, but a more idiomatic way of doing that is '(void)x;'.
A follow-up to this will add a note and fix-it hint suggesting this
replacement in cases where the StmtExpr consists precisely of the self
assignment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122804 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoEnhance the diagnostic for negative array sizes to include the
Chandler Carruth [Tue, 4 Jan 2011 04:44:35 +0000 (04:44 +0000)]
Enhance the diagnostic for negative array sizes to include the
declaration name of the array when present. This ensures that
a poor-man's C++03 static_assert will include the user error message
often embedded in the name.

Update all the tests to reflect the new wording, and add a test for the
name behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122802 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen creating the injected-class-name for a class template involving a
Douglas Gregor [Tue, 4 Jan 2011 02:33:52 +0000 (02:33 +0000)]
When creating the injected-class-name for a class template involving a
non-type template parameter pack, make sure to create a pack expansion
for the corresponding template argument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122799 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement pack expansion of base initializers, so that we can
Douglas Gregor [Tue, 4 Jan 2011 00:32:56 +0000 (00:32 +0000)]
Implement pack expansion of base initializers, so that we can
initialize those lovely mixins that come from pack expansions of base
specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122793 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeComple...
Argyrios Kyrtzidis [Tue, 4 Jan 2011 00:27:27 +0000 (00:27 +0000)]
Rename MaybeSkipFunctionBodyForCodeCompletion -> trySkippingFunctionBodyForCodeCompletion and check isCodeCompletionEnabled() before doing the call.
Suggestions by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122792 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix 80 column violation.
Argyrios Kyrtzidis [Mon, 3 Jan 2011 23:15:14 +0000 (23:15 +0000)]
Fix 80 column violation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122784 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement pack expansions whose pattern is a base-specifier.
Douglas Gregor [Mon, 3 Jan 2011 22:36:02 +0000 (22:36 +0000)]
Implement pack expansions whose pattern is a base-specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122782 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen in code-completion, skip obj-c method bodies for speed up.
Argyrios Kyrtzidis [Mon, 3 Jan 2011 22:33:06 +0000 (22:33 +0000)]
When in code-completion, skip obj-c method bodies for speed up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122781 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd a test that is currently failing
Douglas Gregor [Mon, 3 Jan 2011 21:56:22 +0000 (21:56 +0000)]
Add a test that is currently failing

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122780 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoProperly rebuild pack expansions whose pattern is a non-type template
Douglas Gregor [Mon, 3 Jan 2011 21:37:45 +0000 (21:37 +0000)]
Properly rebuild pack expansions whose pattern is a non-type template
argument. As part of this, be more careful when determining if there
are any parameter packs that cannot be expanded.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122776 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUnwrap template argument packs when checking the template arguments of
Douglas Gregor [Mon, 3 Jan 2011 21:13:47 +0000 (21:13 +0000)]
Unwrap template argument packs when checking the template arguments of
a class template partial specialiation, and look through pack
expansions when checking the conditions of C++0x [temp.class.spec]p8.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122774 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoDiagnose the presence of unexpanded parameter packs within class
Douglas Gregor [Mon, 3 Jan 2011 20:35:03 +0000 (20:35 +0000)]
Diagnose the presence of unexpanded parameter packs within class
template partial specialization arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122769 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove a couple of setters that have no callers.
Argyrios Kyrtzidis [Mon, 3 Jan 2011 19:52:51 +0000 (19:52 +0000)]
Remove a couple of setters that have no callers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122766 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSpeed up code-completion by skipping function bodies.
Argyrios Kyrtzidis [Mon, 3 Jan 2011 19:44:02 +0000 (19:44 +0000)]
Speed up code-completion by skipping function bodies.

When we are in code-completion mode, skip parsing of all function bodies except the one where the
code-completion point resides.

For big .cpp files like 'SemaExpr.cpp' the improvement makes a huge difference, in some cases cutting down
code-completion time -62% !

We don't get diagnostics for the bodies though, so modify the code-completion tests that check for errors.

See rdar://8814203.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122765 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement support for pack expansions in initializer lists and
Douglas Gregor [Mon, 3 Jan 2011 19:31:53 +0000 (19:31 +0000)]
Implement support for pack expansions in initializer lists and
expression lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122764 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix PR8841 by checking for both semantic and lecical dependent
Chandler Carruth [Mon, 3 Jan 2011 19:27:19 +0000 (19:27 +0000)]
Fix PR8841 by checking for  both semantic and lecical dependent
contexts. This prevents -Wunused-function from firing on friend function
definitions inside of class templates for example.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122763 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConsider zero-length array of structs when
Fariborz Jahanian [Mon, 3 Jan 2011 19:23:18 +0000 (19:23 +0000)]
Consider zero-length array of structs when
computing ivar layouts for objc-gc.
Fixes // rdar://8800513

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122762 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRefactor the tree transform's many loops over sets of expressions
Douglas Gregor [Mon, 3 Jan 2011 19:04:46 +0000 (19:04 +0000)]
Refactor the tree transform's many loops over sets of expressions
(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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122761 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoGuard lazy synthesis of provisional ivars under the new
Fariborz Jahanian [Mon, 3 Jan 2011 18:08:02 +0000 (18:08 +0000)]
Guard lazy synthesis of provisional ivars under the new
-fobjc-default-synthesize-properties flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122757 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoIn the latest episode of "Deserializing bugs caused by accessors" the series reached...
Argyrios Kyrtzidis [Mon, 3 Jan 2011 17:57:40 +0000 (17:57 +0000)]
In the latest episode of "Deserializing bugs caused by accessors" the series reached a thrilling climax when
FunctionDecl::setPure crashed a poor user's code.

Remove the use of this accessor when deserializing, along with several other in the neighborhood. Fixes rdar://8759653.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122756 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix PR8654, ensuring each branch of an #if, #elif, #else, ... chain
Chandler Carruth [Mon, 3 Jan 2011 17:40:17 +0000 (17:40 +0000)]
Fix PR8654, ensuring each branch of an #if, #elif, #else, ... chain
receives a PPCallback.

Patch by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122755 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSupport lit fixes for PR8199
David Greene [Mon, 3 Jan 2011 17:28:52 +0000 (17:28 +0000)]
Support lit fixes for PR8199

Replace "clang++" with "clang\+\+" because we have to escape regexp
special characters now.  This is in preparation for changes to lit to
fix PR8199.  Tests will fail until the lit part gets committed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122753 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAnother variadic template metafunction test case: summing values.
Douglas Gregor [Mon, 3 Jan 2011 17:25:02 +0000 (17:25 +0000)]
Another variadic template metafunction test case: summing values.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122752 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImplement support for pack expansions whose pattern is a non-type
Douglas Gregor [Mon, 3 Jan 2011 17:17:50 +0000 (17:17 +0000)]
Implement support for pack expansions whose pattern is a non-type
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122751 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUse some of the llvm cmake infraestructure. This takes care of
Oscar Fuentes [Mon, 3 Jan 2011 17:00:02 +0000 (17:00 +0000)]
Use some of the llvm cmake infraestructure. This takes care of
disabling rtti and exceptions where requested. Remove some unnecessary
code too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122750 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoConsolidate template metafunction tests for variadic templates into a single file
Douglas Gregor [Mon, 3 Jan 2011 16:17:20 +0000 (16:17 +0000)]
Consolidate template metafunction tests for variadic templates into a single file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122748 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSet LLVM_NO_RTTI and LLVM_USED_LIBS for clangStaticAnalyzerCheckers
Oscar Fuentes [Mon, 3 Jan 2011 14:53:25 +0000 (14:53 +0000)]
Set LLVM_NO_RTTI and LLVM_USED_LIBS for clangStaticAnalyzerCheckers

Patch by arrowdodger!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122747 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen we attempt to create a built-in that involves a library type we
Douglas Gregor [Mon, 3 Jan 2011 09:37:44 +0000 (09:37 +0000)]
When we attempt to create a built-in that involves a library type we
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122744 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFunciton -> Function
Peter Collingbourne [Sun, 2 Jan 2011 19:53:19 +0000 (19:53 +0000)]
Funciton -> Function

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122709 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoUnkown -> Unknown
Peter Collingbourne [Sun, 2 Jan 2011 19:53:12 +0000 (19:53 +0000)]
Unkown -> Unknown

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122708 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove obsolete comments.
Francois Pichet [Sun, 2 Jan 2011 09:19:59 +0000 (09:19 +0000)]
Remove obsolete comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122686 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for passing variables declared to use a xmm register to asm
Rafael Espindola [Sun, 2 Jan 2011 03:59:13 +0000 (03:59 +0000)]
Add support for passing variables declared to use a xmm register to asm
statements using the "x" constraint.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122679 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoProduce a better error message for invalid register names.
Rafael Espindola [Sat, 1 Jan 2011 21:47:03 +0000 (21:47 +0000)]
Produce a better error message for invalid register names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122670 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix typo and add comment.
Rafael Espindola [Sat, 1 Jan 2011 21:12:33 +0000 (21:12 +0000)]
Fix typo and add comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122669 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMore empty directory removal.
Benjamin Kramer [Sat, 1 Jan 2011 21:04:42 +0000 (21:04 +0000)]
More empty directory removal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122668 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove empty directories.
Nick Lewycky [Sat, 1 Jan 2011 20:51:16 +0000 (20:51 +0000)]
Remove empty directories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122665 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove stray emacs mode markers in all these files that was causing emacs to
Nick Lewycky [Fri, 31 Dec 2010 17:31:54 +0000 (17:31 +0000)]
Remove stray emacs mode markers in all these files that was causing emacs to
open them in fundamental-mode instead of c++-mode.
Also twiddle whitespace for consistency in ToolChains.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122646 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMSVC doesn't require an accessible copy-constructor when binding a temporary class...
Francois Pichet [Fri, 31 Dec 2010 10:43:42 +0000 (10:43 +0000)]
MSVC doesn't require an accessible copy-constructor when binding a temporary 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122644 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for declaring register contraints in variables. They are only used
Rafael Espindola [Thu, 30 Dec 2010 22:59:32 +0000 (22:59 +0000)]
Add support for declaring register contraints in variables. They are only used
in asm statements:

register int foo asm("rdi");

asm("..." : ... "r" (foo) ...

We also only accept these variables if the constraint in the asm statement is "r".

This fixes most of PR3933.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122643 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCorrect function name in comment.
Nick Lewycky [Thu, 30 Dec 2010 20:21:55 +0000 (20:21 +0000)]
Correct function name in comment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122640 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoExpose Objective-C type encodings of declarations to libclang users. This also adds...
David Chisnall [Thu, 30 Dec 2010 14:05:53 +0000 (14:05 +0000)]
Expose Objective-C type encodings of declarations to libclang users.  This also adds a method in ASTContext which encodes FunctionDecls using the same encoding format that is used for Objective-C methods.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122639 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoSimplify mem{cpy, move, set} creation with IRBuilder.
Benjamin Kramer [Thu, 30 Dec 2010 00:13:21 +0000 (00:13 +0000)]
Simplify mem{cpy, move, set} creation with IRBuilder.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122634 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix PR8796.
Rafael Espindola [Wed, 29 Dec 2010 23:02:58 +0000 (23:02 +0000)]
Fix PR8796.

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122633 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoset features for k8-sse3
Roman Divacky [Wed, 29 Dec 2010 13:28:29 +0000 (13:28 +0000)]
set features for k8-sse3

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122629 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdded scalar casts test.
Abramo Bagnara [Tue, 28 Dec 2010 17:19:27 +0000 (17:19 +0000)]
Added scalar casts test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122599 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoCanonicalize types before possible cast.
Abramo Bagnara [Tue, 28 Dec 2010 09:13:41 +0000 (09:13 +0000)]
Canonicalize types before possible cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122592 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoMore __uuidof validation:
Francois Pichet [Mon, 27 Dec 2010 01:32:00 +0000 (01:32 +0000)]
More __uuidof validation:
1. Do not validate for uuid attribute if the type is template dependent.
2. Search every class declaration and definition for the uuid attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122578 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd support for GNU runtime property set / get structure functions. Minor refactorin...
David Chisnall [Sun, 26 Dec 2010 22:13:16 +0000 (22:13 +0000)]
Add support for GNU runtime property set / get structure functions.  Minor refactoring of Mac runtime (returns the same function for both, as the Mac runtimes currently only provide a single entry point for setting and getting struct properties, although this will presumably be fixed at some point).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122569 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix for PR8695.
David Chisnall [Sun, 26 Dec 2010 20:12:30 +0000 (20:12 +0000)]
Fix for PR8695.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122564 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoThe -fshort-wchar option causes wchar_t to become unsigned, in addition to being
Chris Lattner [Sat, 25 Dec 2010 23:25:43 +0000 (23:25 +0000)]
The -fshort-wchar option causes wchar_t to become unsigned, in addition to being
16-bits in size.  Implement this by splitting WChar into two enums, like we have
for char.  This fixes a miscompmilation of XULRunner, PR8856.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122558 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove all uses of PathV1::GetRootDirectory.
Michael J. Spencer [Sat, 25 Dec 2010 20:09:27 +0000 (20:09 +0000)]
Remove all uses of PathV1::GetRootDirectory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122552 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd basic support for pointer arithmetic in
Ted Kremenek [Fri, 24 Dec 2010 08:39:33 +0000 (08:39 +0000)]
Add basic support for pointer arithmetic in
SimpleSValBuilder.  This clears up some
false positives emitted by ArrayBoundCheckerV2
due to the lack of support for pointer arithmetic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122546 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRemove the EntoSA directories.
Argyrios Kyrtzidis [Fri, 24 Dec 2010 06:19:58 +0000 (06:19 +0000)]
Remove the EntoSA directories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122543 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agodon't use #pragma mark, it isn't portable.
Chris Lattner [Fri, 24 Dec 2010 04:45:23 +0000 (04:45 +0000)]
don't use #pragma mark, it isn't portable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122540 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoifndef _MSC_VER out #pragma mark on MSVC. It still tries to parse the text even
Michael J. Spencer [Fri, 24 Dec 2010 04:07:39 +0000 (04:07 +0000)]
ifndef _MSC_VER out #pragma mark on MSVC. It still tries to parse the text even
though it doesn't know what it is, and complains about invalid tokens ;/.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122538 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoHandle locations coming from macro instantiations properly in SourceManager::isBefore...
Argyrios Kyrtzidis [Fri, 24 Dec 2010 02:53:53 +0000 (02:53 +0000)]
Handle locations coming from macro instantiations properly in SourceManager::isBeforeInTranslationUnit().
Fixes rdar://8790245 and http://llvm.org/PR8821.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122536 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoRefactor how we collect attributes during parsing, and add slots for attributes
John McCall [Fri, 24 Dec 2010 02:08:15 +0000 (02:08 +0000)]
Refactor how we collect attributes during parsing, and add slots for attributes
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122535 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoFix a thinko in a helper routine for template argument deduction that
Douglas Gregor [Fri, 24 Dec 2010 00:35:52 +0000 (00:35 +0000)]
Fix a thinko in a helper routine for template argument deduction that
caused an assertion when dealing with non-type template parameter
packs. Add some tests for deduction and instantiation of non-type
template parameter packs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122534 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoNon-type template parameter packs cannot have default arguments.
Douglas Gregor [Fri, 24 Dec 2010 00:20:52 +0000 (00:20 +0000)]
Non-type template parameter packs cannot have default arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122533 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoWhen instantiating a non-type template parameter pack, be sure to
Douglas Gregor [Fri, 24 Dec 2010 00:15:10 +0000 (00:15 +0000)]
When instantiating a non-type template parameter pack, be sure to
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122532 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoAdd an AST representation for non-type template parameter
Douglas Gregor [Thu, 23 Dec 2010 23:51:58 +0000 (23:51 +0000)]
Add an AST representation for non-type template parameter
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122527 91177308-0d34-0410-b5e6-96231b3b80d8

13 years agoImprove the diagnostic and recovery for missing colons after 'case'
Douglas Gregor [Thu, 23 Dec 2010 22:56:40 +0000 (22:56 +0000)]
Improve the diagnostic and recovery for missing colons after 'case'
and 'default' statements, including a Fix-It to add the colon:

test/Parser/switch-recovery.cpp:13:12: error: expected ':' after 'case'
    case 17 // expected-error{{expected ':' after 'case'}}
           ^
           :
test/Parser/switch-recovery.cpp:16:12: error: expected ':' after 'default'
    default // expected-error{{expected ':' after 'default'}}
           ^
           :

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122522 91177308-0d34-0410-b5e6-96231b3b80d8