Commit Graph

27612 Commits

Author SHA1 Message Date
Alexis Hunt a50dd46ee8 Rename CXXCtorInitializer::BaseOrMember to Initializee, since it will also be
used to store the CXXConstructorDecl in a delegating constructor.

llvm-svn: 123095
2011-01-08 23:01:16 +00:00
Alexis Hunt 1d7926502f Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor
call.

llvm-svn: 123084
2011-01-08 20:30:50 +00:00
Alexis Hunt 4049b8d4cd Check for delegating constructors and (currently) return an error about them.
llvm-svn: 123076
2011-01-08 19:20:43 +00:00
Chandler Carruth b35635e942 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.

llvm-svn: 123056
2011-01-08 06:54:40 +00:00
Ted Kremenek bf4832cda8 Add semantic checking that the "thousands grouping"
prefix in a printf format string is matched
with the appropriate conversion specifier.

llvm-svn: 123055
2011-01-08 05:28:46 +00:00
Ted Kremenek a322cae011 Add printf format string parsing support for '
prefix to format conversions (POSIX extension).

llvm-svn: 123054
2011-01-08 05:28:38 +00:00
Eric Christopher 7d5f2ff6c9 Fix typo.
llvm-svn: 123041
2011-01-07 22:44:49 +00:00
Douglas Gregor b41e2d9298 Variadic templates example: a nearly-complete implementation of a TR1
function class template. 

llvm-svn: 123024
2011-01-07 19:56:20 +00:00
Ted Kremenek ef81e9e243 Fix crash in CFGBuilder on invalid code. We still need
to reject this code, but at least clang doesn't
crash anymore.

Crash reported in PR 8880.

llvm-svn: 123017
2011-01-07 19:37:16 +00:00
Douglas Gregor fe6e33a3c5 Variadic templates example: a nearly-complete implementation of a TR1
tuple class template. This implementation is boosted directly from the
variadic templates proposal. N2080.

Note that one section is #ifdef'd out. I'll implement that aspect of
template argument deduction next.

llvm-svn: 123016
2011-01-07 19:37:08 +00:00
Douglas Gregor 2cd32a0251 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...

llvm-svn: 123014
2011-01-07 19:35:17 +00:00
Douglas Gregor 9f627df2f2 Fix a valgrind error when transforming function prototypes with
function parameter pack expansions.

llvm-svn: 123007
2011-01-07 19:27:47 +00:00
Roman Divacky 7e96295fb5 Use -check-prefix to make it clear the test is SVR4/DARWINPPC specific.
llvm-svn: 123005
2011-01-07 19:01:39 +00:00
Roman Divacky 1b805a0bc9 Drop the _darwin/_svr4 suffixes.
llvm-svn: 123004
2011-01-07 19:00:05 +00:00
Fariborz Jahanian 13f3b2f79b Update AST reader/writer to handle new AppleKext.
Fix an unexpected hickup caused by exceeding size of
generated table (and a misleading comment). Improve
on help message for -fapple-kext.

llvm-svn: 123003
2011-01-07 18:59:25 +00:00
Douglas Gregor f30101186f Implement substitution of a function parameter pack for its set of
instantiated function parameters, enabling instantiation of arbitrary
pack expansions involving function parameter packs. At this point, we
can now correctly compile a simple, variadic print() example:

  #include <iostream>
  #include <string>

  void print() {}

  template<typename Head, typename ...Tail>
  void print(const Head &head, const Tail &...tail) {
    std::cout << head;
    print(tail...);
  }

  int main() {
    std::string hello = "Hello";
    print(hello, ", world!", " ", 2011, '\n');
  }

llvm-svn: 123000
2011-01-07 16:43:16 +00:00
Francois Pichet 044f3d78f4 Prefix all attribute enumerators with attr_ for consistency.
llvm-svn: 122992
2011-01-07 03:17:31 +00:00
Francois Pichet a8fcc8d70b Do not use cdecl, fastcall, stdcall etc.. as identifier name. They are reserved keywords at least on MSVC.
llvm-svn: 122991
2011-01-07 02:58:13 +00:00
John McCall 1c926b78fe Rework a few things about how we emit ObjC's for enumeration statement.
In particular, the iteration variable (if present) should be created and
destroyed in a narrow span around the loop body, and the body should
be emitted in a cleanup scope in case it's not a compound statement.
Otherwise, rename a few variables and use phis instead of temporary
variables for the index and buffer count.

llvm-svn: 122988
2011-01-07 01:49:06 +00:00
Fariborz Jahanian a4cfff87b9 Add all options needed to support -fapple-kext. wip.
llvm-svn: 122987
2011-01-07 01:05:02 +00:00
Douglas Gregor dd47216cc4 Factor out the template transformation of a sequence of function
parameters into parameter types, so that substitution of
explicitly-specified function template arguments uses the same
path. This enables the use of explicitly-specified function template
arguments with variadic templates.

llvm-svn: 122986
2011-01-07 00:20:55 +00:00
Devang Patel c07c98f853 Add target triple.
llvm-svn: 122980
2011-01-06 22:30:05 +00:00
Douglas Gregor 7825bf3a12 Implement template argument deduction from a call to a function
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
2011-01-06 22:09:01 +00:00
Devang Patel 5df8acf809 test case for r122971.
llvm-svn: 122972
2011-01-06 21:40:22 +00:00
Fariborz Jahanian b5b7e9088b Put warning about makeing a string writable into
its own deprecated diagnostics group so it can be
turned off selectively. // rdar://8827606

llvm-svn: 122967
2011-01-06 18:45:19 +00:00
Bob Wilson 44acad8e60 Add cortex-m3 CPU to getCPUDefineSuffix mapping.
Patch by Sylvère Teissier.

llvm-svn: 122965
2011-01-06 16:57:20 +00:00
Abramo Bagnara 88cf54160f Added testcase for commit r122963.
llvm-svn: 122964
2011-01-06 16:56:00 +00:00
Roman Divacky 965b0b72b1 PowerPC fixes.
Fix the width and align of bool type on Darwin to be 32bits
while keeping it 8 everywhere else.

Change the definition of va_list to default to SV4 ABI one
and let darwin subtarget override this.

Both changes submitted by Nathan Whitehorn and reviewed
by Rafael Espindola.

llvm-svn: 122956
2011-01-06 08:27:10 +00:00
Chandler Carruth 080afea262 Tweak the wording of this warning further based on a suggestion from Chris.
llvm-svn: 122951
2011-01-06 06:29:28 +00:00
Chris Lattner 56f64c14b7 fix rdar://8823139, a crash on a comment in a preprocessed .s file
that contains the ## operator.

llvm-svn: 122946
2011-01-06 05:01:51 +00:00
John McCall 8190451ddc Introduce an AttributedType, but don't actually use it anywhere yet.
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
2011-01-06 01:58:22 +00:00
Jakob Stoklund Olesen 4072e59189 Clang should not warn on code in clang that is only there to remove warnings.
llvm-svn: 122941
2011-01-06 01:37:28 +00:00
Douglas Gregor df50b8448c 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.

llvm-svn: 122931
2011-01-06 00:33:28 +00:00
Douglas Gregor 86bea351a9 Fast-path an arity check when performing template argument deduction that compares two parameter-type-lists. No functionality change.
llvm-svn: 122928
2011-01-05 23:23:17 +00:00
Douglas Gregor f6272cd7e9 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.

llvm-svn: 122927
2011-01-05 23:16:57 +00:00
Douglas Gregor 5499af4ef9 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.

llvm-svn: 122926
2011-01-05 23:12:31 +00:00
Douglas Gregor 5ddf182fd3 Fix an embarrassing think in the disambiguation logic for the ellipsis in a parameter-type-list
llvm-svn: 122924
2011-01-05 23:06:07 +00:00
Fariborz Jahanian a61f676cfe Don't warn on missing 'copy' attribute on a 'block'
property when it is 'readonly'. // rdar://8820813

llvm-svn: 122923
2011-01-05 23:00:04 +00:00
Douglas Gregor 9cc2782277 hasInit() -> hasDefaultArg()
llvm-svn: 122905
2011-01-05 21:14:17 +00:00
Douglas Gregor 3c6bd2ad38 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.

llvm-svn: 122904
2011-01-05 21:11:38 +00:00
Douglas Gregor f491ee2ea6 Propagate the "deduced from array bound" bit when comparing deduced
template argument packs. Plus, remove a FIXME that I fixed yesterday.

llvm-svn: 122903
2011-01-05 21:00:53 +00:00
Douglas Gregor 51bc571955 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.

llvm-svn: 122902
2011-01-05 20:52:18 +00:00
Argyrios Kyrtzidis 7a808c0f00 Use the proper enum as parameter, instead of unsigned. No functionality change.
llvm-svn: 122900
2011-01-05 20:09:36 +00:00
Douglas Gregor 79aaca42ac 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.

llvm-svn: 122898
2011-01-05 19:06:29 +00:00
Douglas Gregor e4ff4b56fe 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.

llvm-svn: 122896
2011-01-05 18:58:31 +00:00
Chris Lattner 63c41a2458 fix a -Wself-assign warning
llvm-svn: 122894
2011-01-05 18:41:53 +00:00
Douglas Gregor eb29d18e5d 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.

llvm-svn: 122890
2011-01-05 17:40:24 +00:00
Douglas Gregor e9a8035962 Parse template template argument pack expansions. They're still not
implemented, however.

llvm-svn: 122888
2011-01-05 17:33:50 +00:00
Douglas Gregor 7dba51f8f8 Update C++ [temp.param]p11 citation to reflect the changes in C++0x. No functionality change
llvm-svn: 122878
2011-01-05 16:21:17 +00:00
Douglas Gregor 0018cdc105 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.

llvm-svn: 122877
2011-01-05 16:19:19 +00:00