Граф коммитов

5757 Коммитов

Автор SHA1 Сообщение Дата
NAKAMURA Takumi 6e5658dc89 lib/Sema/SemaExpr.cpp: __null should be LongLongTy on LLP64 Win64.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123791 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-19 00:11:41 +00:00
Ted Kremenek c21fed361c Teach UninitializedValuesV2 to implicitly reason about C++
references by monitoring whether an access to
a variable is solely to compute it's lvalue or
to do an lvalue-to-rvalue conversion (i.e., a load).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123777 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 21:18:58 +00:00
Argyrios Kyrtzidis e188933adf Properly do a float -> _Complex double conversion, fixes rdar://8875946.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123759 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 18:49:33 +00:00
John McCall 62c28c831b Generalize some operations on qualifiers. QualType::getQualifiers() and
::getCVRQualifiers() now look through array types, like all the other
standard queries.  Also, make a 'split' variant of getUnqualifiedType().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123751 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 07:41:22 +00:00
Francois Pichet dbee3411a2 Add support for explicit constructor calls in Microsoft mode.
For example: 

class A{ 
public:
  A& operator=(const A& that) {
      if (this != &that) {
          this->A::~A();
          this->A::A(that);  // <=== explicit constructor call.
      }
      return *this;
  }
};

More work will be needed to support an explicit call to a template constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123735 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 05:04:39 +00:00
Jeffrey Yasskin dec0984fce Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123719 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-18 02:00:16 +00:00
Anders Carlsson 22c412060e Handle base and member destructors in CheckFallThrough.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123667 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 19:06:31 +00:00
Argyrios Kyrtzidis b918d0f5d8 Convert "#pragma unused(...)" into tokens for the parser.
This allows us to cache a "#pragma unused" that occurs inside an inline C++ member function.
Fixes rdar://8829590&8770988.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 18:58:44 +00:00
Anders Carlsson b971dbdb65 Change ParseOptionalCXX0XVirtSpecifierSeq to take a VirtSpecifiers struct.
Enforce C++[class.mem]p8:
A virt-specifier-seq shall contain at most one of each virt-specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123611 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-17 03:05:47 +00:00
Anders Carlsson 0dc5f9aea3 Fix a bug where the -Wmissing-noreturn would always treat constructors with base or member initializers as noreturn.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123603 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 22:12:43 +00:00
Douglas Gregor 2d75bbd36e Emit an extension diagnostic for C99 designated initializers that appear in C++ code
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123582 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 16:13:16 +00:00
Douglas Gregor 9da95e6eef Tweak the partial ordering rules for function templates to prefer a
non-variadic function template over a variadic one. This matches GCC
and the intent of the C++0x wording, in a way that I think is likely
to be acceptable to the committee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-16 16:03:23 +00:00
Douglas Gregor 1aee05d08b Introduce a new kind of TemplateName that captures a substituted
template template parameter pack that cannot be fully expanded because
its enclosing pack expansion could not be expanded. This form of
TemplateName plays the same role as SubstTemplateTypeParmPackType and
SubstNonTypeTemplateParmPackExpr do for template type parameter packs
and non-type template parameter packs, respectively.

We should now handle these multi-level pack expansion substitutions
anywhere. The largest remaining gap in our variadic-templates support
is that we cannot cope with non-type template parameter packs whose
type is a pack expansion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 06:45:20 +00:00
Ted Kremenek 610068c8cd Add initial prototype for implementation of
-Wuninitialized based on CFG dataflow analysis.  WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123512 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 02:58:47 +00:00
Douglas Gregor c7793c73ba Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,
that captures the substitution of a non-type template argument pack
for a non-type template parameter pack within a pack expansion that
cannot be fully expanded. This follows the approach taken by
SubstTemplateTypeParmPackType.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123506 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-15 01:15:58 +00:00
Douglas Gregor 2be29f423a Teach template template argument pack expansions to keep track of the
number of expansions, when we know it, and propagate that information
through Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123493 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 23:41:42 +00:00
Douglas Gregor 6a24bfda08 Handle substitutions into function parameter packs whose patterns
contain multiple parameter packs at different levels.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123488 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:40:04 +00:00
Ted Kremenek 689ebfc4fe The variable 'ReusedDecl' is written but never read.
Remove this variable (found by clang static analyzer).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:31:38 +00:00
Ted Kremenek fe62b06665 The variable 'isTemplateSpecialization' is no longer
used; nuke all assignments and its declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123483 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:31:36 +00:00
Ted Kremenek e6df5f6aa1 Remove unused store to variable 'Name'. Found by clang static analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123482 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 22:31:34 +00:00
Douglas Gregor 67fd1251aa Teach PackExpansionExpr to keep track of the number of pack expansions
it will expand to, if known. Propagate this information throughout Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123470 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 21:20:45 +00:00
Douglas Gregor 07a77b4b1d When we're instantiating a direct variable initializer that has a pack
expansion in it, we may end up instantiating to an empty
expression-list. In this case, the variable is uninitialized; tweak
the instantiation logic to handle this case. Fixes PR8977.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123449 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 17:12:22 +00:00
Douglas Gregor cded4f649c Keep track of the number of expansions to be produced from a type pack
expansion, when it is known due to the substitution of an out
parameter pack. This allows us to properly handle substitution into
pack expansions that involve multiple parameter packs at different
template parameter levels, even when this substitution happens one
level at a time (as with partial specializations of member class
templates and the signatures of member function templates).

Note that the diagnostic we provide when there is an arity mismatch
between an outer parameter pack and an inner parameter pack in this
case isn't as clear as the normal diagnostic for an arity
mismatch. However, this doesn't matter because these cases are very,
very rare and (even then) only typically occur in a SFINAE context.

The other kinds of pack expansions (expression, template, etc.) still
need to support optional tracking of the number of expansions, and we
need the moral equivalent of SubstTemplateTypeParmPackType for
substituted argument packs of template template and non-type template
parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123448 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 17:04:44 +00:00
Douglas Gregor 0bc15d92bf Fix a few warnings stemming from my inability to properly fill out
switch() statements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123429 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 05:11:40 +00:00
Douglas Gregor c3069d618f Start implementing support for substitution into pack expansions that
involve template parameter packs at multiple template levels that
occur within the signatures members of class templates (and partial
specializations thereof). This is a work-in-progress that is deficient
in several ways, notably:
  - It only works for template type parameter packs, but we need to
  also support non-type template parameter packs and template template
  parameter packs.
  - It doesn't keep track of the lengths of the substituted argument
  packs in the expansion, so it can't properly diagnose length
  mismatches.

However, this is a concrete step in the right direction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123425 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-14 02:55:32 +00:00
Douglas Gregor c421f546e6 Only apply the parameter pack matching of C++0x [temp.arg.template]p3
when we're actually matching a template template argument to a
template template parameter. Otherwise, use strict matching.

Fixes <rdar://problem/8859985> clang++: variadics and out-of-line definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123385 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 18:47:47 +00:00
Douglas Gregor 4f1d282d6f Allow us to transform pack expansion expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 00:19:55 +00:00
Douglas Gregor a034782313 Implement C++0x [temp.arg.template]p3, which allows slightly fuzzy
matching of variadic template template parameters to template
arguments. This paragraph was the subject of ISO C++ committee
document N2555: Extending Variadic Template Template Parameters.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123348 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 00:08:50 +00:00
Douglas Gregor ab7ddf0e8a Refactor and simplify Sema::TemplateParameterListsAreEqual. We had a
bunch of duplicated checks for parameter pack/non-pack mismatches.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 23:45:44 +00:00
Douglas Gregor 1d5d0b9df6 Add the location of the right parenthesis of a C++ named cast
(static_cast, dynamic_cast, reinterpret_cast, or const_cast) to
improve source-location information. Fixes PR8960.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123336 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 22:41:29 +00:00
Douglas Gregor 2fc1bb76e7 Teach TreeTransform how to transform a pack expansion type into
another pack expansion type. This can happen when rebuilding types in
the current instantiation.

Fixes <rdar://problem/8848837> (Clang crashing on libc++ <functional>).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123316 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 17:07:58 +00:00
John McCall ae278a3a57 Slight bugfix to the attribute-distribution logic for GC attributes.
Slight optimization of getObjCGCAttrKind.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123295 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 00:34:59 +00:00
Francois Pichet 2432320a99 Add a comment for r123231.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123291 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 23:38:13 +00:00
Douglas Gregor 203e6a322a Add TemplateArgument::CreatePackCopy() to create a new parameter pack
in ASTContext-allocated memory, copying the provided template
arguments. Use this new routine where we can. No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123289 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 23:09:57 +00:00
Douglas Gregor 77d6bb9e22 Implement partial ordering of class template partial specializations
and function templates that contain variadic templates. This involves
three small-ish changes:

  (1) When transforming a pack expansion, if the transformed argument
  still contains unexpanded parameter packs, build a pack
  expansion. This can happen during the substitution that occurs into
  class template partial specialiation template arguments during
  partial ordering. 
 
  (2) When performing template argument deduction where the argument
  is a pack expansion, match against the pattern of that pack
  expansion.

  (3) When performing template argument deduction against a non-pack
  parameter, or a non-expansion template argument, deduction fails if
  the argument itself is a pack expansion (C++0x
  [temp.deduct.type]p22).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123279 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 22:21:24 +00:00
Douglas Gregor 5c7bf42ef1 Implement C++ [temp.func.order]p5 more directly, by passing down the
number of explicit call arguments. This actually fixes an erroneous
test for [temp.deduct.partial]p11, where we were considering
parameters corresponding to arguments beyond those that were
explicitly provided.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123244 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 17:34:58 +00:00
Abramo Bagnara 2b57aefea7 Added warning about invalid register specification for local variables.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123236 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 15:16:52 +00:00
Francois Pichet a15a5eede9 In Microsoft mode, force 64 bit hex integer constants to signed type if the LL or i64 suffix is used. This MSVC behavior.
For example:

void f(long long){ printf("long long"); }
void f(unsigned long long) { printf("unsigned long long"); }
int main() {
   f(0xffffffffffffffffLL);
}
Will print "long long" using MSVC.

This patch also fixes 16 compile errors related to overloading issues when parsing the MSVC 2008 C++ standard lib.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123231 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 12:23:00 +00:00
Douglas Gregor 483dd2f55e Ensure that the result type of an Objective-C class message send is
complete. However, if it returns a reference type, don't require the
type it refers to to be complete. Fixes <rdar://problem/8807070>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123214 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 03:23:19 +00:00
Douglas Gregor 21371ea7cf When mapping from a function parameter pack to the set of function
parameters it expanded to, map exactly the number of function
parameters that were expanded rather than just running to the end of
the instantiated parameter list. This finishes the implementation of
the last sentence of C++0x [temp.deduct.call]p1.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123213 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 03:14:20 +00:00
Douglas Gregor 7d5c0c1273 Implement the last bullet of [temp.deduct.type]p5 and part of the last
sentence of [temp.deduct.call]p1, both of which concern the
non-deducibility of parameter packs not at the end of a
parameter-type-list. The latter isn't fully implemented yet; see the
new FIXME.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123210 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 01:52:23 +00:00
Douglas Gregor 3cae5c9a79 Implement more of C++0x [temp.arg.explicit]p9, allowing extension of
pack expansions in template argument lists and function parameter
lists. The implementation of this paragraph should be complete
*except* for cases where we're substituting into one of the unexpanded
packs in a pack expansion; that's a general issue I haven't solved yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123188 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 20:53:55 +00:00
Douglas Gregor 0216f8121d Repent for my copy-and-paste sins, factoring out the code that forms
argument packs from a set of deduced arguments, then checks that those
argument packs match previously-deduced argument packs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123182 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 17:53:52 +00:00
Douglas Gregor 5429385919 Factor out the code to set up template argument deduction for a set of
template argument packs. This also ensures that explicitly-specified
template arguments get properly represented in those cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123180 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 17:35:05 +00:00
Douglas Gregor d373119819 Work-in-progress implementation of C++0x [temp.arg.explicit]p9, which
allows an argument pack determines via explicit specification of
function template arguments to be extended by further, deduced
arguments. For example:

template<class ... Types> void f(Types ... values);
void g() { 
  f<int*, float*>(0, 0, 0);   // Types is deduced to the sequence int*, float*, int
}

There are a number of FIXMEs in here that indicate places where we
need to implement + test retained expansions, plus a number of other
places in deduction where we need to correctly cope with the
explicitly-specified arguments when deducing an argument
pack. Furthermore, it appears that the RecursiveASTVisitor needs to be
auditied; it's missing some traversals (especially w.r.t. template
arguments) that cause it not to find unexpanded parameter packs when
it should.

The good news, however, is that the tr1::tuple implementation now
works fully, and the tr1::bind example (both from N2080) is actually
working now. 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123163 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-10 07:32:04 +00:00
Sean Hunt cbb6748009 Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor
call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123084 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 20:30:50 +00:00
Sean Hunt 97fcc4977b Check for delegating constructors and (currently) return an error about them.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123076 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 19:20:43 +00:00
Chandler Carruth eeef924c4f Remove a kludge from analysis based warnings that used to detect
temporaries with no-return destructors. The CFG now properly supports
temporaries and implicit destructors which both makes this kludge no
longer work, and conveniently removes the need for it.

Turn on CFG handling of implicit destructors and initializers. Several
ad-hoc benchmarks don't indicate any measurable performance impact from
growing the CFG, and it fixes real correctness problems with warnings.

As a result of turning on these CFG elements, we started to tickle an
inf-loop in the unreachable code logic used for warnings. The fix is
trivial.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123056 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 06:54:40 +00:00
Ted Kremenek 65197b4b0c Add semantic checking that the "thousands grouping"
prefix in a printf format string is matched
with the appropriate conversion specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123055 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 05:28:46 +00:00
Douglas Gregor 91fc73e7ff When instantiating the arguments to an initializer, use the
TreeTransform version of TransformExprs() rather than explicit loop,
so that we expand pack expansions properly. Test cast coming soon...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123014 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 19:35:17 +00:00