• Home
  • History
  • Annotate
  • only in /external/clang/test/SemaCXX/
History log of /external/clang/test/SemaCXX/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
icrosoftExtensions.cpp
R19955.cpp
R20110.cpp
_try.cpp
lignof.cpp
nonymous-union-cxx11.cpp
onstant-expression-cxx11.cpp
onstructor.cpp
xx0x-compat.cpp
xx0x-initializer-constructor.cpp
xx0x-initializer-stdinitializerlist-system-header.cpp
xx0x-initializer-stdinitializerlist.cpp
xx1y-generic-lambdas-capturing.cpp
xx1y-generic-lambdas-variadics.cpp
cl_init_aggr.cpp
estructor.cpp
llexport.cpp
llimport.cpp
or-range-examples.cpp
icrosoft-dtor-lookup.cpp
s_integer_suffix.cpp
ew-delete-cxx0x.cpp
ew-delete.cpp
s_returns_retained_block_return.cpp
tatic-assert.cpp
witch-implicit-fallthrough-blocks.cpp
witch-implicit-fallthrough.cpp
emplate-implicit-vars.cpp
ype-definition-in-specifier.cpp
ypo-correction-pt2.cpp
ypo-correction.cpp
ndefined-internal.cpp
nderlying_type.cpp
ninit-variables.cpp
arn-bad-memaccess.cpp
arn-self-assign.cpp
arn-tautological-undefined-compare.cpp
arn-undefined-bool-conversion.cpp
indows-arm-valist.cpp
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
icrosoftExtensions.cpp
ddr-of-overloaded-function-casting.cpp
st-print.cpp
ttr-flatten.cpp
ttr-no-sanitize-address.cpp
ttr-no-sanitize-memory.cpp
ttr-no-sanitize-thread.cpp
ttr-no-split-stack.cpp
ool-compare.cpp
onversion-function.cpp
xx0x-initializer-constructor.cpp
xx0x-initializer-scalars.cpp
xx11-inheriting-ctors.cpp
xx11-unused.cpp
xx1y-deduced-return-type.cpp
xx1y-variable-templates_top_level.cpp
xx98-compat.cpp
ecl-expr-ambiguity.cpp
ecl-microsoft-call-conv.cpp
eclspec-thread.cpp
ecltype.cpp
estructor.cpp
llexport.cpp
llimport.cpp
laborated-type-specifier.cpp
rr_init_conversion_failed.cpp
xpressions.cpp
riend.cpp
uncdname.cpp
icrosoft-cxx0x.cpp
icrosoft-new-delete.cpp
ested-name-spec.cpp
verload-call.cpp
verloaded-operator.cpp
ragma-optimize.cpp
cope-check.cpp
emplate-implicit-vars.cpp
ype-traits.cpp
ypo-correction-pt2.cpp
ndefined-inline.cpp
sing-decl-1.cpp
ector-casts.cpp
ector.cpp
arn-absolute-value-header.cpp
arn-absolute-value.cpp
arn-absolute-value2.cpp
arn-consumed-analysis.cpp
arn-float-conversion.cpp
arn-thread-safety-parsing.cpp
arn-unreachable.cpp
arn-unused-comparison.cpp
arn-unused-filescoped.cpp
arn-unused-variables.cpp
ritable-strings-deprecated.cpp
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
icrosoftCompatibility.cpp
icrosoftExtensions.cpp
R8012.cpp
bstract.cpp
ccess.cpp
ddr-of-overloaded-function.cpp
ggregate-initialization.cpp
lias-template.cpp
nonymous-struct.cpp
st-print.cpp
ttr-common.cpp
ttr-cxx0x.cpp
ttr-deprecated.cpp
ttr-optnone.cpp
ttr-selectany.cpp
ttr-unavailable.cpp
ttr-used.cpp
ttr-weak.cpp
ttr-weakref.cpp
99-variable-length-array.cpp
alling-conv-compat.cpp
ompare.cpp
onditional-expr.cpp
onst-cast.cpp
onstant-expression-cxx11.cpp
onstant-expression.cpp
onstexpr-value-init.cpp
onstructor-initializer.cpp
onversion-function.cpp
rashes.cpp
style-cast.cpp
xx-altivec.cpp
xx0x-cursory-default-delete.cpp
xx0x-delegating-ctors.cpp
xx0x-deleted-default-ctor.cpp
xx0x-type-convert-construct.cpp
xx11-attr-print.cpp
xx11-gnu-attrs.cpp
xx11-user-defined-literals.cpp
xx1y-generic-lambdas.cpp
xx1y-init-captures.cpp
xx1y-variable-templates_in_class.cpp
xx1y-variable-templates_top_level.cpp
xx98-compat.cpp
ecl-microsoft-call-conv.cpp
ecltype.cpp
eleted-function.cpp
eleted-operator.cpp
eprecated.cpp
estructor.cpp
llexport.cpp
llimport.cpp
nable_if.cpp
num-scoped.cpp
xplicit.cpp
xpression-traits.cpp
xpressions.cpp
lexible-array-test.cpp
or-range-dereference.cpp
unctional-cast.cpp
oto.cpp
mplicit-member-functions.cpp
mplicit-virtual-member-functions.cpp
nit-priority-attr.cpp
ambda-expressions.cpp
inkage.cpp
inkage2.cpp
ember-expr.cpp
ember-init.cpp
ember-pointer-ms.cpp
ember-pointer.cpp
icrosoft-dtor-lookup-cxx11.cpp
icrosoft-dtor-lookup.cpp
issing-members.cpp
s-interface.cpp
s_struct.cpp
ested-name-spec.cpp
ew-delete.cpp
ew-null.cpp
onnull.cpp
ull_in_arithmetic_ops.cpp
ullptr_in_arithmetic_ops.cpp
ld-style-cast.cpp
perator-arrow-depth.cpp
verload-0x.cpp
verloaded-operator.cpp
r13394-crash-on-invalid.cpp
r18284-crash-on-invalid.cpp
r9812.c
r9812.cpp
ragma-vtordisp.cpp
ragma-weak.cpp
rimary-base.cpp
ualified-id-lookup.cpp
eferences.cpp
einterpret-cast.cpp
eturn-noreturn.cpp
eturn-stack-addr.cpp
eturn.cpp
val-references-examples.cpp
cope-check.cpp
ourceranges.cpp
tatic-cast.cpp
witch-implicit-fallthrough.cpp
railing-return-0x.cpp
ype-definition-in-specifier.cpp
ype-traits.cpp
ypeid-ref.cpp
ypes_compatible_p.cpp
ypo-correction-pt2.cpp
ypo-correction.cpp
ndefined-internal.cpp
ninitialized.cpp
nreachable-code.cpp
ararg-class.cpp
ector-casts.cpp
irtual-base-used.cpp
irtual-override-x86.cpp
irtual-override.cpp
la.cpp
tordisp-mode.cpp
arn-absolute-value-header.cpp
arn-absolute-value2.cpp
arn-address.cpp
arn-bool-conversion.cpp
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
arn-exit-time-destructors.cpp
arn-func-as-bool.cpp
arn-global-constructors.cpp
arn-infinite-recursion.cpp
arn-memsize-comparison.cpp
arn-new-overaligned.cpp
arn-reinterpret-base-class.cpp
arn-shadow.cpp
arn-sign-conversion.cpp
arn-string-conversion.cpp
arn-sysheader-macro.cpp
arn-tautological-compare.cpp
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
arn-unreachable.cpp
arn-unused-attribute.cpp
arn-unused-comparison.cpp
arn-unused-label-error.cpp
arn-unused-value.cpp
arn-unused-variables.cpp
arn-weak-vtables.cpp
9a5d6bb0c26215adddc5ce00f21d863160cbd0b7 17-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r197409:
------------------------------------------------------------------------
r197409 | rikka | 2013-12-16 11:19:18 -0800 (Mon, 16 Dec 2013) | 4 lines

Make Sema::BuildCXXNestedNameSpecifier correctly clear the previous
CXXScopeSpec when necessary while performing typo correction. This fixes
the crash reported in PR18213 (the problem existed since r185487, and
r193020 made it easier to hit).
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@197463 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
2434dcfb022778b06cfd257d830d0249680b87cf 05-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r196454:
------------------------------------------------------------------------
r196454 | faisalv | 2013-12-04 17:40:41 -0800 (Wed, 04 Dec 2013) | 43 lines

Fix init-captures for generic lambdas.

For an init capture, process the initialization expression
right away. For lambda init-captures such as the following:
const int x = 10;
auto L = [i = x+1](int a) {
return [j = x+2,
&k = x](char b) { };
};
keep in mind that each lambda init-capture has to have:
- its initialization expression executed in the context
of the enclosing/parent decl-context.
- but the variable itself has to be 'injected' into the
decl-context of its lambda's call-operator (which has
not yet been created).
Each init-expression is a full-expression that has to get
Sema-analyzed (for capturing etc.) before its lambda's
call-operator's decl-context, scope & scopeinfo are pushed on their
respective stacks. Thus if any variable is odr-used in the init-capture
it will correctly get captured in the enclosing lambda, if one exists.
The init-variables above are created later once the lambdascope and
call-operators decl-context is pushed onto its respective stack.

Since the lambda init-capture's initializer expression occurs in the
context of the enclosing function or lambda, therefore we can not wait
till a lambda scope has been pushed on before deciding whether the
variable needs to be captured. We also need to process all
lvalue-to-rvalue conversions and discarded-value conversions,
so that we can avoid capturing certain constant variables.
For e.g.,
void test() {
const int x = 10;
auto L = [&z = x](char a) { <-- don't capture by the current lambda
return [y = x](int i) { <-- don't capture by enclosing lambda
return y;
}
};
If x was not const, the second use would require 'L' to capture, and
that would be an error.
Make sure TranformLambdaExpr is also aware of this.

Patch approved by Richard (Thanks!!)
http://llvm-reviews.chandlerc.com/D2092
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@196470 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-init-captures.cpp
b7accd0f5690bdeb4bfa23380f33b0c38bfb4e52 05-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r196423:
------------------------------------------------------------------------
r196423 | faisalv | 2013-12-04 14:43:08 -0800 (Wed, 04 Dec 2013) | 17 lines

Fix for PR18052 - Lambdas within NSDMI's and default arguments in Nested classes.

Clang currently croaks on the following:
struct X1 {
struct X2 {
int L = ([] (int i) { return i; })(2);
};
};

asserting that the containing lexical context of the lambda is not Sema's cur context, when pushing the lambda's decl context on.

This occurs because (prior to this patch) getContainingDC always returns the non-nested class for functions at class scope (even for inline member functions of nested classes (to account for delayed parsing of their bodies)). The patch addresses this by having getContainingDC always return the lexical DC for a lambda's call operator.

Link to the bug: http://llvm.org/bugs/show_bug.cgi?id=18052
Link to Richard Smith's feedback on phabricator: http://llvm-reviews.chandlerc.com/D2331

Thanks!
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@196469 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
37c07bfb94e08f95da299596820da4ac98184288 02-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r196050:
------------------------------------------------------------------------
r196050 | rafael | 2013-12-01 08:54:29 -0800 (Sun, 01 Dec 2013) | 5 lines

Handle CC and NoReturn when instantiating members of class templates.

Before we were considering them only when instantiating templates.

This fixes pr18033.
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@196057 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-microsoft-call-conv.cpp
4444446abb50f7b0314d82be0afa892f945cc9bc 01-Dec-2013 Bill Wendling <isanbard@gmail.com> Merging r195777:
------------------------------------------------------------------------
r195777 | delesley | 2013-11-26 11:45:21 -0800 (Tue, 26 Nov 2013) | 1 line

Thread safety analysis: fix ICE due to missing null check on dyn_cast.
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@196007 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
13303b992574409370abff941d90ee4bfa5b97e5 26-Nov-2013 Bill Wendling <isanbard@gmail.com> Merging r195687:
------------------------------------------------------------------------
r195687 | rsmith | 2013-11-25 13:30:29 -0800 (Mon, 25 Nov 2013) | 3 lines

PR18044: Reject declarations of enumtype::X early to avoid an assertion in
downstream code.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195720 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
2ca3db4876207a0f2d9ed683b0d3b6f3193f39bc 22-Nov-2013 Bill Wendling <isanbard@gmail.com> Merging r195384:
------------------------------------------------------------------------
r195384 | rsmith | 2013-11-21 15:30:57 -0800 (Thu, 21 Nov 2013) | 2 lines

PR18013: Don't assert diagnosing a bad std::initializer_list construction.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195394 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
579d45ff5f92c4f5e31213e31490acdc5bcc5567 20-Nov-2013 Bill Wendling <isanbard@gmail.com> Merging r195154:
------------------------------------------------------------------------
r195154 | rafael | 2013-11-19 13:07:04 -0800 (Tue, 19 Nov 2013) | 15 lines

Further fixes when thiscall is the default for methods.

The previous patches tried to deduce the correct function type. I now realize
this is not possible in general. Consider

class foo {
template <typename T> static void bar(T v);
};
extern template void foo::bar(const void *);

We will only know that bar is static after a lookup, so we have to handle this
in the template instantiation code.

This patch reverts my previous two changes (but not the tests) and instead
handles the issue in DeduceTemplateArguments.
------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195226 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-microsoft-call-conv.cpp
f4966557bedd375dbf0909c8d94e092ddf0dc8de 18-Nov-2013 Rafael Espindola <rafael.espindola@gmail.com> The attached patch is a follow up from my previous one. The existing
logic was not handling typedefs as free functions. This was not
causing problems with the existing tests, but does with the microsoft
abi where they have to get a different calling convention.

I will try to refactor this into a method on Declarator in a second.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195050 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-microsoft-call-conv.cpp
cdf7cfc16b340a39e52be769d533049a88dca770 18-Nov-2013 Rafael Espindola <rafael.espindola@gmail.com> Use the default method CC in GetFullTypeForDeclarator.

Before this patch explicit template instatiations of member function templates
were failing with the microsoft abi and 32 bits. This was happening because
the expected and computed function types had different calling conventions.

This patch fixes it by considering the default calling convention in
GetFullTypeForDeclarator.

This fixes pr17973.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195032 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-microsoft-call-conv.cpp
cf19e5bad3efe2c7efa886e984988ea21825c45d 16-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> If a replaceable global operator new/delete is marked inline, don't warn if
it's also __attribute__((used)), since that undoes the problematic part of
'inline'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194916 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
5f900e8f3f6f1aff13f4bfe6991864ccd0659537 16-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Downgrade the Error on an 'inline' operator new or delete to an ExtWarn. Some
projects are relying on such (questionable) practices, so we should give them
a way to opt out of this diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194905 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
4c3e0bc7850df76824138ecfcc434388e7f69559 16-Nov-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: track state of temporary objects.
Earlier versions discarded the state too soon, and did not track state changes,
e.g. when passing a temporary to a move constructor. Patch by
chris.wailes@gmail.com; review and minor fixes by delesley.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194900 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
93982a7557fae3c72d84a3fc4c8d2b9852ccc5db 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR8455: Handle an attribute between a goto label and a variable declaration per
the GNU documentation: the attribute only appertains to the label if it is
followed by a semicolon. Based on a patch by Aaron Ballman!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194869 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
6c6fd7e9596e7c870e322f4030bdd16235348378 15-Nov-2013 Alp Toker <alp@nuanti.com> Ignore test Inputs globally and remove redundant lit.local.cfg files

By adding a default config.excludes pattern we can avoid individual
suppressions in subdirectories.

This matches LLVM's lit.cfg which also excludes a few other common non-test
filenames for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194814 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/lit.local.cfg
f93ec7608aa79f9aac09304bfd3bc1918caf128f 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17533 and duplicates: don't compute the return type of an overloaded operator
until after we've referenced the operator; otherwise, we might pick up a
not-yet-deduced type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194775 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
f72bc468e54819393c1805f19cbf353061b4c0ec 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't reject dependent range-based for loops in constexpr functions. The loop
variable isn't really uninitialized, it's just not initialized yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194767 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
e21432efa94079aa1a62f7d5ff3b47a92d3c8296 15-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Modern gcc is happy to constant evaluate __builtin_strlen in various cases
where we didn't. Extend our constant evaluation for __builtin_strlen to handle
any constant array of chars, not just string literals, to match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194762 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
e05372a773e3c8c9a606af9ee6bc9ee4fc103804 14-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wdeprecated-writable-string in C++ to -Wc++11-compat, since it's ill-formed in C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194736 91177308-0d34-0410-b5e6-96231b3b80d8
ritable-strings-deprecated.cpp
142ab06ffb2ec286917554aa5d945323a1ebf359 14-Nov-2013 Serge Pavlov <sepavloff@gmail.com> Added warning on structures/unions that are empty or contain only
bit fields of zero size. Warnings are generated in C++ mode and if
only such type is defined inside extern "C" block.
The patch fixed PR5065.

Differential Revision: http://llvm-reviews.chandlerc.com/D2151


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194653 91177308-0d34-0410-b5e6-96231b3b80d8
xtern-c.cpp
torage-class.cpp
f2941ec5bfcce36feffac514582d168b4e0ef811 13-Nov-2013 Reid Kleckner <reid@kleckner.net> Only provide MS builtins when -fms-extensions is on

We already have builtins that are only available in GNU mode, so this
mirrors that.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D2128

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194615 91177308-0d34-0410-b5e6-96231b3b80d8
uiltins.cpp
d1fa81ccbce1ba2d8f467e7c2800250b81ea2e35 13-Nov-2013 Serge Pavlov <sepavloff@gmail.com> Warn on duplicate function specifier

This patch fixes PR8264. Duplicate qualifiers already are diagnozed,
now the same diagnostics is issued for duplicate function specifiers.

Differential Revision: http://llvm-reviews.chandlerc.com/D2025


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194559 91177308-0d34-0410-b5e6-96231b3b80d8
xplicit.cpp
irtuals.cpp
394558e6a1329b791de69d0fc7c618eac0dbc982 12-Nov-2013 Faisal Vali <faisalv@yahoo.com> A quick fix to PR17877 that was introduced by r194188 (generic-lambda-capturing) that broke libc++.

See http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-November/033369.html for discussion on cfe-dev.

This fix explicitly checks whether we are within the declcontext of a lambda's call operator - which is what I had intended to be true (and assumed would be true if getCurLambda returns a valid pointer) before checking whether a lambda can capture the potential-captures of the innermost lambda.

A deeper fix (that addresses why getCurLambda() returns a valid pointer when perhaps it shouldn't?) - as proposed by Richard Smith in http://llvm.org/bugs/show_bug.cgi?id=17877 - has been suggested as a FIXME.

Patch was LGTM'd by Richard (just barely :)

http://llvm-reviews.chandlerc.com/D2144

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194448 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
e0ac9bfbf588e269fefc8758e715ee5804affb18 12-Nov-2013 Reid Kleckner <reid@kleckner.net> -fms-compatibility: Use C++98 null pointer constant rules

Patch by Will Wilson!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194441 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
f9495911c46a5f90d8cf14774c11ff521d505c7e 08-Nov-2013 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: check guarded_by and pt_guarded_by on array access.
Currently supported only with -Wthread-safety-beta.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194275 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
baa9af171fd7ac6ff6a1b5ca09bf77168c1728e7 07-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17800: When performing pack expansion, we must always rebuild the AST nodes
to avoid breaking AST invariants by reusing Stmt nodes within the same
function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194217 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9aebdc94d819e8a537030efc70567d585382ecf9 07-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17615: A delegating constructor initializer is a full-expression. Don't
forget to clean up temporaries at the end of it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194213 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
ec00b0f5673e36f754f83dc81f8fa9852cb0ef76 07-Nov-2013 Chris Wailes <chris.wailes@gmail.com> Added a test case for the fix to bug 17632 in r193751

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194212 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
c00e4194296e994efab0e4bf64ca66737850bdf0 07-Nov-2013 Faisal Vali <faisalv@yahoo.com> This patch implements capturing of variables within generic lambdas.

Both Richard and I felt that the current wording in the working paper needed some tweaking - Please see http://llvm-reviews.chandlerc.com/D2035 for additional context and references to core-reflector messages that discuss wording tweaks.

What is implemented is what we had intended to specify in Bristol; but, recently felt that the specification might benefit from some tweaking and fleshing.

As a rough attempt to explain the semantics: If a nested lambda with a default-capture names a variable within its body, and if the enclosing full expression that contains the name of that variable is instantiation-dependent - then an enclosing lambda that is capture-ready (i.e. within a non-dependent context) must capture that variable, if all intervening nested lambdas can potentially capture that variable if they need to, and all intervening parent lambdas of the capture-ready lambda can and do capture the variable.

Of note, 'this' capturing is also currently underspecified in the working paper for generic lambdas. What is implemented here is if the set of candidate functions in a nested generic lambda includes both static and non-static member functions (regardless of viability checking - i.e. num and type of parameters/arguments) - and if all intervening nested-inner lambdas between the capture-ready lambda and the function-call containing nested lambda can capture 'this' and if all enclosing lambdas of the capture-ready lambda can capture 'this', then 'this' is speculatively captured by that capture-ready lambda.

Hopefully a paper for the C++ committee (that Richard and I had started some preliminary work on) is forthcoming.

This essentially makes generic lambdas feature complete, except for known bugs. The more prominent ones (and the ones I am currently aware of) being:
- generic lambdas and init-captures are broken - but a patch that fixes this is already in the works ...
- nested variadic expansions such as:
auto K = [](auto ... OuterArgs) {
vp([=](auto ... Is) {
decltype(OuterArgs) OA = OuterArgs;
return 0;
}(5)...);
return 0;
};
auto M = K('a', ' ', 1, " -- ", 3.14);
currently cause crashes. I think I know how to fix this (since I had done so in my initial implementation) - but it will probably take some work and back & forth with Doug and Richard.

A warm thanks to all who provided feedback - and especially to Doug Gregor and Richard Smith for their pivotal guidance: their insight and prestidigitation in such matters is boundless!

Now let's hope this commit doesn't upset the buildbot gods ;)

Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194188 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas-capturing.cpp
xx1y-generic-lambdas.cpp
298028994ea4dae826422c15139682b82197a35e 06-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix diagnostic goof in r194161.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194162 91177308-0d34-0410-b5e6-96231b3b80d8
perator-arrow-depth.cpp
195dd7c8448893e13a0cd8e776520f14cba65b08 06-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a limit to the length of a sequence of 'operator->' functions we will
follow when building a class member access expression. Based on a patch by
Rahul Jain!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194161 91177308-0d34-0410-b5e6-96231b3b80d8
perator-arrow-depth.cpp
9a2f84b2f03e79fb21f9db9e029045fba09dedef 06-Nov-2013 DeLesley Hutchins <delesley@google.com> Thread safety analysis: minor bugfix to smart pointer handling, and expanded
test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194157 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
9a9ca98d6463530384aa12685034899c4cc8733d 06-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> More constant evaluation cleanup, and fix an issue where we'd override an
earlier 'non-constant' diagnostic with a later one if the earlier one was from
a side-effect we thought we could evaluate past.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194117 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
43399fb0e79687043b7904195e95a23e44bd6ca1 06-Nov-2013 DeLesley Hutchins <delesley@google.com> Thread safety analysis: check pt_guarded_by attribute when calling -> and *
on smart pointers. -Wthread-safety-beta only.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194103 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
f490f0eaba5fed6236d8f8a965a2fd98fa41e891 05-Nov-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor constant expression handling and make a couple of tweaks to make it a
bit more robust against future changes. This includes a slight diagnostic
improvement: if we know we're only trying to form a constant expression, take
the first diagnostic which shows the expression is not a constant expression,
rather than preferring the first one which makes the expression unfoldable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194098 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9ce5135c15b3dfd5ee666b843f5df8ffb3a5038f 05-Nov-2013 Kaelyn Uhrain <rikka@google.com> Revert "Try to correct a mistyped "-" or ">" to "->" for some C++ cases."

Revert this patch until cases of rejected valid code (e.g. identifiers
that require ADL to be resolved properly) are fixed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194088 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
b3e277222ac7e2148fc8ce2d5cf596231e1ee926 04-Nov-2013 Kaelyn Uhrain <rikka@google.com> Try to correct a mistyped "-" or ">" to "->" for some C++ cases.

Similar C code isn't caught as it seems to hit a different code path.
Also, as the check is only done for record pointers, cases involving
an overloaded operator-> are not handled either. Note that the reason
this check is done in the parser instead of Sema is not related to
having enough knowledge about the current state as it is about being
able to fix up the parser's state to be able to recover and traverse the
correct code paths.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194002 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
62e9370d9da9ee4f675da52d559a79c93c30642e 04-Nov-2013 David Majnemer <david.majnemer@gmail.com> Sema: Do not allow overloading between methods based on restrict

If the sole distinction between two declarations is that one has a
__restrict qualifier then we should not consider it to be an overload.

Instead, we will consider it as an incompatible redeclaration which is
similar to how MSVC, ICC and GCC would handle it.

This fixes PR17786.

N.B. We must not mangle in __restrict into method qualifiers becase we
don't allow overloading between such declarations anymore. To do
otherwise would be a violation of the Itanium ABI.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193964 91177308-0d34-0410-b5e6-96231b3b80d8
verload-decl.cpp
4ce94dc407de0d757d08ab641706cd9e501012ff 02-Nov-2013 David Majnemer <david.majnemer@gmail.com> Add test case for r193923


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193924 91177308-0d34-0410-b5e6-96231b3b80d8
nherit.cpp
3a665576c16c353d8f524189d695e3c9140eefb8 02-Nov-2013 David Majnemer <david.majnemer@gmail.com> Sema: Disallow derived classes with virtual bases from having flexible array members

Flexible array members only work out if they are the last field of a
record, however virtual bases would give us many situations where the
flexible array member would overlap with the virtual base fields.

It is unlikely in the extreme that this behavior was intended by the
user so raise a diagnostic instead of accepting. This is will not
reject conforming code because flexible array members are an extension
in C++ mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193920 91177308-0d34-0410-b5e6-96231b3b80d8
lexible-array-test.cpp
633c0c2fbc1d9272b3f25220ffb8fe4b04ece3db 02-Nov-2013 David Majnemer <david.majnemer@gmail.com> Sema: Cleanup and simplify anonymous union diagnostics

The determination of which diagnostics would be issued for certain
anonymous unions started to get a little ridiculous. Clean this up by
inverting the condition-tree's logic from dialect -> issue to
issue -> diagnostic.

As part of this cleanup, move ext_c99_flexible_array_member from
DiagnosticParseKinds.td to DiagnosticSemaKinds.td because it's driven by
Sema, not Parse.

Also, the liberty was taken to edit ext_c99_flexible_array_member to
match other, similar, diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193919 91177308-0d34-0410-b5e6-96231b3b80d8
99.cpp
6f6dc158ee2fbe5b9b8685dad45be02cba0873f5 02-Nov-2013 David Majnemer <david.majnemer@gmail.com> Sema: Flexible array members were introduced in C99, diagnose their use in C++

The declaration of a flexible array member was correctly diagnosed as an
extension in C89 mode but not in C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193918 91177308-0d34-0410-b5e6-96231b3b80d8
99.cpp
5423746bbd6128027ad16de77718d507cedc97a9 02-Nov-2013 Richard Trieu <rtrieu@google.com> Change the other -Wtautological-compare warnings to not trigger in template
specializations. Also switch to -Wuninitialized for a test case that depended
on a warning firing in template specializations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193906 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
491b714e104cdd8e380aa0a03be9b217737efa89 01-Nov-2013 Richard Trieu <rtrieu@google.com> Add non-type template parameter test for disabled -Wtautological-compare
warning in template specializations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193890 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
cbc198785c8ec64c1f869e65132cd4336f5c750a 01-Nov-2013 Richard Trieu <rtrieu@google.com> Disable -Wtautological-compare in template instantiations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193888 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
311cb2b3221f6253ef86580151662f6c6788a320 01-Nov-2013 Richard Trieu <rtrieu@google.com> Disable -Wtautological-constant-out-of-range-compare in template instantiations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193887 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
32b5ca012c42d418c9ff0d4175b17f174459e187 01-Nov-2013 Faisal Vali <faisalv@yahoo.com> Support return type deduction for templates in -fdelayed-template-parsing (microsoft) mode

Please see http://llvm-reviews.chandlerc.com/D2053 for discussion and Richard's stamp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193849 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
xx1y-generic-lambdas.cpp
0e429f1f48298b749cd0b0d6e931ed15c2a7a2b1 29-Oct-2013 Chris Wailes <chris.wailes@gmail.com> Changed tests_typestate to test_typestate for consistency.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193648 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
bb17ff90d9d9a3fac5388304840a3424c04bf2ee 29-Oct-2013 Alp Toker <alp@nuanti.com> Switch %clang -cc1 tests to %clang_cc1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193561 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-gnu-attrs.cpp
02debf605cd904edac8dceb196e5f142ce3d14eb 25-Oct-2013 Jordan Rose <jordan_rose@apple.com> Add -Wstring-plus-char, which warns when adding char literals to C strings.

Specifically, this warns when a character literal is added (using '+') to a
variable with type 'char *' (or any other pointer to character type). Like
-Wstring-plus-int, there is a fix-it to change "foo + 'a'" to "&foo['a']"
iff the character literal is on the right side of the string.

Patch by Anders Rönnholm!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193418 91177308-0d34-0410-b5e6-96231b3b80d8
tring-plus-char.cpp
9d33c40838367ffcc3206a7120a0ce32922b66d8 25-Oct-2013 David Majnemer <david.majnemer@gmail.com> Sema: Do not allow lambda expressions to appear inside of constant expressions

We would previously not diagnose this which would lead to crashes (on
very strange code).

This fixes PR17675.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193397 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-0x.cpp
101e9dc388c92d1e58bf977ff9697572cbe8b422 25-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Consider used attributes in hidden decls.

Without this patch we would warn and fail to output the function in the test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193388 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
858d2ba136c8dcdc051fe20b3190c40bc25de189 25-Oct-2013 Richard Trieu <rtrieu@google.com> Simplify and refactor the uninitialized field warning.

Change the uninitialized field warnings so that field initializers are checked
inside the constructor. Previously, in class initializers were checked
separately. Running one set of checks also simplifies the logic for preventing
duplicate warnings. Added new checks to warn when an uninitialized field is
used in base class initialization. Also fixed misspelling of uninitialized
and moved all code for this warning together.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193386 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
9bd1c1332f7b2a82ed7b328b216a35a299a5945a 25-Oct-2013 Faisal Vali <faisalv@yahoo.com> Refactor: Extract specializing the generic lambda call operator during conversion to fptr deduction into its own function.

No functionality change.

All clang regression tests pass.

Thanks!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193383 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
c4fe0a62ad5909c996b4edaa725772c0116b7dea 24-Oct-2013 Faisal Vali <faisalv@yahoo.com> Fix a test file option from -emit-llvm -o to -emit-llvm-only.

As requested by Rafael Espindola here: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131021/091556.html


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193296 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
605f91ffd18f35ffcb5fcdd38379bd09b67a6cb8 24-Oct-2013 Faisal Vali <faisalv@yahoo.com> Fix an instantiation bug with nested generic lambdas and conversion to fptrs.

This patch fixes the typelocs of the conversion-operator and the conversion-operator-name and adds the parameters of the call operator to the FunctionProtoTypeLoc of the respective entities. Thus, when the template declarations (conversion operators) undergo deduction and instantiation/transformation/substitution - they add themselves to the local instantiation scope if needed.

This patch supports the following:

auto L = [](auto b) {
return [](auto a) ->decltype(a) { return a; };
};
int (*fp)(int) = L(8);

Richard LGTM'd this patch: http://llvm-reviews.chandlerc.com/D1831

Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193294 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
a3d311e468bce37defb97ed75105f8d36942b651 23-Oct-2013 Faisal Vali <faisalv@yahoo.com> And Again: Teach TreeTransform how to transform nested generic lambdas.


A previous attempt http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090049.html resulted in PR 17476, and was reverted,

The original TransformLambdaExpr (pre generic-lambdas) transformed the TypeSourceInfo of the Call operator in its own instantiation scope via TransformType. This resulted in the parameters of the call operator being mapped to their transformed counterparts in an instantiation scope that would get popped off.
Then a call to TransformFunctionParameters would add the parameters and their transformed mappings (but newly created ones!) to the current instantiation scope. This would result in a disconnect between the new call operator's TSI parameters and those used to construct the call operator declaration. This was ok in the non-generic lambda world - but would cause issues with nested transformations (when non-generic and generics were interleaved) in the generic lambda world - that I somewhat kludged around initially - but this resulted in PR17476.

The new approach seems cleaner. We only do the transformation of the TypeSourceInfo - but we make sure to do it in the current instantiation scope so we don't lose the untransformed to transformed mappings of the ParmVarDecls when they get created.

Another attempt caused a test to fail (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20131021/091533.html) and also had to be reverted - my apologies - in my haste, i did not run all the tests - argh!

Now all the tests seem to pass - but a Fixme has been added - since I suspect Richard will find the fix a little inelegant ;) I shall try and work on a more elegant fix once I have had a chance to discuss with Richard or Doug at a later date.

Hopefully the third time;s a charm *fingers crossed*

This does not yet include capturing.

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193230 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
80f2b2e693422f84ec3735f16a08614a527b0bc5 23-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Revert r193223 and r193216.

They were causing CodeGenCXX/mangle-exprs.cpp to fail.

Revert "Remove the circular reference to LambdaExpr in CXXRecordDecl."

Revert "Again: Teach TreeTransform and family how to transform generic lambdas nested within templates and themselves."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193226 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
b814a2ac581f7aa31aeef1abb8567ea123a13519 23-Oct-2013 Faisal Vali <faisalv@yahoo.com> Again: Teach TreeTransform and family how to transform generic
lambdas nested within templates and themselves.

A previous attempt http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090049.html resulted in PR 17476, and was reverted,


The original TransformLambdaExpr (pre generic-lambdas) transformed the TypeSourceInfo of the Call operator in its own instantiation scope via TransformType. This resulted in the parameters of the call operator being mapped to their transformed counterparts in an instantiation scope that would get popped off.
Then a call to TransformFunctionParameters would add the parameters and their transformed mappings (but newly created ones!) to the current instantiation scope. This would result in a disconnect between the new call operator's TSI parameters and those used to construct the call operator declaration. This was ok in the non-generic lambda world - but would cause issues with nested transformations (when non-generic and generics were interleaved) in the generic lambda world - that I somewhat kludged around initially - but this resulted in PR17476.

The new approach seems cleaner. We only do the transformation of the TypeSourceInfo - but we make sure to do it in the current instantiation scope so we don't lose the untransformed to transformed mappings of the ParmVarDecls when they get created.

This does not yet include capturing.

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193216 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
a8a2ebe9e729f69dc5775dee33cde1d5067a880a 23-Oct-2013 Alp Toker <alp@nuanti.com> Retain previous language linkage of friend function declarations

With this extension, friend function declarations will retain the language
linkage specified for previous declarations instead of emitting an error
diagnostic.

The feature is known to be compatible with GCC and MSVC and permits a
language to be specified indirectly where it cannot otherwise be written
directly in class scope.

Work is ongoing to improve linkage spec diagnostics.

Fixes PR17337.

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193206 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
65f958dca64ef64d43bf85e871ec64e638ff2602 22-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Consider hidden decls for isUsed checks.

This fixes pr17624.

A FIXME from Richard Smith:

It seems to me that the root cause is that a per-Decl 'used' flag doesn't
really make much sense in the way we use it now. I think we should either track
whether that particular declaration is used (with isUsed scanning the entire
redecl chain), or we should only have one flag for the entire redeclaration
chain (perhaps by always looking at the flag on either the most recent decl or
the canonical decl). Modeling it as "is this declaration or any previous
declaration used" is weird, and requires contortions like the loop at the end
of Sema::MarkFunctionReferenced.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193202 91177308-0d34-0410-b5e6-96231b3b80d8
arn-func-not-needed.cpp
7e66ed34c34efc4acba464a2e7ae10e22abdeb7f 21-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Extend test to show an alias can be before a definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193099 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-gnu-attrs.cpp
b75009c53084f97a8e295164c07d1007e66ccefa 21-Oct-2013 David Majnemer <david.majnemer@gmail.com> Be more precise when diagnosing 'inline' on global replacement functions


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193061 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
a3bfa54f2ad8600fc1bb3d39b37e3cd5469ccbb6 20-Oct-2013 Alp Toker <alp@nuanti.com> Switch attribute test line endings from CRLF

The convention is LF unless specifically testing line endings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193056 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cleanup-gcc.cpp
ttr-cleanup.cpp
8b407727aef487051835440deb641e60f7a743f8 20-Oct-2013 Alp Toker <alp@nuanti.com> Fix crash in cleanup attr handling

ResolveSingleFunctionTemplateSpecialization() returns 0 and doesn't emit diags
unless the expression has template-ids, so we must null check the result.

Also add a better diag noting which overloads are causing the problem.

Reviewed by Aaron Ballman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193055 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cleanup.cpp
d2b0cf38be1e6bd9b35353ae3da49eda5dc4e1e5 20-Oct-2013 David Majnemer <david.majnemer@gmail.com> Sema: Diagnose global replacement functions declared as inline

This fixes PR17591.

N.B. This actually goes beyond what the standard mandates by requiring
the restriction to hold for declarations instead of definitions. This
is believed to be a defect in the standard and an LWG issue has been
submitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193044 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
b5c7768a74936d4e2c7a484570a638cb74702d8b 19-Oct-2013 Kaelyn Uhrain <rikka@google.com> Allow CorrectTypo to replace CXXScopeSpecifiers that refer to classes.

Now that CorrectTypo knows how to correctly search classes for typo
correction candidates, there is no good reason to only replace an
existing CXXScopeSpecifier if it refers to a namespace. While the actual
enablement was a matter of changing a single comparison, the fallout
from enabling the functionality required a lot more code changes
(including my two previous commits).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193020 91177308-0d34-0410-b5e6-96231b3b80d8
issing-members.cpp
ypo-correction-pt2.cpp
ypo-correction.cpp
6e4f6f865010649bc3969e57436b5501544a0c39 19-Oct-2013 Kaelyn Uhrain <rikka@google.com> Be smarter about deciding to add a leading '::' to a
NestedNameSpecifier that replaces an existing specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193019 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
sing-decl-1.cpp
13be03222faa22b1a1088ea5c1a00014934b9ee4 19-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: fix assert failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193010 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
be63ab6612b250972ae528ae910e5fa64f9c5731 18-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: assume that non-const reference parameters are initially
in the "uknown" state. Patch by chris.wailes@gmail.com. Reviewed by delesley.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192995 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
c5cdafcdb8eea9625e86b015ba7a2504f18a99b7 18-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: All the return_typestate parameter to be attached to the
default constructor. Patch by chris.wailes@gmail.com, reviewed by delesley.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192991 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
7121bdb91b86f6053765bda18dd0a8a118929ace 18-Oct-2013 David Majnemer <david.majnemer@gmail.com> [-fms-extensions] Permit 'override' in C++98 and 'sealed' as a synonym for 'final'

Summary: Some MS headers use these features.

Reviewers: rnk, rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1948

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192936 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
ype-traits.cpp
d4f0e1991f42c69111213699fb2d09dedee1cd36 18-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: Add param_typestate attribute, which specifies that
function parameters must be in a particular state. Patch by
chris.wailes@gmail.com. Reviewed by delesley@google.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192934 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
cd0f6d7600a691ad81dab308e9905fb0cce1df4d 18-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed Analysis: Allow parameters that are passed by non-const reference
to be treated as return values, and marked with the "returned_typestate"
attribute. Patch by chris.wailes@gmail.com; reviewed by delesley@google.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192932 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
9cd5d407202bd150fde8fdfcbf51139926a3aee7 18-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: update to previous test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192926 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
52f717eba7eff69c97d64de5e3669f4a5ee57d5c 17-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: fix ICE in handling of loop source locations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192911 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
d1bcd4c73504c98d765531ad6bf259cc35c1437e 17-Oct-2013 David Majnemer <david.majnemer@gmail.com> Remove unicode characters, trailing whitespace from test case


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192877 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
a32966fd8474e7a7002f65d32ace6b7e18dee66b 16-Oct-2013 Benjamin Kramer <benny.kra@googlemail.com> Sema: Simplify the check if a method returns an instance of the class.

Just checking if the parent of the method is the same as the return type
should be sufficient. Also fixes PR17587.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192802 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-result.cpp
7752a741093888ea62e88777929fdaa4c23d0264 15-Oct-2013 David Majnemer <david.majnemer@gmail.com> Sema: Don't crash when __try/__except/__finally appears in a template function

We wouldn't transform the compound statement in any of these forms,
causing crashes when it got time to act on them. Additionally, we
wouldn't check to see if the handler was invalid before deciding whether
or not we should continue acting on the __try.

This fixes PR17584.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192682 91177308-0d34-0410-b5e6-96231b3b80d8
_try.cpp
edb5fdfb732d9b05f7f3c3248edea7b14331f4a4 15-Oct-2013 David Majnemer <david.majnemer@gmail.com> Sema: Consider it an error to apply __builtin_offsetof to a member in a virtual base

icc 13 and g++ 4.9 both reject this while we would crash.

Fixes PR17578.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192674 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
b7f23f18acaf84d14d6ca2c02c12c22e68d72837 15-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Correctly skip type sugar when determining the width of an enum type. Derived
from a patch by Justin Bogner.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192671 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
b79b17b67f2c0de8fd343fdd070e5ccbfe20d602 15-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17567: Improve diagnostic for a mistyped constructor name. If we see something
that looks like a function declaration, except that it's missing a return type,
try typo-correcting it to the relevant constructor name.

In passing, fix a bug where the missing-type-specifier recovery codepath would
drop a preceding scope specifier on the floor, leading to follow-on diagnostics
and incorrect recovery for the auto-in-c++98 hack.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192644 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
81e34b1c137ffaa9b9c7d488744bdaa0cee8e845 14-Oct-2013 Serge Pavlov <sepavloff@gmail.com> Do not use typo correction that is unaccessible.
This patch fixes PR17019. When doing typo correction, Sema::CorrectTypo uses
correction already seen for the same typo. This causes problems if that
correction is from another scope and cannot be accessed in the current.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192594 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
f30e194f9d797ebeb2f6c3f96e88160ed1a6519a 12-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: replace the consumes attribute with a set_typestate
attribute. Patch by chris.wailes@gmail.com; reviewed and edited by delesley.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192515 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
1bf6343612e394051fffc587e6899de6901065e0 12-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: switch from tests_consumed/unconsumed to a general
tests_typestate attribute. Patch by chris.wailes@gmail.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192513 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
f18e6e87c2fa41c2a891463483603d770a1e58a7 12-Oct-2013 Richard Trieu <rtrieu@google.com> Improve the error message for attempting to build a for range loop using a
function parameter that has array type. Such a parameter will be treated as
a pointer type instead, resulting in a missing begin function error is a
suggestion to dereference the pointer. This provides a different,
more informative diagnostic as well as point to the parameter declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192512 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-examples.cpp
627c7f9740dfe9c208543798eccbe5ca23e1ef42 11-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: check destructor calls.
This allows the callable_when attribute to be attached to destructors.
Original patch by chris.wailes@gmail.com, reviewed and edited by delesley.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192508 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
b2969b1e50580344891a98f5b241f8351fe371cf 11-Oct-2013 Warren Hunt <whunt@google.com> Adds Microsoft compatiable C++ record layout code to clang.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192494 91177308-0d34-0410-b5e6-96231b3b80d8
s_struct.cpp
6e04a849fec62c15968f8a1c94ac380f5eae7b99 10-Oct-2013 Benjamin Kramer <benny.kra@googlemail.com> Sema: Taking the address of a dtor is illegal per C++ [class.dtor]p2.

Emit a proper error instead of crashing in CodeGen. PR16892.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192345 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
7385840b600d0e4a96d75042f612f6430e4a0390 09-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: improve loop handling. The prior version of the analysis
marked all variables as "unknown" at the start of a loop. The new version
keeps the initial state of variables unchanged, but issues a warning if the
state at the end of the loop is different from the state at the beginning.
This patch will eventually be replaced with a more precise analysis.

Initial patch by chris.wailes@gmail.com. Reviewed and edited by
delesley@google.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192314 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
45d3950e373412f395413c81a0310e8090508608 09-Oct-2013 Hans Wennborg <hans@hanshq.net> Tighten diagnostics for calling conventions on variadic functions

Follow-up from r192240.

This makes it an error to use callee-cleanup conventions on variadic
functions, except for __fastcall and __stdcall, which we ignore with
a warning for GCC and MSVC compatibility.

Differential Revision: http://llvm-reviews.chandlerc.com/D1870

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192308 91177308-0d34-0410-b5e6-96231b3b80d8
alling-conv-compat.cpp
2dd68de1bf29993c8c8d7e20a3f230fc9a5a40e8 08-Oct-2013 Justin Bogner <mail@justinbogner.com> Sema: Only merge typedef attributes if the previous decl is a typedef

In r186373, we started merging attributes on typedefs, but this causes
us to try to merge attributes even if the previous declaration was not
a typedef.

Only merge the attributes if the previous decl was also a typedef.

Fixes rdar://problem/15044218

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192146 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-aligned.cpp
ttr-deprecated.cpp
66540857c08de7f1be9bea48381548d3942cf9d1 04-Oct-2013 DeLesley Hutchins <delesley@google.com> Consumed Analysis: Change callable_when so that it can take a list of states
that a function can be called in. This reduced the total number of annotations
needed and makes writing more complicated behaviour less burdensome.
Patch by chriswails@gmail.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191983 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
f003acd8e7bdb994743dc8ea64f90db5360a8b4a 04-Oct-2013 Rafael Espindola <rafael.espindola@gmail.com> Revert "Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves."

This reverts commit r191879. It caused llvm.org/pr17476.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191955 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
618c28547a7f7cc785a6c6301f79febf5a584f9e 03-Oct-2013 Faisal Vali <faisalv@yahoo.com> Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.

This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130930/090048.html

When I first committed this patch - a bunch of buildbots were unable to compile the code that VS2010 seemed to compile. Seems like there was a dependency on Sema/Template.h which VS did not seem to need, but I have now added for the other compilers. It still compiles on Visual Studio 2010 - lets hope the buildbots remain quiet (please!)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191879 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
9683f1de5f8eb3a4dd7c7fcb4ff58033b9cfa46f 03-Oct-2013 Faisal Vali <faisalv@yahoo.com> Revert changes from the nested lambdas commit till i figure out
why the buildbots are failing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191876 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
aecbb9de3bed4372695756f18af2c1304a81e7c4 03-Oct-2013 Faisal Vali <faisalv@yahoo.com> Teach TreeTransform and family how to transform generic lambdas within templates and nested within themselves.

This does not yet include capturing (that is next).

Please see test file for examples.

This patch was LGTM'd by Doug:
http://llvm-reviews.chandlerc.com/D1784


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191875 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
a89ee579e86912302251dd9b06a472b4531f864f 02-Oct-2013 Kaelyn Uhrain <rikka@google.com> Fix a typo suggestion regression introduced by r191544.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191798 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
de8eaa2bf22ab0a59118289ee8b97f6ac6a97196 01-Oct-2013 Faisal Vali <faisalv@yahoo.com> Fix computation of linkage within nested lambdas.

When nested C++11 lambdas are used in NSDMI's - this patch prevents infinite recursion by computing the linkage of any nested lambda by determining the linkage of the outermost enclosing lambda (which might inherit its linkage from its parent).

See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval.

[On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions]


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191727 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
91d3f338e446e654392184e68f940c77b5c98f39 01-Oct-2013 Eli Friedman <eli.friedman@gmail.com> Fix typo correction usage of SemaAccess.cpp.

When we check access for lookup results, make sure we propagate the
result's access to the access control APIs; this can be different from
the natural access of the declaration depending on the path used by the lookup.

PR17394.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191726 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
9b93f206d89dbf86805b610b417bb874f7f446e8 01-Oct-2013 Eli Friedman <eli.friedman@gmail.com> Tweak changes in r186464 to avoid a crash.

Currently, IR generation can't handle file-scope compound literals with
non-constant initializers in C++.

Fixes PR17415 (the first crash in the bug).

(We should probably change (T){1,2,3} to use the same codepath as T{1,2,3} in
C++ eventually, given that the semantics of the latter are actually defined by
the standard.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191719 91177308-0d34-0410-b5e6-96231b3b80d8
ompound-literal.cpp
8a3f9e46cb988d2c664395b21910091e3730ae82 01-Oct-2013 Richard Smith <richard-llvm@metafoo.co.uk> Remove support for arrays of runtime bound in C++1y, now they have been voted
out of the working paper. This reverts r179962 and r179992.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191718 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-array-runtime-bound.cpp
xx98-compat-pedantic.cpp
c6867ddf541925c4dede00295fa2d06e8a39e89c 29-Sep-2013 Faisal Vali <faisalv@yahoo.com> Revert the linkage fix.
I got a bunch of buildbot failures that i don't understand - sorry.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191647 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
99229cd81825a9c1df20ed8971d10608e5793521 29-Sep-2013 Faisal Vali <faisalv@yahoo.com> Fix computation of linkage within nested lambdas.
When nested lambdas are used in NSDMI's - this prevents infinite recursion.

See http://llvm-reviews.chandlerc.com/D1783 for Doug's approval regarding the code, and then request for some tests.

[On a related note, I need this patch so as to pass tests of transformations of nested lambdas returned from member functions]


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191645 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
d6992ab33b7113e1bd7af51c0c52d17c23706c01 29-Sep-2013 Faisal Vali <faisalv@yahoo.com> Implement conversion to function pointer for generic lambdas without captures.

The general strategy is to create template versions of the conversion function and static invoker and then during template argument deduction of the conversion function, create the corresponding call-operator and static invoker specializations, and when the conversion function is marked referenced generate the body of the conversion function using the corresponding static-invoker specialization. Similarly, Codegen does something similar - when asked to emit the IR for a specialized static invoker of a generic lambda, it forwards emission to the corresponding call operator.

This patch has been reviewed in person both by Doug and Richard. Richard gave me the LGTM.

A few minor changes:
- per Richard's request i added a simple check to gracefully inform that captures (init, explicit or default) have not been added to generic lambdas just yet (instead of the assertion violation).
- I removed a few lines of code that added the call operators instantiated parameters to the currentinstantiationscope. Not only did it not handle parameter packs, but it is more relevant in the patch for nested lambdas which will follow this one, and fix that problem more comprehensively.
- Doug had commented that the original implementation strategy of using the TypeSourceInfo of the call operator to create the static-invoker was flawed and allowed const as a member qualifier to creep into the type of the static-invoker. I currently kludge around it - but after my initial discussion with Doug, with a follow up session with Richard, I have added a FIXME so that a more elegant solution that involves the use of TrivialTypeSourceInfo call followed by the correct wiring of the template parameters to the functionprototypeloc is forthcoming.

Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191634 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-generic-lambdas.cpp
4cb295d3b32cb04215f87948fbf944ee4c31de1b 29-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++1y sized deallocation (n3778). This is not enabled by -std=c++1y;
instead, it's enabled by the -cc1 flag -fsized-deallocation, until we sort out
the backward-compatibility issues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191629 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-sized-deallocation.cpp
9beaf20b882eb83082da27a74760277bb9fc0bdd 28-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add compat/extension warnings for init captures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191609 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-compat.cpp
1851715dd6e2111e4c503f473f7bd4917df0ff7b 28-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add extra testing for init-captures.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191608 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-init-captures.cpp
2ceb67a5345ef711468a32dbf17769828b5fbadd 28-Sep-2013 Kaelyn Uhrain <rikka@google.com> Don't suggest namespaces if the next token is a '.'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191589 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
d0629eb137d06bf6d46a430abdb7fa044909298b 27-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Variable templates: handle instantiation of static data member templates
appropriately, especially when they appear within class templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191548 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_in_class.cpp
0f90ee0939ae785f412da07e94afdf8053681b39 27-Sep-2013 Kaelyn Uhrain <rikka@google.com> Don't give suggest things like function names on the left side of "=".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191545 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
6243f627680fbf7c5bf2f339967d806f47153746 27-Sep-2013 Kaelyn Uhrain <rikka@google.com> Avoid the hard-coded limit on the number of typo corrections attempted.

Move some tests from typo-correction.cpp to typo-correction-pt2.cpp
because they were running afoul of the hard-coded limit of 20 typos
corrected. Some of the tests after it were still working due to the
limit not applying to cached corrections and in cases where a non-NULL
MemberContext is passed in to Sema::CorrectTypo. Most of the moved tests
still passed after being moved, but the test involving "data_struct" had
only been passing because the test had exceeded that limit so a fix for
it is also included (most of the changes to ParseStmt.cpp are shared with
and originated from another typo correction impovement that was split
into a separate commit).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191544 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
ypo-correction.cpp
a934c31d1056429a1e32fbcd198b4c5d0a42d84e 26-Sep-2013 Kaelyn Uhrain <rikka@google.com> Fix error recovery when a return type correction includes a new name specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191459 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
3d9559b91c00757b296354cc6ca93e899266c7d2 26-Sep-2013 Kaelyn Uhrain <rikka@google.com> Teach typo correction to look inside of classes like it does namespaces.

Unlike with namespaces, searching inside of classes requires also
checking the access to correction candidates (i.e. don't suggest a
correction to a private class member for a correction occurring outside
that class and its methods or friends).

Included is a small (one line) fix for a bug, that was uncovered while
cleaning up the unit tests, where the decls from a TypoCorrection candidate
were preserved in new TypoCorrection candidates that are derived (copied)
from the old TypoCorrection--notably when creating a new candidate by
changing the NestedNameSpecifier associated with the base idenitifer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191449 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
ypo-correction-pt2.cpp
859b6227694033dd6eaf3991a2b80877a406c382 26-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++1y digit separator proposal (' as a digit separator). This is not
yet approved by full committee, but was unanimously supported by EWG.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191417 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
01ae093cbc7f347f509cfc8e53b8c2c36e0146b2 25-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Allow dynamic_cast to void* even with -fno-rtti.

PR17346.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191340 91177308-0d34-0410-b5e6-96231b3b80d8
o-rtti.cpp
2ae28e57a2d5e3456171fa1ade37060169583e38 25-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Fix -Wmissing-variable-declarations regression.

This issue was introduced in r181677.

PR17349.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191339 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-variable-declarations.cpp
ecbce69e354c77bf2d359111bad0c77c516e16f0 24-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement restriction that a partial specialization must actually specialize
something, for variable templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191278 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_in_class.cpp
xx1y-variable-templates_top_level.cpp
06dd2b317a4bf282f3ac526b5cc4d74c39ed7ced 24-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Handle standard libraries that miss out the space when defining the standard
literal operators. Also, for now, allow the proposed C++1y "il", "i", and "if"
suffixes too. (Will revert the latter if LWG decides not to go ahead with that
change after all.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191274 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-user-defined-literals.cpp
25b24eb889d633c4666001af107d8eb5c45dd065 23-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16529: Don't forget to add the CXXFunctionalCastExpr type sugar to an
InitListExpr for a C++11-style T{...} construction, if initialization
registered a destructor for it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191182 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype.cpp
b390e49da4f140fab12732a1c99f4074f5f351a2 21-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR17295: Do not allow explicit conversion functions to be used in cases where
an additional conversion (other than a qualification conversion) would be
required after the explicit conversion.

Conversely, do allow explicit conversion functions to be used when initializing
a temporary for a reference binding in direct-list-initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191150 91177308-0d34-0410-b5e6-96231b3b80d8
xplicit.cpp
ef8f90caa14d85cffba2fea4b6bd425c3b22eea7 20-Sep-2013 Richard Trieu <rtrieu@google.com> Modify the uninitialized field visitor to detect uninitialized use across the
fields in the class. This allows a better checking of member intiailizers and
in class initializers in regards to initialization ordering.

For instance, this code will now produce warnings:

class A {
int x;
int y;
A() : x(y) {} // y is initialized after x, warn here
A(int): y(x) {} // default initialization of leaves x uninitialized, warn here
};

Several test cases were updated with -Wno-uninitialized to silence this warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191068 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-value-init.cpp
xx0x-class.cpp
ninitialized.cpp
arn-unused-private-field.cpp
a41c97a5d1912ffd184381d269fd8e5a25ee5e59 20-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Switch the semantic DeclContext for a block-scope declaration of a function or
variable from being the function to being the enclosing namespace scope (in
C++) or the TU (in C). This allows us to fix a selection of related issues
where we would build incorrect redeclaration chains for such declarations, and
fail to notice type mismatches.

Such declarations are put into a new IdentifierNamespace, IDNS_LocalExtern,
which is only found when searching scopes, and not found when searching
DeclContexts. Such a declaration is only made visible in its DeclContext if
there are no non-LocalExtern declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@191064 91177308-0d34-0410-b5e6-96231b3b80d8
locks-1.cpp
xx0x-initializer-references.cpp
xtern-c.cpp
unction-redecl.cpp
arn-unreachable.cpp
d2f9308220af22bfc1bcd3bc2cad118dbd8be013 19-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Make Preprocessor::Lex non-recursive.

Before this patch, Lex() would recurse whenever the current lexer changed (e.g.
upon entry into a macro). This patch turns the recursion into a loop: the
various lex routines now don't return a token when the current lexer changes,
and at the top level Preprocessor::Lex() now loops until it finds a token.
Normally, the recursion wouldn't end up being very deep, but the recursion depth
can explode in edge cases like a bunch of consecutive macros which expand to
nothing (like in the testcase test/Preprocessor/macro_expand_empty.c in this
patch).

<rdar://problem/14569770>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190980 91177308-0d34-0410-b5e6-96231b3b80d8
arn-empty-body.cpp
5f33c37f8fe476602d9a1cc968060f6113ec8aaa 19-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Add specific warning flags for GNU ext in Sema.

This patch adds the following, more specific warning flags:

gnu-anonymous-struct
gnu-compound-literal-initializer
gnu-empty-struct
gnu-flexible-array-initializer
gnu-flexible-array-union-member
gnu-folding-constant
redeclared-class-member
gnu-redeclared-enum
gnu-union-cast
gnu-variable-sized-type-not-at-end

Patch by Peter Lewis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190972 91177308-0d34-0410-b5e6-96231b3b80d8
nu-flags.cpp
58ee425b11e178c652fa6ff4c1c924fe9b98801e 19-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Remove a bogus diagnostic preventing static data member templates from being
defined with no initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190970 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_in_class.cpp
8e6557e57e2b88fd3de8a87e53e30c774497f51d 18-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix accepts-invalid if a variable template explicit instantiation is missing an
argument list, but could be instantiated with argument list of <>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190913 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_top_level.cpp
6aa7df9df93bcf2d6399f6e535ef74c132db40ec 18-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> If a variable template specialization with an incomplete array type is
referenced, try to instantiate its definition in order to complete the type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190910 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_in_class.cpp
e9f6f33f0cf98a3e39025a57a0079cd316ed98f8 17-Sep-2013 David Majnemer <david.majnemer@gmail.com> [-cxx-abi microsoft] Correctly identify Win32 entry points

Summary:
This fixes several issues with the original implementation:
- Win32 entry points cannot be in namespaces
- A Win32 entry point cannot be a function template, diagnose if we it.
- Win32 entry points cannot be overloaded.
- Win32 entry points implicitly return, similar to main.

Reviewers: rnk, rsmith, whunt, timurrrr

Reviewed By: rnk

CC: cfe-commits, nrieck

Differential Revision: http://llvm-reviews.chandlerc.com/D1683

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190818 91177308-0d34-0410-b5e6-96231b3b80d8
s-overload-entry-point.cpp
175d417134124df3abba8d874e51f04d5b4b9ee6 16-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add some missing ProhibitAttributes calls to some declaration-like #pragmas.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190806 91177308-0d34-0410-b5e6-96231b3b80d8
aptured-statements.cpp
2440fb1f91557912f8c43cb72201170254ae09f4 16-Sep-2013 Amara Emerson <amara.emerson@arm.com> Add error checking to reject neon_vector_type attribute on targets without NEON.

Patch by Artyom Skrobov.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190801 91177308-0d34-0410-b5e6-96231b3b80d8
eon-vector-types.cpp
3312933e244d820c1c6fec83c4c0c0f67f42d25b 16-Sep-2013 Wei Pan <wei.pan@intel.com> Handle PredefinedExpr with templates and lambdas

Summary:

- lambdas, blocks or captured statements in templates were not
handled which causes codegen crashes.

Differential Revision: http://llvm-reviews.chandlerc.com/D1628



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190784 91177308-0d34-0410-b5e6-96231b3b80d8
redefined-expr.cpp
3225b9c9b35056f15b967bda1f1d8a3ca1680a42 14-Sep-2013 Serge Pavlov <sepavloff@gmail.com> Avoid getting an argument of allocation function if it does not exist.
This is a fix to PR12778: in erroneous code an allocation function
can be declared with no arguments, quering the first argument in this case
causes assertion violation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190751 91177308-0d34-0410-b5e6-96231b3b80d8
R12778.cpp
1fca547913774c6c547a15414d1a7051c1f446b5 13-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> Part three of PR15721: if we have an invalid CXXDefaultInitExpr, don't crash if
we try to constant-evaluate it. Patch by Karthik Bhat, test by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190722 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
b445cb9662067b7c7586815937b07828ede9bb49 13-Sep-2013 Aaron Ballman <aaron@aaronballman.com> vector_size cannot be applied to Booleans. Updated the semantic checking logic, as well as the comment and added a test case. Fixes PR12649

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190721 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
422ac9ee19c177fe65e613ff49998bd5a6e55408 13-Sep-2013 Aaron Ballman <aaron@aaronballman.com> Switching the WeakRef attribute to using the new checkStringLiteralArgument helper function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190719 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-weakref.cpp
f37e4f24c39d0fd3c7f954d2321c4590421907af 13-Sep-2013 Benjamin Kramer <benny.kra@googlemail.com> Guard availability and thread safety attributes against wide strings.

Found by inspection.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190701 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
fbb08b5ec01fbdeb6219fbba0f5edfd95c752233 13-Sep-2013 Richard Trieu <rtrieu@google.com> Refactor the uninitialized field visitor. Also moved the calls to the visitor
later in the code so that the expressions will have addition processing first.
This catches a few additional cases of uninitialized uses of class fields.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190657 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
d068607c136298bec0891d750389a55bac9f5c98 11-Sep-2013 Aaron Ballman <aaron@aaronballman.com> Tablegen now generates a StringSwitch for attributes containing enumeration arguments to map strings to the proper enumeration value. This makes error checking more consistent and reduces the amount of hand-written code required.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190545 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-parsing.cpp
a19efafb13390d84e68c5cb80049913f41652582 11-Sep-2013 Aaron Ballman <aaron@aaronballman.com> Adding some additional test cases for the cleanup attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190525 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cleanup.cpp
71fcba874e399eb33e0ebf7c6b19bc2a5e876993 11-Sep-2013 Daniel Jasper <djasper@google.com> Split -Wunused-variable warning.

With r190382, -Wunused-variable warns about unused const variables when
appropriate. For codebases that use -Werror, this poses a problem as
existing unused const variables need to be cleaned up first. To make the
transistion easier, this patch splits -Wunused-variable by pulling out
an additional -Wunused-const-variable (by default activated along with
-Wunused-variable).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190508 91177308-0d34-0410-b5e6-96231b3b80d8
o-warn-unused-const-variables.cpp
a3d727ba775eaecd4fd69e1c90b81732394716a6 11-Sep-2013 Eli Friedman <eli.friedman@gmail.com> volatile types are not trivially copyable.

PR17123.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190484 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
ba081617a9f116ca2d511d0bf96e45c53ecc2523 11-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Fix is_trivially_constructible preconditions.

Fixes a crash in cases where the first argument was an incomplete type
or an uninstantiated template type.

<rdar://problem/14938471>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190482 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
ebaee6b74e56f28c088225b11a512e6e7d1fb9d8 11-Sep-2013 Aaron Ballman <aaron@aaronballman.com> The cleanup attribute no longer uses an unresolved, simple identifier as its argument. Instead, it takes an expression that is fully resolved.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190476 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cleanup-gcc.cpp
ttr-cleanup.cpp
812d6bcbd13190e6e5c2c915bf1499038d56b44b 10-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR5683: Issue a warning when subtracting pointers to types of zero size, and
treat such subtractions as being non-constant. Patch by Serge Pavlov! With a
few tweaks by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190439 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
1507bf55c958bdd4b14a3ee49f66af874f179cf2 10-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Fix regression from r190382.

Make sure we perform the correct "referenced-but-not-used" check for
static member constants.

Fixes bug reported on cfe-commits by Alexey Samsonov.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190437 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
39bd371610af27b073c792c54c6c28133329f6ad 10-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Make -Wunused warning rules more consistent.

This patch does a few different things.

This patch improves unused var diags for const vars: we no longer
unconditionally suppress diagnostics for const vars, instead only suppressing
the diagnostic when the declaration appears to be useful.

This patch also makes us more consistently use whether a variable/function
is declared in the main file to suppress diagnostics where appropriate.

Fixes <rdar://problem/14907887>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190382 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/warn-unused-variables.h
arn-unused-filescoped.cpp
35bc0055408131d34543c6b4a137d021b26f2d6a 10-Sep-2013 Reid Kleckner <reid@kleckner.net> Ignore calling conventions when checking function template specializations

Summary:
Calling conventions are inherited during decl merging. Before this
change, deduction would fail due to a type mismatch between the template
and the specialization. This change adjusts the CCs to match before
deduction, and lets the decl merging logic diagnose mismatch or inherit
the CC from the template.

This allows specializations of static member function templates in the
Microsoft C++ ABI.

Reviewers: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1570

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190377 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-microsoft-call-conv.cpp
9c5716c30d91212dcdea5e5c9b9ded9ed2439a09 06-Sep-2013 Eli Friedman <eli.friedman@gmail.com> Add self-comparison warnings for fields.

This expands very slightly what -Wtautological-compare considers to be
tautological to include implicit accesses to C++ fields and ObjC ivars.
I don't want to turn this into a full expression-identity check, but
these additions seem pretty well-contained, and maintain the theme
of checking for "x == x".

<rdar://problem/14431127>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190118 91177308-0d34-0410-b5e6-96231b3b80d8
elf-comparison.cpp
a33ab6074a2cc60fe895d6669f9ee776c5fea335 06-Sep-2013 David Blaikie <dblaikie@gmail.com> Consumed Analysis: The 'consumable' attribute now takes a identifier specifying the default assumed state for objects of this class

This information is used for return states and pass-by-value parameter
states.

Patch by Chris Wailes.

Review by DeLesley Hutchins and Aaron Ballman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190116 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
3082be2f92c5d273ada989c1a13bcb46bc14e4c7 06-Sep-2013 Richard Smith <richard-llvm@metafoo.co.uk> When creating an implicit conversion sequence for a reference of type T from an
initializer list containing a single element of type T, be sure to mark the
sequence as a list conversion sequence so that it is known to be worse than an
implicit conversion sequence that initializes a std::initializer_list object.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190115 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
1e75a1a9e5c66ea09eababb1c8f3e2f49cadf0bd 04-Sep-2013 Serge Pavlov <sepavloff@gmail.com> Clear LookupResult object if invalid candidate is found.
If source code is invalid, error recovery can lead to name lookup in a set containing invalid declaration. The lookup is stopped once found such declaration, but LookupResult object could remain in inconsistent state. Its destructor triggered a check, which caused assert violation.
This patch fixes PR16964 and PR12791.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189916 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
5094920177bba444d8d67f672b428999770583b9 04-Sep-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: update to comments in test cases.
Patch by chris.wailes@gmail.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189866 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-parsing.cpp
caa5ab264ddea332e8423af1ebcea50d0cb37206 03-Sep-2013 Aaron Ballman <aaron@aaronballman.com> Switched FormatAttr to using an IdentifierArgument instead of a StringArgument since that is a more accurate modeling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189851 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-attr-print.cpp
0e8534efc3c536795ede0128aed86a6b8ad53ab7 03-Sep-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: add return_typestate attribute.
Patch by chris.wailes@gmail.com

Functions can now declare what state the consumable type the are returning will
be in. This is then used on the caller side and checked on the callee side.
Constructors now use this attribute instead of the 'consumes' attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189843 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
9a96de74d82abf520a8d65c38fb216e8a40c7bb2 31-Aug-2013 Richard Trieu <rtrieu@google.com> The diagnostic err_init_conversion_failed uses the enum
InitializedEntity::EntityKind as an index for one of its %select. Over time,
EntityKind has been expanded, but the diagnostic text has not been updated.
This adds additional text to the %select to cover the new enum values. A
comment has been added to the end of the enum regarding this situation. This
fixes the crasher in PR17043.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189716 91177308-0d34-0410-b5e6-96231b3b80d8
rr_init_conversion_failed.cpp
c55bee6e278d888d7a5d29fc17df6a9ae1e8b7d3 31-Aug-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: add 'consumable' class attribute.
Patch by chris.wailes@gmail.com

Adds the 'consumable' attribute that can be attached to classes. This replaces
the previous method of scanning a class's methods to see if any of them have
consumed analysis attributes attached to them. If consumed analysis attributes
are attached to methods of a class that isn't marked 'consumable' a warning
is generated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189702 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
4252598a2e58c3f74027511f535ed327f9b32b77 30-Aug-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: track function parameters.
Patch by chris.wailes@gmail.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189616 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
d324a0bcda2754c6fe0b5e27ad50e42850d498c4 29-Aug-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: non-const methods no longer transfer an object into an
unknown state. Patch by chris.wailes@gmail.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189612 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
b7dc1f5f30e1e46e44389b036d48f9614cfd5fe3 29-Aug-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: improve handling of conditionals.
Patch by chris.wailes@gmail.com.

* The TestedVarsVisitor was folded into the ConsumedStmtVisitor.
* The VarTestResult class was updated to allow these changes.
* The PropagationInfo class was updated for the same reasons.
* Correctly handle short-circuiting of Boolean operations.
* Blocks are now marked as unreachable when we can statically prove we will
never branch to them.
* Unreachable blocks are skipped by the analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189594 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
9d57b8dea3b139dc2e2976ffccef50c74ac03873 29-Aug-2013 David Majnemer <david.majnemer@gmail.com> Sema: Subst type default template args earlier

Summary:
We would not perform substitution at an appropriate point, allowing strange
results to appear. We would accepts things that we shouldn't or mangle things incorrectly. Note that this hasn't fixed the other cases like
template-template parameters or non-type template parameters.

Reviewers: doug.gregor, rjmccall, rsmith

Reviewed By: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1507

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189540 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
3f93d4ce2ba550f1dac4ae544ffe1349e42f708a 28-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Improve error for assignment to incomplete class.

PR7681.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189510 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
ef072033876e295ec5d3402f8730a3ae358ad815 28-Aug-2013 Reid Kleckner <reid@kleckner.net> Delete CC_Default and use the target default CC everywhere

Summary:
Makes functions with implicit calling convention compatible with
function types with a matching explicit calling convention. This fixes
things like calls to qsort(), which has an explicit __cdecl attribute on
the comparator in Windows headers.

Clang will now infer the calling convention from the declarator. There
are two cases when the CC must be adjusted during redeclaration:
1. When defining a non-inline static method.
2. When redeclaring a function with an implicit or mismatched
convention.

Fixes PR13457, and allows clang to compile CommandLine.cpp for the
Microsoft C++ ABI.

Excellent test cases provided by Alexander Zinenko!

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D1231

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189412 91177308-0d34-0410-b5e6-96231b3b80d8
alling-conv-compat.cpp
ecl-microsoft-call-conv.cpp
irtual-override-x86.cpp
15b2674896371ac2a0fe707b538a1a29dec9d8e4 26-Aug-2013 Wei Pan <wei.pan@intel.com> Handle predefined expression for a captured statement

- __func__ or __FUNCTION__ returns captured statement's parent
function name, not the one compiler generated.

Differential Revision: http://llvm-reviews.chandlerc.com/D1491

Reviewed by bkramer



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189219 91177308-0d34-0410-b5e6-96231b3b80d8
redefined-expr.cpp
9e8bd1dc1bb519357188af1390bde360ce002125 23-Aug-2013 DeLesley Hutchins <delesley@google.com> Consumed analysis: change class name in test cases.

The name of a class used in the testing files was updated to actually
be descriptive. Patch by chris.wailes@gmail.com.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189132 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
8ef1b372b4a13e79ac827b15635cd0fe08170189 23-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Reword a diagnostic to avoid a confusing implication that it might be talking
about a declaration within a return type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189083 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
ested-name-spec.cpp
5fdd207ec8f4c1f58bd74f8a84ce1935487563ce 22-Aug-2013 DeLesley Hutchins <delesley@google.com> Update to consumed analysis.

Patch by chris.wailes@gmail.com. The following functionality was added:

* The same functionality is now supported for both CXXOperatorCallExprs and CXXMemberCallExprs.
* Factored out some code in StmtVisitor.
* Removed variables from the state map when their destructors are encountered.
* Started adding documentation for the consumed analysis attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189059 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis.cpp
b9377d373bad7a0d76924551474665cc1fa01555 22-Aug-2013 Larisse Voufo <lvoufo@google.com> Add a constexpr functionality test for static data member templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188975 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_in_class.cpp
567f917df048d42732997a479b2b257403fc88ef 22-Aug-2013 Larisse Voufo <lvoufo@google.com> Refactor for clarity and simplicity.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188974 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_in_class.cpp
xx1y-variable-templates_top_level.cpp
04592e7c1260a6a671a24d91dab16f5d5a024fe0 22-Aug-2013 Larisse Voufo <lvoufo@google.com> Improve support for static data member templates. This revision still has at least one bug, as it does not respect the variable template specialization hierarchy well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188969 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_in_class.cpp
24146975f1af8c1b4b14e8545f218129d0e7dfeb 22-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Split isFromMainFile into two functions.

Basically, isInMainFile considers line markers, and isWrittenInMainFile
doesn't. Distinguishing between the two is useful when dealing with
files which are preprocessed files or rewritten with -frewrite-includes
(so we don't, for example, print useless warnings).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188968 91177308-0d34-0410-b5e6-96231b3b80d8
arn-using-namespace-in-header.cpp
f96df620402f41ce9f1a97c0d286c2b42637d5b9 21-Aug-2013 Nick Lewycky <nicholas@mxc.ca> Fix the end sourcelocation of the call expression in a member access when
recovering by adding empty parenthesis. Fixes PR16676!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188920 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
28bdbf0861fefb33474fddbda1d3c66ee29be2af 21-Aug-2013 Benjamin Kramer <benny.kra@googlemail.com> Sema: Use the right type for PredefinedExpr when it's in a lambda.

1. We now print the return type of lambdas and return type deduced functions
as "auto". Trailing return types with decltype print the underlying type.
2. Use the lambda or block scope for the PredefinedExpr type instead of the
parent function. This fixes PR16946, a strange mismatch between type of the
expression and the actual result.
3. Verify the type in CodeGen.
4. The type for blocks is still wrong. They are numbered and the name is not
known until CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188900 91177308-0d34-0410-b5e6-96231b3b80d8
redefined-expr.cpp
37aa0f7ca567128fb00f88ceb4a7c229833f257e 21-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> If we find an error in the range expression in a range-based for loop, and the
loop variable has a type containing 'auto', set the declaration to be invalid
(because we couldn't deduce its type) to prevent follow-on errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188853 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-crashes.cpp
or-range-examples.cpp
556ef7f8b833d20caf31b80f8c1b5cad2e32ef10 20-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16727: don't try to evaluate a potentially value-dependent expression when
checking for missing parens in &&/|| expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188716 91177308-0d34-0410-b5e6-96231b3b80d8
arentheses.cpp
2d67097ad41f4c2fe82ebce3f587e06498f1bd71 17-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor all diagnosing of TypoCorrections through a common function, in
preparation for teaching this function how to diagnose a correction that
includes importing a module.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188602 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
29535baf2a2bd1d92b8a80992164ea815dda16b3 17-Aug-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't reject attribute used in an "extern const" variable definition.

Before this patch we would warn and drop the attribute in
extern const char test3[] __attribute__((used)) = "";

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188588 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-used.cpp
6b725d120b6b068d9ec3a224133b21c55b5e8bef 16-Aug-2013 DeLesley Hutchins <delesley@google.com> Thread safety analysis: new test case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188571 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
2f835ca26aad970be44227d40269db45e73d0a08 16-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Don't allow unary negation on scoped enums.

PR16900.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188511 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
7336b9f8c0b58550a74c85a64f06d0fd74e7ad0d 16-Aug-2013 DeLesley Hutchins <delesley@google.com> Thread Safety Analysis: fix bug when using TryLock with && and || expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188505 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
37e849ad80731ac1b2ad1c64e73bced27802bd8b 14-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16875: The return type of a dependent function type is visible when it's
referenced as a member of the current instantiation. In that case, deduce the
type of the function to a dependent type rather than exposing an undeduced auto
type to the rest of the current instantiation.

The standard doesn't really say that the type is dependent in this case; I'll
bring this up with CWG.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188410 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
933c66b6956e91ef9017b28dd499b317aba83b7b 14-Aug-2013 Larisse Voufo <lvoufo@google.com> Bug fix: note diagnosis on expression narrowing should say "variable template" instead of "static data member" when appropriate

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188409 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_top_level.cpp
4a91989b2dc901a4998fa5443aeba0276a8cfaa6 14-Aug-2013 Larisse Voufo <lvoufo@google.com> Bug fix: disallow a variable template to be redeclared as a non-templated variable

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188350 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_top_level.cpp
72a36a14b10c18bc72bf0472dc29e86327615c26 14-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't produce duplicate notes if we have deduction failure notes when resolving
the address of an overloaded function template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188334 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function-casting.cpp
xx1y-deduced-return-type.cpp
c99b90edb85ea0a5be6ce567a8c0147b76534e15 14-Aug-2013 Eli Friedman <eli.friedman@gmail.com> sizeof(void) etc. should be a hard error in C++.

PR16872.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188324 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
ttr-cxx0x.cpp
cl_ambig_res.cpp
dd9459f8869f66409f7ea429053b453e33f6499c 13-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix implementation of C11 6.2.7/4 and C++11 [dcl.array]p3:

When a local extern declaration redeclares some other entity, the type of that
entity is merged with the prior type if the prior declaration is visible (in C)
or is declared in the same scope (in C++).

- Make LookupRedeclarationWithLinkage actually work in C++, use it in the right
set of cases, and make it track whether it found a shadowed declaration.
- Track whether we found a declaration in the same scope (for C++) including
across serialization and template instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188307 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
439d665f4d1066ee5ebd8dd0938d85be83d490c4 13-Aug-2013 Larisse Voufo <lvoufo@google.com> variable templates updated for PCH serialization... Still working on test cases...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188249 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-variable-templates_top_level.cpp
42acc0c357557574514814863cab950f23cbff5e 12-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Fix pretty-printing for unnamed unions.

This is just a couple of minor fixes to account for the existence
of ElaboratedType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188209 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
a03c5eee51439b4d4d891284126831d10972e05c 12-Aug-2013 Eli Friedman <eli.friedman@gmail.com> Fix crash w/BlockDecl and invalid qualified decl.

I'm not really satisfied with the ad-hoc nature of
Sema::diagnoseQualifiedDeclaration, but I'm not sure how to fix it.

Fixes <rdar://problem/14639501>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188208 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
df7bef07eebd5c7913e8be09c62a6a470f255fd2 12-Aug-2013 DeLesley Hutchins <delesley@google.com> Patch by Chris Wailes <chris.wailes@gmail.com>.
Reviewed by delesley, dblaikie.

Add the annotations and code needed to support a basic 'consumed' analysis.

Summary:
This new analysis is based on academic literature on linear types. It tracks
the state of a value, either as unconsumed, consumed, or unknown. Methods are
then annotated as CallableWhenUnconsumed, and when an annotated method is
called while the value is in the 'consumed' state a warning is issued. A value
may be tested in the conditional statement of an if-statement; when this occurs
we know the state of the value in the different branches, and this information
is added to our analysis. The code is still highly experimental, and the names
of annotations or the algorithm may be subject to change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188206 91177308-0d34-0410-b5e6-96231b3b80d8
arn-consumed-analysis-strict.cpp
arn-consumed-analysis.cpp
arn-consumed-parsing.cpp
62f675cf69ca52c163fd9c0564d84356bb7ffca1 10-Aug-2013 Serge Pavlov <sepavloff@gmail.com> Avoid spurious error messages if parent template class cannot be instantiated

Differential Revision: http://llvm-reviews.chandlerc.com/D924


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188133 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
7ea491cd10c4ea5bf54b9dc15a07ff49cc8a44c6 09-Aug-2013 Richard Trieu <rtrieu@google.com> Fix for PR16570: when comparing two function pointers, discard qualifiers when
comparing non-reference function parameters. The qualifiers don't matter for
comparisons.

This is a re-commit of r187769, which was accidentially reverted in r187770,
with a simplification at the suggestion of Eli Friedman.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188112 91177308-0d34-0410-b5e6-96231b3b80d8
unction-pointer-arguments.cpp
1c56c9d9c2eed9ade88afe93541cc6fd25932355 08-Aug-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix alignof computation of large arrays on x86_64.

We were exposing the extra alignment given to large arrays. The new behavior
matches gcc, which is a good thing since this is a gcc extension.

Thanks to Joerg Sonnenberger for noticing it.

While at it, centralize the method description in the .h file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187999 91177308-0d34-0410-b5e6-96231b3b80d8
lignof.cpp
f58443e4740539ef211f4da01be2160b2c91e1c3 08-Aug-2013 Richard Trieu <rtrieu@google.com> Split the deprecated increment bool warning into a sub-group of -Wdeprecated
so that it can be toggled independently of other deprecated warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187958 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
fbbdc5daee4dc772d4d137080890fd79492592d6 08-Aug-2013 Richard Trieu <rtrieu@google.com> Emit an error for enum increments and decrements in C++ mode.
Fixes PR16394.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187955 91177308-0d34-0410-b5e6-96231b3b80d8
num-increment.cpp
acdbbc7811c6045a718669a8a0740488edbbbd66 06-Aug-2013 Richard Trieu <rtrieu@google.com> Add a new warning to -Wloop-analysis to detect suspicious increments or
decrements inside for loops. Idea for this warning proposed in PR15636:

http://llvm.org/bugs/show_bug.cgi?id=15636


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187817 91177308-0d34-0410-b5e6-96231b3b80d8
arn-loop-analysis.cpp
3835a4ef050da466038844274d79f1fc9d77c0f1 06-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16755: When initializing or modifying a bitfield member in a constant
expression, truncate the stored value to the size of the bitfield.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187782 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
3151b7c6dd49947b0a91b3e22c31f4864629e355 06-Aug-2013 Larisse Voufo <lvoufo@google.com> Fixing commit r187768: Moved diagnosis of forward declarations of variable templates from Parser to Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187770 91177308-0d34-0410-b5e6-96231b3b80d8
unction-pointer-arguments.cpp
1a81e74903cf4f24bf0c4921fc86727e66994e5a 06-Aug-2013 Richard Trieu <rtrieu@google.com> Fix for PR16570: when comparing two function pointers, discard qualifiers when
comparing non-reference function parameters. The qualifiers don't matter for
comparisons.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187769 91177308-0d34-0410-b5e6-96231b3b80d8
unction-pointer-arguments.cpp
ef4579cda09b73e3d4d98af48201da25adc29326 06-Aug-2013 Larisse Voufo <lvoufo@google.com> Started implementing variable templates. Top level declarations should be fully supported, up to some limitations documented as FIXMEs or TODO. Static data member templates work very partially. Static data member templates of class templates need particular attention...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187762 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
xx1y-variable-templates_in_class.cpp
xx1y-variable-templates_top_level.cpp
xx98-compat.cpp
or-range-examples.cpp
nknown-type-name.cpp
0e2189791acf7fcec4f1b32af24efb2d363f30c1 05-Aug-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++'s restrictions on the type of an expression passed to a vararg
function: it can't be 'void' and it can't be an initializer list. We give a
hard error for these rather than treating them as undefined behavior (we can
and probably should do the same for non-POD types in C++11, but as of this
change we don't).

Slightly rework the checking of variadic arguments in a function with a format
attribute to ensure that certain kinds of format string problem (non-literal
string, too many/too few arguments, ...) don't suppress this error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187735 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings-0x.cpp
8b051ce94e59c37cfe09e34fe2bf15c037cbbdb3 05-Aug-2013 David Majnemer <david.majnemer@gmail.com> Sema: Don't assume a nested name specifier holds a type

Sema::PerformObjectMemberConversion assumed that the Qualifier it was
given holds a type. However, the specifier could hold just a namespace.
In this case, we should ignore the qualifier and not attempt to cast to
it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187715 91177308-0d34-0410-b5e6-96231b3b80d8
r13394-crash-on-invalid.cpp
789d82a568264543410a3bf0c2c431ccc11d5d1d 01-Aug-2013 Arnaud A. de Grandmaison <arnaud.adegm@gmail.com> Check dynamic_cast is not used with -fno-rtti, unless it is a noop or can be resolved statically.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187564 91177308-0d34-0410-b5e6-96231b3b80d8
o-rtti.cpp
c66e7e99d5acc560de5cea50909fcea22ef12ca5 31-Jul-2013 Reid Kleckner <reid@kleckner.net> Fix declaring class template methods with an attributed typedef

This change unifies the logic for template instantiation of methods and
functions declared with typedefs.

It ensures that SubstFunctionType() always fills the Params out param
with non-null ParmVarDecls or returns null.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D1135

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187528 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-microsoft-call-conv.cpp
c14e6dda1e1287d3e0aeaa0e8f7bb2c9126f312c 31-Jul-2013 Kaelyn Uhrain <rikka@google.com> A few small cleanups to r187504. Thanks to dblaikie for the assist.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187521 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
baaeb85f07640794f6a4fabb871e33deeab07df2 31-Jul-2013 Kaelyn Uhrain <rikka@google.com> Improve the diagnostic experience, including adding recovery, for
changing '->' to '.' when there is no operator-> defined for a class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187504 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
89310785fe44470da0c1c1eefa54ad9c6dae8e78 31-Jul-2013 Richard Trieu <rtrieu@google.com> Fix a crasher than manifests when typo correction suggests a function template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187467 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction-pt2.cpp
9f939f75c64770c746d78579f75a49f9c657e426 30-Jul-2013 Aaron Ballman <aaron@aaronballman.com> Replacing err_attribute_argument_not_int with err_attribute_not_type_attr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187419 91177308-0d34-0410-b5e6-96231b3b80d8
nit-priority-attr.cpp
2437c8642da2728aab47262ffb74dfa796a1cf35 27-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Don't build expressions for invalid casts.

This matches how we normally perform semantic analysis for other sorts
of invalid expressions: it means we don't have to reason about invalid
sub-expressions.

Fixes PR16680.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187276 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
14d937afc2ad8f65dccbafeb62271e80dbd46a78 27-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Handle a difference in lambda return type deduction between C++11 and C++1y: if
no return type is specified, C++11 will deduce a cv-qualified return type in
some cases, but C++1y never will.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187275 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
ec0808decc682f76e411eed7206a82a34b87dd7d 27-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16708: If a lambda has an implicit return type, don't get confused if its return type has already been determined to be a type containing an 'auto'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187266 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
f221d161ae559ca0395fa5920c36c4c4a688e380 25-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add another C++14 constexpr test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187096 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-duffs-device.cpp
03ce5f8c68f55405db6001e82bdb18581d0dadce 24-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: track object lifetime during constexpr evaluation, and don't allow
objects to be used once their lifetimes end. This completes the C++1y
constexpr extensions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@187025 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
-c-e-cxx.cpp
baec77865b3ce64bb942dddc5dc2fada84ce5099 23-Jul-2013 Aaron Ballman <aaron@aaronballman.com> Added the attribute name to the err_attribute_wrong_number_arguments diagnostic for clarity; updated almost all of the affected test cases.

Thanks to Fariborz Jahanian for the suggestion!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186980 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-no-sanitize-address.cpp
ttr-no-sanitize-memory.cpp
ttr-no-sanitize-thread.cpp
nit-priority-attr.cpp
arn-thread-safety-parsing.cpp
437d43fa2c8e338de3285f4028f0578ddd1b8f80 23-Jul-2013 Aaron Ballman <aaron@aaronballman.com> Consolidate several attribute argument diagnostics into a single, selectable diagnostic. This makes the diagnostic more consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186940 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
4ac537b0f07f2efb9fcf081f60d54e6cfb1cf2d5 23-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y literal suffix support:
* Allow ns, us, ms, s, min, h as numeric ud-suffixes
* Allow s as string ud-suffix


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186933 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-user-defined-literals.cpp
df88082fd50a0eb6ab2a4f21ed6c4df005700ec8 23-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Testcase for PR16673.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186891 91177308-0d34-0410-b5e6-96231b3b80d8
arn-logical-not-compare.cpp
cbc820af7193e3ad9c71fbe6e3c8bd3c1166e540 22-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR257 / fix PR16659:
A constructor for an abstract class does not call constructors for virtual
base classes, so it is not an error if no initializer is present for the
virtual base and the virtual base cannot be default initialized.

Also provide a (disabled by default, for now) warning for the case where a
virtual base class's initializer is ignored in an abstract class's constructor,
and address a defect in DR257 where it was not carried through to C++11's rules
for implicit deletion of special member functions.

Based on a patch by Maurice Bos.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186803 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
81e4549fede62835235a53c024909c3fab6b73ac 21-Jul-2013 Lubos Lunak <l.lunak@suse.cz> report unused-value warning also for warn_unused types



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186793 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-value.cpp
cfc57085a6eb8036d29164d4294cd95853ee1182 20-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add missing check for creating an instance of an abstract class through an
implicit conversion sequence.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186769 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
cbec59a267d8d6c402c6b0206e36dca091fc9ae4 20-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Undisable a test for a c++98-compat warning for inheriting constructors now that we implement them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186768 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
1d3ce65c190ef287ae3fa7bdff7f3621fd53b151 20-Jul-2013 Lubos Lunak <l.lunak@suse.cz> add type attribute warn_unused, for -Wunused-variable warnings (pr#14253)

The functionality is equivalent to the GCC attribute. Variables of tagged
types will be warned about as unused if they are not used in any way
except for possible (even non-trivial) ctors/dtors called. Useful for tagging
classes like std::string (which is not part of this commit).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186765 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-attribute.cpp
654005265b1faab223f055bff3dd254476df7ff5 20-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix bug in computing POD-for-layout.

A class with a field of non-POD-for-layout type is not POD-for-layout.
This computation should not depend on whether the field is of POD type
in the language sense.

Fixes PR16537.

Patch by Josh Magee.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186741 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
4384712b3a0aedd7c68d6abdb0407850f7b46c8b 20-Jul-2013 Larisse Voufo <lvoufo@google.com> FIXME fix: improving diagnostics for template arguments deduction of class templates and explicit specializations
This patch essentially removes all the FIXMEs following calls to DeduceTemplateArguments() that want to keep track of deduction failure info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186730 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function-casting.cpp
xx1y-deduced-return-type.cpp
8c5d4078bb40642847164e7613828262d32db973 20-Jul-2013 Larisse Voufo <lvoufo@google.com> Revert "Use function overloading instead of template specialization for diagnosis of bad template argument deductions."

This reverts commit a730f548325756d050d4caaa28fcbffdae8dfe95.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186729 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function-casting.cpp
xx1y-deduced-return-type.cpp
a730f548325756d050d4caaa28fcbffdae8dfe95 20-Jul-2013 Larisse Voufo <lvoufo@google.com> Use function overloading instead of template specialization for diagnosis of bad template argument deductions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186727 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function-casting.cpp
xx1y-deduced-return-type.cpp
22050f25e34ba0cd21ee2dc3d765951c48e27cde 18-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Reinstate r186040, with additional fixes and more test coverage (reverted in
r186331).

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186546 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
9a3ecb015448dad705829b683f2392cfda80fc13 17-Jul-2013 Reid Kleckner <reid@kleckner.net> MS wide bitfield error check in Sema

cl.exe treats wide bitfields as an error. This patch causes them to be
an error if IsMsStruct is true, as it is in straight C.

Patch by Warren Hunt!

Reviewers: eli.friedman

Differential Revision: http://llvm-reviews.chandlerc.com/D1125

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186536 91177308-0d34-0410-b5e6-96231b3b80d8
s_wide_bitfield.cpp
21cde050b64eefbb5094af67985752eee42d00e2 17-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Make Expr::isConstantInitializer match IRGen.

Sema needs to be able to accurately determine what will be
emitted as a constant initializer and what will not, so
we get accurate errors in C and accurate -Wglobal-constructors
warnings in C++. This makes Expr::isConstantInitializer match
CGExprConstant as closely as possible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186464 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
5029bd518b4d5363ceb049c9162c30e5b38ba199 16-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix alignment of class derived from empty class.

The record layout code didn't properly take into account that
an empty class at offset 0 can have an alignment greater than 1.

Patch by Andrea Di Biagio.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186370 91177308-0d34-0410-b5e6-96231b3b80d8
lignment-of-derived-class.cpp
bf03b375d887403e78837c9453fbad45efaef91d 16-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix member refs with using decl + anonymous union.

Make sure we call BuildFieldReferenceExpr with the appropriate decl
when a member of an anonymous union is made public with a using decl.
Also, fix a crash on invalid field access into an anonymous union.

Fixes PR16630.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186367 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
3d882faf18532a94aa3c10881ec45aff14fa7336 15-Jul-2013 Kaelyn Uhrain <rikka@google.com> Fix a typo in the diagnostic note added in r186342.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186348 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
d4224347be04594788fc0f26dff7d2c2cc90851e 15-Jul-2013 Kaelyn Uhrain <rikka@google.com> Move the "->" to "." fixit from r186128 into a separate note since
recovery is not attempted with the fixit. Also move the associated test
case from FixIt/fixit.cpp to SemaCXX/member-expr.cpp since the fixit is
no longer automatically applied.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186342 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
52c2575fc77a51f36129be89d1a0a90e31617a57 15-Jul-2013 Chandler Carruth <chandlerc@gmail.com> Re-revert r86040, which was un-reverted in r186199.

This breaks the build of basic patterns with repeated friend
declarations. See the added test case in SemaCXX/friend.cpp or the test
case reported to the original commit log.

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186331 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
f9e65a274d4e5c5a45503efc81da43be76503983 12-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r186040, reverted in r186185, with fix for PR16597.

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186199 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
1afa611e36e0ab23dd3cde4bbe5aa74ceb7d77c5 12-Jul-2013 Chandler Carruth <chandlerc@gmail.com> Revert r186040 to fix PR16597 while Richard investigates what the best
fix is.

Original commit log:
If we friend a declaration twice, that should not make it visible to
name lookup in the surrounding context. Slightly rework how we handle
friend declarations to inherit the visibility of the prior
declaration, rather than setting a friend declaration to be visible
whenever there was a prior declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186185 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
fcb5a251e9c0c8c2d54323677d4f2ba5219301d0 12-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix crash on zero-argument assignment operator.

Make sure we don't crash when checking whether an assignment operator
without any arguments is a special member. <rdar://problem/14397774>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186137 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
cf2901abf346c64792e3beb1e7dfeecff0b313f7 12-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Make CXXBaseSpecifier::getType return unqual type.

Various pieces of code, like base initialization in Sema and RTTI IRGen,
don't properly ignore qualifiers on base classes. Instead of auditing the
whole codebase, just strip them off in the getter. (The type as written is
still available in the TypeSourceInfo for code that cares.)

Fixes PR16596.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186125 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
5154dce6388e3aaa445467030df7a45ed1211abe 11-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a __builtin_addressof that performs the same functionality as the built-in
& operator (ignoring any overloaded operator& for the type). The purpose of
this builtin is for use in std::addressof, to allow it to be made constexpr;
the existing implementation technique (reinterpret_cast to some reference type,
take address, reinterpert_cast back) does not permit this because
reinterpret_cast between reference types is not permitted in a constant
expression in C++11 onwards.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186053 91177308-0d34-0410-b5e6-96231b3b80d8
uiltins.cpp
433a13d0cdb1c48b828fe5bfb6a835c58e1e758b 11-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> If we friend a declaration twice, that should not make it visible to name
lookup in the surrounding context. Slightly rework how we handle friend
declarations to inherit the visibility of the prior declaration, rather
than setting a friend declaration to be visible whenever there was a prior
declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186040 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
0daf1f4a0ff1cd6487c7040ac8f97eee48185536 10-Jul-2013 Kaelyn Uhrain <rikka@google.com> Offer typo suggestions for 'using' declarations.

Patch courtesy of Luke Zarko <zarko@google.com>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186019 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
d739c4ecf7d7f2222f6f1c8de9e234d1c8a0468c 09-Jul-2013 Eli Friedman <eli.friedman@gmail.com> Fix crash typo-correcting dependent member func.

PR16561.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185887 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
6c4898b6ff23950cddca6948ef3fa0dd1848f6f1 09-Jul-2013 Kaelyn Uhrain <rikka@google.com> Attempt typo correction for function calls with the wrong number of arguments.

Combined with typo correction's new ability to apply global/absolute nested
name specifiers to possible corrections, cases such as in PR12287 where the
desired function is being shadowed by a lexically closer function with the
same name but a different number of parameters will now include a FixIt.

On a side note, since the test for this change caused
test/SemaCXX/typo-correction.cpp to exceed the typo correction limit for
a single file, I've included a test case for exceeding the limit and added
some comments to both the original and part two of typo-correction.cpp
warning future editors of the files about the limit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185881 91177308-0d34-0410-b5e6-96231b3b80d8
efault1.cpp
ypo-correction-pt2.cpp
ypo-correction.cpp
96e7813f08c6adf1d8657b0da86741b54e850fd7 04-Jul-2013 Rafael Espindola <rafael.espindola@gmail.com> Add 'not' to commands that are expected to fail.

This is at least good documentation, but also opens the possibility of
using pipefail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185652 91177308-0d34-0410-b5e6-96231b3b80d8
mbiguous-conversion-show-overload.cpp
onstexpr-backtrace-limit.cpp
truct-class-redecl.cpp
arn-reinterpret-base-class.cpp
14b7673b341c0c9edc719754b9c2faafac21fe36 04-Jul-2013 Richard Trieu <rtrieu@google.com> Improve -Wlogical-not-parentheses to catch when the not is applied to an enum.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185602 91177308-0d34-0410-b5e6-96231b3b80d8
arn-logical-not-compare.cpp
b2567ddad9a1142d7224e5363029d640e8f4f59d 03-Jul-2013 Kaelyn Uhrain <rikka@google.com> Allow typo correction to try removing nested name specifiers.

The removal is tried by retrying the failed lookup of a correction
candidate with either the MemberContext or SS (CXXScopeSpecifier) or
both set to NULL if they weren't already. If the candidate identifier
is then looked up successfully, make a note in the candidate that the
SourceRange should include any existing nested name specifier even if
the candidate isn't adding a different one (i.e. the candidate has a
NULL NestedNameSpecifier).

Also tweak the diagnostic messages to differentiate between a suggestion
that just replaces the identifer but leaves the existing nested name
specifier intact and one that replaces the entire qualified identifier,
in cases where the suggested replacement is unqualified.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185487 91177308-0d34-0410-b5e6-96231b3b80d8
r13394-crash-on-invalid.cpp
caa16dd469b6f7bfb5bce05afd8772f5d4196322 03-Jul-2013 Kaelyn Uhrain <rikka@google.com> Look for corrections in enclosing namespaces that require a global NestedNameSpecifier.

CorrectTypo will now see and consider those corrections that are effectively
shadowed by other declarations in a closer context when resolved via an
unqualified lookup. This involves adding any parent namespaces to the set of
namespaces as fully-qualified name specifiers, and also adding potential
corrections that passed name lookup but were rejected by the given
CorrectionCandidateCallback into the set of failed corrections that should be
tried with the set of namespace specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185486 91177308-0d34-0410-b5e6-96231b3b80d8
r13394-crash-on-invalid.cpp
ypo-correction.cpp
3c3af140263c3761665aa2c0aac4266115f5caf1 01-Jul-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16502: Fix a dumb bug where we might look past the last initializer in an
InitListExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185304 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-init-ref.cpp
0c0b3909d11de7440d77556089516918b9c04cef 30-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Teach -Wunsequenced that the side-effects of a function evaluation are sequenced
before the value computation of the result. In C, this is implied by there being
a sequence point after their evaluation, and in C++, it's implied by the
side-effects being sequenced before the expressions and statements in the
function body.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185282 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unsequenced.cpp
aa4bc18240c03b5ed7952aa5e013c081f8733ed3 30-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Reinstate r185229, reverted in r185256, with a tweak: further ignore the
standard's rule that an extern "C" declaration conflicts with any entity in the
global scope with the same name. Now we only care if the global scope entity is
a variable declaration (and so might have the same mangled name as the extern
"C" declaration). This has been reported as a standard defect.

Original commit message:

PR7927, PR16247: Reimplement handling of matching extern "C" declarations
across scopes.

When we declare an extern "C" name that is not a redeclaration of an entity in
the same scope, check whether it redeclares some extern "C" entity from another
scope, and if not, check whether it conflicts with a (non-extern-"C") entity in
the translation unit.

When we declare a name in the translation unit that is not a redeclaration,
check whether it conflicts with any extern "C" entities (possibly from other
scopes).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185281 91177308-0d34-0410-b5e6-96231b3b80d8
xtern-c.cpp
riend.cpp
inkage-spec.cpp
inkage2.cpp
6e428a446ed7cc170346430afa7be54e83b2d28c 29-Jun-2013 Timur Iskhodzhanov <timurrrr@google.com> Revert r185229 as it breaks compilation of <windows.h>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185256 91177308-0d34-0410-b5e6-96231b3b80d8
xtern-c.cpp
riend.cpp
inkage-spec.cpp
inkage2.cpp
5eab8d733ce7867fda4e6d5f5afa6dfe8a105c79 29-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR7927, PR16247: Reimplement handling of matching extern "C" declarations
across scopes.

When we declare an extern "C" name that is not a redeclaration of an entity in
the same scope, check whether it redeclares some extern "C" entity from another
scope, and if not, check whether it conflicts with a (non-extern-"C") entity in
the translation unit.

When we declare a name in the translation unit that is not a redeclaration,
check whether it conflicts with any extern "C" entities (possibly from other
scopes).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185229 91177308-0d34-0410-b5e6-96231b3b80d8
xtern-c.cpp
riend.cpp
inkage-spec.cpp
inkage2.cpp
5fb478be9b91f15624e855e7bd6ac2101021ac48 28-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Fix error recovery with in-class initializer.

Previously, for a field with an invalid in-class initializer, we
would create a CXXDefaultInitExpr referring to a null Expr*.
This is not a good idea.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185216 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
d943352fabd065ce2eaa21f4a550ed2ffa5353ab 27-Jun-2013 Douglas Gregor <dgregor@apple.com> Under -fms-extensions, only inject a friend tag name when we didn't see a tag with that name in an enclosing scope.

r177473 made us correctly consider only those declarations in the
enclosing namespace scope when looking for a friend declaration. Under
ms-extensions mode, where we do some level of friend injection, this
meant that we were introducing a new tag type into a different scope
than what Microsoft actually does. Address this by only doing the
friend injection when we didn't see any tag with that name in any
outer scope. Fixes <rdar://problem/14250378>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185100 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
7419d013fd2c4dda596066f4864d5c40e85ba330 27-Jun-2013 Larisse Voufo <lvoufo@google.com> Fix a conversion to incomplete type bug -- The error message now specifically states that the type is incomplete and points to the forward declaration of the incomplete type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185056 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-incomplete-type.cpp
418dd3eb3e813235af089b5c88182941f8a03d20 27-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16467: Teach -Wunsequenced that in C11 (unlike C++11), an assignment's
side-effect is not sequenced before its value computation. Also fix a
mishandling of ?: expressions where the condition is constant that was
exposed by the tests for this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185035 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unsequenced.cpp
b4f0f3f3f7adcbaf1cd56e53ddb7af92afba2c58 26-Jun-2013 Aaron Ballman <aaron@aaronballman.com> This patch fixes PR16395, when HandleMSProperty returns null due to a declaration with no name.

Patch thanks to Robert Wilhelm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185022 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
cd06f26835033e879a9278941f4f6e6a4086976d 26-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Rewrite record layout for ms_struct structs.

The old implementation of ms_struct in RecordLayoutBuilder was a
complete mess: it depended on complicated conditionals which didn't
really reflect the underlying logic, and placed a burden on users of
the resulting RecordLayout. This commit rips out almost all of the
old code, and replaces it with simple checks in
RecordLayoutBuilder::LayoutBitField.

This commit also fixes <rdar://problem/14252115>, a bug where class
inheritance would cause us to lay out bitfields incorrectly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185018 91177308-0d34-0410-b5e6-96231b3b80d8
s_struct.cpp
dccd04d8611b9d25fd17444f20566773e657a7e6 26-Jun-2013 Nick Lewycky <nicholas@mxc.ca> Don't check for triviality on fields of templated records. We can't know the
answer until after instantiation. Fixes PR16061!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184890 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-nontrivial-union.cpp
f6a144f5991c6b29622a31fdab86adede0648d12 26-Jun-2013 David Majnemer <david.majnemer@gmail.com> Implement DR136

Friend declarations that specify a default argument must be a definition
and the only declaration in the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184889 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
147fab970c9877273e6185f0e276f376887c967f 26-Jun-2013 Matt Beaumont-Gay <matthewbg@google.com> Don't try to get the layout of an invalid decl in getDeclAlign.

When the decl that we're getting alignment for is a FieldDecl, and the field's
parent record is invalid, skip the actual field alignment calculation (and
return 1-byte alignment in the general case).

Also, assert in in getASTRecordLayout that the decl is valid. This was
inspired by PR16292; see also r184581 and r184751.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184883 91177308-0d34-0410-b5e6-96231b3b80d8
lignof.cpp
db2fe739e5aac227d85d149efc9036696997a26f 25-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> More of N3652: don't add an implicit 'const' to 'constexpr' member functions when checking for overloads in C++1y.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184865 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
12df246d6dea2ee1f92c186f922f1afcf499647a 24-Jun-2013 Reid Kleckner <reid@kleckner.net> [AST] Introduce a new DecayedType sugar node

The goal of this sugar node is to be able to look at an arbitrary
FunctionType and tell if any of the parameters were decayed from an
array or function type. Ultimately this is necessary to implement
Microsoft's C++ name mangling scheme, which mangles decayed arrays
differently from normal pointers.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D1014

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184763 91177308-0d34-0410-b5e6-96231b3b80d8
unction-type-qual.cpp
319957c64a445b6e16bf00054fc4bb88754abfc8 23-Jun-2013 Stephen Lin <stephenwlin@gmail.com> Add null check (resolves PR16423)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184661 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
b1ce9297371b65b3726c09e85aed9781f70bca14 23-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix assert if an attempt is made to explicitly instantiate an alias template.
Patch by Ismail Pazarbasi!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184650 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
e2a90b8bb054fc8de6c115a31bfadf7868bcf0c3 22-Jun-2013 Richard Trieu <rtrieu@google.com> Extend -Wnon-pod-varargs to check calls made from member pointers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184629 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
0538f0e9200df56974b5a71bc276dbce456e9781 22-Jun-2013 Richard Trieu <rtrieu@google.com> Extend -Wnon-pod-varargs to more cases, such as function pointers as return
types and function pointer arrays.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184616 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
c8fa525b5b81eeb7a62294dd3218ca2a6ccf0a6a 22-Jun-2013 David Blaikie <dblaikie@gmail.com> Provide suggested no-arg calls for overloaded member functions missing calls

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184612 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
9b60195ad4843c9e2e231673a0dbc0d5c8c6eb2b 21-Jun-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Destroy temporary record arguments in the callee

Itanium destroys them in the caller at the end of the full expression,
but MSVC destroys them in the callee. This is further complicated by
the need to emit EH-only destructor cleanups in the caller.

This should help clang compile MSVC's debug iterators more correctly.
There is still an outstanding issue in PR5064 of a memcpy emitted by the
LLVM backend, which is not correct for C++ records.

Fixes PR16226.

Reviewers: rjmccall

Differential Revision: http://llvm-reviews.chandlerc.com/D929

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184543 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoft-dtor-lookup.cpp
a80d1b4c5ecf1a93bcf3b1438e0e03cf2ff34b39 21-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix copy-pasted comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184494 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_pointer_return_false_hack.cpp
3e1aca289f56310f20f3d97e154337275adf17a4 21-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Don't allow __attribute__((common)) in C++. PR16330.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184493 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-common.cpp
f462b0152f10eed0b989b07bcf457b6fb0d83bdb 20-Jun-2013 Richard Trieu <rtrieu@google.com> Extend -Wnon-pod-varargs to check calls made from function pointers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184470 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
4cde94a04694d5d24dc9e3bf6c5fa3403629838e 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Clean up warning and add a test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184466 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
f5d40bf94ac1d1d281d50fa12aeb2b7b8d7aaf9d 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Add an additional test for dynamic_cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184454 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic-cast.cpp
c2fa6b6f9a89f55397355937544fbbe8258ead5d 20-Jun-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Improved source code fidelity for gcc mode attribute.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184417 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-print.cpp
xx11-attr-print.cpp
37a84f653c196aa0b73fad96707175a62dcb6a12 20-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16377: Allow evaluation of statement expressions in constant evaluation,
why not. Apparently GCC supports this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184396 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
87c29321c4b819d8a10f362f42fb7f7226820041 20-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a workaround for a libstdc++-4.2 <tr1/hashtable> bug. This header uses

return false;

in a function returning a pointer. 'false' was a null pointer constant in C++98
but is not in C++11. Punch a very small hole in the initialization rules in
C++11 mode to allow this specific case in system headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184395 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_pointer_return_false_hack.cpp
eb82a420c8898ea71e13d82e6646d33f49fc574c 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Add a few more tests for casts.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184392 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
ember-pointer-ms.cpp
ullptr.cpp
896436706037daf3c24e66bb95cb6ef9750a15b0 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Add a testcase which uses an UnresolvedUsingTypenameDecl as the base of an NNS.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184386 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
94d22de7514991e1039b102f899b93e71d8e9bbe 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Fix r184381 so the test doesn't fail. Sorry for the inconvenience, I thought I had checked it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184382 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
c02bea4e807de99dc0690ef814500b6266d9b6c9 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Extra test for diagnostic in Sema::BuildCXXNestedNameSpecifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184381 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
fa0d3f815e6de3f5129572b179b8027c4a3eecde 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Improve diagnostic for redeclaring static member function. Fixes PR16382.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184378 91177308-0d34-0410-b5e6-96231b3b80d8
verload-decl.cpp
d4fbdc7100adfb19aada96714dc8d4bf26ea1aa1 20-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Add missing test for -Wunneeded-member-functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184371 91177308-0d34-0410-b5e6-96231b3b80d8
arn-member-not-needed.cpp
f67129ab204e2884d674075d74e8ffe1f17f67e3 19-Jun-2013 Reid Kleckner <reid@kleckner.net> [Windows] Fix __declspec(property) when the getter returns a ref

This fixes an issue when parsing atlbase.h.

Patch by Will Wilson!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184319 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
3882aed80cbb38e007e4fb80076b400a9a4b8445 19-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix pr16354.

We now reject things like

struct ABC {
static double a;
};
register double ABC::a = 1.0;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184300 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-data-member.cpp
662f41bd9d4bfb4aebaba05e6043a6ff5f0dc2ff 18-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> DR14, DR101, and part of DR1: fix handling of extern "C" declarations in
namespaces, by treating them just like we treat extern "C" declarations in
function scope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184223 91177308-0d34-0410-b5e6-96231b3b80d8
R10447.cpp
xtern-c.cpp
0bb5199941d6058b866afe01956cca36e64cc247 18-Jun-2013 Larisse Voufo <lvoufo@google.com> r184100 Fix -- Updated test cases for contextual conversion

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184165 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-contextual-conversion-tweaks.cpp
xx98-compat-pedantic.cpp
26e51781f9d55cdae764facf8fe773aa2adb4569 17-Jun-2013 Eli Friedman <eli.friedman@gmail.com> Fix Expr::Classify to correctly classify ExtVectorElementExprs. PR16204.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184123 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
b67313d9136559ec0f8cda43550f73399fe2b76a 17-Jun-2013 Rafael Espindola <rafael.espindola@gmail.com> Revert "Updated test cases for contextual conversion"

This reverts commit r184100.

It was faling on some bots:
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/1973/steps/test_clang/logs/Clang%20%3A%3A%20SemaCXX__cxx1y-contextual-conversion-tweaks.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184108 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-contextual-conversion-tweaks.cpp
xx98-compat-pedantic.cpp
37aba4797703ebadbd480b757ce40b81036539bc 17-Jun-2013 Larisse Voufo <lvoufo@google.com> Updated test cases for contextual conversion

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184100 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-contextual-conversion-tweaks.cpp
xx98-compat-pedantic.cpp
9109bf10d50d3b5aa57205db1b8e38a31e3ae477 17-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++11: don't warn about the deprecated 'register' keyword if it's combined with
an asm label.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184069 91177308-0d34-0410-b5e6-96231b3b80d8
eprecated.cpp
58df0426944c1bf8a80b6935bbea3815fc506474 17-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add warning group -Wdeprecated-register for C++11 warning on 'register' being
deprecated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184068 91177308-0d34-0410-b5e6-96231b3b80d8
eprecated.cpp
19707c29ae43e2f8738a3537064c7d4ab1e0ae80 16-Jun-2013 Larisse Voufo <lvoufo@google.com> Fixed one buildbot-failure-causing bug...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184053 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
539470e7d38f71b7a0700e1f1b371e76480cf0a6 15-Jun-2013 Larisse Voufo <lvoufo@google.com> Updated the support for contextual conversion tweaks (n3323) with a previously overlooked part: implicitly converting array sizes to size_t, rather than contextually converting them to some unique type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184048 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
d570a9282fd1793cbf21c090d80cb0b6b4b89982 15-Jun-2013 Faisal Vali <faisalv@yahoo.com> A quick fix to allow return type deduction on member templates
by ensuring DiagnoseUseOfDecl is called both on the found decl and the
decl being used (i.e the specialization in the case of member templates) whenever they are different.
Per the exchange captured in
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130610/081636.html
a more comprehensive fix that allows both decls to be passed into DiagnoseUseOfDecl is (or should be) forthcoming relatively soon.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184043 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
41cb3d90c2114a7df7aa04f80c8be4b62994fb0d 15-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix handling of const_cast from prvalue to rvalue reference: such a cast is
only permitted if the source object is of class type, and should materialize a
temporary for the reference to bind to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184017 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
onstant-expression-cxx11.cpp
6b759f4d3c8bce0fe1f416953ef790c68e7c30b2 14-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Suppress the c++11 -Wdeprecated warning for 'register' if it is expanded from a
macro defined in a system header. glibc uses it in macros, apparently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184005 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/register.h
eprecated.cpp
93f32da079874f70857af42eb9be382f307d4f1e 14-Jun-2013 Chandler Carruth <chandlerc@gmail.com> Fix the warning for divide by zero to be a bit more robust. ;]

Previously, it only ever fired for zeros which formed null pointers.
Now, hilariously, in C++98 this was almost anything. Including tricks
like warning on the divisor in this code:

typedef char c3[3];
size_t f(c3* ptr) {
return (sizeof(ptr) / sizeof(*ptr)) / (size_t)(!(sizeof(ptr) % sizeof(*ptr)));
}

Why the RHS of the outer divide is a null pointer constant is a sordid
tale of sorrow. Anyways, the committee fixed this for C++11 and onward
as part of core isssue 903, and Richard recently implemented this fix
causing the warning to go away here (and elsewhere).

This patch restores the warning here and adds it for numerous other
somewhat obvious gaffes:

int g(int x) {
return x / (int)(0.0);
}

The patch is essentially just using the full power of our constant
folding in Clang to produce the warning, but insisting that it must fold
to an *integer* which is zero so that we don't get false positives
anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183970 91177308-0d34-0410-b5e6-96231b3b80d8
arn-div-or-rem-by-zero.cpp
6698be8a6930730df5e61c941197e72682196187 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix some confusing diagnostic wording. s/implicit default/implicit/ if we're
not actually talking about a default constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183885 91177308-0d34-0410-b5e6-96231b3b80d8
R9572.cpp
efault-assignment-operator.cpp
eprecated.cpp
mplicit-virtual-member-functions.cpp
ew-delete.cpp
irtual-base-used.cpp
irtual-member-functions-key-function.cpp
36155c14b691720ee3e94bfe99886229650bbfb5 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++11: If a class has a user-declared copy operation or destructor, the
implicit definition of a copy operation is deprecated. Add a warning for this
to -Wdeprecated. This warning is disabled by default for now, pending
investigation into how common this situation is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183884 91177308-0d34-0410-b5e6-96231b3b80d8
eprecated.cpp
f050d2445ed75569ccfe0740caa900403d2ce3b3 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement core issue 903: only integer literals with value 0 and prvalues of
type std::nullptr_t are null pointer constants from C++11 onwards.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183883 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
ambda-expressions.cpp
1b2209fd149436c98e73d4b8667b40b5f4b974cd 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> In C++11, promote access declaration diagnostic from warning to error. There
doesn't seem to be any value in even adding a -W flag for this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183882 91177308-0d34-0410-b5e6-96231b3b80d8
eprecated.cpp
79f4bb7aad1b7c53f8a3bc43d89de0efdef8286d 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wdeprecated warnings and fixits for things deprecated in C++11:
- 'register' storage class
- dynamic exception specifications

Only the former check is enabled by default for now (the latter might be quite noisy).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183881 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
eprecated.cpp
4e47ecb6b2e399d2a7cc3a91d1eab9e501c5580f 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> When copy-initializing a temporary for a reference binding, don't allow use of
explicit constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183879 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
7c3e615f01e8f9f587315800fdaf2305ed824568 13-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR12086, PR15117

Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).

This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183872 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
xx0x-initializer-stdinitializerlist.cpp
a4bb99cd0055ba0e1f3107890e5b6cbe31e6d1cc 12-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Move detection of reference members binding to temporaries from building of
CXXCtorInitializers to the point where we perform the questionable lifetime
extension. This exposed a selection of false negatives in the warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183869 91177308-0d34-0410-b5e6-96231b3b80d8
arn-dangling-field.cpp
edcf5112a571e622c88dbd1634867c386425718c 11-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a testcase for PR7434, which is a bug we no longer appear to have.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183787 91177308-0d34-0410-b5e6-96231b3b80d8
ccess.cpp
2ec2b8459392f3f2f00d816b40e73113d444d838 11-Jun-2013 David Majnemer <david.majnemer@gmail.com> Implement DR85: Redeclaration of member is forbidden

Disallow the existence of a declaration of a member class that isn't a
forward declaration before it's definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183722 91177308-0d34-0410-b5e6-96231b3b80d8
ccess.cpp
ef0e4e6eda13c2dcd6d4d43f1750d1d73202d16a 10-Jun-2013 Richard Trieu <rtrieu@google.com> Add a new warning, -Wlogical-not-parentheses, to -Wparentheses.

This warning triggers on the logical not of a non-boolean expression on the
left hand side of comparison. Often, the user meant to negate the comparison,
not just the left hand side of the comparison. Two notes are also emitted,
the first with a fix-it to add parentheses around the comparison, and the other
to put parenthesis around the not expression to silence the warning.

bool not_equal(int x, int y) {
return !x == y; // warn here
}

return !(x == y); // first fix-it, to negate comparison.

return (!x) == y; // second fix-it, to silence warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183688 91177308-0d34-0410-b5e6-96231b3b80d8
arn-logical-not-compare.cpp
50b60b35a9377bb621f21955b956b581f9860baf 10-Jun-2013 Larisse Voufo <lvoufo@google.com> reverted test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183637 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-contextual-conversion-tweaks.cpp
b6e3808bfe385da8d90bb431e41e30d721d5433f 08-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Recursively lifetime-extend into array temporaries. These can get implicitly
created through binding a reference-to-array to an initializer list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183594 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
33f0faa082b1aa5b52ae50f2ccaffc34629e01da 07-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16273: Weaken a bogus assertion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183550 91177308-0d34-0410-b5e6-96231b3b80d8
railing-return-0x.cpp
8150da3796300bdc876775e1782331f0e43d2d94 07-Jun-2013 Eli Friedman <eli.friedman@gmail.com> When we're synthesizing copy/move-assignment, we can't form a reference to an
invalid field; make sure we don't try. Fixes <rdar://problem/14084171>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183479 91177308-0d34-0410-b5e6-96231b3b80d8
ember-init.cpp
40cba90626044ff28b58c33e743366e94c898227 06-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1270: braces can be elided in all aggregate initialization, not
just copy-list-initialization in a variable declaration. This effectively
reverts r142147.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183397 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
649c6c50fd3dd13577071b26fec4495f7538d923 06-Jun-2013 Hans Wennborg <hans@hanshq.net> Disallow reinterpret_cast from pointer to bool on Windows

This became allowed by accident in r131201, but triggers an assert.
That patch added an exception to allow conversion from pointers to
narrow integral types for MSVC compatibility. However, a pointer can
already be converted to bool in a civilized manner; allowing conversion
via reinterpret_cast is a bad idea.

Fixes PR16222.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183394 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
f69dd33cfc0b1f2a6c88d10951dbd29c4dc806c2 06-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> When a static storage duration temporary appears in a constant expression, it
must be initialized by a constant expression (not just a core constant
expression), because we're going to emit it as a global. Core issue for this is
pending.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183388 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
211c8ddb5b500ed84833751363d0cfe1115f4dd3 05-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Model temporary lifetime-extension explicitly in the AST. Use this model to
handle temporaries which have been lifetime-extended to static storage duration
within constant expressions. This correctly handles nested lifetime extension
(through reference members of aggregates in aggregate initializers) but
non-constant-expression emission hasn't yet been updated to do the same.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183283 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
c2fe81898b1b3b948791ca4ababd3d495601f22a 04-Jun-2013 David Blaikie <dblaikie@gmail.com> Bound member function diagnostic - suggest no-args calls and note overload candidates

Still missing cases for templates, but this is a step in the right
direction. Also omits suggestions that would be ambiguous (eg: void
func(int = 0); + void func(float = 0); func;)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183173 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
xpression-traits.cpp
verloaded-operator.cpp
16b0a310f5649d25849d84409841f401e7a9a0e5 03-Jun-2013 David Blaikie <dblaikie@gmail.com> UnresolvedMemberExpr should have an expr location of the member (not the base)

This matches the behavior of MemberExpr and makes diagnostics such as
"reference to non-static member function must be called" more legible in
the case that the base & member are split over multiple lines (prior to
this change the diagnostic would point to the base, not the member -
making it very unclear in chained multi-line builder-style calls)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183149 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
8a66bf78becf05a24e8251379f3843d1fceb627f 03-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor constant expression evaluation to associate the complete object of a
materialized temporary with the corresponding MaterializeTemporaryExpr. This is
groundwork for providing C++11's guaranteed static initialization for global
references bound to lifetime-extended temporaries (if the initialization is a
constant expression).

In passing, fix a couple of bugs where some evaluation failures didn't trigger
diagnostics, and a rejects-valid where potential constant expression testing
would assume that it knew the dynamic type of *this and would reject programs
which relied on it being some derived type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183093 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
b45a4d217cf1513b14a143143a2c3af8738a3cd7 03-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix a couple of bugs where jump diagnostics would not notice that a variable
has an initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183092 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
c063cb1e1a2e4b76f27762fcf56b4ba2ede8f0a9 02-Jun-2013 David Majnemer <david.majnemer@gmail.com> Allow paren casted throw statements inside of ternary expressions

clang would incorrectly not allow the following:

int x = true ? (throw 1) : 2;

The problem exists because we don't see beyond the parens.
This, in turn, causes us to believe that we are choosing between void
and int which we diagnose as an error.

Instead, allow clang to see the 'throw' inside the parens.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183085 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
a3813c9c2cdcdeae4d4e5b6b85493caef1e70ab7 31-May-2013 David Majnemer <david.majnemer@gmail.com> Put the PR16167 tests together


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183046 91177308-0d34-0410-b5e6-96231b3b80d8
R16167.cpp
inkage-spec.cpp
6242a45ca50586ed3f363d4ac7422e07092e4d96 31-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix handling of braced-init-list as reference initializer within aggregate
initialization. Previously we would incorrectly require an extra set of braces
around such initializers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182983 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-references.cpp
xx98-compat.cpp
ecl-init-ref.cpp
e98089083f2504a4b1f55a9f00a2a2df63cb72e0 30-May-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix PR16060.

The testcase in PR16060 points out that while template arguments can
show that a type is not externally visible, the standards still says
they have external linkage.

In terms of our implementation, it means that we should merge just the
isExternallyVisible bit, not the formal linkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182962 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
76eed42f99158082fae5b903f46dfb6355e66f95 30-May-2013 Aaron Ballman <aaron@aaronballman.com> Microsoft has a language extension which allows union members to be
references. What's more, they use this language extension in their
ATL header files (which come as part of MFC and the Win32 SDK). This patch implements support for the Microsoft extension, and addresses PR13737.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182936 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
9e34bb97b36901ff3edeafc0dbaf2ec05e13a3c4 30-May-2013 Aaron Ballman <aaron@aaronballman.com> Switching the tests to use size_t instead of unsigned int to hopefully appease the Linux x64 build bot (take 2, forgot this test case).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182907 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoft-new-delete.cpp
5537e0a4df10d3445e9714736534e4d33a44fa5d 30-May-2013 Aaron Ballman <aaron@aaronballman.com> Add support to fallback on operator new when a placement operator new[] is called for which there is no valid declaration. This fallback only happens in Microsoft compatibility mode. This patch addresses PR13164, and improves support for the WDK.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182905 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoft-new-delete.cpp
1e8cf74f9031c524ac49c5b7167484e8fc24c9b1 29-May-2013 David Majnemer <david.majnemer@gmail.com> Add another test case for r182814.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182882 91177308-0d34-0410-b5e6-96231b3b80d8
R16167.cpp
aa71567ba4b8a10e9a7d668bf93e35413d7260a8 29-May-2013 David Majnemer <david.majnemer@gmail.com> Disallow extern decls of type void in C++ mode

C++ and C differ with respect to the handling of extern void
declarations. Enforce the C++ behavior in C++ mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182814 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
ualified-id-lookup.cpp
a99ecbcc4c431d52df0b01539035ab5281d54656 25-May-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix linkage computation for derived types in inline functions.

John noticed that the fix for pr15930 (r181981) didn't handle indirect
uses of local types. For example, a pointer to local struct, or a
function that returns it.

One way to implement this would be to recursively look for local
types. This would look a lot like the linkage computation itself for
types.

To avoid code duplication and utilize the existing linkage cache, this
patch just makes the computation of "type with no linkage but
externally visible because it is from an inline function" part of the
linkage computation itself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182711 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
d3bb9ffb9aa3c78ac9b525f5c8071c5a7c5309d4 24-May-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix printing CXXTemporaryObjectExpr with default args.

Patch by Will Wilson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182651 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
2c2f09ec4842be9933f803b1ec9488b62afc9f5c 24-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix crash-on-invalid if list-initialization works, but we bail out when
building the resulting expression because it invokes a deleted constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182624 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
5705f211472f19fc38e58d81365f9261024b3ba3 23-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR14772: Support constant expression evaluation for _Atomic types.
* Treat _Atomic(T) as a literal type if T is a literal type.
* Evaluate expressions of this type properly.
* Fix a lurking bug where we built completely bogus ASTs for converting to
_Atomic types in C++ in some cases, caught by the tests for this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182541 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
bdaeaed3e3293f1915cdf336f406d4d391331039 22-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR16090: C++1y: treat undeduced 'auto' as a literal type, so that constexpr
function templates can use it as a return type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182433 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
097e0a2cb08c8244a6923489acc8f890e6a99b59 21-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Refactor places which perform contextual implicit conversions to go through a
common function. The C++1y contextual implicit conversion rules themselves are
not yet implemented, however.

This also fixes a subtle bug where template instantiation context notes were
dropped for diagnostics coming from conversions for integral constant
expressions -- we were implicitly slicing a SemaDiagnosticBuilder into a
DiagnosticBuilder when producing these diagnostics, and losing their context
notes in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182406 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-delete-expr.cpp
xplicit.cpp
ew-delete.cpp
witch.cpp
f51cfb89b3fe317318e434db4856b06a90afc126 20-May-2013 Peter Collingbourne <peter@pcc.me.uk> [ms-cxxabi] Look up operator delete() at every virtual dtor declaration.

While the C++ standard requires that this lookup take place only at the
definition point of a virtual destructor (C++11 [class.dtor]p12), the
Microsoft ABI may require the compiler to emit a deleting destructor
for any virtual destructor declared in the TU, including ones without
a body, requiring an operator delete() lookup for every virtual
destructor declaration. The result of the lookup should be the same
no matter which declaration is used (except in weird corner cases).

This change will cause us to reject some valid TUs in Microsoft ABI
mode, e.g.:

struct A {
void operator delete(void *);
};

struct B {
void operator delete(void *);
};

struct C : A, B {
virtual ~C();
};

As Richard points out, every virtual function declared in a TU
(including this virtual destructor) is odr-used, so it must be defined
in any program which declares it, or the program is ill formed, no
diagnostic required. Because we know that any definition of this
destructor will cause the lookup to fail, the compiler can choose to
issue a diagnostic here.

Differential Revision: http://llvm-reviews.chandlerc.com/D822

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182270 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoft-dtor-lookup.cpp
a722534711fd93b5685e1a00f37a62f6a578dacd 20-May-2013 Reid Kleckner <reid@kleckner.net> Implement __declspec(selectany) under -fms-extensions

selectany only applies to externally visible global variables. It has
the effect of making the data weak_odr.

The MSDN docs suggest that unused definitions can only be dropped at
linktime, so Clang uses weak instead of linkonce. MSVC optimizes away
references to constant selectany data, so it must assume that there is
only one definition, hence weak_odr.

Reviewers: espindola

Differential Revision: http://llvm-reviews.chandlerc.com/D814

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182266 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-selectany.cpp
5c6134fd09bc5b738dafdd1c774edde13d95cb20 18-May-2013 DeLesley Hutchins <delesley@google.com> Thread safety analysis: add two new attributes to the thread safety analysis:
assert_exclusive_lock and assert_shared_lock. These attributes are used to
mark functions that dynamically check (i.e. assert) that a lock is held.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182170 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
24ce46c8cec99d2e63bed052696e79b6487885fb 17-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Use 'c++' not 'cxx' in these diagnostic group names for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182075 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
b5eb3f5bf383807103dc1377a124fd96ee21d02a 17-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15757: When we instantiate an inheriting constructor template, also
instantiate the inherited constructor template and mark that as the constructor
which the instantiated specialization is inheriting. This fixes a
crash-on-valid when trying to compute the exception specification of a
specialization of the inheriting constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182072 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-inheriting-ctors.cpp
989d0b17f041bad38c3cde09d56b48df493e1d03 17-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Since we're counting number of steps, switch to turing machines which maximize
#steps not #1s, and use a more traditional step count where the 'halt' step is
not counted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182057 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-turing.cpp
0ff5074f37a66bca244a9d5d0da050ff68693ce2 15-May-2013 Hans Wennborg <hans@hanshq.net> Better diagnostics for string initialization.

This commit improves Clang's diagnostics for string initialization.
Where it would previously say:

/tmp/a.c:3:9: error: array initializer must be an initializer list
wchar_t s[] = "Hi";
^
/tmp/a.c:4:6: error: array initializer must be an initializer list or string literal
char t[] = L"Hi";
^

It will now say

/tmp/a.c:3:9: error: initializing wide char array with non-wide string literal
wchar_t s[] = "Hi";
^
/tmp/a.c:4:6: error: initializing char array with wide string literal
char t[] = L"Hi";
^

As a bonus, it also fixes the fact that Clang would previously reject
this valid C11 code:

char16_t s[] = u"hi";
char32_t t[] = U"hi";

because it would only recognize the built-in types for char16_t and
char32_t, which do not exist in C.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181880 91177308-0d34-0410-b5e6-96231b3b80d8
s-wchar.cpp
tring-init.cpp
7247c88d1e41514a41085f83ebf03dd5220e054a 15-May-2013 David Blaikie <dblaikie@gmail.com> Use only explicit bool conversion operator

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
86a87308f11e7ee7c71ff608aec0cde11aa7df58 15-May-2013 Douglas Gregor <dgregor@apple.com> Don't mark a type specifier as "owned" if there is no declaration to own.

This simplifies error recovery elsewhere, eliminating the crash in
<rdar://problem/13853540>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181846 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
f039e3eb0ffa87aae0e38cec48f367ee179b4de6 14-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Suppress bogus "use of undefined constexpr function" error if the function body
was erroneous and got discarded.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181758 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
num-unscoped-nonexistent.cpp
284b3cbfd1cd5b6585437fbb8b95fe136f273efb 12-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support for 'switch' statements in constexpr functions. This is somewhat
inefficient; we perform a linear scan of switch labels to find the one matching
the condition, and then walk the body looking for that label. Both parts should
be straightforward to optimize.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181671 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
9cbcab88d441761b5c5d7811c4d0c205250991bf 10-May-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Avoid patching storage class for block scope thread_local variables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181627 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-thread-local-print.cpp
42860f1133f1ea37cc7a8a590436f169bdfc8755 10-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15966: don't get confused by a complex integer -> complex integer conversion
and misclassify it as a complex-real conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181626 91177308-0d34-0410-b5e6-96231b3b80d8
omplex-overload.cpp
15f92bad58c8650b1306729744b1a1230197497a 10-May-2013 Hans Wennborg <hans@hanshq.net> Add support for __wchar_t in -fms-extensions mode.

MSVC provides __wchar_t. This is the same as the built-in wchar_t type
from C++, but it is also available with -fno-wchar and in C.

The commit changes ASTContext to have two different types for this:

- WCharTy is the built-in type used for wchar_t in C++ and __wchar_t.

- WideCharTy is the type of a wide character literal. In C++ this is
the same as WCharTy, and in C it is an integer type compatible with
the type in <stddef.h>.

This fixes PR15815.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181587 91177308-0d34-0410-b5e6-96231b3b80d8
s-wchar.cpp
25d8c856681120581315edcdb48257c99af6b45c 10-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y auto return type: when a function contains no 'return' statements at all,
substitute 'void' into the return type rather than replacing it with 'void', so
that we maintain the 'auto' type sugar.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181584 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
384af4a7233f1a8e63f979d9973e69b7b3f9366d 08-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add test forgotten in r181388.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181389 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-steps.cpp
a49a7fe2a7c1881402be25ca9124d3883637198f 08-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y constant expression evaluation: compound assignment support for floating-point and pointer types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181376 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
d9de51f83d606ceab521e2cc17afc62e011c7cd8 08-May-2013 Nick Lewycky <nicholas@mxc.ca> When typo correction produces an overloaded result when looking up a member,
return all the overloads instead of just picking the first possible declaration.
This removes an invalid note (and on occasion other invalid diagnostics) and
also makes clang's parsing recovery behave as if the text from its fixit were
applied.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181370 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
99e9fe08bbba3d71db41cfd7585b9658ee85ef55 07-May-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Try to recognise hidden tag type names in potential declarations, in ObjC code as well.

rdar://13829073

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181345 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
d20afcbe94f0daed15d040d98d2aa8ef8ed368e4 07-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y constant expression evaluation: support for compound assignments on integers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181287 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
a8942d7686dde6d221a176c502ce857bdc409dab 07-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: an assignment operator is implicitly 'constexpr' if it would only call 'constexpr' assignment operators for a literal class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181284 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
2624b8157660902303bfce5551cfdd38272d01e5 06-May-2013 Jordan Rose <jordan_rose@apple.com> Fix representation of compound literals for C++ objects with destructors.

Previously, this compound literal expression (a GNU extension in C++):

(AggregateWithDtor){1, 2}

resulted in this AST:

`-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...])
`-CompoundLiteralExpr [...] 'struct AggregateWithDtor'
`-CXXBindTemporaryExpr [...] 'struct AggregateWithDtor' (CXXTemporary [...])
`-InitListExpr [...] 'struct AggregateWithDtor'
|-IntegerLiteral [...] 'int' 1
`-IntegerLiteral [...] 'int' 2

Note the two CXXBindTemporaryExprs. The InitListExpr is really part of the
CompoundLiteralExpr, not an object in its own right. By introducing a new
entity initialization kind in Sema specifically for compound literals, we
avoid the treatment of the inner InitListExpr as a temporary.

`-CXXBindTemporaryExpr [...] 'struct Point' (CXXTemporary [...])
`-CompoundLiteralExpr [...] 'struct AggregateWithDtor'
`-InitListExpr [...] 'struct AggregateWithDtor'
|-IntegerLiteral [...] 'int' 1
`-IntegerLiteral [...] 'int' 2

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181212 91177308-0d34-0410-b5e6-96231b3b80d8
ompound-literal.cpp
10f6f065456a2cfb6c2ab5dfedefb930e5e52e9d 06-May-2013 John McCall <rjmccall@apple.com> Require the containing type to be complete when we see
__alignof__ of a field.

This problem can only happen in C++11.

Also do some petty optimizations.

rdar://13784901

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181185 91177308-0d34-0410-b5e6-96231b3b80d8
lignof.cpp
692eafd2052fb6ca581530d6f3569eea9520a508 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support range-based for loops in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181184 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
ce61715606b5f55ccc023720cdf9c1a796b0d526 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support 'for', 'while', and 'do ... while' in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181181 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
5528ac9f40ec6cb54e7096908bf2beeed511bce4 06-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support for increment and decrement in constant expression evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181173 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
b476a14e9b35ef2448b42b033e1f0cceaa3f2778 05-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Factor out duplication between lvalue-to-rvalue conversions and variable
assignments in constant expressions. No significant functionality changes
(slight improvement to potential constant expression checking).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181170 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx1y.cpp
b98cf79a3add5c80b40a956a4cd3d9b3a23b9b22 05-May-2013 Rafael Espindola <rafael.espindola@gmail.com> Use lexical contexts when checking for conflicting language linkages.

This fixes pr14958. I will audit other calls to isExternCContext to see
if there are any similar bugs left.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181163 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
30ae1ed71dc99a396b7ddba9cabe9846a0c4449d 05-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Handle parens properly when initializing a char array from a string literal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181159 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
ascal-strings.cpp
aa3d68af3b533ee79a862f2c6d159b79d278a6fc 04-May-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Moved pretty printer test for thread local storage in its own file
and specified the triple.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181115 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
xx11-thread-local-print.cpp
dc17384581e37436582a007be4d9185bcf7003ec 04-May-2013 Enea Zaffanella <zaffanella@cs.unipr.it> In VarDecl nodes, store the thread storage class specifier as written.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181113 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
60e141e1f87211ca831de6821003d80fe20a06f3 04-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement most of N3638 (return type deduction for normal functions).
Missing (somewhat ironically) is support for the new deduction rules
in lambda functions, plus PCH support for return type patching.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181108 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-deduced-return-type.cpp
9fd6b8f5a73788f288edd01fa99d434d1e6588ad 04-May-2013 Wei Pan <wei.pan@intel.com> Implement template support for CapturedStmt

- Sema tests added and CodeGen tests are pending

Differential Revision: http://llvm-reviews.chandlerc.com/D728



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181101 91177308-0d34-0410-b5e6-96231b3b80d8
aptured-statements.cpp
0f2fc5ff49cb9abd6c6972ffd6db066295672867 03-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15906: The body of a lambda is not an evaluated subexpression; don't visit it when visiting such subexpressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181046 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
28fff5394fc9521ec0ee1d4f7ef4cca5e4f78071 01-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix spurious trailing comma when printing some of the __c11_atomic_* builtins. Patch by Joe Sprowes!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180867 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
a07a6c3e756d0a6a5baa2cad9d165f79f0fb1b42 01-May-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15884: In the 'taking the address of a temporary' extension, materialize the
temporary to an lvalue before taking its address. This removes a weird special
case from the AST representation, and allows the constant expression evaluator
to deal with it without (broken) hacks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180866 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
dc7a4f5d7a7e3b60d4dc4a80338d7a2728540998 30-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't treat a non-deduced 'auto' type as being type-dependent. Instead, there
are now two distinct canonical 'AutoType's: one is the undeduced 'auto'
placeholder type, and the other is a deduced-but-dependent type. All
deduced-to-a-non-dependent-type cases are still non-canonical.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180789 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
xx11-crashes.cpp
or-range-unused.cpp
cad7e43c5aba88bf6affc155b02d8609485db41b 29-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR580: access checks for template parameters of a class template are
performed within the context of that class template. Patch by Ismail Pazarbasi!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180707 91177308-0d34-0410-b5e6-96231b3b80d8
ccess.cpp
bebf5b1bcfbf591dd3cd80c4aebd6486bb34f41c 26-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: support simple variable assignments in constexpr functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180603 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
onstexpr-printing.cpp
onstexpr-value-init.cpp
-c-e-cxx.cpp
e5e575ded9cd4b80229fb299a2d97e9d44728eda 26-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Add r180263 back, but fix hasBraces() to be correct during parsing.

Original commit message:

Fix a case in linkage computation that should check for single line extern "C".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180591 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
88e37c2a8c7f52b01372e6794ab80caa75842d06 26-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Add a testcase for a recent regression.

Thanks to Bill Wendling for the original testcase.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180586 91177308-0d34-0410-b5e6-96231b3b80d8
inkage.cpp
d247842acdbded335f03f91ba0153bc36e65eb39 26-Apr-2013 Bill Wendling <isanbard@gmail.com> Revert r180263. It's causing failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180583 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
11dc6347bb01b766cf4f357d707ff789cba9114b 25-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Put friend decls in the correct context.

When we find a friend declaration we have to skip transparent contexts for doing
lookups, but we should not skip them when inserting the new decl if the lookup
found nothing.

Fixes PR15841.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180571 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
f49d9c9b858973eb10717f4b3936a4a4384bd355 25-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix a case in linkage computation that should check for single line extern "C".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180263 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
ed5a292592c61f1b0d2da60dddea2fc11fb3f157 23-Apr-2013 Richard Trieu <rtrieu@google.com> Warn that scoped enumerations are a C++11 extenstion when compiling in
C++98 mode. This improves on the previous diagnostic message of:

error: expected identifier or '{'


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180076 91177308-0d34-0410-b5e6-96231b3b80d8
arn-c++11-extensions.cpp
a10b97898ee6339c3110e6ca33f178ff52f05238 22-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y constexpr extensions, round 1: Allow most forms of declaration and
statement in constexpr functions. Everything which doesn't require variable
mutation is also allowed as an extension in C++11. 'void' becomes a literal
type to support constexpr functions which return 'void'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180022 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression-cxx1y.cpp
99ad35921aa6c1b200b6432c066961f930fce1e1 22-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix array constant expression evaluation bug: we can have different values for
different array elements, even if they're all constructed using the same
default constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180017 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9c6a114d4271ab0e3800de1d3407f994dadd240e 22-Apr-2013 David Blaikie <dblaikie@gmail.com> Add a triple to make a test resilient to non-TLS hosts (eg: darwin10)

Making the test introduced in r179962 resilient to being run on darwin10 hosts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179992 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-array-runtime-bound.cpp
840462670ba7a6bc26265a2306b35f2f0f01f51c 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> The 'constexpr implies const' rule for non-static member functions is gone in
C++1y, so stop adding the 'const' there. Provide a compatibility warning for
code relying on this in C++11, with a fix-it hint. Update our lazily-written
tests to add the const, except for those ones which were testing our
implementation of this rule.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179969 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
xx1y-constexpr-not-const.cpp
num-unscoped-nonexistent.cpp
39b0e269dc8895ecc0f92f08126d3082b2a837a8 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Disable VLA diagnostic in C++1y mode, and add some tests.

Still to do here:
- we have a collection of syntactic accepts-invalids to diagnose
- support non-PODs in VLAs, including dynamic initialization /
destruction
- runtime checks (and throw std::bad_array_length) for bad bound
- support VLA capture by reference in lambdas
- properly support VLAs in range-based for (don't recompute bound)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179962 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-array-runtime-bound.cpp
xx98-compat-pedantic.cpp
c3bf52ced9652f555aa0767bb822ec4c64546212 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: Allow aggregates to have default initializers.

Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
xx1y-initializer-aggregates.cpp
e410be9f3f08684c04a611f2ab57257c2d2eb0ae 20-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement core issue 1608: class members can be found via operator lookup in a trailing return type in that class's body.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179941 91177308-0d34-0410-b5e6-96231b3b80d8
railing-return-0x.cpp
2fcf0de8a122ddb265d8c32d6ac1012c070e4f24 19-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Note that we support (and in fact have supported since the dawn of time itself)
C++1y binary literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179883 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
d82fdf059724bfa0b7601833db5fff2b42853f60 17-Apr-2013 Eric Christopher <echristo@gmail.com> Revert r179671 and just pass a triple to the test for a platform with known
TLS support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179692 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-thread-local.cpp
092140a434366007a611c0a1a73fb6a4e8ff7f5e 17-Apr-2013 Douglas Gregor <dgregor@apple.com> Fix PR15291: noreturn adjustment in overload resolution for function templates, from Alexander Zinenko!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179680 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-noreturn.cpp
e68d9e08152bd246aa1d7da02a67efea81112707 17-Apr-2013 Eric Christopher <echristo@gmail.com> Add a bit of a hack to deal with a failing testcase on darwin10 bots.

We currently emit an error message when you try to use thread local
storage on targets that don't support it and testing C++11 thread
locals will trip this. We don't want to xfail the test for all darwin
hosts so add a quick hack to check for darwin10 and disable the
test based on that. Only checking darwin10 because anything earlier
is really old and I don't have a list of what other hosts don't
support tls handy.

Alternate suggestions welcome!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179671 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-thread-local.cpp
d314abeffba04dffc101e4e71cc3a32ddeed4ae6 17-Apr-2013 John McCall <rjmccall@apple.com> Don't put too much thought into whether or not to capture a
type-dependent intermediate result in a postfix ++ pseudo-
object operation.

Test case by Tong Shen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179637 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
6afcf8875d4e447645cd7bf3733dd8e2eb8455dc 16-Apr-2013 Tareq A. Siraj <tareq.a.sriaj@intel.com> Sema for Captured Statements

Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic
analysis. Currently captures all variables by reference.

TODO: templates

Author: Ben Langmuir <ben.langmuir@intel.com>

Differential Revision: http://llvm-reviews.chandlerc.com/D433


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179618 91177308-0d34-0410-b5e6-96231b3b80d8
aptured-statements.cpp
6ca6752992103964706ca0983efbc2b9fcfe3307 16-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Suppress unused warning on static inline function template specializations.

Patch by Halfdan Ingvarsson!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179598 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
76da55d3a49e1805f51b1ced7c5da5bcd7f759d8 16-Apr-2013 John McCall <rjmccall@apple.com> Basic support for Microsoft property declarations and
references thereto.

Patch by Tong Shen!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179585 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
df4cc0a0c75ff9d92ca501ecd40c5413b97506d6 15-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Local thread_local variables are implicitly 'static'. (This doesn't apply to _Thread_local nor __thread.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179517 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-thread-local.cpp
19b6a707a86302adc80d64464cbc3cb8a7a7f3a6 10-Apr-2013 Matt Beaumont-Gay <matthewbg@google.com> Suppress -Wunused-variable for variables declared in headers, which may in
fact be defined and used in another TU.

Reshuffle some test cases because we suppress -Wunused-variable after we've
emitted an error.

This fixes PR15558.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179138 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/warn-unused-variables.h
arn-unused-variables-error.cpp
arn-unused-variables.cpp
391ca9f2c9e9b93fe7196b56f20701cbb6dc0dd7 09-Apr-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> Mark as referenced the functions from instantiated UserDefinedLiterals.

Fixes rdar://13589856

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179078 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-user-defined-literals-unused.cpp
5696884053b4a60dbed01ea8c7e6cd8dcf9b5de9 08-Apr-2013 DeLesley Hutchins <delesley@google.com> Thread safety analysis: turn on checking within lock and unlock functions.
These checks are enabled with the -Wthread-safety-beta flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179046 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
f608aff66c5412ab583258f989417b4974ba507a 06-Apr-2013 Richard Trieu <rtrieu@google.com> When -Woverloaded-virtual is triggered, call HandleFunctionTypeMismatch to add
more information to the notes. This information is already present on other
diagnostic messages that involves overloads.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178923 91177308-0d34-0410-b5e6-96231b3b80d8
arn-overloaded-virtual.cpp
ea4b1113cea2190e4ac1d07f99102a1c0fd3eddd 04-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't patch the storage class of static data members.

This removes a bit of patching that survived r178663. Without it we can produce
better a better error message for

const int a = 5;
static const int a;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178795 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
29c41b51137b2cbc21a8c93f7c61149247c6b01a 04-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Use isExternalLinkage instead of hasExternalLinkage.

Having these not be the same makes an easy to misuse API. We should audit the
uses and probably rename to something like

foo->hasExternalLinkage():
The c++ standard one. That is UniqueExternalLinkage or ExternalLinkage.

foo->hasUniqueExternalLinkage():
Is UniqueExternalLinkage.

foo->hasCogeGenExternalLinkage():
Is ExternalLinkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178768 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
ba2bfa07cbcb088e3afc5565a3b301a7873771a3 04-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix a recent linkage regression.

Now that we don't have a semantic storage class, use the linkage.

Thanks to Bruce Stephens for reporting this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178766 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
80a8689b274f758d9d7fb04c5cad81a582525497 04-Apr-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix linkage related crash.

This test was exactly the opposite of what it should be. We should check if
there old decl has linkage (where it makes sense) and if the new decl has
the extern keyword.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178735 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
d613ac9c57936d219d9eecba1d061a45ff7a3ae8 04-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix 41 of the 61 tests which fail with modules enabled: we were computing and
caching the linkage for a declaration before we set up its redeclaration chain,
when determining whether a declaration could be a redeclaration of something
from an unimported submodule. We actually want to look at the declaration as if
it were not a redeclaration here, so compute the linkage but don't cache it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178733 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
78037ac3e7562aa3e306eaba97f1c609b86337d9 03-Apr-2013 John McCall <rjmccall@apple.com> Complain about attempts to befriend declarations via a using
declaration. Patch by Stephen Lin!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178698 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
20a7cf4d782e32b2752e651a11ed3712d2debd65 03-Apr-2013 Kaelyn Uhrain <rikka@google.com> Give the default CorrectionCandidateCallback::ValidateCandidate some
smarts so that it doesn't approve of keywords and/or type names when it
knows (based on its flags) that those kinds of corrections are not
wanted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178668 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
8b0822b3043f91a113d39da7aa9bb0634db69807 02-Apr-2013 Alexander Kornienko <alexfh@google.com> Moved fallthrough regression test to switch-implicit-fallthrough.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178554 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-regression.cpp
witch-implicit-fallthrough.cpp
b0707c9a933b1839fa966e4c72e4dcb9a198f11f 02-Apr-2013 Alexander Kornienko <alexfh@google.com> Fixed "fallthrough annotation does not directly precede switch label" warning in
case when [[clang::fallthrough]]; is used in a method of a local class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178543 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-regression.cpp
725fe0ede4c5355666a300f4fd7dae9454f35a37 01-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15633: Note that we are EnteringContext when parsing the nested name
specifier for an enumeration. Also fix a crash-on-invalid if a non-dependent
name specifier is used to declare an enum template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178502 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
b6bead467640e4d05f6a0a90255eebc939f690a2 29-Mar-2013 Rafael Espindola <rafael.espindola@gmail.com> Don't special case one line extern "C" decls.

We already avoided warning for

extern "C" const char *Version_string = "2.9";

now we also don't produce any warnings for

extern "C" {
extern const char *Version_string2 = "2.9";
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178333 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
e93e2552e76ab704ec85919cc2c76f02b8b081ee 29-Mar-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Add more tests for r178297

This covers a few cases where the class of a member pointer is not a
CXXRecordDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178307 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer-ms.cpp
84e9ab44af3a16f66d62590505db2036ef0aa03b 28-Mar-2013 Reid Kleckner <reid@kleckner.net> [ms-cxxabi] Correctly compute the size of member pointers

Summary:
This also relaxes the requirement on Windows that the member pointer
class type be a complete type (http://llvm.org/PR12070). We still ask
for a complete type to instantiate any templates (MSVC does this), but
if that fails we continue as normal, relying on any inheritance
attributes on the declaration.

Reviewers: rjmccall

CC: triton, timurrrr, cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D568

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178283 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer-ms.cpp
5fd1fac0104e22533bc0284fdd0f42f843c975f5 28-Mar-2013 Jordan Rose <jordan_rose@apple.com> Provide a fixit to static_cast for reinterpret_casts within a class hierarchy.

The suggestion was already in the text of the note; this just adds the
actual fixit and the appropriate test cases.

Patch by Alexander Zinenko!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178274 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reinterpret-base-class.cpp
eb82a53aaa7880b7d3fd733aeee38b9aeee919ba 28-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> For -Wignored-qualifiers, don't warn on qualifiers which we acquire via a
typedef. Also don't warn on the _Atomic type specifier, just on the _Atomic
type qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178218 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
8c952cd40ccec9d720931f27e7d722fed207d536 28-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> Teach -Wigored-qualifiers about exotic flavors of declarator and the _Atomic type qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178217 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
4cf4a5e96ab0babd13774b17112e7c1d83042ea7 28-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> Support C11 _Atomic type qualifier. This is more-or-less just syntactic sugar for the _Atomic type specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178210 91177308-0d34-0410-b5e6-96231b3b80d8
tomic-type.cxx
9ef9875bbe19dc9f73c6c95b803d9a4945168690 27-Mar-2013 Joao Matos <ripzonetriton@gmail.com> Implement compiler intrinsics needed for compatibility with MSVC 2012 <type_traits>.

Patch by me and Ryan Molden.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178111 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
12fef490dce56bf8abc1bad7fec798eb882aabf7 27-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15597: Fix a confusion between the implicit exception specification and the
uninstantiated exception specification when a special member within a class
template is both defaulted and given an exception specification on its first
declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178103 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
fdb468fc8ab84af5f32868cc6511cf1160074d53 27-Mar-2013 John McCall <rjmccall@apple.com> Make the -Wreinterpret-base-class logic safe against invalid
declarations at any point. Patch by Alexander Zinenko, and
report by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178098 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reinterpret-base-class.cpp
0162c1ce296fc48fbe03a31a2ae00b939eef86a8 27-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13267210> Ensure that Sema::CompareReferenceRelationship returns consistent results with invalid types.

When Sema::RequireCompleteType() is given a class template
specialization type that then fails to instantiate, it returns
'true'. On subsequent invocations, it can return false. Make sure that
this difference doesn't change the result of
Sema::CompareReferenceRelationship, which is expected to remain stable
while we're checking an initialization sequence.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178088 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
8af742a499bf13f0a3d53b03aa44ae748fadd61e 26-Mar-2013 Richard Trieu <rtrieu@google.com> Handle CXXOperatorCallExpr when checking self referrnce during initialization of
class types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177987 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
dc392c1bae3306af7aec25f0b0b14637d2dc6b39 26-Mar-2013 Douglas Gregor <dgregor@apple.com> <rdar://problem/13185264> Don't crash when attempting to redundantly initialize a member of an anonymous union.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177941 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
437da054125a1e5cdd8c9765e09e42da922482f3 22-Mar-2013 John McCall <rjmccall@apple.com> Warn about attempts to reinterpret_cast between two types that are
hierarchy-related at a possibly nonzero offset.

Patch by Alexander Zinenko!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177698 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reinterpret-base-class.cpp
b760f11fae94e3003b9241ac50c02617465f2fa2 22-Mar-2013 John McCall <rjmccall@apple.com> Fix a crash-on-valid where a block capture copy expression was
picking up cleanups from earlier in the statement. Also fix a
crash-on-invalid where a reference to an invalid decl from an
enclosing scope was causing an expression to fail to build, but
only *after* a cleanup was registered from that statement,
causing an assertion downstream.

The crash-on-valid is rdar://13459289.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177692 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
7132be1ef46248746990590b91e693dfc3cce251 19-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> Diagnose uses of 'alignof' on functions in -pedantic mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177354 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
c7f811638f8603fa373d2be724e8b1c8ba51ad75 18-Mar-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add missing diagnostic for a nested-name-specifier on a free-standing type definition. Bump some related diagnostics from warning to extension in C++, since they're errors there. Add some missing checks for function specifiers on non-function declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177335 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
torage-class.cpp
7adf3a9f84688f334a1cd977317bb42f9e06c9f4 15-Mar-2013 Ted Kremenek <kremenek@apple.com> Enhance -Wtautological-constant-out-of-range-compare to include the name of the enum constant.

This is QoI. Fixes <rdar://problem/13076064>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177190 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
arn-enum-compare.cpp
96db329b3a982ac83c700c4469a3f618dc53cb42 15-Mar-2013 Fariborz Jahanian <fjahanian@apple.com> Diagnose about extern "C" functions returning c++ objects
on first declaration only. // rdar://13364028


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177127 91177308-0d34-0410-b5e6-96231b3b80d8
unction-extern-c.cpp
82aaebeaad75456bc736ea1c474479bb6597305d 12-Mar-2013 Rafael Espindola <rafael.espindola@gmail.com> Add an interesting testcase we already handle correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176890 91177308-0d34-0410-b5e6-96231b3b80d8
xtern-c.cpp
c812c3ae43e0608c9ccf7f4c5f71f376609eecae 12-Mar-2013 Rafael Espindola <rafael.espindola@gmail.com> Move the extern "C" sema tests to a new file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176888 91177308-0d34-0410-b5e6-96231b3b80d8
xtern-c.cpp
unction-redecl.cpp
024c1199fa9d28e00160d5f05ed7dc3d25264837 12-Mar-2013 Rafael Espindola <rafael.espindola@gmail.com> We already reported an error for

extern "C" {
void test5_f() {
extern int test5_b;
}
}
static float test5_b;

This patch makes us report one for

extern "C" {
void test6_f() {
extern int test6_b;
}
}
extern "C" {
static float test6_b;
}

Not because we think the declaration would be extern C, but because of the rule:

An entity with C language linkage shall not be declared with the same name as an entity in global scope...

We were just not looking past the extern "C" to see if the decl was in global
scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176875 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
10b1d1cf5ebb14b672d6b0c88f5160ad3cf1e988 12-Mar-2013 Rafael Espindola <rafael.espindola@gmail.com> Error if an extern C declaration matches a previous hidden extern C declaration.

Without this patch we produce an error for

extern "C" {
void f() {
extern int b;
}
}
extern "C" {
extern float b;
}

but not for

extern "C" {
void f() {
extern int b;
}
}
extern "C" {
float b;
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176867 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
6cda3e604f2a2fa289cc9145719ba84461315e21 07-Mar-2013 Douglas Gregor <dgregor@apple.com> When possible, move __block variables to the heap rather than copying them.

Fixes <rdar://problem/13330126>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176663 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
4b02dff7aebb98d2d60b2ff4d3fc86109213128c 05-Mar-2013 David Blaikie <dblaikie@gmail.com> Add quotation marks to template names in diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176474 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
7a534b94138ef2ad1a75b26b3b5bf1aa948d4121 04-Mar-2013 John McCall <rjmccall@apple.com> Perform non-overload placeholder conversions on the operands
to a subscript operator.

rdar://13332183

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176428 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
65611bf036dab4e2ba90b1316b1b21b276dde185 02-Mar-2013 Rafael Espindola <rafael.espindola@gmail.com> Process #pragma weak only after we know the linkage of the function or variable
we are looking at.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176414 91177308-0d34-0410-b5e6-96231b3b80d8
ragma-weak.cpp
5509f37aacf8a4d65f759554c9ec18adc1ac7b4e 26-Feb-2013 Matt Arsenault <Matthew.Arsenault@amd.com> Fix initializer for variables with attribute address_space set.

This would error in C++ mode unless the variable also had a cv
qualifier.

e.g.

__attribute__((address_space(2))) float foo = 1.0f; would error but
__attribute__((address_space(2))) const float foo = 1.0f; would not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176121 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-space-initialize.cpp
85aee96c62a99069ea60cb47d5ae69150ca44746 26-Feb-2013 Kostya Serebryany <kcc@google.com> Unify clang/llvm attributes for asan/tsan/msan (Clang part)

These are two related changes (one in llvm, one in clang).
LLVM:
- rename address_safety => sanitize_address (the enum value is the same, so we preserve binary compatibility with old bitcode)
- rename thread_safety => sanitize_thread
- rename no_uninitialized_checks -> sanitize_memory

CLANG:
- add __attribute__((no_sanitize_address)) as a synonym for __attribute__((no_address_safety_analysis))
- add __attribute__((no_sanitize_thread))
- add __attribute__((no_sanitize_memory))

for S in address thread memory
If -fsanitize=S is present and __attribute__((no_sanitize_S)) is not
set llvm attribute sanitize_S


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176076 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-no-sanitize-address.cpp
ttr-no-sanitize-memory.cpp
ttr-no-sanitize-thread.cpp
d8be0abf30003766f0eb02c87496f29b178146fb 26-Feb-2013 Michael Han <fragmentshaders@gmail.com> Update tests to do a full match against printed C++11 attributes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176074 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-attr-print.cpp
6980f17c78442a7db80d98902932ef047930284a 25-Feb-2013 Michael Han <fragmentshaders@gmail.com> Fix empty declaration printing.

Don't print the semicolon when visiting an empty declaration because the semicolon
will be printed as a terminator later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@176035 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
960876cd88a9aba546345dec49a1cf9a4f248356 24-Feb-2013 Benjamin Kramer <benny.kra@googlemail.com> Add the testcase from PR13573, this used to crash.

The error is a bit strange tbh, but better than crashing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175996 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
02fb50d54042982bccc04c276ad2342827c8fcd3 23-Feb-2013 Rafael Espindola <rafael.espindola@gmail.com> Remove the hack that avoided mangling static functions in extern C contexts.

Weather we should give C language linkage to functions and variables with
internal linkage probably depends on how much code assumes it. The standard
says they should have no language linkage, but gcc and msvc assign them
C language linkage.

This commit removes the hack that was preventing the mangling on static
functions declare in extern C contexts. It is an experiment to see if we
can implement the rules in the standard.

If it turns out that many users depend on these functions and variables
having C language linkage, we should change isExternC instead and try
to convince the CWG to change the standard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175937 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
4c8cba87e49ec2fd39c1ff3b903924e791734a8a 22-Feb-2013 Rafael Espindola <rafael.espindola@gmail.com> Make sure pragmas don't attach visibility attributes to auto variables with
internal linkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175903 91177308-0d34-0410-b5e6-96231b3b80d8
uto-pragma.cpp
684aa73192d92850a926870be62a1787eb5b7ed9 22-Feb-2013 Michael Han <fragmentshaders@gmail.com> [Sema] Semantic analysis for empty-declaration and attribute-declaration.

Introduce a new AST Decl node "EmptyDecl" to model empty-declaration. Have attributes from attribute-declaration appertain
to the EmptyDecl node by creating the AST representations of these attributes and attach them to the EmptyDecl node so these
attributes can be sema checked just as attributes attached to "normal" declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175900 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
33b52ad7d30ebd9119e2c3e34e9294ee830288f6 22-Feb-2013 Timur Iskhodzhanov <timurrrr@google.com> Fix MergeFunctionDecl implicit CC for static methods.

Patch by Alexander Zinenko!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175890 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-microsoft-call-conv.cpp
f6565a9f7318b1ca6ea9510003dde7b89696daab 22-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Handle alignas(foo...) pack expansions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175875 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
425663a16cc0d1bbd6764300f8a59251057dffe8 22-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Teach -ast-print how to print trailing-return-types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175864 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
b83a5d8fb2306e3ef5c6a5c2af0bf52a824f2149 22-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix typo 'with with' in diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175823 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-regparm.cpp
896c7dd62801c0aacf14b05183c3c471c1fe9f7a 16-Feb-2013 David Blaikie <dblaikie@gmail.com> Don't warn on conversion from NULL to nullptr_t

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175331 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
820b23dc924a4ae7af07d5a75d6b1d781c267d57 15-Feb-2013 Argyrios Kyrtzidis <akyrtzi@gmail.com> When a statement is dropped from the AST because it was invalid, make sure
we don't do the scope checks otherwise we are going to hit assertion checks
since a label may not have been actually added.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175281 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
747836e5c79b5e12fe9cfb9b724dc4edeb115419 14-Feb-2013 Rafael Espindola <rafael.espindola@gmail.com> Partially revert r175117 so that we don't break assumptions about how
static functions in extern "C" contexts are mangled. Should fix the
bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175132 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
d2fdd4256a2efc41365ccdd27a210d1d99a1fe3a 14-Feb-2013 Rafael Espindola <rafael.espindola@gmail.com> merge hasCLanguageLinkage and isExternC. Keep the shorter name.

I added hasCLanguageLinkage while fixing some language linkage bugs some
time ago so that I wouldn't have to check all users of isExternC. It turned
out to be a much longer detour than expected, but this patch finally
merges the two again. The isExternC function now implements just the
standard notion of having C language linkage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175119 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
950fee2555f7a6bd193e588d6b6a941fd182391a 14-Feb-2013 Rafael Espindola <rafael.espindola@gmail.com> Add a getLanguageLinkage method to VarDecls and FunctionDecls. Use it to fix
some cases where functions with no language linkage were being treated as having
C language linkage. In particular, don't warn in

extern "C" {
static NonPod foo();
}

Since getLanguageLinkage checks the language linkage, the linkage computation
cannot use the language linkage. Break the loop by checking just the context
in the linkage computation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175117 91177308-0d34-0410-b5e6-96231b3b80d8
unction-extern-c.cpp
inkage2.cpp
d3b4f0e27ffa8d73f8c69a717c39c39a4d47ff0c 14-Feb-2013 Nick Lewycky <nicholas@mxc.ca> When marking derived classes' virtual methods ODR-used in order to trigger
instantiation in order to permit devirtualization later in codegen, skip over
pure functions since those can't be devirtualization targets.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175116 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
1b9e8f7e0bf2c6a2857f1b2208ca5f83b567b835 12-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> Accept over-qualified constructor in MSVC emulation mode

MSVC accepts this:

class A {
A::A();
};

Clang accepts regular member functions with extra qualification as an MS
extension, but not constructors. This changes the parser to defer rejecting
qualified constructors so that the same Sema logic can apply to constructors as
regular member functions. This also improves the error message when MS
extensions are disabled (in my opinion). Before it was:

/Users/jason/Desktop/test.cpp:2:8: error: expected member name or ';' after declaration specifiers
A::A();
~~~~ ^
1 error generated.

After:

/Users/jason/Desktop/test.cpp:2:6: error: extra qualification on member 'A'
A::A();
~~~^
1 error generated.

Patch by Jason Haslam.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174980 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
9efe057ac090ed0d45a64b82e68c74e52c67ed91 12-Feb-2013 Nick Lewycky <nicholas@mxc.ca> Attempt to fix this test on i686 targets.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174953 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
3c86a5c2f60d4f68afde96e2138b6933b30d6aa8 12-Feb-2013 Nick Lewycky <nicholas@mxc.ca> The meat of this patch is in BuildCXXMemberCalLExpr where we make it use
MarkMemberReferenced instead of marking functions referenced directly. An audit
of callers to MarkFunctionReferenced and DiagnoseUseOfDecl also caused a few
other changes:
* don't mark functions odr-used when considering them for an initialization
sequence. Do mark them referenced though.
* the function nominated by the cleanup attribute should be diagnosed.
* operator new/delete should be diagnosed when building a 'new' expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174951 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
ndefined-internal.cpp
ed4330bc159b8311080d03caacac9a8cbf42370c 07-Feb-2013 DeLesley Hutchins <delesley@google.com> Thread safety analysis: make sure that expressions in attributes are parsed
in an unevaluated context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174644 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
f5a6aefa37d73fff3c47953e2c447f074e726a0e 07-Feb-2013 Nick Lewycky <nicholas@mxc.ca> Apply the pure-virtual odr rule to other constructs which can call overloaded
operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174584 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
878d0ad2c9d83ee6485fd16e21c5082acc63a890 07-Feb-2013 Alexander Kornienko <alexfh@google.com> -Wimplicit-fallthrough: fixed two cases where "fallthrough annotation in unreachable code" was issued incorrectly.

Summary:
-Wimplicit-fallthrough: fixed two cases where "fallthrough annotation in unreachable code" was issued incorrectly:

1. In actual unreachable code, but not immediately on a fall-through execution
path "fallthrough annotation does not directly precede switch label" is better;
2. After default: in a switch with covered enum cases. Actually, these shouldn't
be treated as unreachable code for our purpose.

Reviewers: rsmith

Reviewed By: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D374

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174575 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough.cpp
a4dc51b46861eb52626f89183da7610437baba93 05-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add some missing diagnostics for C++11 narrowing conversions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174337 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
93aa2db250a0e67192ab2a5417e4dfd5530d6f56 04-Feb-2013 Dmitri Gribenko <gribozavr@gmail.com> DeclPrinter: fix CXXConstructExpr printing with implicit default argument

This is an improvement of r173630, that handles the following case:

struct VirualDestrClass
{
VirualDestrClass(int arg);
virtual ~VirualDestrClass();
};

struct ConstrWithCleanupsClass
{
ConstrWithCleanupsClass(const VirualDestrClass& cplx = VirualDestrClass(42));
};

ConstrWithCleanupsClass cwcNoArg;

That was printed as:

ConstrWithCleanupsClass cwcNoArg();


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174296 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
3fa3feab35096b608f1d79bb541798b37a55e7b9 02-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR15132: Replace "address expression must be an lvalue or a function
designator" diagnostic with more correct and more human-friendly "cannot take
address of rvalue of type 'T'".

For the case of & &T::f, provide a custom diagnostic, rather than unhelpfully
saying "cannot take address of rvalue of type '<overloaded function type>'".

For the case of &array_temporary, treat it just like a class temporary
(including allowing it as an extension); the existing diagnostic wording
for the class temporary case works fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174262 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of.cpp
onditional-expr.cpp
xx0x-initializer-aggregates.cpp
ullptr.cpp
821b93eec8b58a3e320ef34e7c98906ab61cf8c3 02-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Correctly classify T{} as an array temporary if T is an array of class type with nontrivial destructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174261 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of-temporary.cpp
b7e5eec2f57bd82c6ddb762ca3dd7b7d8697e9d5 02-Feb-2013 Nick Lewycky <nicholas@mxc.ca> This patch makes "&Cls::purevfn" not an odr use. This isn't what the standard
says, but that's a defect (to be filed). "Cls::purevfn()" is still an odr use.

Also fixes a bug that caused us to not mark the function referenced just
because we didn't want to mark it odr used.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174242 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of.cpp
ndefined-internal.cpp
0162b832fd6450cd3a23019a3c900382d0e9415c 01-Feb-2013 Alexander Kornienko <alexfh@google.com> Fixed segmentation fault when a CFGBlock has NULL successor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174182 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough.cpp
5f838aa9c82c22b6ed2a0cb090969a706c8a1775 01-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix diagnostic for bad alignas use: it can't be applied to functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174160 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
cd0655b17249c4c4908ca91462657f62285017e6 01-Feb-2013 Nick Lewycky <nicholas@mxc.ca> Add a new -Wundefined-inline warning for inline functions which are used but not
defined. Fixes PR14993!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174158 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-inline.cpp
be507b6e72df8ab5e7d8c31eb4453e1bdf5fcfaf 01-Feb-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement [dcl.align]p5 and C11 6.7.5/4: alignas cannot underalign.
Also support alignas(0), which C++11 and C11 require us to ignore.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174157 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
a31f65b10e61ca8f2f427b1df176c10ea8a0efa2 01-Feb-2013 Michael Han <fragmentshaders@gmail.com> [Sema][Attr]Fix alignment attribute printing.

Remove "IsMSDeclspec" argument from Align attribute since the arguments in Attr.td should
only model those appear in source code. Introduce attribute Accessor, and teach TableGen
to generate syntax kind accessors for Align attribute, and use those accessors to decide
if an alignment attribute is a declspec attribute.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174133 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-print.cpp
xx11-attr-print.cpp
29805ca6d278b4d9563adfee67f2478f0fecdcfc 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Improve 'failed template argument deduction' diagnostic for the case where we
have a direct mismatch between some component of the template and some
component of the argument. The diagnostic now says what the mismatch was, but
doesn't yet say which part of the template doesn't match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174039 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
0efa62f2096f28a610ac2ea8d2651448a7ec89c7 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Replace "failed template argument deduction" diagnostic with something useful
in the one case where we've already factored out a reason code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174036 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
f2705196d83a162665d4350bf3bb464972974ee3 31-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Clarify the diagnostic for -Wnested-anon-types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174032 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
onstant-expression-cxx11.cpp
4ceaf337be78fa89b4a97f351be6d0bda962d7de 31-Jan-2013 Nick Lewycky <nicholas@mxc.ca> Fix ODR-use of a MemberExpr to check before marking a pure function used. Remove
a workaround for this bug from the -Wundefined-internals warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174020 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
4874a8143dc3032205f97527ff619730db3d1f57 30-Jan-2013 Alexander Kornienko <alexfh@google.com> Don't warn on fall-through from unreachable code.

Summary:
A motivating example:
class ClassWithDtor {
public:
~ClassWithDtor() {}
};
void fallthrough3(int n) {
switch (n) {
case 2:
do {
ClassWithDtor temp;
return;
} while (0); // This generates a chain of unreachable CFG blocks.
case 3:
break;
}
}

Reviewers: rsmith, doug.gregor, alexfh

Reviewed By: alexfh

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D330

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173889 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough.cpp
a367e9de80eb05e78f06dc35c1e050799e735282 29-Jan-2013 David Blaikie <dblaikie@gmail.com> Move -Wstatic-float-init fixit into a note & don't recover as if constexpr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173841 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-class.cpp
arn-static-const-float.cpp
6933e3b037fcb15b68f41d2b91ee01db45a2d43a 29-Jan-2013 David Blaikie <dblaikie@gmail.com> Don't fixit/recover from -Wstatic-float-init when it's not an error.

Fix to change r173414 that lead to Clang changing const to constexpr even under
-Wno-static-float-init.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173835 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-class.cpp
a0109e284457c996d4eb8f231e01dda303d1a345 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Produce a diagnostic if alignas is applied to an expression. Neither C11 nor
C++11 allows that.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173789 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
ttr-cxx0x.cpp
d03de6aaa312d57dcd6e2bc76bed1e89f5c5019d 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Downgrade 'attribute ignored when parsing type' from error to warning, to match
the diagnostic's warn_ name. Switch some places (notably C++11 attributes)
which really wanted an error over to a different diagnostic. Finally, suppress
the diagnostic entirely for __ptr32, __ptr64 and __w64, to avoid producing
diagnostics in important system headers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173788 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
xx11-gnu-attrs.cpp
4cd81c5bf5957b2b10ddf253035f6e1596082108 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [dcl.align]p1 and C11 6.7.5/2 rules for alignas and _Alignas.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173779 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
8f3aacc8c4849c9e0e7a236954725fffdeb917a6 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Propagate the spelling list index for an attribute across template instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173768 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-attr-print.cpp
353299a29d3a1847b9bf657fd5478e40cffd5e5e 29-Jan-2013 Michael Han <fragmentshaders@gmail.com> Add a test case for attribute print.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173765 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-print.cpp
33f04a208a1a6e73da73460142327ff05e8c391b 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Treat alignas and _Alignas as keyword attributes. This allows us to
pretty-print them properly (modulo the more general badness in alignment
attribute printing).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173752 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-attr-print.cpp
cda7968b38d76848b4fb24f7cc28ab83835b4ea3 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Actually remove the hack which was blocking the Borland-style attributes from
working, and add the missing attribute spellings. This brings _pascal,
_fastcall, _stdcall and _cdecl to life in -fborland-extensions mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173749 91177308-0d34-0410-b5e6-96231b3b80d8
orland-extensions.cpp
5cd532ca0bc1cb8110e24586d064f72332d8b767 29-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Replace AS_MSTypespec with AS_Keyword, for representing any attribute spelled
as a keyword. Rationalize existing attributes to use it as appropriate, and to
not lie about some __declspec attributes being GNU attributes. In passing,
remove a gross hack which was discarding attributes which we could handle. This
results in us actually respecting the __pascal keyword again.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173746 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-print.cpp
orland-extensions.cpp
xx11-attr-print.cpp
c5f7d6aed586fc492383255633c7ea5591256bfe 28-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add a -pedantic warning: an anonymous union within an anonymous union is not
permitted in standard C++, despite being silently accepted by many (all?) major
C++ implementations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173643 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
onstant-expression-cxx11.cpp
5250e2b24f7288fb31dc6357831fcbc4ced26693 27-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Decl printer: fix CXXConstructExpr with implicit default argument

Patch by Will Wilson.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173630 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
98bfbf5354b8b35fd3efd12932894d7452697226 26-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix mismatch between pointer and pointee type when diagnosing an incorrect
object argument type for a member call.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173554 91177308-0d34-0410-b5e6-96231b3b80d8
verload-member-call.cpp
25cf8abf30189323199b1424848b105940267c1b 26-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Revert r172285 (suppressing a 'redundant' -Wc++98-compat warning) and add a
testcase for a situation it caused us to miss.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173540 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
c6dcea93b499b504da22f9921fc198423ad0b13b 25-Jan-2013 Alexander Kornienko <alexfh@google.com> Silence unintended fallthrough diagnostic on a case label preceded with a normal label.

Summary:
It's unlikely that a fallthrough is unintended in the following code:
switch (n) {
...
label:
case 1:
...
goto label;
...
}

Reviewers: rsmith, doug.gregor

Reviewed By: doug.gregor

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D329

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173486 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough.cpp
e992ed1a065d857947b3969e6b779c41cc35c234 25-Jan-2013 Alexander Kornienko <alexfh@google.com> Don't suggest to insert [[clang::fallthrough]] before empty cases. Fix for multiple case labels.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173458 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough.cpp
b4b1d69f19f32e8aeb2ce1e0239c6e20a7f9e952 25-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Sync 'in class initialization of static const double' extension up with GCC,
and split it out of -Wgnu into its own warning flag.

* In C++11, this is now a hard error (GCC has no extension here in C++11 mode).
The error can be disabled with -Wno-static-float-init, and has a fixit to
add 'constexpr'.

* In C++98, this is still an ExtWarn, but is now controlled by
-Wstatic-float-init as well as -Wgnu.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173414 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-class.cpp
arn-static-const-float.cpp
0a04cbd98f65827918e857e7ab5597676b9d8e3b 25-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> FileCheck'ize test/SemaCXX/qualified-names-print.cpp and merge it to other
-ast-print tests


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173387 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
ualified-names-print.cpp
51d8c52ad36129760eaa586f85176037e2cd0d0e 24-Jan-2013 Michael Han <fragmentshaders@gmail.com> PR14922: when printing an attribute, use the real syntax of the attribute (GNU, C++11, MS Declspec) instead of hardcoded GNU syntax.

Introduce a spelling index to Attr class, which is an index into the attribute spelling list of an attribute defined in Attr.td.
This index will determine the actual spelling used by an attribute, as it incorporates both the syntax and naming of the attribute.
When constructing an attribute AST node, the spelling index is computed based on attribute kind, scope (if it's a C++11 attribute), and
name, then passed to Attr that will use the index to print itself.

Thanks to Richard Smith for the idea and review.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173358 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-print.cpp
xx11-attr-print.cpp
9b7ea0d2cc86c949ed70ad810f51ff34c7ce2f83 24-Jan-2013 Nick Lewycky <nicholas@mxc.ca> Start checking nonnull (as well as format and argument_with_type_tag) on
overloaded binary operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173315 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-nonnull.cpp
630f4bb9f12e330438281c4e46deb6656620b73a 23-Jan-2013 Dmitri Gribenko <gribozavr@gmail.com> Implement -Wvla correctly

GCC implements -Wvla as "warn on every VLA" (this is useful to find every VLA,
for example, if they are forbidden by coding guidelines). Currently Clang
implements -Wvla as "warn on VLA when it is an extension".

The attached patch makes our behavior match GCC. The existing vla extwarn is
moved under -Wvla-extension and is still included into -Wgnu.

This fixes PR5953.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173286 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array-cxx11.cpp
99-variable-length-array.cpp
arn-vla.cpp
3edf387e4338ff98d9874b4c1b41d787e49d6c2b 23-Jan-2013 Nick Lewycky <nicholas@mxc.ca> Make __attribute__((nonnull)) use the general expression evaluator to search for
nulls instead of limiting itself to the language-defined "null pointer
constant".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173227 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-nonnull.cpp
3a344f9fc7a62ad0a8d26b2a1ccf5e4989720d0c 22-Jan-2013 Nico Weber <nicolasweber@gmx.de> Fix a bug in VarDecl::getSourceRange() for static member arrays with an element
type with an implicit initializer expression.

Patch from Will Wilson <will@indefiant.com>!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173170 91177308-0d34-0410-b5e6-96231b3b80d8
ourceranges.cpp
39371b8bbf1bb54bcadef74cffefc98ca8f00b76 19-Jan-2013 Ted Kremenek <kremenek@apple.com> Reapply r172878 with test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172888 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
77fd3c0d7837040bb84c1617a6a423f833e784fe 19-Jan-2013 Ted Kremenek <kremenek@apple.com> -Wuninitialized: warn about uninitialized values resulting from ?: that evaluate to lvalues (in C++).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172875 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
0ecc2e9ce86b0705bc1a53a9c8f90c433bcdca1b 18-Jan-2013 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: ignore edges from throw expressions in CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172858 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
ba57183965f117279342903edec19766e478c9a8 18-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Some builtins do not evaluate their arguments. Teach EvaluatedExprVisitor not
to visit them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172769 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unsequenced.cpp
995e4a7530d705147c875b63608532c483c011a8 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> -Wunsequenced: if the LHS of an &&, || or ?: is not constant, check for
unsequenced operations in the RHS. We don't compare the RHS with the rest of
the expression yet; such checks will need care to avoid diagnosing unsequenced
operations which are both in conditionally-evaluated subexpressions which
actually can't occur together, such as in '(b && ++x) + (!b && ++x)'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172760 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unsequenced.cpp
ee000bb236fd99f297c253206e5f110a8f49661e 17-Jan-2013 David Blaikie <dblaikie@gmail.com> Improve -Wreorder to handle cases of anonymous class member ordering

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172707 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reorder-ctor-initialization.cpp
6c3af3d0e3e65bcbca57bfd458d684941f6d0531 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wunsequenced (with compatibility alias -Wsequence-point) to warn on
expressions which have undefined behavior due to multiple unsequenced
modifications or an unsequenced modification and use of a variable.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172690 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
arn-unsequenced.cpp
4d8a33b4cea46948f86afccf0ad3675aff924148 17-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Delay linkage checks when validating the weakref attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172678 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-weakref.cpp
afb7ce3f877594362381926eaeac8ed6bbe18069 17-Jan-2013 Aaron Ballman <aaron@aaronballman.com> Fixes crash when illegal function definitions are deleted or defaulted. Fixes PR14577.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172676 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
2a5bb509e2d33a0f7aa4bb0ba53c73b5dfdd6bb4 17-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Check for internal weak decls after merging.

This fixes pr14946. The problem was that the linkage computation was done too
early, so things like "extern int a;" would be given external linkage, even if
a previous declaration was static.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172667 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-weak.cpp
02d65ee373feb1cb029185aa0de04d0c214eda3d 15-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Don't crash when binding a reference to a temporary pointer created from
resolving an overloaded function reference within an initializer list.
Previously we would try to resolve the overloaded function reference without
first stripping off the InitListExpr wrapper.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172517 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-references.cpp
a121eb3af061a9402aa88630a0eb535d92962e2c 15-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR14950: Fix out-of-bounds function parameter access in literal operator lookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172514 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-user-defined-literals.cpp
5c52166525f8714c3e3a979b156ec23426947fd3 15-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Fix behavior of [[gnu::]] function attributes. Per g++'s behavior, these
attributes appertain to a declaration, even though they would be much more
naturally modelled as appertaining to a function type. Previously, we would
try to distribute them from the declarator to the function type, then
reject them for being at an incorrect location. Now, we just distribute them
as far as the declarator; the existing attribute handling code can actually
apply them there just fine.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172504 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-gnu-attrs.cpp
fe1d594c3912f88f54786a6a9380c4359eb61b23 14-Jan-2013 NAKAMURA Takumi <geek4civic@gmail.com> clang/test/SemaCXX/cxx11-gnu-attrs.cpp: Add explicit -triple x86_64-unknown-unknown, or it doesn't work for targetting win32.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172404 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-gnu-attrs.cpp
d6e7fae82b857eaeb487ceb591942b8969afdd96 14-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Add extra tests for [[gnu::...]] attributes, missed from r172382.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172391 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-gnu-attrs.cpp
508276c8895d0a52198a0fa5dd01471236a94d50 12-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> bar

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172316 91177308-0d34-0410-b5e6-96231b3b80d8
uiltins.cpp
7a525acb2ba57ea03cfc8f843bfb2e5f81caf65f 12-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Fix a regression from 171193: main cannot be overloaded.
Thanks Eli Friedman for noticing it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172292 91177308-0d34-0410-b5e6-96231b3b80d8
verload-decl.cpp
193649c2a3ff0616777de934a2bf47eaeb4f1076 12-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Only produce one -Wc++98-compat warning when initializing a reference from an init list with multiple elements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172285 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
013539cddae154cd1782984a7dc3bb471cac397e 12-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Add a test from pr14898.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172283 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
294ddc63398f2c9435fcfbdb4da4ac3a23c1cbba 11-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Reject incompatible redeclarations of extern C symbols.

Before we were only checking if the new declaration itself was marked extern
C. Fixes prpr14766.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172243 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
601e6e894c2a38243588b375bed0b9a9e60060bb 11-Jan-2013 Enea Zaffanella <zaffanella@cs.unipr.it> Fixed an assertion failure triggered by invalid code.

Set invalid type of declarator after emitting error diagnostics,
so that it won't be later considered when instantiating the template.
Added test5_inst in test/SemaCXX/condition.cpp for non-regression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172201 91177308-0d34-0410-b5e6-96231b3b80d8
lias-template.cpp
ondition.cpp
abe75ef905626d00358427a7a3c59480c1f03361 09-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Handle static functions being redeclared in function scope.

Fixes pr14861.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171978 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
b9725cfb0a50731930a6331beb70f361b4d52a29 08-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Mark all subsequent decls used.

In the source

static void f();
static void f();
template<typename T>
static void g() {
f();
}
static void f() {
}
void h() {
g<int>();
}

the call to f refers to the second decl, but it is only marked used at the end
of the translation unit during instantiation, after the third f decl has been
linked in.

With this patch we mark all subsequent decls used, so that it is easy to check
if a symbol is used or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171888 91177308-0d34-0410-b5e6-96231b3b80d8
arn-func-not-needed.cpp
ef3c69406f73b892a3d5023ea42b3d7ed9c99d33 08-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Clear the LV cache when setting the instantiated from link.
Fixes pr14835.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171857 91177308-0d34-0410-b5e6-96231b3b80d8
isibility.cpp
774d8b4679ce1317da0f18336c3d27bdb11e5f63 08-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> PR14838: When a member reference is bound to a temporary, don't forget to
perform the semantic checks associated with the destruction of that temporary.
It'll be destroyed at the end of the constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171818 91177308-0d34-0410-b5e6-96231b3b80d8
ember-init.cpp
57cbb141ca7ee020d6853cd098065a9e0c2d69cc 07-Jan-2013 Douglas Gregor <dgregor@apple.com> Use the C++11 POD definition in C++11 mode to determine whether one
can create a VLA of class type. Fixes <rdar://problem/12151822>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171783 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array-cxx11.cpp
6acc4bc44db341d499a925cfe68bea89390039a4 05-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Assert that redeclarations have the same linkage.

It is somewhat hard to test linkage, so I decided to try to add an assert. This
already found some interesting cases where there were different.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171585 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
6769ccb6853871c085c8366ab5e993841ad56d00 03-Jan-2013 Rafael Espindola <rafael.espindola@gmail.com> Warn on unused auto variables.

To do so we have to wait until we know that the type of a variable has been
deduced. Sema::FinalizeDeclaration is the first callback that is used for
decl with or without initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171458 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
87b8127c2c65c8229e5b874c10a33f1ce13493ad 30-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Don't warn on unused member functions that are extern because of a typedef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171267 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
de210a51dc26de6bee00a9ab172111c6f245a9fe 30-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Use hasCLanguageLinkage when warning about non C return types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171263 91177308-0d34-0410-b5e6-96231b3b80d8
unction-extern-c.cpp
9f0c692c4db9012248c65fab6cb703f2ce444dfe 30-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Don't get confused if a extern "C" builtin function is redeclared without
the extern "C".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171260 91177308-0d34-0410-b5e6-96231b3b80d8
arn-bad-memaccess.cpp
9f409549fa36f1a69042d4793321e82004dbfea9 30-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Don't warn for undefined but used decls that are external because of a typedef.

This fixes pr14736. It is fairly ugly, but I don't think we can do much better
as we have to wait at least until the end of the typedef to know if the
function will have external linkage or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171240 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
78eeba8c7d53b6b2983c76b77b23b45b89ed939d 28-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Reject overloading of two static extern C functions.

This patch moves hasCLanguageLinkage to be VarDecl and FunctionDecl methods
so that they can be used from SemaOverload.cpp and then fixes the logic
in Sema::IsOverload.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171193 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
e57e3d3783586934e26191cfc06ed5f3d966ea9c 27-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Implement dcl.link paragraph 5.

The language linkage of redeclarations must match. GCC was already reporting
an error for this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171139 91177308-0d34-0410-b5e6-96231b3b80d8
inkage2.cpp
137d6625eb61a41e776d89b39f3cb958d4a21140 26-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Fix a regression from the previous commit.
Template instantiation can set the canonical decl to used after subsequent
decls have been chained, so we have to check that too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171088 91177308-0d34-0410-b5e6-96231b3b80d8
arn-func-not-needed.cpp
485458aa998c12e43bc9883b49060425d58b351d 26-Dec-2012 Rafael Espindola <rafael.espindola@gmail.com> Use the most recent redecl to decide if it is needed.

This fixes pr14691, which I think is a regression from r168519.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171077 91177308-0d34-0410-b5e6-96231b3b80d8
arn-func-not-needed.cpp
c83c2300e1946fea78ecd3c2e93d9c2dd2638a2b 19-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13470: Ensure that copy-list-initialization isntantiates as
copy-list-initialization (and doesn't add an additional copy step):

Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it
when instantiating initializers in order to correctly handle instantiation of
copy-list-initialization. Teach TreeTransform that function arguments are
initializations, and so need this special treatment too. Finally, remove some
hacks which were working around SubstInitializer's shortcomings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170489 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
a9990e80f5d1236277c87aa6fac03e0992c52341 14-Dec-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Have Sema::ActOnStartOfFunctionDef return the declaration that was passed it.

This fixes the missing warning here:

struct S {
template <typename T>
void meth() {
char arr[3];
arr[4] = 0; // warning: array index 4 is past the end of the array
}
};

template <typename T>
void func() {
char arr[3];
arr[4] = 0; // no warning
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170180 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
6febf1265b5a5c3025752193caa9714ed523b12d 13-Dec-2012 Eli Friedman <eli.friedman@gmail.com> Using CanQualType::getAs<ArrayType> is unsafe; fix the code currently using it,
and make sure additional uses don't get introduced. <rdar://problem/12858424>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170081 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bound-merge.cpp
206491dcbe1ed01ee8ce86a0ffe272d5d25491d3 13-Dec-2012 Eli Friedman <eli.friedman@gmail.com> Add missing check for error return from DefaultLvalueConversion. Fixes <rdar://problem/12857416>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170056 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
fff3248e69c478cfb4d1a1ffdefb808d5885535b 09-Dec-2012 Aaron Ballman <aaron@aaronballman.com> Virtual method overrides can no longer have mismatched calling conventions. This fixes PR14339.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169705 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override-x64.cpp
irtual-override-x86.cpp
2801d9afa1fabbc99b7c1ad9f2f3df0e0b24adb1 09-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix overload resolution for the initialization of a multi-dimensional
array from a braced-init-list. There seems to be a core wording wart
here (it suggests we should be testing whether the elements of the init
list are implicitly convertible to the array element type, not whether
there is an implicit conversion sequence) but our prior behavior appears
to be a bug, not a deliberate effort to implement the standard as written.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169690 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
xx0x-initializer-stdinitializerlist.cpp
bc2a35d5ff492107dab5bdb7682f0da2f4a88861 08-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Finish implementing 'selected constructor' rules for triviality in C++11. In
the cases where we can't determine whether special members would be trivial
while building the class, we eagerly declare those special members. The impact
of this is bounded, since it does not trigger implicit declarations of special
members in classes which merely *use* those classes.

In order to determine whether we need to apply this rule, we also need to
eagerly declare move operations and destructors in cases where they might be
deleted. If a move operation were supposed to be deleted, it would instead
be suppressed, and we could need overload resolution to determine if we fall
back to a trivial copy operation. If a destructor were implicitly deleted,
it would cause the move constructor of any derived classes to be suppressed.

As discussed on cxx-abi-dev, C++11's selected constructor rules are also
retroactively applied as a defect resolution in C++03 mode, in order to
identify that class B has a non-trivial copy constructor (since it calls
A's constructor template, not A's copy constructor):

struct A { template<typename T> A(T &); };
struct B { mutable A a; };


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169673 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
93699d23cd07c021eac2e26f8e32b58276bfa912 08-Dec-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: check member access on guarded non-primitive types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169669 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
ac71351acdefc9de0c770c1d717e621ac9e684bf 08-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Properly compute triviality for explicitly-defaulted or deleted special members.
Remove pre-standard restriction on explicitly-defaulted copy constructors with
'incorrect' parameter types, and instead just make those special members
non-trivial as the standard requires.

This required making CXXRecordDecl correctly handle classes which have both a
trivial and a non-trivial special member of the same kind.

This also fixes PR13217 by reimplementing DiagnoseNontrivial in terms of the
new triviality computation technology.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169667 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-struct.cpp
xx0x-cursory-default-delete.cpp
xx98-compat.cpp
8fda1ab0fbfeac24489906d0bd6714c337f66e0f 07-Dec-2012 NAKAMURA Takumi <geek4civic@gmail.com> clang/test: Remove "REQUIRES:LP64" in two tests. Each of them have explicit triple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169587 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
42427409fd75a48381071e6da008a3c06897437a 06-Dec-2012 Benjamin Kramer <benny.kra@googlemail.com> Sema: Don't emit a warning when __func__ is used in a lambda outside of a function.

Fixes PR14518.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169510 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
d5e839429771ad4d1a8b3db598cbbc6d93621f75 06-Dec-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't use dyn_cast on a Type* which might not be canonical. Fixes an extremely obscure record layout bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169467 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
91e2061763f5e59f57e59c6f141b74b5ff0408ad 05-Dec-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: check locks on method calls, operator=, and
copy constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169350 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
d87de7bdbc25dd84ae3dbefffda4539c443000d2 01-Dec-2012 Eli Friedman <eli.friedman@gmail.com> Make -Wtautological-constant-out-of-range-compare behave sanely for enums with a signed fixed type.
<rdar://problem/12780159>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169051 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
84268904947ada7e251932a6f5b0f4364df7a2c7 29-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Reject uses of __int128 on platforms that don't support it. Also move the ugly
'getPointerWidth(0) >= 64' test to be a method on TargetInfo, ready to be
properly cleaned up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168856 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
afb49189d6962f3636d6a93d09c0b495e94ac782 29-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> The declaration of a special member can require overload resolution to be
performed, to determine whether that special member is deleted or constexpr.
That overload resolution process can in turn trigger the instantiation of a
template, which can do anything, including triggering the declaration of that
very same special member function. When this happens, do not try to recursively
declare the special member -- that's impossible. Instead, only try to realise
the truth. There is no special member.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168847 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-member-functions.cpp
a70c3f8738cc123ded68c183cedd6e93df670c2f 28-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Per C++11 [except.spec]p2, rvalue references are not permitted in exception specifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168824 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
21173b1080abaa2738f9e700a9d4b0d04f928930 28-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14388: An array or function type in an exception specification should be
decayed to a pointer type. Patch by WenHan Gu, with a little tweaking and
additional testcases by me.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168822 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
b8abff66a8d30356c82314c4734c692cdd479e5e 28-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> C++ core issue 1344, PR10618: promote "addition of default argument makes this
a special member" diagnostic from warning to error, and fix the cases where it
produced diagnostics with incorrect wording.

We don't support this as an extension, and we ban it even in C++98 mode. This
breaks too much (for instance, the ABI-specified calling convention for a type
can change if it acquires a copy constructor through the addition of a default
argument).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168769 91177308-0d34-0410-b5e6-96231b3b80d8
opy-constructor-error.cpp
efault-arg-special-member.cpp
1c80b522e45243d91838bb9b549f844b762cd2bf 25-Nov-2012 Rafael Espindola <rafael.espindola@gmail.com> Add a basic testcase for the "variable is not needed" warning and one that
regressed in r168519.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168563 91177308-0d34-0410-b5e6-96231b3b80d8
arn-variable-not-needed.cpp
728948fba8ce2249db0a6fd228d883f38434289a 19-Nov-2012 Kaelyn Uhrain <rikka@google.com> When adding a NamedDecl to a correction, add the underlying Decl (via
getUnderlyingDecl()) so that derivatives of
CorrectionCandidateCallback::ValidateCandidate(...) don't have to worry
about being thrown by UsingDecls and such.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168317 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
8f50b24c8b17368f68c2e71240d487dde53f6da8 16-Nov-2012 Richard Trieu <rtrieu@google.com> Take into account the zero sign bit for positive numbers when computing the bit
width of an enum with negative values in IntRange. Include a test for
-Wtautological-constant-out-of-range-compare where this had manifested.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168126 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
621ba4f0dba0accdf67fb38e98bbe14db22ddf8e 15-Nov-2012 Nick Lewycky <nicholas@mxc.ca> Teach the uninitialized field warning about anonymous structs and union members.
Fixes PR14073!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168031 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
5d1cf4f292cb060b1973eb197607fc6d5716bd12 15-Nov-2012 Richard Trieu <rtrieu@google.com> Fix an off-by-one error by switching < to <= in -Wtautological-constant-out-of-range-compare and added test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168023 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
d6537015745128064dc12fcc06af65372dfd5da9 15-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> Per [basic.lookup.classref]p3, in an expression of the form p->~type-name, the
type-name is looked up in the context of the complete postfix-expression. Don't
forget to pass the scope into this lookup when the type-name is a template-id;
it might name an alias template which can't be found within the class itself.

Bug spotted by Johannes Schaub on #llvm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168011 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
seudo-destructors.cpp
526e627d2bd7e8cbf630526d315c90864898d9ff 14-Nov-2012 Richard Trieu <rtrieu@google.com> Improve -Wtautological-constant-out-of-range-compare by taking into account
type conversion between integers. This allows the warning to be more accurate.

Also, turned the warning off in an analyzer test. The relavent test cases
are covered by the tests in Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167992 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
b6ad9b163d50827d4cd7eccadb20432cd3c089d5 14-Nov-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> In ExpressionEvaluationContextRecord manage LambdaMangle with a shared
pointer, otherwise we will double free it when ExpressionEvaluationContextRecord
gets copied.

Fixes crash in rdar://12645424 & http://llvm.org/PR14252

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167946 91177308-0d34-0410-b5e6-96231b3b80d8
rash-lambda-12645424.cpp
66cff7257698d5528632917d38f9a3037bb1506d 14-Nov-2012 David Blaikie <dblaikie@gmail.com> Provide the correct mangling and linkage for certain unnamed nested classes.

This corrects the mangling and linkage of classes (& their member functions) in
cases like this:

struct foo {
struct {
void func() { ... }
} x;
};

we were accidentally giving this nested unnamed struct 'no' linkage where it
should've had the linkage of the outer class. The mangling was incorrecty too,
mangling as TU-wide unnamed type mangling of $_X rather than class-scoped
mangling of UtX_.

This also fixes -Wunused-member-function which would incorrectly diagnose
'func' as unused due to it having no linkage & thus appearing to be TU-local
when in fact it might be correctly used in another TU.

Similar mangling should be applied to function local classes in similar cases
but I've deferred that for a subsequent patch.

Review/discussion by Richard Smith, John McCall, & especially Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167906 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
97c81bfaf0b6c90576081c5af7ea22fab6f2b7f9 13-Nov-2012 Kaelyn Uhrain <rikka@google.com> For classes that have the warn_unused_result attribute, don't apply the
attribute to the class' methods even when they return an instance of the
class (e.g. assignment operators).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167873 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-result.cpp
d449c792d98f58277e02c0ddc8330cd9de5f82f5 13-Nov-2012 Kaelyn Uhrain <rikka@google.com> A couple of small fixes to r167783

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167791 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-result.cpp
51ceb7bab599ea7d39d290ff5e88e4a1f0f5bc5c 13-Nov-2012 Kaelyn Uhrain <rikka@google.com> Enable C++11 attribute syntax for warn_unused_result and allow it to be
applied to CXXRecordDecls, where functions with that return type will
inherit the warn_unused_result attribute.

Also includes a tiny fix (with no discernable behavior change for
existing code) to re-sync AttributeDeclKind enum and
err_attribute_wrong_decl_type with warn_attribute_wrong_decl_type since
the enum is used with both diagnostic messages to chose the correct
description.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167783 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-result.cpp
3078353fb56772193b9304510048ac075a2c95b5 12-Nov-2012 Ted Kremenek <kremenek@apple.com> Per discussion on cfe-dev, re-enable suppression of -Wimplicit-fallthrough on C, but also include dialects of C++ earlier than C++11.

There was enough consensus that we *can* get a good language solution
to have an annotation outside of C++11, and without this annotation
this warning doesn't quite mean's completeness criteria for this
kind of warning. For now, restrict this warning to C++11 (where an
annotation exists), and make this the behavior for the LLVM 3.2 release.
Afterwards, we will hammer out a language solution that we are all
happy with.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167749 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-cxx98.cpp
e0ff690900ecb28e7d840d7f765f25437eb67c66 09-Nov-2012 Nico Weber <nicolasweber@gmx.de> Don't crash on calling static member overloaded operator, PR14120

Patch from Brian Brooks!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167604 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
45a37da030be06bb7babf5e65a64d62cd0def7e6 08-Nov-2012 Matt Beaumont-Gay <matthewbg@google.com> Fix a bug I found while preparing my devmtg talk: When passing NULL to a
function that takes a const Foo&, where Foo is convertible from a large number
of pointer types, we print ALL the overloads, no matter the setting of
-fshow-overloads.

There is potential follow-on work in unifying the "print candidates, but not
too many" logic between OverloadCandidateSet::NoteCandidates and
ImplicitConversionSequence::DiagnoseAmbiguousConversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167596 91177308-0d34-0410-b5e6-96231b3b80d8
mbiguous-conversion-show-overload.cpp
e81b43bc306d361fcf4d411aeb14b43f8464bf4a 08-Nov-2012 David Blaikie <dblaikie@gmail.com> PR14284: crash on ext-valid returning NULL from a void function

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167565 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
b578aee665aad5ed1a46a26217c730fdfbfc8c2e 07-Nov-2012 David Blaikie <dblaikie@gmail.com> PR12713 - crash on invalid due to unmatched parens in decltype

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167547 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype.cpp
ce2661f9ccb85de1aacaa7c3ea414a757f5986f6 07-Nov-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11851 (and duplicates): Whenever a constexpr function is referenced,
instantiate it if it can be instantiated and implicitly define it if it can be
implicitly defined. This matches g++'s approach. Remove some cases from
SemaOverload which were marking functions as referenced when just planning how
overload resolution would proceed; such cases are not actually references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167514 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
mplicit-exception-spec.cpp
70a01898008a90007866f15c4d9d53ba00b0d203 07-Nov-2012 Eli Friedman <eli.friedman@gmail.com> Fix assertion failure with auto and nested initializer list; PR14272.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167506 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
f64231e9f47234826fbcdc3b4fe0370ef6c9961d 06-Nov-2012 Michael Han <Michael.Han@autodesk.com> Teach Clang parser to reject C++11 attributes that appertain to declaration specifiers.

We don't support any C++11 attributes that appertain to declaration specifiers so reject
the attributes in parser until we support them; this also conforms to what g++ 4.8 is doing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167481 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
95b66fca551d5148413f66db63143620e5846818 05-Nov-2012 Nico Weber <nicolasweber@gmx.de> Delete comment I forgot to delete in my last change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167418 91177308-0d34-0410-b5e6-96231b3b80d8
arn-using-namespace-in-header.cpp
776b7ac94c6329f0d2786b5ca28547ad9b9e5577 05-Nov-2012 Nico Weber <nicolasweber@gmx.de> Use Richard's BE_THE_HEADER trick to simplify a test. No intended behavior change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167417 91177308-0d34-0410-b5e6-96231b3b80d8
arn-using-namespace-in-header.cpp
arn-using-namespace-in-header.h
161db02a747e0c8e717f542674c0581c03fc3c93 02-Nov-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: Fixed ICE caused by double delete when late parsed
attributes are attached to function declarations nested inside a class method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167321 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
cef3a7bf84817c58c7666df9e87199b9a6b8b9a3 02-Nov-2012 Eli Friedman <eli.friedman@gmail.com> Change diagnostics for enums with fixed underlying type so in C++98 mode, we cite C++11.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167273 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
ef4b666e841e3917385892713612888ec6c3a056 01-Nov-2012 Rafael Espindola <rafael.espindola@gmail.com> Fix an incorrect assert, the LHS can be an LValue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167232 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
889b99e6d5b389c0ed99e7ad8470c28b146a42d3 01-Nov-2012 Eli Friedman <eli.friedman@gmail.com> Correctly reject gotos in function-level try blocks. PR14225.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167184 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
c39a2b0577e5b2160575f5c1a43c2569ce3059d8 30-Oct-2012 Ted Kremenek <kremenek@apple.com> Update test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167005 91177308-0d34-0410-b5e6-96231b3b80d8
o-warn-composite-pointer-type.cpp
9568f0c13a84695c5cc064e7c32412f84604cb1e 29-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Partially roll back r166898; it exposed a bug in the standard.

The problem is as follows: C++11 has contexts which are not
potentially-evaluated, and yet in which we are required or encouraged to
perform constant evaluation. In such contexts, we are not permitted to
implicitly define special member functions for literal types, therefore
we cannot evalaute those constant expressions.

Punt on this in one more context for now by skipping checking constexpr
variable initializers if they occur in dependent contexts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166956 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
c36e3596be351a557cc81c8db3ea75fa4bd54c7a 28-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Revert functional part of r166896 and just suppress -Wunneeded-internal-declaration for reference types for now. This needs more work; the cases we currently miss are a bit random.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166899 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
1432a43e3076eec84967305bd85bace3a6e9102b 28-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> When determining whether to try evaluating the initializer of a variable, check
whether the initializer is value-dependent rather than whether we are in a
dependent context. This allows us to detect some errors sooner, and fixes a
crash-on-invalid if a dependent type leaks out to a non-dependent context in
error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166898 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
xx11-crashes.cpp
623ef4bf31bc5ec14ed9b5645921a0a2e0d00ee4 28-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> In -Wunneeded-internal-declaration, suppress the warning for variables which
might have been used in constant expressions, rather than suppressing it for
variables which are const. The important thing here is that such variables
can have their values used without actually being marked as 'used'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166896 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
644e90a17f1bc3dcc2b7b018eb02abb3a1c2022b 28-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Fix invalid jump scopes again. This time without trying to find out if an
incomplete type has a destructor or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166895 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
1a7b2e99c09e4368d7b6e43cdbfe53ee0ade1a51 28-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Add a testcase from the previous bootstrap problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166894 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
a92afb611c015196541edd53347aa23dba1949ac 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Revert 166876 while I debug a bootstrap problem.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166878 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
ff8f9676c025dd9942521a29bf967505c3bda62a 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Reapply 166855 with an early exit on null QualTypes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166876 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
3954d394e42e63b15b1a3634e4c93e0986c75a6d 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Add a reduced testcase of the last bootstrap failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166866 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
029d28449c4adb5ce92b58b5a57eeca6e396e404 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Revert r166855. I can reproduce the bootstrap failure and have a testcase
to reduce.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166863 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
b21c11d655027ae439be83af84f9bce3ab0f728b 27-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a test case for the stack overflow in rdar://12542261

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166858 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-crashes.cpp
76b5d24b748896b5a0be7fff779943e3108e7518 27-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Fix cases where we were not producing an error when a computed goto could
jump over destructor calls.
Fixes pr13812.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166855 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
1e584697aa795f915cd46afefd4e1141ee356b8c 27-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> In Parser::ParseDecltypeSpecifier, make sure the end location it returns
is at the end of parsed tokens when an error occurs, otherwise we'll hit
an assertion when trying to annotate the decltype tokens.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166826 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype.cpp
e925322569cb4aad26cc62036a13e2d3daed862d 25-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14171: Don't crash if we hit one of the paths where GetFullTypeForDeclarator
rebuilds a function type, and that function type has parens around its name.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166644 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
unction-type-qual.cpp
39e177692ea2096af2ad0dcead79250b50958fa3 24-Oct-2012 David Blaikie <dblaikie@gmail.com> Fix false positive in -Wunused-variable when a ctor call make involve cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166625 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
9dd686d2be3c3785a089ff12a3d3eb64e9b32dc0 24-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Update regression tests for r166617.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166619 91177308-0d34-0410-b5e6-96231b3b80d8
xplicit.cpp
ambda-expressions.cpp
a45451d0959501c7d82582c61571a29cfdacdb0b 24-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Don't print scope qualifiers for references to a type defined locally in a function. Patch by Grzegorz Jablonski.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166617 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
6c8b6498bed5f378018285c42b367dc2e06a98cd 24-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Add an additional test for namespaces and -Wmissing-variable-declarations. Move C++ test into SemaCXX.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166616 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-variable-declarations.cpp
946fa657a70408719d2cafa542e396b002d61316 24-Oct-2012 Rafael Espindola <rafael.espindola@gmail.com> Add a test showing that nodebug is accepted in methods too. Patch by
Paul Robinson.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166606 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-nodebug.cpp
a7a38cb64e0781b8489332cedcfae9c8f95ba22e 23-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Fix pretty-printing pseudo-destructor calls. Patch by Grzegorz Jablonski.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166500 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
84c3b9745f813a784b5d8ce77f2785750523d9eb 23-Oct-2012 Matt Beaumont-Gay <matthewbg@google.com> Fix -Wunused-value to not warn on expressions that have unresolved lookups due
to dependent arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166468 91177308-0d34-0410-b5e6-96231b3b80d8
nused.cpp
b5b37d194dddb960f43f763b3f9c3e17e7be3c2d 23-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Ugly ugly hack for libstdc++-4.6 and libstdc++-4.7 compatibility. These
libraries have an incorrect definition of std::common_type (inherited from a
bug in the standard -- see LWG issue 2141), whereby they produce reference
types when they should not.

If we instantiate a typedef named std::common_type<...>::type, which is defined
in a system header as decltype(... ? ... : ...), and the decltype produces a
reference type, convert it to the non-reference type. (This doesn't affect any
LWG2141-conforming implementation of common_type, such as libc++'s, because the
default implementation of common_type<...>::type isn't supposed to produce a
reference type.)

This is horrible. I'm really sorry. :( Better ideas appreciated!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166455 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_common_type_hack.cpp
efeeccfb5efa94b6b4198298a80ad9a699bebcce 21-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r166268, reverted in r166272, with a fix for the issue which Nick
found: if an overloaded operator& is present before a template definition,
the expression &T::foo is represented as a CXXOperatorCallExpr, not as a
UnaryOperator, so we didn't notice that it's permitted to reference a non-static
data member of an unrelated class.

While investigating this, I discovered another problem in this area: we are
treating template default arguments as unevaluated contexts during substitution,
resulting in performing incorrect checks for uses of non-static data members in
C++11. That is not fixed by this patch (I'll look into this soon; it's related
to the failure to correctly instantiate constexpr function templates), but was
resulting in this bug not firing in C++11 mode (except with -Wc++98-compat).

Original message:

PR14124: When performing template instantiation of a qualified-id outside of a
class, diagnose if the qualified-id instantiates to a non-static class member.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166385 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-overloaded-functions.cpp
arn-assignment-condition.cpp
b687f3ba4cdc3fd6e4fa9a89addc1efa61761eeb 20-Oct-2012 Logan Chien <tzuhsiang.chien@gmail.com> Fix __builtin_va_arg assertion failure in ARM AAPCS.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166369 91177308-0d34-0410-b5e6-96231b3b80d8
uiltins-arm.cpp
uiltins-va_arg.cpp
5016a70c183a50845a0421802d161093dd0643f6 20-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1472: A reference isn't odr-used if it has preceding initialization,
initialized by a reference constant expression.

Our odr-use modeling still needs work here: we don't yet implement the 'set of
potential results of an expression' DR.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166361 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
e1aebe1e3aabe955e3805e994647e5e31dcc4d8c 19-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Pretty-print a ParenListExpr in a variable initializer correctly. Patch by Grzegorz Jablonski.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166311 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
8e8fb3be5bd78f0564444eca02b404566a5f3b5d 19-Oct-2012 Andy Gibbs <andyg1001@hotmail.co.uk> Prior to adding the new "expected-no-diagnostics" directive to VerifyDiagnosticConsumer, make the necessary adjustment to 580 test-cases which will henceforth require this new directive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166280 91177308-0d34-0410-b5e6-96231b3b80d8
008-01-11-BadWarning.cpp
icrosoftCompatibilityNoExceptions.cpp
R10447.cpp
R5086-ambig-resolution-enum.cpp
R6562.cpp
R9884.cpp
R9902.cpp
R9908.cpp
_try.cpp
nonymous-union-cxx11.cpp
locks-1.cpp
locks.cpp
orland-extensions.cpp
uiltin-exception-spec.cpp
uiltin-ptrtomember-overload.cpp
uiltin_objc_msgSend.cpp
ast-explicit-ctor.cpp
lass-layout.cpp
omma.cpp
omplex-init-list.cpp
onstexpr-turing.cpp
ecltype-98.cpp
ecltype-pr4444.cpp
ecltype-pr4448.cpp
ecltype-this.cpp
ecltype.cpp
efault-argument-temporaries.cpp
o-while-scope.cpp
mpty-class-layout.cpp
xception-spec-no-exceptions.cpp
riend-out-of-line.cpp
nu-case-ranges.cpp
oto2.cpp
ndirect-goto.cpp
ssue547.cpp
ocal-classes.cpp
ookup-member.cpp
ember-expr-anonymous-union.cpp
ember-expr-static.cpp
ember-pointer-size.cpp
s-exception-spec.cpp
ew-delete-predefined-decl-2.cpp
ew-delete-predefined-decl.cpp
o-warn-composite-pointer-type.cpp
ullptr-98.cpp
verload-value-dep-arg.cpp
verloaded-builtin-operators-0x.cpp
ragma-pack.cpp
ragma-unused.cpp
refetch-enum.cpp
rimary-base.cpp
trtomember-overload-resolution.cpp
ualified-member-enum.cpp
hort-wchar-sign.cpp
tatic-initializers.cpp
ag-ambig.cpp
rivial-constructor.cpp
rivial-destructor.cpp
nused-functions.cpp
sing-decl-pr4441.cpp
sing-decl-pr4450.cpp
alue-dependent-exprs.cpp
ararg-default-arg.cpp
arn-new-overaligned-2.cpp
arn-self-comparisons.cpp
ero-length-arrays.cpp
79cf161f178e36ce6d8aeea2a247e367b8d0fc34 19-Oct-2012 Nick Lewycky <nicholas@mxc.ca> Revert r166268, this fix for a crash-on-invalid introduced a rejects-valid.
Richard has an unreduced testcase to work with.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166272 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-overloaded-functions.cpp
arn-assignment-condition.cpp
80ddc31c5379df78a007eaf08d531efdbcd9b161 19-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR14124: When performing template instantiation of a qualified-id outside of a
class, diagnose if the qualified-id instantiates to a non-static class member.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166268 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-overloaded-functions.cpp
arn-assignment-condition.cpp
5f750680d421328225e597d6429a298027dc6360 19-Oct-2012 David Blaikie <dblaikie@gmail.com> Handle diamond inheritance in -Woverloaded-virtual.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166254 91177308-0d34-0410-b5e6-96231b3b80d8
arn-overloaded-virtual.cpp
25c9bc117d8825dce7911f6fddf3725d1914a7c6 18-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Use the type as written when pretty-printing C-style casts. Patch by Grzegorz Jablonski.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166237 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
eafa9d4d0d8b97f006dbd19c1e51d14663c8c5c3 18-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Remove check which incorrectly suppressed printing an identifier in type printing. Patch by Benoit Perrot.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166227 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
d03ef04ed32e9c9d7c714e8f1b31693c5b907dd2 18-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Fix AST pretty-printing for C++ new expressions with placement arguments with default values.

Based on patch by Grzegorz Jablonski.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166226 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
9be36ab27b874b404099650e0c29bc92f3c7662d 18-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1535: only potentially-evaluated typeid expressions are disallowed in constant
expressions, not *any* typeid on a polymorphic class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166156 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
76398e5ad39ae719dcc650c7cddeb25379c02c34 18-Oct-2012 David Blaikie <dblaikie@gmail.com> Fix -Woverloaded-virtual when the using statement refers to a base declaration of a virtual function.

GCC and Clang both do not warn on:

struct a { virtual void func(); };
struct b: a { virtual void func(); void func(int); };
struct c: b { void func(int); using b::func; };

but if the "using" was using a::func GCC would still remain silent where Clang
would warn. This change makes Clang consistent with GCC's existing behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166154 91177308-0d34-0410-b5e6-96231b3b80d8
arn-overloaded-virtual.cpp
bea52dac0c2e717990109cfd4812bc3422378b1a 18-Oct-2012 Fariborz Jahanian <fjahanian@apple.com> Adds couple of missing warning flags so warnings can be turned
off. // rdar://12501960


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166150 91177308-0d34-0410-b5e6-96231b3b80d8
o-warn-composite-pointer-type.cpp
64fe36eab6f0cf02a38d1a555e2e132890e231d2 17-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update test FIXME: The '[]' in 'delete []' is never part of a lambda.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166090 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-0x.cpp
16de3db5bb059c5274e75a788581b8123c05762a 17-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Move test to a more appropriate place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166078 91177308-0d34-0410-b5e6-96231b3b80d8
st-print.cpp
9b29f4fe3d0600edf6ba00d48f2d4f2b1984f247 16-Oct-2012 David Blaikie <dblaikie@gmail.com> Implement GCC's -Wint-to-pointer-cast.

This implementation doesn't warn on anything that GCC doesn't warn on with the
exception of templates specializations (GCC doesn't warn, Clang does). The
specific skipped cases (boolean, constant expressions, enums) are open for
debate/adjustment if anyone wants to demonstrate that GCC is being overly
conservative here. The only really obvious false positive I found was in the
Clang regression suite's MPI test - apparently MPI uses specific flag values in
pointer constants. (eg: #define FOO (void*)~0)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166039 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
ecl-expr-ambiguity.cpp
3ce9fae275ec05cd648d6093b95eb1d05bc14a98 12-Oct-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: support multiple thread-safety attributes on
declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165826 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
2edcde8747a000113b434a5c88b4648beed4197b 11-Oct-2012 Eli Friedman <eli.friedman@gmail.com> Make sure we perform the variadic method check correctly for calls to a member operator(). PR14057.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165678 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-format.cpp
ararg-non-pod.cpp
3ea19c8307932655092235b57f04a5e6658bbc46 11-Oct-2012 David Blaikie <dblaikie@gmail.com> Fix a crash-on-invalid when parsing a reference to an invalid auto declaration

auto x((unknown));
int& y = x;

would crash because we were not flagging 'x' as an invalid declaration here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165675 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
b5e4ace3161bd2c3f88f39e228ba8f6aaa15e751 10-Oct-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix stack overflow when trying to create an implicit moving
constructor with invalid code.

rdar://12240916

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165623 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-crashes.cpp
ef2388b10c41a9696d5d81f42ca79ff005fef7fc 06-Oct-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: allow attributes on constructors to refer to 'this'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165339 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
d1a55a6631b11b6c5364772023451c547eafedee 05-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Egriegious hack to support libstdc++4.6's broken <atomic> header, which defines
a non-inline namespace, then reopens it as inline to try to add its symbols to
the surrounding namespace. In this one special case, permit the namespace to be
reopened as inline, and patch up the name lookup tables to match.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165263 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_atomic_ns_hack.cpp
6880f492365cc4fa4c941aa83688635003ee7498 03-Oct-2012 Michael Han <Michael.Han@autodesk.com> Improve C++11 attribute parsing.

- General C++11 attributes were previously parsed and ignored. Now they are parsed and stored in AST.
- Add support to parse arguments of attributes that in 'gnu' namespace.
- Differentiate unknown attributes and known attributes that can't be applied to statements when emitting diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165082 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-per-method.cpp
6b2cc42f1504db6577fd67fa55ef023254744e2c 03-Oct-2012 Richard Trieu <rtrieu@google.com> Change how the SelfReferenceChecker handles MemberExpr. Instead of treating
each one separately, process a stack of MemberExpr's as a single unit so that
static calls and member access will not be warned on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165074 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
66360e224689dc23a0acd8a6705ba50bec13bc97 02-Oct-2012 Jordan Rose <jordan_rose@apple.com> -Wformat: Don't check format strings in uninstantiated templates.

Also applies to -Wnonnull, -Wtype-safety, and -Wnon-pod-varargs.
All of these can be better checked at instantiation time.

This change does not actually affect regular CallExpr function calls,
since the checks there only happen after overload resolution.
However, it will affect Objective-C method calls.

<rdar://problem/12373934>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164984 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings.cpp
01cad02220180b9646525295f502c00c64a172d0 01-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix treatment of case which came up on std-proposals@: 'void' is permitted in core constant expressions, despite not being a literal type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164968 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
c4a839101e883261d038a1d5ea718dd46abd1d2d 01-Oct-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13978: A 'decltype' DeclSpec has an expression representation, not a type
representation. Fix crash if it appears in the return type of a member function
definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164967 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-overloaded-functions.cpp
568f785a76e0a21de20932abf09ce7653e651f92 01-Oct-2012 Richard Trieu <rtrieu@google.com> Cleaning up the self initialization checker.
-Allow Sema to do more processing on the initial Expr before checking it.
-Remove the special conditions in HandleExpr()
-Move the code so that only one call site is needed.
-Removed the function from Sema and only call it locally.
-Warn on potentially evaluated reference variables, not just casts to r-values.
-Update tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164951 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
66da0abf7ab7cd449bb1d5134b2ef97d9d34d812 29-Sep-2012 Alexander Kornienko <alexfh@google.com> Compatibility macro detection for the -Wimplicit-fallthrough diagnostic.

Summary:
When issuing a diagnostic message for the -Wimplicit-fallthrough diagnostics, always try to find the latest macro, defined at the point of fallthrough, which is immediately expanded to "[[clang::fallthrough]]", and use it's name instead of the actual sequence.

Known issues:
* uses PP.getSpelling() to compare macro definition with a string (anyone can suggest a convenient way to fill a token array, or maybe lex it in runtime?);
* this can be generalized and used in other similar cases, any ideas where it should reside then?

Reviewers: doug.gregor, rsmith

Reviewed By: rsmith

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D50

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164858 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-macro.cpp
f3477c13eeaf11b32a41f181398fb5deffd0dd73 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Revert 'Fix a typo 'iff' => 'if''. iff is an abreviation of if and only if. See: http://en.wikipedia.org/wiki/If_and_only_if Commit 164766

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164769 91177308-0d34-0410-b5e6-96231b3b80d8
iscrim-union.cpp
94ff8e1f57c6382d91d0de981a4f311509d83e37 27-Sep-2012 Sylvestre Ledru <sylvestre@debian.org> Fix a typo 'iff' => 'if'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164766 91177308-0d34-0410-b5e6-96231b3b80d8
iscrim-union.cpp
d278dbe43aff06865ae3388ba6b4ac5a9d68e179 26-Sep-2012 DeLesley Hutchins <delesley@google.com> Fix template instantiation of attributes. More specifically, fix the case
where an attribute is attached to a forward declaration of a template function,
and refers to parameters of that declaration, but is then inherited by the
definition of that function. When the definition is instantiated, the
parameter references need to be remapped.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164710 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
ea30e2f8667668173cf7433c3c80cf603bd922a4 25-Sep-2012 John McCall <rjmccall@apple.com> Add the Microsoft __is_interface_class type trait.
Patch by Andy Gibbs!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164591 91177308-0d34-0410-b5e6-96231b3b80d8
s-interface.cpp
e402e72273cde2a64fa6097c1fe93f500038675d 25-Sep-2012 John McCall <rjmccall@apple.com> Fix for r163013 regression and further __interface enhancement.
Patch by Andy Gibbs!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164590 91177308-0d34-0410-b5e6-96231b3b80d8
s-interface.cpp
e49ff3ef3459e97fa76502bd9eae4ed9170fd048 25-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix crash when a decltype expression in a trailing return type refers to the
function being instantiated. An error recovery codepath was recursively
performing name lookup (and triggering an unbounded stack of template
instantiations which blew out the stack before hitting the depth limit).

Patch by Wei Pan!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164586 91177308-0d34-0410-b5e6-96231b3b80d8
railing-return-0x.cpp
6319917b5021e9602389b49ca4f245d235e9b90a 25-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Handle C++ functional casts in a similar way to C-style casts in
unused expression warnings. <rdar://problem/12359208>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164569 91177308-0d34-0410-b5e6-96231b3b80d8
nused.cpp
dd152615ff4ef03ba1f28f50f6040a28be301b0e 24-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> More tests for r164545 (change extension warning about 'long long').


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164556 91177308-0d34-0410-b5e6-96231b3b80d8
arn-c++11-extensions.cpp
e3b136bd873508c9ac0ee6eba98c2a810a177eba 24-Sep-2012 Dmitri Gribenko <gribozavr@gmail.com> Change the wording of the extension warning from
> 'long long' is an extension when C99 mode is not enabled
to
> 'long long' is a C++11 extension
while compiling in C++98 mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164545 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
xx98-compat-pedantic.cpp
d2f388299153d80cbe5ffaaed8a882b59a1b59bc 21-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: better handling of unreachable blocks. Fixes a bug
where a call to function marked 'noreturn' is followed by unreachable
implicit destructor calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164394 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
7821e0756744018a34c533f30cdabe62a72d4e4a 21-Sep-2012 Hans Wennborg <hans@hanshq.net> Make warnings about uninitialized fields include the field name.

This makes the wording more informative, and consistent with the other
warnings about uninitialized variables.

Also, me and David who reviewed this couldn't figure out why we would
need to do a lookup to get the name of the variable; so just print the
name directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164366 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
efaulted-ctor-loop.cpp
ninitialized.cpp
60ff198a22815b0aec5b96eaae977de067dcd4c1 21-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: fix bug where shared trylock was treated
as exclusive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164332 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
186af2de86aea41d7418158e68f96c1f8620e013 21-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: properly canonicalize calls to virtual methods within
lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164324 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
8b533d97e0683a0c87096b95927a2e9ce02243d4 20-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> If the range in a for range statement doesn't have a viable begin/end function,
but can be dereferenced to form an expression which does have viable begin/end
functions, then typo-correct the range, even if something else goes wrong with
the statement (such as inaccessible begin/end or the wrong type of loop
variable).

In order to ensure we recover correctly and produce any followup diagnostics in
this case, redo semantic analysis on the for-range statement outside of the
diagnostic trap, after issuing the typo-correction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164323 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-dereference.cpp
a193f20916f0e0e5a3b0f76ca69e2b3870c1a325 20-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> Improvements to my patch in r164143 per
Richard's comments. // rdar://12202422


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164316 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
arn-enum-compare.cpp
7c3c6bca2662704fbe038137d8ef2e4112359586 20-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Handle lambdas where the lambda-declarator is an explicit "(void)". PR13854.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164274 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
2a237e03c407ff55bd8639b18658a8751955f1db 19-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: Fix warning when EXCLUSIVE_LOCKS_REQUIRED
is placed on a function that has no path to the exit block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164244 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
5b280f28351bbdc103cc50d3b0f52f92d286fa0a 19-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: fix ICE when EXCLUSIVE_LOCKS_REQUIRED or
LOCKS_EXCLUDED is used on a method with a name that is is not a simple
identifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164242 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
4d09f592dbd34154408e96278d0daca67649fb9d 19-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> Fix test better way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164234 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-examples.cpp
9cd5b24315aea4bc58bac03cfb4874e076b013b8 18-Sep-2012 Eli Friedman <eli.friedman@gmail.com> Add an extra check for invalid decls in the lambda semantic analysis to avoid a crash. PR13860.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164168 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
15a9356464f0809e1cb24aa3a7cc2577914ff5bb 18-Sep-2012 Fariborz Jahanian <fjahanian@apple.com> c: warn when an integer value comparison with an
integral expression have the obvious result.
Patch reviewed by John McCall off line.
// rdar://12202422


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164143 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
or-range-examples.cpp
arn-enum-compare.cpp
471f985ae04817e0e8198a925fc7d74eaacaf962 18-Sep-2012 Hans Wennborg <hans@hanshq.net> Warn about self references in in-class initializers.

This makes Clang warn about self references in in-class initializers,
for example:

struct S {
int a = a + 42;
};

This basically just moves UninitializedFieldVisitor up a bit in
SemaDeclCXX.cpp, and adds a call to it from ActOnCXXInClassMemberInitializer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164131 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
43f8c40b05482894d94a8779a5ccd0f9a35420f3 18-Sep-2012 Ted Kremenek <kremenek@apple.com> Per discussion on cfe-dev, remove -Wunique-enums entirely. There
is no compelling argument that this is a generally useful warning,
and imposes a strong stylistic argument on code beyond what it was
intended to find warnings in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164083 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unique-enum.cpp
a6ddea6adbef22d4e2673dbb7236186ac5b14e09 14-Sep-2012 Richard Smith <richard-llvm@metafoo.co.uk> When diagnosing multiple mem-initializers in a delegating ctor, point to the delegating initializer, not to the first initializer. For good measure, also highlight the other initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163919 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-delegating-ctors.cpp
867c179ed3b5f338537a84da658ecac25addb9f7 14-Sep-2012 Douglas Gregor <dgregor@apple.com> Add missing test from r163874.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163910 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unused.cpp
dd084276526db1d53edf2b6fc8c4c8187e6ab540 14-Sep-2012 Douglas Gregor <dgregor@apple.com> As we do with base and member initializers in a dependent class, delay
type checking for non-static data member initializers in a dependent
class, because our ASTs lose too much information to when
type-checking an initializer. Fixes <rdar://problem/11974632>,
although the result is still rather unsatisfactory.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163871 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
71074fdf40a8f5b53810712102b58c27efc30759 13-Sep-2012 Douglas Gregor <dgregor@apple.com> When we substitute into the type of a function based on the
TypeSourceInfo, we may have lost some adjustments made to the type of
that function due to declaration merging. Adjust the resulting type
correspondingly. Fixes PR12948 / <rdar://problem/11552434>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163845 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-noreturn.cpp
75379455fc88ca1f021e55ffe1cab3a9c2b2a37a 13-Sep-2012 Douglas Gregor <dgregor@apple.com> Promote the warning about extra qualification on a declaration from a
warning to an error. C++ bans it, and both GCC and EDG diagnose it as
an error. Microsoft allows it, so we still warn in Microsoft
mode. Fixes <rdar://problem/11135644>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163831 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
lass.cpp
ested-name-spec.cpp
db3353f6c9f3ffd291ce9e314e996071252c4285 12-Sep-2012 NAKAMURA Takumi <geek4civic@gmail.com> clang/test/SemaCXX/dcl_ambig_res.cpp: [PR13819] It requires LP64 for now due to __SIZE_TYPE__.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163700 91177308-0d34-0410-b5e6-96231b3b80d8
cl_ambig_res.cpp
b774d73540ba62a5e6a8e9217b320b27a946cfad 12-Sep-2012 NAKAMURA Takumi <geek4civic@gmail.com> clang/test: [PR8833] Introduce the feature "LP64" to suppress LLP64-incompatible tests.

I think some of them could be rewritten to fit also LLP64.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163699 91177308-0d34-0410-b5e6-96231b3b80d8
style-cast.cpp
unctional-cast.cpp
verloaded-builtin-operators.cpp
f9ee0bacd27085417dedf1a9f5df8a4cb5a758c1 12-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: fix bug in expression matching code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163656 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
24a6c9459a50248e502884f129c789d452f70acc 11-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: fix bug related to lock_returned attribute
on templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163642 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
4e0d3cb72f37f46e62df9bbf5a5f3eb910de3f5b 11-Sep-2012 Rafael Espindola <rafael.espindola@gmail.com> Fix namespace nesting and remove windows line endings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163620 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
654f1d508cbc9553f4931b340dfa19b453f72ebd 11-Sep-2012 David Blaikie <dblaikie@gmail.com> Fix PR13784: instantiation of an abstract class in a conditional operator.

A couple of missing "RequireNonAbstractType" calls in conditional operator
handling. I looked for opportunities to tie this check in to all relevant
callers of PerformCopyInitialization (couldn't be all callers since this is
called for base subobject copying too, where it's acceptable to copy abstract
types) but the callers varied too much & in many cases had substantial code
or conditionals on the RequireNonAbstractType call, the
PerformCopyInitialization call, or the code between the two calls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163555 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
3f0ec5209726641782468bd4c7597e79dda78b15 10-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: differentiate between two forms of analysis; a precise
analysis that may give false positives because it is confused by aliasing, and
a less precise analysis that has fewer false positives, but may have false
negatives. The more precise warnings are enabled by -Wthread-safety-precise.
An additional note clarify the warnings in the precise case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163537 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
0cb8939851364eb37a0f8bf8bb47874b7d966915 10-Sep-2012 Douglas Gregor <dgregor@apple.com> Allow vector types in pseudo-destructor expressions. Fixes PR13798.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163514 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
e75bb61f1b876afaa6b2f4a2b860c2889ea1d050 09-Sep-2012 Abramo Bagnara <abramo.bagnara@bugseng.com> Fixed support for disabled wchar_t and added an appropriate test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163476 91177308-0d34-0410-b5e6-96231b3b80d8
o-wchar.cpp
3d074c3828220d94c290a9d3c052b25865760e1f 07-Sep-2012 Chad Rosier <mcrosier@apple.com> Whitespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163404 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
0b4db3e08a201c35f0011489bd5cd5d39bbe54fb 07-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: Add support for selectively turning off warnings
within part of a particular method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163397 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
fd0f11ccd51154e933fad7dfa134cb4f62c87056 05-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: bugfix for case where a trylock occurs in an
expression involving temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163237 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
b197b781b792e43f7e164a889ccfc30673d54fff 05-Sep-2012 Abramo Bagnara <abramo.bagnara@gmail.com> Added missing test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163226 91177308-0d34-0410-b5e6-96231b3b80d8
o-wchar.cpp
679fc9314c2bde5eb6bea33c790d1a035461e618 04-Sep-2012 Joao Matos <ripzonetriton@gmail.com> Revert r163078 per chandlerc's request.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163145 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer-ms.cpp
f712c48ce80763f3c0bbc2e1b0afe6ed3b5b88cb 02-Sep-2012 Joao Matos <ripzonetriton@gmail.com> Added a diagnostic for mismatched MS inheritance attributes. Also fixed the incomplete type member pointer size calculation under the MS ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163078 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer-ms.cpp
5408153e9140f34bbca9059638c61cc12bd539cf 01-Sep-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: fix handling of LOCK_RETURNED attribute so that the
latest definition of a function is always used when computing lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163028 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
4e4c15765d5f097e21dcaa30f1a94481924340f7 31-Aug-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: fix handling of string constants in mutex
expressions, which should be ignored right now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163026 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
a6c66cedc022c9e5d45a937d6b8cff491a6bf81b 31-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Change the representation of builtin functions in the AST
(__builtin_* etc.) so that it isn't possible to take their address.
Specifically, introduce a new type to represent a reference to a builtin
function, and a new cast kind to convert it to a function pointer in the
operand of a call. Fixes PR13195.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162962 91177308-0d34-0410-b5e6-96231b3b80d8
uiltins.cpp
ccc4f283cf0e892e19a097a2aa4ec4491682b15f 30-Aug-2012 Douglas Gregor <dgregor@apple.com> The presence of a user-*declared* constructor makes the default
constructor not user provided (and, therefore, non-trivial). Fixes
<rdar://problem/11736429>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162947 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
d295970adc93ed4035d18df23673c2a72d124cc8 30-Aug-2012 Douglas Gregor <dgregor@apple.com> Extend the "__is_pod" hack, which demotes various type trait keywords
(__is_pod, __is_signed, etc.) to normal identifiers if they are
encountered in certain places in the grammar where we know that prior
versions of libstdc++ or libc++ use them, to still allow the use of
these keywords as type traits. Fixes <rdar://problem/9836262> and PR10184.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162937 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_is_pod_hack.cpp
48def65d1cfbd020c5d4a7e542a00d63808c6060 29-Aug-2012 Hans Wennborg <hans@hanshq.net> Move TLS check from LValueExprEvaluator::VisitVarDecl to
CheckLValueConstantExpression.

Richard pointed out that using the address of a TLS variable is ok in a
core C++11 constant expression, as long as it isn't part of the eventual
result of constant expression evaluation. Having the check in
CheckLValueConstantExpression accomplishes this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162850 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
29f431b3e310ae6bd367dccf5a2794ad1cac9592 29-Aug-2012 Hans Wennborg <hans@hanshq.net> Fix r162835 as per Richard's comments.

VisitVarDecl should return Error(E), and we should test that the address
of a TLS var can't be used as a constexpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162837 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
88617a24adafed42e33d196972f97c72d9a5e0a0 28-Aug-2012 Hans Wennborg <hans@hanshq.net> Warn about suspicious implicit conversions from floating point to bool

This warns in two specific situations:

1) For potentially swapped function arguments, e.g.

void foo(bool, float);
foo(1.7, false);

2) Misplaced brackets around function call arguments, e.g.

bool InRange = fabs(a - b < delta);

Where the last argument in a function call is implicitly converted
from bool to float, and the function returns a float which gets
implicitly converted to bool.

Patch by Andreas Eckleder!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162763 91177308-0d34-0410-b5e6-96231b3b80d8
arn-implicit-conversion-floating-point-to-bool.cpp
df5faf5e7ae6823d0af0b801c4ac26d47f2cee97 25-Aug-2012 Chad Rosier <mcrosier@apple.com> [ms-inline asm] As part of a larger refactoring, rename AsmStmt to GCCAsmStmt.
No functional change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162632 91177308-0d34-0410-b5e6-96231b3b80d8
issing-header.cpp
4bda1d8cfe7d42b2798a06d16a5b776d980aad5f 22-Aug-2012 Rafael Espindola <rafael.espindola@gmail.com> Merge existing attributes before processing pragmas in friend template
declarations.
Fixes pr13662.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162360 91177308-0d34-0410-b5e6-96231b3b80d8
ragma-visibility.cpp
e1715b66a878bcab315513351e5df68bfc010d2e 21-Aug-2012 Sam Panzer <espanz@gmail.com> Better diagnostics for range-based for loops with bad range types.

The old error message stating that 'begin' was an undeclared identifier
is replaced with a new message explaining that the error is in the range
expression, along with which of the begin() and end() functions was
problematic if relevant.

Additionally, if the range was a pointer type or defines operator*,
attempt to dereference the range, and offer a FixIt if the modified range
works.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162248 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-dereference.cpp
or-range-no-std.cpp
ypo-correction.cpp
d30fb9e2462d3cfe04d4f32cb40bf1edd9e3b383 20-Aug-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: fix scoping issues related to 'this', including an
ICE in friend functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162229 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
5965b7c7ddf8d9635426943a05441c71cb59fef6 20-Aug-2012 Hans Wennborg <hans@hanshq.net> Better wording for reference self-initialization warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162198 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
ninitialized.cpp
0576681bac125be07f77f66b02a3dba2c3a24557 18-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR41111, PR5925, PR13210: Teach tentative parsing to annotate identifiers and
nested names as id-expressions, using the annot_primary_expr annotation, where
possible. This removes some redundant lookups, and also allows us to
typo-correct within tentative parsing, and to carry on disambiguating past an
identifier which we can determine will fail lookup as both a type and as a
non-type, allowing us to disambiguate more declarations (and thus offer
improved error recovery for such cases).

This also introduces to the parser the notion of a tentatively-declared name,
which is an identifier which we *might* have seen a declaration for in a
tentative parse (but only if we end up disambiguating the tokens as a
declaration). This is necessary to correctly disambiguate cases where a
variable is used within its own initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162159 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ypo-correction.cpp
nknown-type-name.cpp
8be9e77f7e532866fa0ef2bc8c3cd549f0cc8da2 17-Aug-2012 Hans Wennborg <hans@hanshq.net> Warn about self-initialization of references.

Initializing a reference with itself, e.g. "int &a = a;" seems like a
very bad idea.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162093 91177308-0d34-0410-b5e6-96231b3b80d8
onvert-to-bool.cpp
eferences.cpp
ninitialized.cpp
0652c35a303a6186142eea566c88714c59bdc664 17-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't forget to apply #pragma pack to partial and explicit specializations of
class templates. This fixes misalignment issues in llvm/Support/Endian.h when
built by Clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162074 91177308-0d34-0410-b5e6-96231b3b80d8
ragma-pack.cpp
95526a480f252514d63a00bb032a2cb205dbf021 16-Aug-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: prevent a compiler error in cases where a
late-parsed attribute is attached to an invalid declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161997 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
1b4b1461da093bfcb85edfb67710d21f79c7f16c 15-Aug-2012 Richard Trieu <rtrieu@google.com> Check local static variables for self reference on initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161909 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
2217f853e1909b80f87ce0dcec5543e894d11bc9 14-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Make __is_convertible_to handle abstract types correctly. PR13591.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161828 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
ee2f032fe0fc86762608458c2a167ae504579a64 10-Aug-2012 DeLesley Hutchins <delesley@google.com> Thread-safety-analysis: adds existential quantification over lock
expressions. The syntax &MyClass::mutex is interpreted as a
pattern that matches m->mutex for any object m of type MyClass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161691 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
a74b715cdc37c4523818a4018faae99d977aa537 10-Aug-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: refactor to support more sophisticated handling
of expressions, and better error messages.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161690 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
c3b2308f66fe8abd2c1a911b500c0b989c295819 08-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Unify the codepaths for emitting deprecation warnings. The test changes are just to account for us emitting notes more consistently.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161528 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
50800fc551ac6b8a95cca662223e7f061bbd169a 08-Aug-2012 David Blaikie <dblaikie@gmail.com> Implement warning for integral null pointer constants other than the literal 0.

This is effectively a warning for code that violates core issue 903 & thus will
become standard error in the future, hopefully. It catches strange null
pointers such as: '\0', 1 - 1, const int null = 0; etc...

There's currently a flaw in this warning (& the warning for 'false' as a null
pointer literal as well) where it doesn't trigger on comparisons (ptr == '\0'
for example). Fix to come in a future patch.

Also, due to this only being a warning, not an error, it triggers quite
frequently on gtest code which tests expressions for null-pointer-ness in a
SFINAE context (so it wouldn't be a problem if this was an error as in an
actual implementation of core issue 903). To workaround this for now, the
diagnostic does not fire in unevaluated contexts.

Review by Sean Silva and Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161501 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
ambda-expressions.cpp
50d61c8ccfc633b13cdf594ea3cd3a217076debe 08-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement final piece of DR963 and also DR587:

A conditional operator between glvalues of types cv1 T and cv2 T produces a
glvalue if the expressions are of the same value kind and one of cv1 and cv2
is a subset of the other.

A conditional operator between two null pointer constants is permitted if one
of them is of type std::nullptr_t.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161476 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
ullptr.cpp
06808f1b880f461c396450db4c6a9c6d6c6c2efc 08-Aug-2012 Eli Friedman <eli.friedman@gmail.com> Get rid of an early return in Sema::ActOnFields which doesn't make sense anymore.
Fixes a crash (<rdar://problem/11067144>), and generally seems to improve
recovery in other cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161474 91177308-0d34-0410-b5e6-96231b3b80d8
R9460.cpp
onstructor-initializer.cpp
604fb38cd943649bee579103d17ca6cda4aad144 08-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> When building a conditional operator where one operand is a throw-expression
and the other is a glvalue of class type, don't forget to copy-initialize a
temporary when performing the lvalue-to-rvalue conversion on the glvalue.
Strangely, DefaultLvalueConversions misses this part of the lvalue-to-rvalue
conversions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161450 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
0b8220ae342f71fb50e763668f92d038eb54fb3f 07-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> -Wunused-private-fields: Don't try to check unresolved initializer expressions
for side-effects. Instead, check for side-effects after performing
initialization. Doing so also removes some strange corner cases and differences
between in-class initialization and constructor initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161449 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-private-field.cpp
e27a08aa814cb2fe9367163edd612c90aad57789 06-Aug-2012 Richard Trieu <rtrieu@google.com> For global record types, the self reference checker was called twice, resulting
in duplicate -Wuninitialized warnings. Change so that only the check in
TryConstructorInitialization() will be used and a single warning be emitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161345 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
eef00293897a73cc47f4d42e2653ff47c59d6030 06-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13527: don't assert if a function is explicitly defaulted when it's already
been defined.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161315 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
5295b97d6a0117414a24d319d9a018191ec1d8e3 03-Aug-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix crash if a literal operator template's template parameter pack is not a non-type template parameter pack. Patch by Andy Gibbs!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161260 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-operators.cpp
5121781d756e7814168b4255a57545d5ca497ec3 01-Aug-2012 Aaron Ballman <aaron@aaronballman.com> Explicitly defaulted constructors cannot be used for default initialization.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161088 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-cursory-default-delete.cpp
3c394c54511b27be0ff6968f159bba3521ab3c3e 01-Aug-2012 Douglas Gregor <dgregor@apple.com> When testing whether we can perform copy or move initialization, be
sure to supply an initialization location. Fixes <rdar://problem/11951661>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161084 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
43e3deeabf3ca02da427b63df8604e2daf86e8a3 31-Jul-2012 Sylvestre Ledru <sylvestre@debian.org> Fix some minor typos

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161036 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
d64effc4e31044c05d6e4400150edb26e914983a 30-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Extend the ',' versus ';' diagnostic for -Wvexing-parse to cover the with-arguments case as well as the no-arguments case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160999 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
b9c6261d02f688d0a9a36b736ad5956fbc737854 30-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improvements to vexing-parse warnings. Make the no-parameters case more
accurate by asking the parser whether there was an ambiguity rather than trying
to reverse-engineer it from the DeclSpec. Make the with-parameters case have
better diagnostics by using semantic information to drive the warning,
improving the diagnostics and adding a fixit.

Patch by Nikola Smiljanic. Some minor changes by me to suppress diagnostics for
declarations of the form 'T (*x)(...)', which seem to have a very high false
positive rate, and to reduce indentation in 'warnAboutAmbiguousFunction'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160998 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
cl_ambig_res.cpp
ecl-expr-ambiguity.cpp
e5e8f4d2db48ec21f537fd6452276c1fe26bc726 30-Jul-2012 Benjamin Kramer <benny.kra@googlemail.com> Use the location of the copy assignment when diagnosing classes that are nontrivial because of it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160962 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
2cd7f41f4eb2b02568664132253f8e1d9cf381dd 30-Jul-2012 Benjamin Kramer <benny.kra@googlemail.com> Fix ambiguity detection in GetBestOverloadCandidateSimple.

When performing the simplistic overload resolution for single-argument methods,
don't check the best overload for ambiguity with itself when the best overload
doesn't happen to be the first one.

Fixes PR13480.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160961 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
d22f0847a95938203fe12ab50bfc33d79c664a77 28-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13433: In Microsoft mode, don't require function calls within decltype
expressions to have complete return types (or accessible destructors). If the
return type is required to be complete for some other reason (for instance, if
it is needed by overload resolution), then it will still be required to be
complete. This is apparently required in order to parse a MSVC11 header.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160924 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoft-cxx0x.cpp
b399696572b5c610e8b88574084f7982c715dc94 27-Jul-2012 Benjamin Kramer <benny.kra@googlemail.com> Fix PR13394: Erasing from a vector changes the end of the vector, so make sure we always have the right end.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160855 91177308-0d34-0410-b5e6-96231b3b80d8
r13394-crash-on-invalid.cpp
b9d0b76e42fd2d4cdfd135220302458d03ad09fe 27-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be
expected).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160847 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
mplicit-exception-spec.cpp
ember-init.cpp
ype-traits.cpp
612409ece080e814f79e06772c690d603f45fbd6 25-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12057: Allow variadic template pack expansions to cross lambda boundaries.
Rather than adding a ContainsUnexpandedParameterPack bit to essentially every
AST node, we tunnel the bit directly up to the surrounding lambda expression
when we reach a context where an unexpanded pack can not normally appear.
Thus any statement or declaration within a lambda can now potentially contain
an unexpanded parameter pack.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160705 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
168c07b93510aabd2a19af323d1132fffe498ee4 24-Jul-2012 Hans Wennborg <hans@hanshq.net> Tweak warning text for returning incomplete type from extern "C" functions.

A warning was added in r150128 for returning non-C compatible
user-defined types from functions with C linkage.

This makes the text more clear for the case when the type isn't
decidedly non-C compatible, but incomplete.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160681 91177308-0d34-0410-b5e6-96231b3b80d8
unction-extern-c.cpp
b67e7fc607671ef3df64de63c38545197e9992b2 22-Jul-2012 Francois Pichet <pichet2000@gmail.com> Allow the parser to recover gracefully if a typename is used to introduce a decltype type.
In Microsoft mode, we emit a warning instead of an error.

This fixes a couple of errors when parsing the MSVC 11 RC headers with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160613 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
dfd110ce5e64077ec94df195233e7a39895bf15e 22-Jul-2012 Francois Pichet <pichet2000@gmail.com> char16_t and char32_t are defined via typedef in MSVC 11 RC. So introduce a way to disable keywords under Microsoft mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160612 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
4914c2897bb8beb5e15b2a0bf3e72d78da0706ae 20-Jul-2012 Aaron Ballman <aaron@aaronballman.com> No longer assuming the number of prototype arguments is always less than the number of formal parameters for a variadic function call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160570 91177308-0d34-0410-b5e6-96231b3b80d8
ember-operator-expr.cpp
381767fcfe2fdf53727099d95b23b0c9e6a9aa6c 20-Jul-2012 Nico Weber <nicolasweber@gmx.de> Let Expr::HasSideEffects() return false for NULL, bool literals, this, and nullptr.

Fixes PR13413, -Wunused-private-field now warns on unused fields initialized to NULL.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160541 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-private-field.cpp
4a410dd179a960318dc0fef0a4eb1c1de63d9870 20-Jul-2012 Nico Weber <nicolasweber@gmx.de> Rename warn-unused-member.cpp to warn-unused-private-field.cpp to
make it match the flag it tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160536 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-member.cpp
arn-unused-private-field.cpp
ddcfbc9ad1817f545610999d655ac6c28d4c0c12 19-Jul-2012 Jordan Rose <jordan_rose@apple.com> For varargs, diagnose passing ObjC objects by value like other non-POD types.

While we still want to consider this a hard error (non-POD variadic args are
normally a DefaultError warning), delaying the diagnostic allows us to give
better error messages, which also match the usual non-POD errors more closely.

In addition, this change improves the diagnostic messages for format string
argument type mismatches by passing down the type of the callee, so we can
say "variadic method" or "variadic function" appropriately.

<rdar://problem/11825593>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160517 91177308-0d34-0410-b5e6-96231b3b80d8
rintf-block.cpp
rintf-cstr.cpp
ee7af50cc7999a2e5101da80bef0fdcff8c90b11 19-Jul-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a test case for rdar://11806334.

Makes sure we don't overflow the stack.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160511 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
f81678707e936cf04a2a9f7c21d51a77ffc1f6c9 19-Jul-2012 Aaron Ballman <aaron@aaronballman.com> Relaxed enumeration constant naming rules for scoped enumerators so they no longer emit a diagnostic when the enumeration's name matches that of the class. Fixes PR13128.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160490 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
5912597f3a01f6b5a6f6c5543317d209dbbb0a87 18-Jul-2012 Eli Friedman <eli.friedman@gmail.com> Fix test so it works the same way on 32-bit and 64-bit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160415 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
26dc97cbeba8ced19972a259720a71aefa01ef43 17-Jul-2012 Eli Friedman <eli.friedman@gmail.com> Don't treat overflow in floating-point conversions as a hard error in constant evaluation. <rdar://problem/11874571>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160394 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
251c449b280eb845017a6c022ed7189d17c63d49 17-Jul-2012 Rafael Espindola <rafael.espindola@gmail.com> Handle the case where the base type is not dependent, but the derived one is.
Fixes pr13353.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160393 91177308-0d34-0410-b5e6-96231b3b80d8
r13353.cpp
9532e0d89ca2afa556f032aa9377f6ec1d3eaa3e 17-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> -Wuninitialized: Split the classification of DeclRefExprs as initialization or
use out of TransferFunctions, and compute it in advance rather than on-the-fly.

This allows us to handle compound assignments with DeclRefExprs on the RHS
correctly, and also makes it trivial to treat const& function parameters as not
initializing the argument. The patch also makes both of those changes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160330 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
85f485a70fbec54c9b4562dfc4d95188ea6c9b48 16-Jul-2012 David Blaikie <dblaikie@gmail.com> Fix rejects-valid: explicit specialization of redeclared deleted function template.

Review by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160306 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
2b884a873afac6b766dc7fff26a645b77b97dfcd 15-Jul-2012 Eric Christopher <echristo@apple.com> Use llvm::APSInt::isSameValue to compare for the same value.

Finishes rdar://11875995

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160225 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unique-enum.cpp
3f635c08b2d0b2d5bafb38da09589cb238407faa 14-Jul-2012 Ted Kremenek <kremenek@apple.com> Refine CFG so that '&&' and '||' don't lead to extra confluence points when used in a branch, but
instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||'
respectively. This eliminates some artifical control-flow from the CFG and results in a more
compact CFG.

Note that this patch only alters the branches 'while', 'if' and 'for'. This was complex enough for
one patch. The remaining branches (e.g., do...while) can be handled in a separate patch, but they
weren't immediately tackled because they were less important.

It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement.
I've tried to audit these changes, but it is also known that the destructor logic needs some refinement
in the area of '||' and '&&' regardless (i.e., their are known bugs).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160218 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
f729ce0b231e045b8e7db61e85e87186c09db238 12-Jul-2012 Rafael Espindola <rafael.espindola@gmail.com> Ignore visibility attributes after definitions. This matches newer (4.7) gcc's
behavior and is the first step in fixing pr13338.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160104 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-visibility.cpp
e3f470a718ec00eb8b546e405fa59bc2df2d7c46 12-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Stop instantiating a class if we hit a static_assert failure. Also, if the
static_assert fails when parsing the template, don't diagnose it again on every
instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160088 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-assert.cpp
78541c433049322b27b4f437973076ba29cff709 11-Jul-2012 Jordan Rose <jordan_rose@apple.com> Allow -verify directives to be filtered by preprocessing.

This is accomplished by making VerifyDiagnosticsConsumer a CommentHandler,
which then only reads the -verify directives that are actually in live
blocks of code. It also makes it simpler to handle -verify directives that
appear in header files, though we still have to manually reparse some files
depending on how they are generated.

This requires some test changes. In particular, all PCH tests now have their
-verify directives outside the "header" portion of the file, using the @line
syntax added in r159978. Other tests have been modified mostly to make it
clear what is being tested, and to prevent polluting the expected output with
the directives themselves.

Patch by Andy Gibbs! (with slight modifications)

The new Frontend/verify-* tests exercise the functionality of this commit,
as well as r159978, r159979, and r160053 (Andy's other -verify enhancements).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160068 91177308-0d34-0410-b5e6-96231b3b80d8
arn-deprecated-header.cpp
a4334dffde250c22c339a974a7131914fe723180 11-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix crash when constant-evaluating a CXXConstructExpr representing
value-initialization for an array of class type with a trivial default
constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160024 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
13106117060c90d6f84bd2ed7a5c03e0502ff419 10-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: impove handling of trylock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160018 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
bb35151a166db2b4fee043bc90e60858ac2b7a89 08-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Reject 'int a[1][];' in Sema rather than crashing in IR generation. Found by a
misreduction of PR13290.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159905 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bound-merge.cpp
de31aa7f0ef71f5c162372e319cbc03c0924f074 08-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13290: Constant-evaluation support for CXXConstructExprs which construct a
multidimensional array of class type. Also, preserve zero-initialization when
evaluating an initializer list for an array, in case the initializers refer to
later elements (which have preceding zero-initialization).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159904 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
20599392a99956eaac4cf351a0935574090cb6c3 07-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12670: Support for initializing an array of non-aggregate class type from an
initializer list. Patch by Olivier Goffart, with extra testcases by Meador Inge
and Daniel Lunow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159896 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
xx0x-initializer-aggregates.cpp
cl_init_aggr.cpp
5381c05f51e5b7c7627f1d95b9a3425303ce086a 05-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: eliminate false positives in case where the definition
duplicates attributes on the declaration. Also eliminates a false negative in
ReleasableMutexLock. Fixing this bug required some refactoring.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159780 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
f4bb8d06c4f1665f89a9e9ddd61f2a2d26904da0 05-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13273: When performing list-initialization with an empty initializer list,
actually perform value initialization rather than trying to fake it with a call
to the default constructor. Fixes various bugs related to the previously-missing
zero-initialization in this case.

I've also moved this and the other list initialization 'special case' from
TryConstructorInitialization into TryListInitialization where they belong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159733 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
xx0x-initializer-constructor.cpp
96fac6a7fe89deff7860e536febbd4ae17bb57f3 03-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: improve handling of smart pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159679 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
9d6e7f3e12f1a825377ace33161e80caeda8cd06 03-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread Safety Analysis: handle expressions involving temporaries,
e.g. ExprWithCleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159674 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
bbe334142b38d2f9dad3ae2eb7b332c54a5b2cc1 03-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: fixed bug that occurs when very silly people
use scoped_lockable without putting unlock_function on the
destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159609 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
879a4334e4c4cab0c22ba91492ffc2838bbc21fc 03-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: fixed incorrect error message at the end of a locks_required function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159607 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
c36eda1113e014400d32fbbb99be36ff0b41f795 03-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: don't warn in case of duplicate annotation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159606 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
76f0a6e9bc9ee5aae029f959f64fae290727cca4 02-Jul-2012 DeLesley Hutchins <delesley@google.com> Thread Safety Analysis: turn off checking within trylock functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159601 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
8a50fe0d76b0f245b4cdd599230f2ee023be82cd 02-Jul-2012 Douglas Gregor <dgregor@apple.com> Be more eager about setting the 'Invalid' bit on an invalid class
template instantiation. I wasn't able to reproduce this down to
anything small enough to put in our test suite, but it's "obviously"
okay to set the invalid bit earlier and precludes a
known-broken-but-not-marked-broken class from being used elsewhere.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159584 91177308-0d34-0410-b5e6-96231b3b80d8
R9460.cpp
622da859b816036290b7e6f046521e4dea388361 02-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Additional testing for fixes in r158289 and r158290 to allow implicitly-declared
constructors for non-literal types to be constexpr in some circumstances.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159513 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
4ac5751efb9de1065c71b0db587185d552803e2f 29-Jun-2012 Kaelyn Uhrain <rikka@google.com> In Sema::ClassifyName, try to avoid nonsensical corrections to
keywords when doing type correction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159464 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
04ca19b97e85381920df7214f2c31b6833b314ce 29-Jun-2012 Richard Trieu <rtrieu@google.com> Add a fix-it hint note to -Wunique-enum to suggest that the last element gets
initialized with the next to last element to silence the warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159458 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unique-enum.cpp
619ee6acdd43b95b20c5aa96b22c3f238ce1a021 29-Jun-2012 David Blaikie <dblaikie@gmail.com> Avoid redundant error when redefining a function as deleted.

Reviewed by Doug Gregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159442 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
592a4230c6e91fead00d605f6155080544cdf8c9 29-Jun-2012 Douglas Gregor <dgregor@apple.com> When a builtin that requires a constant is given a type- or
value-dependent expression, don't complain that it wasn't the constant
we wanted. Fixes <rdar://problem/11688587> and PR11074.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159404 91177308-0d34-0410-b5e6-96231b3b80d8
eon-vector-types.cpp
c99a5d820ead4e4f1f4b4a8ab61007b8da0307e6 29-Jun-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: support release() function on scoped
lockable objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159387 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
12d2cc71bfeb1e7be9ce00fc52feab50941cac24 27-Jun-2012 Fariborz Jahanian <fjahanian@apple.com> patch to suggest 'static' function should be 'static inline'
when it appears to be unused and occurs in a header.
// rdar://11202617


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159282 91177308-0d34-0410-b5e6-96231b3b80d8
arn-static-function-inheader.cpp
arn-static-function-inheader.h
2dc509d89379c7921ef0dd95d88cd1fc8b0526d1 27-Jun-2012 Daniel Jasper <djasper@google.com> Introduce __has_feature(attribute_unused_on_fields) to determine whether
the current version of clang understands __attribute__((unused)) on
fields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159252 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-member.cpp
e92b1f4917bfb669a09d220dc979fc3676df4da8 26-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix lifetime issue for backing APValue of OpaqueValueExpr in recursive
constexpr function evaluation, and corresponding ASan / valgrind issue in
tests, by storing the corresponding value with the relevant stack frame. This
also prevents re-evaluation of the source of the underlying OpaqueValueExpr,
which makes a major performance difference for certain contrived code (see
testcase update).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159189 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
d9cf8268dcd3f4d393b7a38fef7eb40c7e7f4d10 25-Jun-2012 David Blaikie <dblaikie@gmail.com> PR12937: Explicitly deleting an explicit template specialization.

This works around a quirk in the way that explicit template specializations are
handled in Clang. We generate an implicit declaration from the original
template which the explicit specialization is considered to redeclare. This
trips up the explicit delete logic.

This change only works around that strange representation. At some point it'd
be nice to remove those extra declarations to make the AST more accurately
reflect the C++ semantics.

Review by Doug Gregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159167 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
f6172aee547241427e6dabdd0bd6fcaf1c046689 25-Jun-2012 Eli Friedman <eli.friedman@gmail.com> Use std::map instead of llvm::DenseMap because we rely on the stability of references to values in these maps. PR13197.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159161 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-many-arguments.cpp
831421f24057b93ea28bc92d8bd6290631a43caf 25-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r158887, reverted in r158949, along with a fix for the bug which
resulted in it being reverted. A test for that bug was added in r158950.

Original comment:

If an object (such as a std::string) with an appropriate c_str() member function
is passed to a variadic function in a position where a format string indicates
that c_str()'s return type is desired, provide a note suggesting that the user
may have intended to call the c_str() member.

Factor the non-POD-vararg checking out of DefaultVariadicArgumentPromotion and
move it to SemaChecking in order to facilitate this. Factor the call checking
out of function call checking and block call checking, and extend it to cover
constructor calls too.

Patch by Sam Panzer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159159 91177308-0d34-0410-b5e6-96231b3b80d8
rintf-block.cpp
rintf-cstr.cpp
f63797c741e646b9482d204c88dee02fb41d7962 25-Jun-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: implement lock_returned attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159152 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
5c62ef52ac555bc2e2c9a3d26b2aa9b0598451f7 25-Jun-2012 Daniel Jasper <djasper@google.com> Add test for -Wused-but-marked-unused on private fields.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159130 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-member.cpp
9f728cd37476c6588b06d241fa778d2df6e277da 23-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Minor improvements to some C99 variadic-macro-related diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159054 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
c1fb54265614845ee1e09856af6e46961c6209f4 23-Jun-2012 Kaelyn Uhrain <rikka@google.com> Perform typo correction for base class specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159046 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
0da4414f3d30c34fafb81b13b2cec3680c0bc9e1 22-Jun-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: fixes a bug in which locksets are not handled
properly if there is a join point in the control flow graph that involves
a trylock. Also changes the source locations of some warnings to be
more consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159008 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
4e294eea2c8a8965e24682ed9da8944969830813 22-Jun-2012 Rafael Espindola <rafael.espindola@gmail.com> Revert r158887. This fixes pr13168.

Revert "If an object (such as a std::string) with an appropriate c_str() member function"

This reverts commit 7d96f6106bfbd85b1af06f34fdbf2834aad0e47e.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158949 91177308-0d34-0410-b5e6-96231b3b80d8
rintf-block.cpp
rintf-cstr.cpp
28a5f0cdfcc927a94c1bda6a225200762df22411 21-Jun-2012 David Blaikie <dblaikie@gmail.com> PR13165: False positive when initializing member data pointers with NULL.

This now correctly covers, I believe, all the pointer types:
* 'any' pointers (both function and data normal pointers and ObjC object pointers)
* member pointers (both function and data)
* block pointers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158931 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
7d96f6106bfbd85b1af06f34fdbf2834aad0e47e 21-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> If an object (such as a std::string) with an appropriate c_str() member function
is passed to a variadic function in a position where a format string indicates
that c_str()'s return type is desired, provide a note suggesting that the user
may have intended to call the c_str() member.

Factor the non-POD-vararg checking out of DefaultVariadicArgumentPromotion and
move it to SemaChecking in order to facilitate this. Factor the call checking
out of function call checking and block call checking, and extend it to cover
constructor calls too.

Patch by Sam Panzer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158887 91177308-0d34-0410-b5e6-96231b3b80d8
rintf-block.cpp
rintf-cstr.cpp
86197b311ddb938c9605fdc3e4e57157c4cfe9bd 20-Jun-2012 Alexander Kornienko <alexfh@google.com> Added test with sizeof conditions (relies on to-be-implemented functionality of CFG, discussion: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120507/057370.html)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158854 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough.cpp
33c0f3703de3ab6d8f3a41d7fb9d2b3489617b21 20-Jun-2012 Jordan Rose <jordan_rose@apple.com> Remove -Winternal-linkage-in-inline in C++.

It's very easy for anonymous external linkage to propagate in C++ through
return types and parameter types. Likewise, it's possible that a template
containing an inline function is only used with parameters that have internal
linkage. Actually diagnosing where the internal linkage comes from is fairly
difficult (both to locate and then to print nicely). Finally, since we only
have one translation unit available, we can't even prove that any of this
violates the ODR.

This warning needs better-defined behavior in C++ before it can really go in.

Rewording of the C warning (which /is/ specified by C99) coming shortly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158836 91177308-0d34-0410-b5e6-96231b3b80d8
nline.cpp
ed36b2a80878c29603bdc89a7969253fb6446174 20-Jun-2012 Nico Weber <nicolasweber@gmx.de> Do a second lookup for type_info in the global namespace in microsoft mode. PR13153.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158768 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibilityNoExceptions.cpp
b26331b4ff419b22861b0823daf83bc8f22a6803 19-Jun-2012 David Blaikie <dblaikie@gmail.com> Enable -Wnull-conversion for non-integral target types (eg: double).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158744 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
0d3317e0a2e0adb57ce8d075ebdcb41a3f939805 19-Jun-2012 Kaelyn Uhrain <rikka@google.com> Improve the error message when a function overload candidate is rejected
because it expects a reference and receives a non-l-value.

For example, given:

int foo(int &);
template<int x> void b() { foo(x); }

clang will now print "expects an l-value for 1st argument" instead of
"no known conversion from 'int' to 'int &' for 1st argument". The change
in wording (and associated code to detect the case) was prompted by
comment #5 in PR3104, and should be the last bit of work needed for the
bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158691 91177308-0d34-0410-b5e6-96231b3b80d8
ser-defined-conversions.cpp
c4429b9ee5045525f532d00e820a81b7eeac28f8 19-Jun-2012 Jordan Rose <jordan_rose@apple.com> Change -Winternal-linkage-in-inline from ExtWarn to Warning in C++.

Per post-commit review, it's not appropriate to use ExtWarn in C++, because
we can't prove that the inline function will actually be defined in more than
one place (and thus we can't prove that this violates the ODR).

This removes the warning entirely from uses in the main source file in C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158689 91177308-0d34-0410-b5e6-96231b3b80d8
nline.cpp
0eb3f45a92f706d50de55aefb19d66febfba78aa 19-Jun-2012 Jordan Rose <jordan_rose@apple.com> Support -Winternal-linkage-in-inline in C++ code.

This includes treating anonymous namespaces like internal linkage, and allowing
const variables to be used even if internal. The whole thing's been broken out
into a separate function to avoid nested ifs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158683 91177308-0d34-0410-b5e6-96231b3b80d8
nline.cpp
93f95f2a2cbb6bb3d17bfb5fc74ce1cccea751b6 18-Jun-2012 Sean Hunt <scshunt@csclub.uwaterloo.ca> Handle C++11 attribute namespaces automatically.

Now, as long as the 'Namespaces' variable is correct inside Attr.td, the
generated code will correctly admit a C++11 attribute only when it has the
appropriate namespace(s).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158661 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-per-method.cpp
c2f51cfefd77e9b25f201ecf879343d6d9a45158 15-Jun-2012 Sean Hunt <scshunt@csclub.uwaterloo.ca> Stop referring to functions as methods in per-function fallthrough-checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158545 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-per-method.cpp
de5e75caac71d4cfeb9d04cd10281176f43579d6 15-Jun-2012 Richard Trieu <rtrieu@google.com> Use a proper visitor to recursively check for uninitialized use in constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158477 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
ninitialized.cpp
0e9e9f8d17e38b3c44f6e1323be3a812a793bdd1 14-Jun-2012 Daniel Jasper <djasper@google.com> Look at incomplete FunctionTemplateDecls in order to determine whether
a CXXRecordDecl is complete. Fixes Bug 13086.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158469 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-member.cpp
568eae48a4e19c0359cdcd2a33b8ec9812e4abbc 13-Jun-2012 Daniel Jasper <djasper@google.com> Allow __attribute__((unused)) for fields and make it silence
-Wunused-private-field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158411 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-member.cpp
df9ef1bc8c3780307ab2ed81bf5e31c23310b936 13-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13099: Teach -Wformat about raw string literals, UTF-8 strings and Unicode escape sequences.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158390 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings-0x.cpp
3c2fcf8705023e1d91d1c85dc7c8a4aa2248050b 10-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12964: __int128 and unsigned __int128 are promoted integral types, be sure to
consider them when enumerating builtin operator candidates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158293 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-operator.cpp
verloaded-builtin-operators.cpp
0f4b5be4a3b3e1c18e611e5a5c262ef028e8320a 08-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR13051: Only suggest the 'template' and 'operator' keywords when performing
typo-correction after a scope specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158231 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
f4fe843aac730e2202b3c9c6c52649ee186ba788 08-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Allow friend declarations of defaulted special member functions. Only
definitions of such members are prohibited, not mere declarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158186 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
ef094a1ab79c57269b627cb19748384d9a26fb31 08-Jun-2012 Kaelyn Uhrain <rikka@google.com> Ignore corrections to functions with bodies when deciding which
correction to use for an invalid function redeclaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158177 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
ested-name-spec.cpp
8d3607bf22a6a70acce3722a758f02d4ea84fc3a 06-Jun-2012 Kaelyn Uhrain <rikka@google.com> Allow CorrectTypo to add/modify nested name qualifiers to typos that
are otherwise too short to try to correct.

The TODOs added to two of the tests are for existing deficiencies in the
typo correction code that could be exposed by using longer identifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158109 91177308-0d34-0410-b5e6-96231b3b80d8
laborated-type-specifier.cpp
ested-name-spec.cpp
ualified-id-lookup.cpp
f8cc02e50553b5c3bc6570bff0c47ac7db85fe8d 06-Jun-2012 Daniel Jasper <djasper@google.com> Introduce -Wunused-private-field. If enabled, this warning detects
unused private fields of classes that are fully defined in the current
translation unit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158054 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-member.cpp
36d02af300a207242f0486b4255420d8be796b21 05-Jun-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add a warning for when an array-to-pointer decay is performed on an array
temporary or an array subobject of a class temporary, and the resulting value
is used to initialize a pointer which outlives the temporary. Such a pointer
is always left dangling after the initialization completes and the array's
lifetime ends.

In order to detect this situation, this change also adds an
LValueClassification of LV_ArrayTemporary for temporaries of array type which
aren't subobjects of class temporaries. These occur in C++11 T{...} and GNU C++
(T){...} expressions, when T is an array type. Previously we treated the former
as a generic prvalue and the latter as a class temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157955 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of-temporary.cpp
287698336ff9f9315bf814943068d6b8261e517d 04-Jun-2012 Aaron Ballman <aaron@aaronballman.com> Fixes some test cases that should have come along with r157943.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157947 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
44f5b1d95a3e4edf12c9b395d9f47767e75037b6 04-Jun-2012 Aaron Ballman <aaron@aaronballman.com> Removing the lambda extension warning concerning single return statements, as it no longer applies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157943 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
b1c6f5fa23015fb5ee063fa5eb9717ea5d78cf12 04-Jun-2012 Douglas Gregor <dgregor@apple.com> When adding built-in operator candidates for overload resolution
involving 'restrict', place restrict on the pointer type rather than
on the pointee type. Also make sure that we gather restrict from the
pointer type. Fixes PR12854 and the major part of PR11093.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157910 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
1973634e445d4f1abdeedc2809f2d281929253b6 02-Jun-2012 Alexander Kornienko <alexfh@google.com> Implementation of a "soft opt-in" option for -Wimplicit-fallthrough diagnostics: -Wimplicit-fallthrough-per-method


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157871 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-per-method.cpp
784ae8e5c6b557e2395991c6008293660f5afe66 01-Jun-2012 Kaelyn Uhrain <rikka@google.com> Don't allow multiple correction candidates that have the same identifier
but different nested name specifiers to quietly clobber each other so
only one remains if they do not refer to the same NamedDecl. Fixes
PR12951.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157823 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
1dfc4ba88714d8ac9a85dba051cf94e57f7b3e04 01-Jun-2012 Aaron Ballman <aaron@aaronballman.com> Anonymous union members within a struct are now properly handled as an unevaluated field in C++11 mode. This fixes PR12866.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157784 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union-cxx11.cpp
90c78328e70cb376754edf87708505a84c044271 31-May-2012 Anna Zaks <ganna@apple.com> Change wording of 'memcpy' type mismatch warning and remove fixit.

As per comments following r157659.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157722 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof-fixit.cpp
arn-memset-bad-sizeof.cpp
abe21e36d789cfe800562a1e889738addfd2ac5b 30-May-2012 David Blaikie <dblaikie@gmail.com> Disable -Wunique-enum for anonymous enums.

This is a large class of false positives where anonymous enums are used to
declare constants (see Clang's Diagnostics.h for example). A small number of
true positives could probably be found in this bucket by still warning if the
anonymous enum is used in a declarator (enum { ... } x;) but so far we don't
believe this to be a source of significant benefit so I haven't bothered to
preserve those cases.

General offline review/acknowledgment by rtrieu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157713 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unique-enum.cpp
7af7de7d6b121132dfe8c3b9b5febe2b37aafd62 30-May-2012 Richard Trieu <rtrieu@google.com> Add new -Wunique-enum which will warn on enums which all elements have the
same value and were initialized with literals. Clang will warn on code like
this:

enum A {
FIRST = 1,
SECOND = 1
};



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157666 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unique-enum.cpp
6fcb3727e31280ba816dc86d024586b8c5933c13 30-May-2012 Anna Zaks <ganna@apple.com> Add fixits for memory access warnings.
Also, do not display the builtin name and macro expansion when the
function is a builtin.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157659 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof-fixit.cpp
e0cf31dc263979027f345c00318a704c5f5b1e76 28-May-2012 Benjamin Kramer <benny.kra@googlemail.com> PR12962: Fix a rare use after free when collecting virtual overrides.

The DenseMap reallocates after 64 insertions so this only happened in
large test cases under very specific circumstances.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157549 91177308-0d34-0410-b5e6-96231b3b80d8
ong-virtual-inheritance-chain.cpp
350e956532d99ce2e804a478df5b6f1f5e096d88 27-May-2012 Fariborz Jahanian <fjahanian@apple.com> -Wdeprecated warning to include reference (as a note)
to the declaration in this patch. // rdar://10893232


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157537 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
a189d8976f1193b788508a1a29b2e9d0aca06aca 26-May-2012 Alexander Kornienko <alexfh@gmail.com> Don't offer '[[clang::fallthrough]];' fix-it when a fall-through occurs to a
switch label immediately followed by a 'break;'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157508 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough.cpp
4059da87fa2fe9f415c9656dc63e75d5d4a489ef 24-May-2012 Eli Friedman <eli.friedman@gmail.com> A minor tweak to the new volatile lvalue warning: don't warn on "(void)x", where "x" refers to a local variable. This should silence a useless warning in compiler-rt and other places.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157414 91177308-0d34-0410-b5e6-96231b3b80d8
nused.cpp
8ab10aa6bef39dffde2207dd2257c521bb2e731f 24-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> DR1152 / PR12931 / PR6177: A candidate function which requires binding a const
volatile reference to a temporary is not viable. My interpretation is that
DR1152 was a bugfix, not a rule change for C++11, so this is not conditional on
the language mode. This matches g++'s behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157370 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
a6115068cde719142eb394db88612c185cabd05b 24-May-2012 Eli Friedman <eli.friedman@gmail.com> Add a warning to diagnose statements in C++ like "*(volatile int*)x;". Conceptually, this is part of -Wunused-value, but I added a separate flag -Wunused-volatile-lvalue so it doesn't get turned off by accident with -Wno-unused-value. I also made a few minor improvements to existing unused value warnings in the process. <rdar://problem/11516811>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157362 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
nused.cpp
arn-unused-value.cpp
11d1a697dcf677c42394dfa9506ace4935f3b00d 20-May-2012 Nico Weber <nicolasweber@gmx.de> Error when using typeid() with -fno-rtti. PR 12888.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157139 91177308-0d34-0410-b5e6-96231b3b80d8
o-rtti.cpp
25582fc0aeac053cdc115ee95cbed53f28bf592e 17-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Recover better from a missing 'typename' in a function template definition.
Disambiguate past such a potential problem, and use the absence of 'typename'
to break ties in favor of a parenthesized thingy being an initializer, if
nothing else in the declaration disambiguates it as declaring a function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156963 91177308-0d34-0410-b5e6-96231b3b80d8
nknown-type-name.cpp
def07624ecc535431e0c814b4b5b842de8a06997 16-May-2012 David Blaikie <dblaikie@gmail.com> Include the correct conversion context locations for condition expressions.

This improves the conversion diagnostics (by correctly pointing to the loop
construct for conversions that may've been caused by the contextual conversion
to bool caused by a condition expression) and also causes the NULL conversion
warnings to be correctly suppressed when crossing a macro boundary in such a
context. (previously, since the conversion context location was incorrect, the
suppression could not be performed)

Reported by Nico Weber as feedback to r156826.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156901 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
9fb1ac520d1806ba2b069f6087f40fc9c704b067 15-May-2012 David Blaikie <dblaikie@gmail.com> Don't warn when NULL is used within a macro but its conversion is outside a macro.

This fixes the included test case & was reported by Nico Weber.

It's a little bit nasty using the difference in the conversion context, but
seems to me like a not unreasonable solution. I did have to fix up the
conversion context for conditional operators (it seems correct to me to include
the context for which we're actually doing the comparison - across all the
nested conditionals, rather than the innermost conditional which might not
actually have the problematic implicit conversion at all) and template default
arguments (this is a bit of a hack, since we don't have the source location of
the '=' anymore, so I just used the start of the parameter - open to
suggestions there)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156861 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
8f0a7e7845f619575f8af0b0bf46d027b20a0b63 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> If we see a declaration which is either missing a type or has a malformed type,
and the thing we have has a scope specifier, and we're in a context that doesn't
allow declaring a qualified name, then the error is a malformed type, not a
missing type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156856 91177308-0d34-0410-b5e6-96231b3b80d8
nknown-type-name.cpp
827adaff666e53ae2f2db994bcd62ebe1ff5b9ce 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't use the implicit int rule for error recovery in C++. Instead, try to
disambiguate whether the type name was forgotten or mistyped.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156854 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
be0ee875d8a91c031a085cbbd73ad9e8dc1aa8ff 15-May-2012 David Blaikie <dblaikie@gmail.com> Improve some of the conversion warnings to fire on conversion to bool.

Moves the bool bail-out down a little in SemaChecking - so now
-Wnull-conversion and -Wliteral-conversion can fire when the target type is
bool.

Also improve the wording/details in the -Wliteral-conversion warning to match
the -Wconstant-conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156826 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
onversion.cpp
xpressions.cpp
verload-call.cpp
arn-literal-conversion.cpp
c608c3c0781e15b74fbbda03f8708cc85a3dd488 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Further improvement to wording of overload resolution diagnostics, and including
the sole parameter name in the diagnostic in more cases. Patch by Terry Long!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156807 91177308-0d34-0410-b5e6-96231b3b80d8
efault1.cpp
verload-call.cpp
verload-member-call.cpp
dbbecccb8431bb4545fc01c6401abc4253667360 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12826: Converting an lvalue to an xvalue is a no-op conversion, not an lvalue-to-rvalue conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156803 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
3003e1d6626d07e8fc4af95fad95b3a5d4c4af98 15-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fold the six functions checking explicitly-defaulted special member functions
into one. These were all performing almost identical checks, with different bugs
in each of them.

This fixes PR12806 (we weren't setting the exception specification for an
explicitly-defaulted, non-user-provided default constructor) and enforces
8.4.2/2's rule that an in-class defaulted member must exactly match the implicit
parameter type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156802 91177308-0d34-0410-b5e6-96231b3b80d8
R10243.cpp
xx0x-cursory-default-delete.cpp
xx0x-defaulted-functions.cpp
f7b8056f1ff0c0409a9523a34f78b69ab8314bec 11-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11857: When the wrong number of arguments are provided for a function
which expects exactly one argument, include the name of the argument in
the diagnostic text. Patch by Terry Long!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156607 91177308-0d34-0410-b5e6-96231b3b80d8
efault1.cpp
verload-call.cpp
verload-member-call.cpp
f6278e545d9bc09fb5d7579d1123f0a455352627 09-May-2012 Richard Trieu <rtrieu@google.com> Pull some cases of initialization with self-reference warnings out of
-Wconditional-uninitialized into -Wuninitialized.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156512 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
f63eee78a3ed50a974d0963623a06888ecd4ef6b 09-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Stop AltiVec parsing from going down the 'implicit int' codepath as part of its
normal parse for token sequences like 'vector pixel foo'. This incidentally also
fixes a couple of wrong-parse issues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156503 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
83a22ecbf52c06b4ee364f3fadcdb0abaf2dabf6 09-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Recover properly if a class member declaration starts with a scope specifier
or template-id which can't be parsed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156468 91177308-0d34-0410-b5e6-96231b3b80d8
ember-init.cpp
7e9f8af453598292cb57ba8e4dd63b9a5814b9ac 09-May-2012 Richard Trieu <rtrieu@google.com> Update the SelfReferenceChecker. Refactored some of the visitor methods.
Added support for conditional operators and tightened the exclusion of the
unary operator from all operators to only the address of operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156450 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
0a84e7a4d6e2b8f52879ebdf03ce0a682ba0eb8b 07-May-2012 Aaron Ballman <aaron@aaronballman.com> Updating the test case based on previous patch

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156275 91177308-0d34-0410-b5e6-96231b3b80d8
irtuals.cpp
21eb6d4961abf710de3864a537655e9c57903803 07-May-2012 Aaron Ballman <aaron@aaronballman.com> Detecting illegal instantiations of abstract types when using a function-style cast. Fixed PR12658.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156271 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
f108c63ccc576fe6a3ca08399dbcec574b089ea8 06-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> A conversion operator in a base class shouldn't hide another conversion operator
in the same class, even if they convert to the same type. Fixes PR12712.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156247 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
bbba25fa8e388e82e04f66784c2fc9f89b901abe 04-May-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: check for LOCKABLE attribute on base classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156175 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
9087599e5ee64ecd30194b3d89f8748ac95c62f7 04-May-2012 Richard Trieu <rtrieu@google.com> Skip checking for infinite for-loops if there are global or static variables
in the conditional.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156148 91177308-0d34-0410-b5e6-96231b3b80d8
arn-loop-analysis.cpp
e0d3b4cd2b66f1cef26cacbed5820ab7c22ad5b3 03-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wimplicit-fallthrough warning flag, which warns on fallthrough between
cases in switch statements. Also add a [[clang::fallthrough]] attribute, which
can be used to suppress the warning in the case of intentional fallthrough.

Patch by Alexander Kornienko!

The handling of C++11 attribute namespaces in this patch is temporary, and will
be replaced with a cleaner mechanism in a subsequent patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156086 91177308-0d34-0410-b5e6-96231b3b80d8
witch-implicit-fallthrough-cxx98.cpp
witch-implicit-fallthrough.cpp
82129e25c8d26d933771bc37aa0e0ed2edd131b4 03-May-2012 Richard Trieu <rtrieu@google.com> Add commas to for loop warning to separate variable names.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156033 91177308-0d34-0410-b5e6-96231b3b80d8
arn-loop-analysis.cpp
60f2024b7df091fb0d8b7e37334bc83ac66a5c39 03-May-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: additional support for smart pointers in lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156030 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
f26efd79d1bd139641d0bb40842f908c67f041c2 02-May-2012 DeLesley Hutchins <delesley@google.com> Thread Safety Analysis: fixed attribute handling for lock_returned attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156005 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
6deb820a1d2f98e8eda7df1da057cecce8655289 02-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Disable our non-standard delayed parsing of exception specifications. Delaying
the parsing of such things appears to be a conforming extension, but it breaks
libstdc++4.7's std::pair.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155975 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-noexcept-unevaluated.cpp
mplicit-exception-spec.cpp
12f3297fbef1673b32c8987da9933687996c65b3 02-May-2012 Kaelyn Uhrain <rikka@google.com> Try harder to recognize hidden tag type names in potential declarations instead
of giving unhelpful errors about undeclared identifers and missing semicolons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155965 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
4e31b4d6cf25029aa280d691e9023359c0ef4204 01-May-2012 Rafael Espindola <rafael.espindola@gmail.com> Extend the error about incompatible visibility attributes in different
decls to work on function templates specializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155943 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-visibility.cpp
ca2e1b7990230c5088eb2f280cea9db5f516ad69 01-May-2012 David Blaikie <dblaikie@gmail.com> Workaround a miscompile in 483.xalancbmk while we figure it out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155938 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
5729672524865f212cbadb51170dca0694e79a71 01-May-2012 David Blaikie <dblaikie@gmail.com> PR12710 - broken default argument handling for templates.

I broke this in r155838 by not actually instantiating non-dependent default arg
expressions. The motivation for that change was to avoid producing duplicate
conversion warnings for such default args (we produce them once when we parse
the template - there's no need to produce them at each instantiation) but
without actually instantiating the default arg, things break in weird ways.

Technically, I think we could still get the right diagnostic experience without
the bugs if we instantiated the non-dependent args (for non-dependent params
only) immediately, rather than lazily. But I'm not sure if such a refactoring/
change would be desirable so here's the conservative fix for now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155893 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
8d59deec807ed53efcd07855199cdc9c979f447f 01-May-2012 John McCall <rjmccall@apple.com> My first effort to do this more subtly failed, so elaborately
test for an invalid declaration at every single place in the
constant evaluator that's about to request a struct layout.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155868 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
aa5498649c7ad1b61e5da2497e8c60c924ac5e55 01-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Remove -Wc++98-compat warning for an outrageously-rare circumstance of 'this'
being used in an exception specification in a way which isn't otherwise
ill-formed in C++98: this warning also incorrectly triggered on uses of 'this'
inside thread-safety attributes, and the mechanism required to tell these cases
apart is more complex than can be justified by the (minimal) value of this part
of -Wc++98-compat.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155857 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
arn-thread-safety-analysis.cpp
c1c0725978ed31253af5ef4849a124e8fc13ebbb 30-Apr-2012 David Blaikie <dblaikie@gmail.com> Fix PR12378: provide conversion warnings on default args of function templates

Apparently we weren't checking default arguments when they were instantiated.
This adds the check, fixes the lack of instantiation caching (which seems like
it was mostly implemented but just missed the last step), and avoids
implementing non-dependent default args (for non-dependent parameter types) as
uninstantiated default arguments (so that we don't warn once for every
instantiation when it's not instantiation dependent).

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155838 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
694e796f462748ab4dc7ecdf4be5da44dd2c8c94 30-Apr-2012 Richard Trieu <rtrieu@google.com> Add -Wloop-analysis. This warning will fire on for loops which the variables
in the loop conditional do not change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155835 91177308-0d34-0410-b5e6-96231b3b80d8
arn-loop-analysis.cpp
98f71aae339e00bfc7b556a78e2538931198ec9c 28-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> C++11 weakens the requirement for types used with offsetof from POD to standard layout type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155757 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof-0x.cpp
152f6b7be508fbc61543f3736ebd390d7ac84bd1 28-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> Rename isPODType (using the C++98 rules) into isCXX98PODType and make isPODType decide which one to use based on LangOptions.

- -Wc++98-compat depends on the c++98 definition
- Now __is_pod returns the right thing in c++11 and c++98 mode
- All changes to the type traits test are validated against g++ 4.7

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155756 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
470360d8035ce4213a963d281c3b542edfea9fda 28-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> Revert "Use the C++11 definition of PODness for __is_pod in C++11 mode."

This is just papering over a major bug in isPODType, real fix coming up soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155755 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
046e8691ff467541ef7c32c9fc6bf41b1dcbd03a 28-Apr-2012 Benjamin Kramer <benny.kra@googlemail.com> Use the C++11 definition of PODness for __is_pod in C++11 mode.

Keep the old definition for C++98 so we don't break tr1::is_pod.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155754 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
a1366cbab89ec6d4f630dca91e85d03d9e5d1d7d 27-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.
We do not support IRGen for these, and get some parts of the semantic analysis
wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155728 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
d601c62ad49ddc2593dfeb3d777ad8baf4ab6acb 27-Apr-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add test case for rdar://11293995

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155690 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-member-expr.cpp
1de9d7de172379d6af75fd11dda2a713e4f36f62 26-Apr-2012 John McCall <rjmccall@apple.com> Fix a crash-on-invalid where the constant evaluator would try to
evaluate certain expressions involving invalidly-defined classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155645 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
a43ea64602a4cd4a18ed193bfc94a1f2aa4d3475 26-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12647: An alias template instantiation which occurs in a SFINAE context is
itself a SFINAE context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155621 91177308-0d34-0410-b5e6-96231b3b80d8
lias-template.cpp
6e4a0af697eec5b0c47ccf96dff170af56df826d 26-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12660: Don't crash when initializing a const reference from a braced init list
which creates a temporary by calling a constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155608 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-references.cpp
86e6fdcf1a04edc4c24f53f9dbacf7e1b52f306d 26-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Two missing -Wc++98-compat warnings, for null pointers as non-type template
arguments, and 'this' in exception-specifications.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155606 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
2b90f7637e846ea555dedac14e7f5065d85c5d3b 25-Apr-2012 Kaelyn Uhrain <rikka@google.com> Add an error message with fixit hint for changing '.' to '->'.

This is mainly for attempting to recover in cases where a class provides
a custom operator-> and a '.' was accidentally used instead of '->' when
accessing a member of the object returned by the current object's
operator->.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155580 91177308-0d34-0410-b5e6-96231b3b80d8
rrow-operator.cpp
64b111e81d0d699825734e282e2ee71fb2a0ce19 23-Apr-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: refactor test cases so that the style is
consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155388 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
aed9ea398a3fd8d488120728e2df4ac81c3b0c4b 23-Apr-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: support the use of pt_guarded_by attributes
on smart pointers. Also adds test case for previous commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155379 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
79747e00e9f6b13b56e91462982d2456d0d9128f 23-Apr-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: support new "pointer to member" syntax for
existentially quantified lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155357 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
a4156b8574666aa69a2b0ad35dc9e9603433e4ae 21-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix regression in r154844. If necessary, defer computing adjusted destructor
exception specifications in C++11 until after we've parsed the exception
specifications for nested classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155293 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-exception-spec.cpp
7d90fe5a941efc106237d23badec816ed65e267f 21-Apr-2012 Matt Beaumont-Gay <matthewbg@google.com> Fix a QoI bug reported by a user.

Set the source location for the "member reference base type ... is not a
structure or union" diag to point at the operator rather than the member name.
If we're giving this diagnostic because of a typo'd '.' in place of a ';' at
the end of a line, the caret previously pointed at the identifier on the
following line, which isn't as helpful as it could be. Pointing the caret at
the '.' makes it more obvious what the problem is.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155267 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
ae519c42a1e0a023be6c07ba1dc10f28e29d6bc3 19-Apr-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: split warnings into two groups: attribute warnings
which are checked in the parser, and analysis warnings that require the
full analysis. This allows attribute syntax to be checked independently
of the full thread safety analysis. Also introduces a new warning for the
case where a string is used as a lock expression; this allows the analysis
to gracefully handle expressions that would otherwise cause a parse error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155129 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
03544fccd1782418c1bf2528111683e18f43b913 19-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add missing -Wc++98-compat warnings for initializer list initializations which
initialize references, create std::initializer_list objects, or call constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155105 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
74e2fc332e07c76d4e69ccbd0e9e47a0bafd3908 16-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement the last part of C++ [class.mem]p2, delaying the parsing of
exception specifications on member functions until after the closing
'}' for the containing class. This allows, for example, a member
function to throw an instance of its own class. Fixes PR12564 and a
fairly embarassing oversight in our C++98/03 support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154844 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-noexcept-unevaluated.cpp
mplicit-exception-spec.cpp
cefc3afac14d29de5aba7810cc8fe6c858949e9d 16-Apr-2012 Douglas Gregor <dgregor@apple.com> Implement C++11 [expr.prim.general]p3, which permits the use of 'this'
in the declaration of a non-static member function after the
(optional) cv-qualifier-seq, which in practice means in the exception
specification and late-specified return type.

The new scheme here used to manage 'this' outside of a member function
scope is more general than the Scope-based mechanism previously used
for non-static data member initializers and late-parsesd attributes,
because it can also handle the cv-qualifiers on the member
function. Note, however, that a separate pass is required for static
member functions to determine whether 'this' was used, because we
might not know that we have a static function until after declaration
matching.

Finally, this introduces name mangling for 'this' and for the implicit
'this', which is intended to match GCC's mangling. Independent
verification for the new mangling test case would be appreciated.

Fixes PR10036 and PR12450.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154799 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
030c7e9d105fdd9b5cb11b5b16c258bcb39bdac1 16-Apr-2012 David Blaikie <dblaikie@gmail.com> Fix tests that weren't actually verifying anything.

Passing -verify to clang without -cc1 or -Xclang silently passes (with a
printed warning, but lit doesn't care about that). This change adds -cc1 or,
as is necessary in one case, -Xclang to fix this so that these tests are
actually verifying as intended.

I'd like to change the driver so this kind of mistake could not be made, but
I'm not entirely sure how. Further, since the driver only warns about unknown
flags in general, we could have similar bugs with a misspellings of arguments
that would be nice to find.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154776 91177308-0d34-0410-b5e6-96231b3b80d8
arn-everthing.cpp
fe587201feaebc69e6d18858bea85c77926b6ecf 15-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12226: don't generate wrong code if a braced string literal is used to
initialize an array of unsigned char. Outside C++11 mode, this bug was benign,
and just resulted in us emitting a constant which was double the required
length, padded with 0s. In C++11, it resulted in us generating an array whose
first element was something like i8 ptrtoint ([n x i8]* @str to i8).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154756 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
a1c4f7c833093f87d5187c4449a3d4534cfa40a4 13-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12500: Improve the wording of the diagnostic for a redefinition of a name
in the wrong namespace scope. Patch by Jonathan Sauer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154656 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ual-id-test.cpp
97b57a2170c2138fb71d336d77c6db7728938108 13-Apr-2012 John McCall <rjmccall@apple.com> When we're flagging a protected scope to prevent jumps into the
shadow of a block expression with non-trivial destructed cleanups,
we should flag that in the enclosing function, not in the block
that we're about to pop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154646 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
c02af35e92909d672b67efee407d2cee6d6d86e5 12-Apr-2012 Ted Kremenek <kremenek@apple.com> Add -Wuninitialized test for C++11 lambdas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154608 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
f7ecc3016e6309a092493070d071489516b273c0 12-Apr-2012 Douglas Gregor <dgregor@apple.com> Compute standard conversion sequences for conversions to atomic
types. The second and third conversions in the sequence are based on
the conversion for the underlying type, so that we get sensible
overloading behavior for, e.g., _Atomic(int) vs. _Atomic(float).

As part of this, actually implement the lvalue-to-rvalue conversion
for atomic types. There is probably a pile of code in SemaExpr that
can now be deleted, but I haven't tracked it down yet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154596 91177308-0d34-0410-b5e6-96231b3b80d8
tomic-type.cxx
994d73f8473cb2cd3ce2f69c9575c95015be788a 11-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Part of PR10101: after a parse error in a declaration, try harder to find the
right place to pick up parsing. In C++, this had a tendency to skip everything
declared within headers if the TU starts with garbage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154530 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
69a30b838c723cb1850de55cfa48a402cfeeb6e0 10-Apr-2012 Douglas Gregor <dgregor@apple.com> When we determine that an initialization sequence failed due to an
incomplete type, keep track of the actual type that was
incomplete. Otherwise, we might fail to produce a diagnostic. Fixes
PR12498.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154432 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
6ee326af4e77e6f05973486097884d7431f2108d 10-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Disambiguation of '[[':
* In C++11, '[[' is ill-formed unless it starts an attribute-specifier. Reject
array sizes and array indexes which begin with a lambda-expression. Recover by
parsing the lambda as a lambda.
* In Objective-C++11, either '[' could be the start of a message-send.
Fully disambiguate this case: it turns out that the grammars of message-sends,
lambdas and attributes do not actually overlap. Accept any occurrence of '[['
where either '[' starts a message send, but reject a lambda in an array index
just like in C++11 mode.

Implement a couple of changes to the attribute wording which occurred after our
attributes implementation landed:
* In a function-declaration, the attributes go after the exception specification,
not after the right paren.
* A reference type can have attributes applied.
* An 'identifier' in an attribute can also be a keyword. Support for alternative
tokens (iso646 keywords) in attributes to follow.

And some bug fixes:
* Parse attributes after declarator-ids, even if they are not simple identifiers.
* Do not accept attributes after a parenthesized declarator.
* Accept attributes after an array size in a new-type-id.
* Partially disamiguate 'delete' followed by a lambda. More work is required
here for the case where the lambda-introducer is '[]'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154369 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-0x.cpp
ew-delete.cpp
83cad4544f8a89fb6a611f330d71d027c238375e 06-Apr-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: downgraded requirement that mutex expressions refer to a lockable type from error to warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154198 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
0121183f71c2de2fced72fa0afa34b0ce31235e3 06-Apr-2012 Matt Beaumont-Gay <matthewbg@google.com> Test for r154189/PR12481

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154193 91177308-0d34-0410-b5e6-96231b3b80d8
R12481.cpp
cf2fa2f0c9d67adb98b282ec0eaa88f08df29804 06-Apr-2012 DeLesley Hutchins <delesley@google.com> Fixed scoping error for late parsed attributes in nested classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154173 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
bf9658c3c200ee19bf0b6b157149f2376e39d270 06-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Point the caret at the error for the 'expected namespace name' diagnostic in
a namespace alias declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154138 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
a85cf39786fffd6860a940523be01eb02a4935c0 05-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve diagnostics for invalid use of non-static members / this:

* s/nonstatic/non-static/ in the diagnostics, since the latter form outvoted
the former by 28-2 in our diagnostics.
* Fix the "use of member in static member function" diagnostic to correctly
detect this situation inside a block or lambda.
* Produce a more specific "invalid use of non-static member" diagnostic for
the case where a nested class member refers to a member of a
lexically-surrounding class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154073 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
efault2.cpp
ual-id-test.cpp
his.cpp
4fd05dc4062580acea72f8b8231fb0ea3ee49032 05-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add triples to these tests to keep them working on Windows,
where wchar_t is only 16 bits wide.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154072 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
tatic-assert.cpp
69f50e7f29766ce76e79c69c38302ba654202377 05-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix assertions and wrong output from StmtPrinter's string literal printing.
String literals (including unicode ones) can contain non-Unicode codepoints
if they were written using \x or similar. Write those out using \x, but be
careful that the following character can't be misinterpreted as part of the
\x escape sequence. Convert UTF-16 surrogate pairs back to codepoints before
rendering them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154069 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
tatic-assert.cpp
e31b8fb25b458f00e31dcd657c0840e5238e0f05 05-Apr-2012 David Blaikie <dblaikie@gmail.com> Enable warn_impcast_literal_float_to_integer by default.

This diagnostic seems to be production ready, it's just an oversight that it
wasn't turned on by default.

The test changes are a bit of a mixed bag. Some tests that seemed like they
clearly didn't need to use this behavior have been modified not to use it.
Others that I couldn't be sure about, I added the necessary expected-warnings
to.

It's possible the diagnostic message could be improved to make it clearer that
this warning can be suppressed by using a value that won't lose precision when
converted to the target type (but can still be a floating point literal, such
as "bool b = 1.0;").

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154068 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
arn-thread-safety-analysis.cpp
5b4bf13761303978c22f67984b4548379a189166 05-Apr-2012 Douglas Gregor <dgregor@apple.com> Allow a conversion from the empty initializer list {} to an
std::initializer_list<T> so long as <T> is known. This conversion has
identity rank.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154065 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
b4051e7047a0085f0679257386ff183aed3e5162 04-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [temp.arg.nontype]'s permission to use the address of an object
or function with internal linkage as a non-type template argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154053 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
d280389b42bb55cd8969eae181dc3ff9f05e9aaf 04-Apr-2012 Douglas Gregor <dgregor@apple.com> When performing template argument deduction for an initializer list,
be sure to perform the argument type adjustments in
[temp.deduct.call]p2, e.g., array decay.

And, when performing these deductions in the context of 'auto', make
sure that we're deducing the P' in std::initializer_list<P'> rather
than the whole initializer list.

Together, this makes code like

for( auto s : {"Deferred", "New", "Open", "Review"}) { }

work properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153998 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
173a37a57b79bd8f94b85c2273039e760b159922 03-Apr-2012 Nick Lewycky <nicholas@mxc.ca> Remove more redundant lookups. Add a new "all_lookups_iterator" which provides
a view over the contents of a DeclContext without exposing the implementation
details of the StoredDeclsMap. Use this in LookupVisibleDecls to find the
visible declarations. Fixes PR12339!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153970 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
ualified-id-lookup.cpp
ypo-correction.cpp
5bdaac5454d93d1dcdc2319818497b685be56fcf 02-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Finish PR10217: Ensure we say that a special member was implicitly, not
explicitly, deleted in all relevant cases, and explain why.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153894 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
r1301.cpp
70e24fccc8ef4aa8be03a778e9655bfcfa79dd14 01-Apr-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Properly handle explicit constructors in list-initialization. Fixes PR12120.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153849 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
6c4c36c4ed1007143f5b8655eb68b313a7e12e76 30-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR10217: Provide diagnostics explaining why an implicitly-deleted special
member function is deleted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153773 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
xx98-compat-flags.cpp
xx98-compat.cpp
efaulted-private-dtor.cpp
r1301.cpp
mplicit-exception-spec.cpp
alue-initialization.cpp
6960587df0bd1b421c11715807a4d2302a3aae3c 28-Mar-2012 Douglas Gregor <dgregor@apple.com> Unify and fix our checking of C++ [dcl.meaning]p1's requirements
concerning qualified declarator-ids. We now diagnose extraneous
qualification at namespace scope (which we had previously missed) and
diagnose these qualification errors for all kinds of declarations; it
was rather uneven before. Fixes <rdar://problem/11135644>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153577 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
f78c0f9aaabf32f5b5f8633b0066e611b24640ee 27-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Even more careful consideration of C++11 13.3.3.1p4. Fixes PR12241.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153523 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
412e0cc52ea644d804dcfa87194800371f91a977 27-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> When we see 'Class(X' or 'Class::Class(X' and we suspect that it names a
constructor, but X is not a known typename, check whether the tokens could
possibly match the syntax of a declarator before concluding that it isn't
a constructor. If it's definitely ill-formed, assume it is a constructor.

Empirical evidence suggests that this pattern is much more often a
constructor with a typoed (or not-yet-declared) type name than any of the
other possibilities, so the extra cost of the check is not expected to be
problematic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153488 91177308-0d34-0410-b5e6-96231b3b80d8
opy-assignment.cpp
0724b7c43007d978c46f890dcd2ab3c8d3c22920 26-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add a special-case diagnostic for one of the more obnoxious special cases of
unscoped enumeration members: an enumerator name which is visible in the
out-of-class definition of a member of a templated class might not actually
exist in the instantiation of that class, if the enumeration is also lexically
defined outside the class definition and is explicitly specialized.

Depending on the result of a CWG discussion, we may have a different resolution
for a class of problems in this area, but this fixes the immediate issue of a
crash-on-invalid / accepts-invalid (depending on +Asserts). Thanks to Johannes
Schaub for digging into the standard wording to find how this case is currently
specified to behave.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153461 91177308-0d34-0410-b5e6-96231b3b80d8
num-unscoped-nonexistent.cpp
38f0df352fadc546c5666079fb22de5ec1819d92 26-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Handle instantiations of redeclarations of forward-declared enumerations within
templated functions. Build a redeclaration chain, and only instantiate the
definition of the enum when visiting the defining declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153427 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
4ca93d9978aac02b01814b4f749d6903a1f87ee5 26-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Delay checking of dependent underlying types for redeclarations of member
enumerations in templates until the template is instantiated.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153426 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
f602806965531ee06fd8664b9d7a8912c4af2870 24-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Teach APValue printer to print boolean 0 and 1 as 'false' and 'true'. Fix up
some calling code to actually pass in a non-null type, to avoid a crash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153358 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
3343fad1f1ec81af43674b76eddbe9ab10e344eb 24-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> When defining a forward-declared enum, don't try to attach the definition to
a previous declaration if the redeclaration is invalid. That way lies madness.
Fixes a crash-on-invalid reported by Abramo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153349 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
550f2234fc9218914c325041067052342dfce553 22-Mar-2012 Ted Kremenek <kremenek@apple.com> Fix broken CFG when an initializer is a statement expression that starts with a while loop (PR 12325).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153242 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
4c7a6c6e51be5f4ad98c086bbf115ee3ee08ebaf 21-Mar-2012 John McCall <rjmccall@apple.com> Test case for rdar://problem/11055105, a bug with the instantiation
of references to function template parameters in noexcept clauses when
the instantiation is forced from a point during parsing when a block
is in scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153152 91177308-0d34-0410-b5e6-96231b3b80d8
locks-1.cpp
1cd89c4d60d7a458de733a4ea81d5580df82a652 20-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> More careful consideration of C++11 13.3.3.1p4. Fixes PR12257.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153130 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
ca8937111cccdbf7d17c349487a332d6c7c97f91 20-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Fix the other place where C++98 work for initializer lists was necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153129 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
4cf225382a8b061dce41733c962d62b6db9721f8 20-Mar-2012 Ted Kremenek <kremenek@apple.com> Fix crash when querying the CFG reported when using the thread safety analysis
on code using multi-dimensional arrays. Fix by DeLesley Hutchins, and reported in
PR 12271.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153067 91177308-0d34-0410-b5e6-96231b3b80d8
arn-everthing.cpp
3e280b58db5e7dc2bab736fa65af2b8157916726 18-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Add the missing compatibility warning for braced initializers as default arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153026 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
42aceadbc3806868cee8ac576347d258ac99e1f6 18-Mar-2012 Douglas Gregor <dgregor@apple.com> Diagnose tag and class template declarations with qualified
declarator-ids that occur at class scope. Fixes PR8019.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153002 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
b1360498b0c0794fd7925f4bdac68ae91ff7493b 16-Mar-2012 David Blaikie <dblaikie@gmail.com> Suppress macro expansion of NULL in NULL warnings.

For "int i = NULL;" we would produce:

null.cpp:5:11: warning: implicit conversion of NULL constant to integer [-Wconversion]
int i = NULL;
~ ^~~~
null.cpp:1:14: note: expanded from macro 'NULL'
\#define NULL __null
^~~~~~

But we really shouldn't trace that macro expansion back into the header, yet we
still want macro back traces for code like this:

\#define FOO NULL
int i = FOO;

or

\#define FOO int i = NULL;
FOO

While providing appropriate tagging at different levels of the expansion, etc.

The included test case exercises these cases & does some basic validation (to
ensure we don't have macro expansion notes where we shouldn't, and do where we
should) - but doesn't go as far as to validate the source location/ranges
used in those notes and warnings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152940 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
9c6fde5ac9c4a696baaa637a7fb6d83fe91e1e09 16-Mar-2012 Nick Lewycky <nicholas@mxc.ca> Skip through transparent contexts when deciding where to add a friend function.
This fixes g++.dg/parse/friend5.C.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152938 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
4b911e6536ed77524c3cef572cb0f6c8d9079e2e 15-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Support deducing template arguments from nested initializer lists. PR12119.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152848 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
2b2bbee3071cee1b03520d9bf0c80c4f0bbe60eb 15-Mar-2012 David Blaikie <dblaikie@gmail.com> Provide the specific target type in the -Wnull-conversion warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152835 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
95187bdd5c955c8edf3527eae41f1e4f80377f27 15-Mar-2012 David Blaikie <dblaikie@gmail.com> Reapply r152745 (reverted in 152765) now that compiler-rt is fixed.

Original commit message:

Provide -Wnull-conversion separately from -Wconversion.

Like GCC, provide a NULL conversion to non-pointer conversion as a separate
flag, on by default. GCC's flag is "conversion-null" which we provide for
cross compatibility, but in the interests of consistency (with
-Wint-conversion, -Wbool-conversion, etc) the canonical Clang flag is called
-Wnull-conversion.

Patch by Lubos Lunak.
Review feedback by myself, Chandler Carruth, and Chad Rosier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152774 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
onversion.cpp
9ca33fd56720112bcc4bccb8aa6107abbb68cae3 15-Mar-2012 Chad Rosier <mcrosier@apple.com> Revert r152745 as it's breaking the internal buildbots.

Abbreviated commit message:
Provide -Wnull-conversion separately from -Wconversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152765 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
onversion.cpp
47bfaf19ddc980a9eb48f2978f4da9b7861b9cda 14-Mar-2012 David Blaikie <dblaikie@gmail.com> Provide -Wnull-conversion separately from -Wconversion.

Like GCC, provide a NULL conversion to non-pointer conversion as a separate
flag, on by default. GCC's flag is "conversion-null" which we provide for
cross compatibility, but in the interests of consistency (with
-Wint-conversion, -Wbool-conversion, etc) the canonical Clang flag is called
-Wnull-conversion.

Patch by Lubos Lunak.
Review feedback by myself, Chandler Carruth, and Chad Rosier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152745 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
onversion.cpp
5a7120cf82b5f0110cb70aacad850c594a55b378 14-Mar-2012 Nick Lewycky <nicholas@mxc.ca> When emitting a diagnostic about two-phase name lookup, don't do useless
qualified name lookups into transparent contexts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152739 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-value.cpp
84407ba82a10235962901ce269b7b3276d17f01d 14-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Parse brace initializers as default arguments. PR12236.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152721 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-scalars.cpp
e7591c511831aa66afe06902a408647535da6a4d 14-Mar-2012 David Blaikie <dblaikie@gmail.com> Add a test case for PR8385.

"struct{template struct{" would fail an assertion.

This assertion failure seems to have gone away somewhere along the line so
here's a test to make sure we don't regress. We still accept some very weird
explicit template 'instantiations' ("template int;", anyone) but at least we're
not asserting/crashing here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152681 91177308-0d34-0410-b5e6-96231b3b80d8
R8385.cpp
4b1f684416980ef6f1a7cb9e6af9c4fa4a164617 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Allow vectors to be constructed from constexpr function arguments in
constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152665 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9cda03ff7fc40b727d0cc44b1702dbae09d63f42 13-Mar-2012 James Molloy <james.molloy@arm.com> Ensure that default arguments are handled correctly in sub scopes. For example:

void f () {
int g (int a, int b=4);
{
int g(int a, int b=5);
}
}

should compile.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152621 91177308-0d34-0410-b5e6-96231b3b80d8
efault1.cpp
b03a9df68140a393cbef73a23115a0818aff6010 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11925: A function can't have a variably-modified return type. Not even in C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152615 91177308-0d34-0410-b5e6-96231b3b80d8
la.cpp
1b7f9cbed1b96b58a6e5f7808ebc9345a76a0936 13-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR10447: lazily building name lookup tables for DeclContexts was broken.
The deferred lookup table building step couldn't accurately tell which Decls
should be included in the lookup table, and consequently built different tables
in some cases.

Fix this by removing lazy building of DeclContext name lookup tables. In
practice, the laziness was frequently not worthwhile in C++, because we
performed lookup into most DeclContexts. In C, it had a bit more value,
since there is no qualified lookup.

In the place of lazy lookup table building, we simply don't build lookup tables
for function DeclContexts at all. Such name lookup tables are not useful, since
they don't capture the scoping information required to correctly perform name
lookup in a function scope.

The resulting performance delta is within the noise on my testing, but appears
to be a very slight win for C++ and a very slight loss for C. The C performance
can probably be recovered (if it is a measurable problem) by avoiding building
the lookup table for the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152608 91177308-0d34-0410-b5e6-96231b3b80d8
R10447.cpp
23dde82d9043d404ee506880796b761bfec93d0d 13-Mar-2012 John McCall <rjmccall@apple.com> Make the error about assigning to lambda-captured variables
clearer, and mention the existence of mutable lambdas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152598 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
78dae24600a877f52dbb6e58bfd5778754a00974 13-Mar-2012 John McCall <rjmccall@apple.com> Alternate fix to PR12248: put Sema in charge of special-casing
the diagnostic for assigning to a copied block capture. This has
the pleasant side-effect of letting us special-case the diagnostic
for assigning to a copied lambda capture as well, without introducing
a new non-modifiable enumerator for it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152593 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
71930e02730f3afecd6e71e4d6831b4a07436a7f 12-Mar-2012 Eli Friedman <eli.friedman@gmail.com> Make sure we treat variables captured by reference in lambda as modifiable lvalues. Regression from r152491. Fixes PR12248.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152573 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
69730c115c2d0fec2f20609d905d920a5a41b29b 12-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix parsing of type-specifier-seq's. Types are syntactically allowed to be
defined here, but not semantically, so

new struct S {};

is always ill-formed, even if there is a struct S in scope.

We also had a couple of bugs in ParseOptionalTypeSpecifier caused by it being
under-loved (due to it only being used in a few places) so merge it into
ParseDeclarationSpecifiers with a new DeclSpecContext. To avoid regressing, this
required improving ParseDeclarationSpecifiers' diagnostics in some cases. This
also required teaching ParseSpecifierQualifierList about constexpr... which
incidentally fixes an issue where we'd allow the constexpr specifier in other
bad places.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152549 91177308-0d34-0410-b5e6-96231b3b80d8
lias-template.cpp
nvalid-member-expr.cpp
issing-namespace-qualifier-typo-corrections.cpp
ew-delete.cpp
e5658f0ab2a6f8fea258adb64edbb8485bb21dee 10-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12225: The requirement that literal operators be namespace-scope functions
does not imply that such functions can't be declared at block scope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152509 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-operators.cpp
1659c3758b4b2dbd618aed9ff8d1863f11b1bd9b 10-Mar-2012 Nick Lewycky <nicholas@mxc.ca> Slightly tweak this condition. "isTransparentContext()" was checking whether an
enum is scoped or not, which is not relevant here. Instead, phrase the loop in
the same terms that the standard uses, instead of this awkward set of
conditions that is *nearly* equal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152489 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
db762ef262987403b4e2a3bb8d5762277306a224 10-Mar-2012 Douglas Gregor <dgregor@apple.com> Qualifiers on a canonical array type go on the outermost type, not the
innermost type. Fixes PR12142.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152456 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
26b75c07317a3b50a8a00a1623e3ef38af1d8349 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve diagnostics for UCNs referring to control characters and members of the
basic source character set in C++98. Add -Wc++98-compat diagnostics for same in
literals in C++11. Extend such support to cover string literals as well as
character literals, and mark N2170 as done.

This seems too minor to warrant a release note to me. Let me know if you disagree.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152444 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
216f78b7333dbc89f58fa69066396ae3237da6da 09-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Improve our semantic error recovery.

When an error made a record member invalid, the record would stay as "isBeingDefined" and
not "completeDefinition". Even easily recoverable errors ended up propagating records in
such "beingDefined" state, for example:

struct A {
~A() const; // expected-error {{'const' qualifier is not allowed on a destructor}}
};
struct B : A {}; // A & B would stay as "not complete definition" and "being defined".

This weird state was impending lookups in the records and hitting assertion in the ASTWriter.

Part of rdar://11007039

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152432 91177308-0d34-0410-b5e6-96231b3b80d8
R9460.cpp
f85626453123f9691bcef13cff963f556e209c27 09-Mar-2012 Hans Wennborg <hans@hanshq.net> -Wformat-non-iso: warn about positional arguments (pr12017)

This renames the -Wformat-non-standard flag to -Wformat-non-iso,
rewords the current warnings a bit (pointing out that a format string
is not supported by ISO C rather than being "non standard"),
and adds a warning about positional arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152403 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings.cpp
ef9f29804fa8932282a17b414ef0dde2ea4eec03 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix statement printing for raw and template user-defined literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152401 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
3a5032b89df601ab2e0c5c7e9667db2301bf10cf 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Literal operator suffixes and regular names live in separate namespaces.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152395 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-user-defined-literals.cpp
36f5cfe4df32af6c5fe01228102512996f566f9d 09-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Support for raw and template forms of numeric user-defined literals,
and lots of tidying up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152392 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-user-defined-literals.cpp
188158db29f50443b6e412f2a40c800b2669c957 08-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Turn explicit construction of temporaries using initializer list syntax into CXXTemporaryObjectExprs, not just CXXConstructExprs, which have a worrying tendency to vanish. Fixes PR12167.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152340 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
916883004c36291b70355d5e73abb05e138804fb 08-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Ensure we don't print 123ULL_foo when printing a user-defined integer literal.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152303 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
b453ad3214d00acc51c9aa702c76c58354d84b84 08-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add support for cooked forms of user-defined-integer-literal and
user-defined-floating-literal. Support for raw forms of these literals
to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152302 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-user-defined-literals.cpp
2fb4ae36825ca3a0cbe7e845c5747062870066be 08-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [lex.ext]p10 for string and character literals: a ud-suffix not
starting with an underscore is ill-formed.

Since this rule rejects programs that were using <inttypes.h>'s macros, recover
from this error by treating the ud-suffix as a separate preprocessing-token,
with a DefaultError ExtWarn. The approach of treating such cases as two tokens
is under discussion for standardization, but is in any case a conforming
extension and allows existing codebases to keep building while the committee
makes up its mind.

Reword the warning on the definition of literal operators not starting with
underscores (which are, strangely, legal) to more explicitly state that such
operators can't be called by literals. Remove the special-case diagnostic for
hexfloats, since it was both triggering in the wrong cases and incorrect.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152287 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-compat.cpp
5bc37f6e0c932e7a8e0af92b6266372dc7b94cd9 08-Mar-2012 Douglas Gregor <dgregor@apple.com> Loosen the precondition of isCXXInstanceMember() to simply return
"false" for declarations that aren't members of classes. Fixes PR12106.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152284 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
ffea6b4560cee39bd2a26f478e57da19fc3b47b2 08-Mar-2012 Richard Trieu <rtrieu@google.com> Fix -Wuninitialized to catch the case of a class being initialized with a call
to its own member function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152276 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
cbf82092cdb9e3a2e8528384c878f2084a14981c 07-Mar-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Be smarter in discovering list-initialization of temporaries. Fixes PR12182.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152231 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-references.cpp
9fcce65e7e1307b5b8da9be13e4092d6bb94dc1d 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this
representation.

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
xx11-ast-print.cpp
e816c717d4de1de6c67f1fd5ef4a927fe2bf2ea7 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wc++11-compat warning for string and character literals followed by
identifiers, in cases where those identifiers would be treated as
user-defined literal suffixes in C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152198 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-compat.cpp
ce9c8319f43556d9c3fe2771665483d310d86fd8 06-Mar-2012 Sean Callanan <scallanan@apple.com> Extended the UnknownAnyTy resolver to handle
blocks with unknown return types. This allows
LLDB to call blocks even when their return types
aren't provided in the debug information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152147 91177308-0d34-0410-b5e6-96231b3b80d8
nknown-anytype-blocks.cpp
12fc4b0624706b474fa10308631fa8daf92f340f 05-Mar-2012 Peter Collingbourne <peter@pcc.me.uk> Properly handle non-canonical underlying types in
ASTContext::getUnaryTransformType. This can happen if, for example,
an enumeration's underlying type is a typedef.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152031 91177308-0d34-0410-b5e6-96231b3b80d8
nderlying_type.cpp
5cc2c6eb67b6e5361bbe96f79b519fd62ec666d6 05-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Lexing support for user-defined literals. Currently these lex as the same token
kinds as the underlying string literals, and we silently drop the ud-suffix;
those issues will be fixed by subsequent patches.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152012 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
b4a7b1e587a232c95d02a8ca10eeba60164fbba1 04-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add tests for [over.literal]. Fix a few bugs which were exposed by the tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151997 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-operators.cpp
ec92bc78979aae6ec436fe51d082f7467e6f96c0 04-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add a pile of tests for unrestricted unions, and advertise support for them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151992 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-nontrivial-union.cpp
iscrim-union.cpp
0d95dfcc0e07a81596ab7c3e9e86ab663fd4541c 03-Mar-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: expand set of expressions that can be used to denote locks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151956 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
ff1e9cce64f9f4a94ebfbfd26aaca4c389382266 03-Mar-2012 Nico Weber <nicolasweber@gmx.de> Add a test for the -Wstring-plus-int fixit note.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151951 91177308-0d34-0410-b5e6-96231b3b80d8
tring-plus-int.cpp
7ec419aa8f4ff83bc8ff707b45b9bec47fef3a1a 02-Mar-2012 DeLesley Hutchins <delesley@google.com> Issue warning when late-parsed attributes have no declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151947 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
2287c5e2352fc51cd74e8a9a7725cbf87e41c007 02-Mar-2012 DeLesley Hutchins <delesley@google.com> Make late-parsed attributes follow the conventions of ordinary
GNU attributes to a better extent, by allowing them in more
places on a declator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151945 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
2a35be803c405221f5f23c7bdedb91f09efdd3ac 02-Mar-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: handle CFG blocks which call functions marked as noreturn.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151944 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
1cb2d742eb6635aeab6132ee5f0b5781d39487d7 02-Mar-2012 Nico Weber <nicolasweber@gmx.de> Add -Wstring-plus-int, which warns on "str" + int and int + "str".

It doesn't warn if the integer is known at compile time and within
the bounds of the string.

Discussion: http://comments.gmane.org/gmane.comp.compilers.clang.scm/47203



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151943 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds-ptr-arith.cpp
onstant-expression-cxx11.cpp
ull_in_arithmetic_ops.cpp
tring-plus-int.cpp
16581335fc32abcbc6ab14eda7af38cf759664b7 02-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> Ensure that we instantiate static reference data members of class templates
early, since their values can be used in constant expressions in C++11. For
odr-use checking, the opposite change is required, since references are
odr-used whether or not they satisfy the requirements for appearing in a
constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151881 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
ambda-expressions.cpp
88530d5e138f36ea80a7d70c14f37095b8eba85b 01-Mar-2012 Eli Friedman <eli.friedman@gmail.com> Fix the isReferenced bit on parameters in a couple of edge cases. PR12153.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151837 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-parameters.cpp
dca1761c9b91d0a730ac6368425dc978e8481392 01-Mar-2012 Peter Collingbourne <peter@pcc.me.uk> StmtProfiler: Add a null check for child statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151812 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
51ad9cd0644c9acf442f049aed98b66f7b1041a2 29-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Tentatively fix PR12117. The test case from the bug now passes, and all existing tests still pass, but there may still be corner cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151716 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
c60ccf5b4fb657ca40da3019c2bbe15dd8ab9732 29-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make sure list-initialization of arrays works correctly in explicit type conversions. PR12121.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151674 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
2422e82b54aa115bba23da3a44998477720ef6a4 29-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Single- and zero-element initializer lists to scalars are list-initializations. Fixes PR12118.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151666 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-scalars.cpp
adfb535905a7ca4226d06a29ebc665085503afd5 27-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Implement a FIXME for conversion sequence distinction. Should fix PR12092.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151577 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
92b670e1ee0b11d7e558ec659795ddf452e583ed 27-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Fix a couple bugs in the way we handle array indexes in array bounds checking. Specifically, make sure we don't ignore explicit casts in indexes, and make sure we use unsigned extension/comparisons on indexes. Fixes <rdar://problem/10916006>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151569 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
dbe01bb024ce9407954275a5e3c7e1a7113ca9fa 27-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Tests for r151508.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151509 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
ea7c1e24f33c554aeac07dc4f6dc7493dd98e272 26-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't assert when trying to diagnose why a class with a constructor template is
non-trivial.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151486 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-nontrivial-union.cpp
03f68788036803c0bad3fe6ea9a4ea31ba195a2b 26-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Make sure we don't try to produce a definition of an implicitly-deleted function


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151478 91177308-0d34-0410-b5e6-96231b3b80d8
efaulted-private-dtor.cpp
e653ba2f3b6d993b5d410554c12416c03ec7775b 26-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Special members which are defaulted or deleted on their first declaration are
trivial if the implicit declaration would be. Don't forget to set the Trivial
flag on the special member as well as on the class. It doesn't seem ideal that
we have two separate mechanisms for storing this information, but this patch
does not attempt to address that.

This leaves us in an interesting position where the has_trivial_X trait for a
class says 'yes' for a deleted but trivial X, but is_trivially_Xable says 'no'.
This seems to be what the standard requires.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151465 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
d390de9c6312684c5e5b333f434199e193c7467a 25-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix r151443 to only apply C++11's exception for non-static data member access
in cases where we would otherwise disallow the access, and add a -Wc++98-compat
diagnostic for this C++11 feature.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151444 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
7a9f49296a6454b7a6f0edce89dc99d413a7e14e 25-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix assertion (too few Diag arguments) when diagnosing a deleted operator delete


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151442 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-operator.cpp
dfefb840e36f069286ef6cf178ef339c90f4603d 25-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Teach CXXRecordDecl::hasIrrelevantDestructor to check the base classes and
data members for deleted or user-provided destructors.

Now it's computed in advance, serialize it, and in passing fix all the other
record DefinitionData flags whose serialization was missing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151441 91177308-0d34-0410-b5e6-96231b3b80d8
efaulted-private-dtor.cpp
f5cd5cc9a7ec114ef1a4c08491a37d2327697c4a 25-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix a regression from r151117: ADL requires that we attempt to complete any
associated classes, since it can find friend functions declared within them,
but overload resolution does not otherwise require argument types to be
complete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151434 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
d08d599da101f3fe3fd79e853f1dcea6be89d7c2 25-Feb-2012 DeLesley Hutchins <delesley@google.com> Bugfix: bogus warning -- "invalid use of non-static data member",
when a class is forward declared, and the reference to the data
member in question does not occur within a method body.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151413 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-class.cpp
arn-thread-safety-analysis.cpp
ed878af7914df535b32d64f555fa118413186672 25-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement C++11 [over.match.copy]p1b2, which allows the use of
explicit conversion functions to initialize the argument to a
copy/move constructor that itself is the subject of direct
initialization. Since we don't have that much context in overload
resolution, we end up threading more flags :(.

Fixes <rdar://problem/10903741> / PR10456.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151409 91177308-0d34-0410-b5e6-96231b3b80d8
xplicit.cpp
61dab36ccbcc1eef7b7cfcb641e04116726ad053 25-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Remove FIXME: as Eli points out, the behavior here is now correct.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151405 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
c7b5543ad32a5c265c02e71b2a6f9856440ed13f 24-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Back out __decltype warning from r151377: we should either warn on all the GNU
__keywords or none of them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151401 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-98.cpp
359c89df5479810c9d4784fc0b6ab592eb136777 24-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> When checking whether a reference to a variable is an ICE, look at the type of
the declaration, not at the type of the DeclRefExpr, since within a lambda the
DeclRefExpr can be more const than the declaration is.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151399 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
221c27f0d34c5938d84bbb8fafe1c3e3f1f87f2e 24-Feb-2012 Douglas Gregor <dgregor@apple.com> C++11 [class.ctor]p5 says that
A defaulted default constructor for a class X is defined as deleted if [...]
- X is a union and all of its variant members are of const-qualified type.

A pedantic reading therefore says that

union X { };

has a deleted default constructor, which is both silly and almost
certainly unintended. Pretend as if this this read

- X is a union with one or more variant members, and all of its
variant members are of const-qualified type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151394 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
39304fad1c8a7b7e64121e9ae544b18e460b682c 24-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> __decltype is a GNU extension, not a C++11 extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151377 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
ecltype-98.cpp
4ca8ac2e61c37ddadf37024af86f3e1019af8532 24-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement a new type trait __is_trivially_constructible(T, Args...)
that provides the behavior of the C++11 library trait
std::is_trivially_constructible<T, Args...>, which can't be
implemented purely as a library.

Since __is_trivially_constructible can have zero or more arguments, I
needed to add Yet Another Type Trait Expression Class, this one
handling arbitrary arguments. The next step will be to migrate
UnaryTypeTrait and BinaryTypeTrait over to this new, more general
TypeTrait class.

Fixes the Clang side of <rdar://problem/10895483> / PR12038.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151352 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
aa5ab26ed93382b812147f532dcbf4afb5494040 24-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Handle "#pragma GCC visibility" in a few more places. Switch over "#pragma pack" to use the same handling that gcc does. Fixes <rdar://problem/10871094> and <rdar://problem/10893316>.

(Hopefully, common usage of these pragmas isn't irregular enough to break our current handling. Doug has ideas for a more crazy approach if necessary.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151307 91177308-0d34-0410-b5e6-96231b3b80d8
ragma-visibility.cpp
25d0a0f67d9e949ffbfc57bf487012f5cbfd886e 23-Feb-2012 Douglas Gregor <dgregor@apple.com> Provide the __is_trivially_assignable type trait, which provides
compiler support for the std::is_trivially_assignable library type
trait.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151240 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
5b38a0f98e4420dae1bd3e13959bc207c97a9e98 22-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Doug's review comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151173 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-return-init-list.cpp
33deb35535aebe81bed0eaf5c14f3032276a086e 22-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Fix parsing and processing initializer lists in return statements and as direct member initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151155 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
xx0x-initializer-stdinitializerlist.cpp
xx0x-return-init-list.cpp
76517426dc8bf7734c07eefc35171a6bfdba1a2b 22-Feb-2012 Hans Wennborg <hans@hanshq.net> Warn about non-standard format strings (pr12017)

This adds the -Wformat-non-standard flag (off by default,
enabled by -pedantic), which warns about non-standard
things in format strings (such as the 'q' length modifier,
the 'S' conversion specifier, etc.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151154 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings.cpp
428c620478d513081399798db5550bf0c779f244 22-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Throw away stray CXXDefaultArgExprs. Fixes PR12061.

I think there's a deeper problem here in the way TransformCXXConstructExpr works, but I won't tackle it now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151146 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
0635aa75ab48c9c3b4269d266305aba77b6ec58e 22-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Accept braced-init-lists in conditions, and, in passing, dramatically improve
the diagnostic for using a parenthesized direct-initializer in a condition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151137 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-scalars.cpp
e9ee382c32a83e9807a2fe4cfd52b5a11169a4b8 22-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Improve diagnostics a bit for bad member initializers, and fix an obscure bug involving packs. Fixes PR12049.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151130 91177308-0d34-0410-b5e6-96231b3b80d8
R9461.cpp
onstructor-initializer.cpp
76f3f69db1416425070177243e9f390122c553e0 22-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 [expr.call]p11: If the operand to a decltype-specifier is a
function call (or a comma expression with a function call on its right-hand
side), possibly parenthesized, then the return type is not required to be
complete and a temporary is not bound. Other subexpressions inside a decltype
expression do not get this treatment.

This is implemented by deferring the relevant checks for all calls immediately
within a decltype expression, then, when the expression is fully-parsed,
checking the relevant constraints and stripping off any top-level temporary
binding.

Deferring the completion of the return type exposed a bug in overload
resolution where completion of the argument types was not attempted, which
is also fixed by this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151117 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
e43fe993a079795ac3d2ba7c9ec5e2a0c8069918 22-Feb-2012 Kaelyn Uhrain <rikka@google.com> Fix typo correction of template arguments to once again allow type names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151112 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
b09ab8c293833c3dbcbf78f0db5e01fec46966bf 21-Feb-2012 Douglas Gregor <dgregor@apple.com> Only pop the expression evaluation context corresponding to a lambda
expression after we've finished the function body of the corresponding
function call operator. Otherwise, ActOnFinishFunctionBody() will see
the (unfinished) evaluation context of the lambda expression
itself. Fixes PR12031.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151082 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
e38fa1866e684b99c6c6e359449af9e0b6e83164 21-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't assume that a valid expression for the first part of a for-statement
is non-null when diagnosing a broken attempt to write a for-range-statement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151081 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-examples.cpp
f57c413e444b441fa75ae8911d183c19b53bdd56 21-Feb-2012 Jean-Daniel Dupas <devlists@shadowlab.org> When calling a non variadic format function(vprintf, vscanf, NSLogv, …), warn if the format string argument is a parameter that is not itself declared as a format string with compatible format.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151080 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings.cpp
772291a67d483c1c2abf324eec5d8d6ca476bfdc 19-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Emit a warning when list-initializing a std::initializer_list member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150933 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
86024013d4c3728122c58fa07a2a67e6c15837ef 18-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement constant expression support for __real__ and __imag__ on lvalue
complex numbers. Treat complex numbers as arrays of the corresponding component
type, in order to make std::complex behave properly if implemented in terms of
_Complex T.

Apparently libstdc++'s std::complex is implemented this way, and we were
rejecting a member like this:

constexpr double real() { return __real__ val; }

because it was marked constexpr but unable to produce a constant expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150895 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
999713eea940f4e087cc3ac878689c5c5c7a7225 18-Feb-2012 Douglas Gregor <dgregor@apple.com> Rewrite variable capture within lambda expressions and blocks,
eliminating a bunch of redundant code and properly modeling how the
captures of outside blocks/lambdas affect the types seen by inner
captures.

This new scheme makes two passes over the capturing scope stack. The
first pass goes up the stack (from innermost to outermost), assessing
whether the capture looks feasible and stopping when it either hits
the scope where the variable is declared or when it finds an existing
capture. The second pass then walks down the stack (from outermost to
innermost), capturing the variable at each step and updating the
captured type and the type that an expression referring to that
captured variable would see. It also checks type-specific
restrictions, such as the inability to capture an array within a
block. Note that only the first odr-use of each
variable needs to do the full walk; subsequent uses will find the
capture immediately, so multiple walks need not occur.

The same routine that builds the captures can also compute the type of
the captures without signaling errors and without actually performing
the capture. This functionality is used to determine the type of
declaration references as well as implementing the weird decltype((x))
rule within lambda expressions.

The capture code now explicitly takes sides in the debate over C++
core issue 1249, which concerns the type of captures within nested
lambdas. We opt to use the more permissive, more useful definition
implemented by GCC rather than the one implemented by EDG.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150875 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
b78ae9716576399145786b93f687943f8b197170 18-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix a problem in the GCC testsuite, exposed by r150557. Compound literals
are represented as prvalues in C++; don't be fooled into thinking they're
global lvalues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150870 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
e61eb0443a77dd178934d070f458e1a08b84eb96 18-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Add a bunch of missing calls to DiagnoseSentinelCalls. <rdar://problem/10885993>.

This should probably be refactored... but it isn't completely obvious what refactoring is best.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150869 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-sentinel.cpp
213d70b58b4f48050c3e545ce1bd4b0ec3af74be 18-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Diagnose uses of deleted destructors and inaccessible defaulted destructors.

We had two separate issues here: firstly, varions functions were assuming that
they did not need to perform semantic checks on trivial destructors (this is
not true in C++11, where a trivial destructor can nonetheless be private or
deleted), and a bunch of DiagnoseUseOfDecl calls were missing for uses of
destructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150866 91177308-0d34-0410-b5e6-96231b3b80d8
efaulted-private-dtor.cpp
eleted-function.cpp
7d5088aa52d6e32b309ad0af32ea520ddbc5f953 18-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Initial refactoring of 'ShouldDeleteSpecialMember', in preparation for providing
decent diagnostics. Finish the work of combining all the 'ShouldDelete'
functions into one. In unifying the code, fix a minor bug where an anonymous
union with a deleted default constructor as a member of a union wasn't being
considered as making the outer union's default constructor deleted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150862 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
1f27805fe4f5463fd5b4d5396affe1ef23320688 17-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Don't allow non-empty ParenListExprs as array-new initializers.

Don't know what I was thinking there. Fixes PR12023.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150804 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
f3908f2ae111b1b12ade2524dda71c669ed6f121 17-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Make sure all remaining parts of the constant evaluator are aware that an array
can be represented by an LValue, and use that to simplify the code a little.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150789 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
85b29a4c862bb9f41d9739e5dab6436fe6d44ff8 17-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Reject continue/break statements within members of local functions nested within
loop and switch statements, by teaching Scope that a function scope never has
a continue/break parent for the purposes of control flow. Remove the hack in
block and lambda expressions which worked around this by pretending that such
expressions were continue/break scopes.

Remove Scope::ControlParent, since it's unused.

In passing, teach default statements to recover properly from a missing ';', and
add a fixit for same to both default and case labels (the latter already
recovered correctly).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150776 91177308-0d34-0410-b5e6-96231b3b80d8
witch.cpp
ce582fe2a7aad8b14b3636ad9cac0a3b8bbb219b 17-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR12012: Fix a regression in r150419 where we would try (and fail) to
zero-initialize class types with virtual bases when constant-evaluating an
initializer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150770 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-value-init.cpp
3336353578a02eb7dc35926c2440577993196e36 16-Feb-2012 Kaelyn Uhrain <rikka@google.com> Avoid infinite mutual recursion in DiagnoseInvalidRedeclaration.

Don't try to typo-correct a method redeclaration to declarations not in
the current record as it could lead to infinite recursion if CorrectTypo
finds more than one correction candidate in a parent record.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150735 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
b9c64d84ea3edd5e2fffb0a2e85ca1308be4f429 16-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> C++11 allows unions to have static data members. Remove the corresponding
restriction and add some tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150721 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-nontrivial-union.cpp
xx98-compat.cpp
dd5756c04c98e354b85c4f7eb660ae60c6d341ec 16-Feb-2012 DeLesley Hutchins <delesley@google.com> Minor fix to template instantiation, which properly instantiates
dependent attributes on static members of templatized classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150704 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
2f13bec63b0236b169b026b7bc852da51ee029a7 16-Feb-2012 DeLesley Hutchins <delesley@google.com> Thread-safety analysis: Disable checking inside constructors, destructors, lock, and unlock functions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150701 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
4bda3eca138d39585c9e475ad25aa9ff053f923b 16-Feb-2012 DeLesley Hutchins <delesley@google.com> Thread-Safety: added support for 'this' as a lock expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150700 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
c24a2335677f3d1bd2cab1019ac445d650f52123 16-Feb-2012 DeLesley Hutchins <delesley@google.com> Allow thread safety attributes on function definitions.
For compatibility with gcc, clang will now parse gcc attributes on
function definitions, but issue a warning if the attribute is not a
thread safety attribute. Warning controlled by -Wgcc-compat.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150698 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-cursory-default-delete.cpp
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
bd45d257a404ed1f87090c8a32b5dd75576b7d11 16-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Proper checking of list-initializers for array new expressions.

This finishes generalized initializer support in Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150688 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-cxx0x.cpp
2aed8b88613863f3c439cdfb205bdf8b608fb205 16-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Revert "Revert "Make CXXNewExpr contain only a single initialier, and not hold the used constructor itself.""

This reintroduces commit r150682 with a fix for the Bullet benchmark crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150685 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
a2d7dfab309375fbf016b650fa74f9b5d03a9752 16-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Shift Microsoft enum extensions from -fms-extensions to -fms-compatibility, so -fms-extensions doesn't affect enum semantics in incompatible ways. <rdar://problem/10657186>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150663 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility-cxx98.cpp
icrosoftExtensions.cpp
74e1ad93fa8d6347549bcb10279fdf1fbc775321 16-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr tidyups:
* Fix bug when determining whether && / || are potential constant expressions
* Try harder when determining whether ?: is a potential constant expression
* Produce a diagnostic on sizeof(VLA) to provide a better source location


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150657 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9f02d6d2b7d62971ea619b4d0a6e68508e50ec24 16-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Mark the parenthesized array member initialization diagnostic as DefaultError,
and move it out of -Wgnu so that -Wno-gnu leaves it enabled. As requested by
Eli.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150643 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
0f163e964289bc18e9bc1ec37a6a01018ba62640 15-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Support GCC's bug^Wextension allowing class array members to be initalized by a
parenthesized braced-init-list in the base/member initialization list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150625 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
2d4d7fd0ca37b61406dfe58acbefa8cf20ee050a 15-Feb-2012 Kaelyn Uhrain <rikka@google.com> Improve typo correction involving nested name specifiers.

Snooping in other namespaces when the identifier being corrected is
already qualified (i.e. a valid CXXScopeSpec is passed to CorrectTypo)
and ranking synthesized namespace qualifiers relative to the existing
qualifier is now performed. Support for disambiguating the string
representation of synthesized namespace qualifers has also been added
(the change to test/Parser/cxx-using-directive.cpp is an example of an
ambiguous relative qualifier).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150622 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
e4e68d45f89ff4899d30cbd196603d09b7fbc150 15-Feb-2012 Douglas Gregor <dgregor@apple.com> When overload resolution picks an implicitly-deleted special member
function, provide a specialized diagnostic that indicates the kind of
special member function (default constructor, copy assignment
operator, etc.) and that it was implicitly deleted. Add a hook where
we can provide more detailed information later.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150611 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
r1301.cpp
mplicit-exception-spec.cpp
alue-initialization.cpp
d5f55dcb0de1cb03c93adc9a44a5ed24e4cb505d 15-Feb-2012 Dmitri Gribenko <gribozavr@gmail.com> Convert ad-hoc `int array[expr ? -1 : 1]' assertions
in test/SemaCXX/nullptr.cpp to static_assert



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150579 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
83587db1bda97f45d2b5a4189e584e2a18be511a 15-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1454. This allows all intermediate results in constant expressions
to be core constant expressions (including pointers and references to
temporaries), and makes constexpr calculations Turing-complete. A Turing machine
simulator is included as a testcase.

This opens up the possibilty of removing CCValue entirely, and removing some
copies from the constant evaluator in the process, but that cleanup is not part
of this change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150557 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstexpr-turing.cpp
26f2cac83eeb4317738d74b9e567d3d58aa04ed9 14-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: evaluation support for nullptr comparisons.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150521 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
625bb569df0c34feec0d52c0ec5215f21ef2e054 14-Feb-2012 Dmitri Gribenko <gribozavr@gmail.com> Generalize -Wempty-body: warn when statement body is empty (closes: PR11329)

* if, switch, range-based for: warn if semicolon is on the same line.
* for, while: warn if semicolon is on the same line and either next
statement is compound statement or next statement has more
indentation.

Replacing the semicolon with {} or moving the semicolon to the next
line will always silence the warning.

Tests from SemaCXX/if-empty-body.cpp merged into SemaCXX/warn-empty-body.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150515 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
f-empty-body.cpp
arn-empty-body.cpp
70488e201ccd94d4bb1ef0868cc13cca2b7d4ff6 14-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Pending clear answer from WG21 on whether core issue 903 is intended to apply to
C++11 or just C++17, restrict the set of null pointer constants in C++11 mode
back to those which were considered null in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150510 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
1d0c9a8d0573d1f670f484cc17aa94f06be971a5 14-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11650: Implement resolution of core issue 1301. Value initialization can't be
used to construct an object of union type with a deleted default constructor
(plus fixes for some related value-initialization corner cases).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150502 91177308-0d34-0410-b5e6-96231b3b80d8
r1301.cpp
63aae82bb12bbbe9028e597fb77e40fa8d348c12 14-Feb-2012 Kaelyn Uhrain <rikka@google.com> Use several weighted factors to determine typo candidate viablity.

Replace the simple Levenshtein edit distance for typo correction
candidates--and the hacky way adding namespace qualifiers would affect
the edit distance--with a synthetic "edit distance" comprised of several
factors and their relative weights. This also allows the typo correction
callback object to convey more information about the viability of a
correction candidate than simply viable or not viable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150495 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
3164c14cadbb09a05ba811602221e9156077cf44 14-Feb-2012 David Blaikie <dblaikie@gmail.com> Fix crash-on-invalid for 'operator int[]()' in C++11.

Signed off by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150464 91177308-0d34-0410-b5e6-96231b3b80d8
ember-init.cpp
eb273b798760ed960edb0a619092da314e21f4ea 14-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix another issue introduced by the proposed wording for core issue 1358: since
the instantiation of a constexpr function temploid is now always constexpr, a
defaulted constexpr function temploid is often ill-formed by the rule in
[dcl.fct.def.default]p2 that an explicitly-defaulted constexpr function must
have a constexpr implicit definition. To avoid making loads of completely
reasonable code ill-formed, do not apply that rule to templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150453 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
20ff0e2d74c188cb3fd4ec3dead41a80a37c0202 13-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Don't route explicit construction via list-initialization through the functional cast code path. It sometimes does the wrong thing, produces horrible error messages, and is just unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150408 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
xx0x-initializer-constructor.cpp
86c3ae46250cdcc57778c27826060779a92f3815 13-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update constexpr implementation to match CWG's chosen approach for core issues
1358, 1360, 1452 and 1453.
- Instantiations of constexpr functions are always constexpr. This removes the
need for separate declaration/definition checking, which is now gone.
- This makes it possible for a constexpr function to be virtual, if they are
only dependently virtual. Virtual calls to such functions are not constant
expressions.
- Likewise, it's now possible for a literal type to have virtual base classes.
A constexpr constructor for such a type cannot actually produce a constant
expression, though, so add a special-case diagnostic for a constructor call
to such a type rather than trying to evaluate it.
- Classes with trivial default constructors (for which value initialization can
produce a fully-initialized value) are considered literal types.
- Classes with volatile members are not literal types.
- constexpr constructors can be members of non-literal types. We do not yet use
static initialization for global objects constructed in this way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150359 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-value-init.cpp
iteral-type.cpp
f8af98286022f72157d84951b48fde5fb369ab29 12-Feb-2012 Douglas Gregor <dgregor@apple.com> Within the body of a lambda expression, decltype((x)) for an
id-expression 'x' will compute the type based on the assumption that
'x' will be captured, even if it isn't captured, per C++11
[expr.prim.lambda]p18. There are two related refactors that go into
implementing this:

1) Split out the check that determines whether we should capture a
particular variable reference, along with the computation of the
type of the field, from the actual act of capturing the
variable.
2) Always compute the result of decltype() within Sema, rather than
AST, because the decltype() computation is now context-sensitive.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150347 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
6dc00f6e98a00bd1c332927c3e04918d7e8b0d4f 12-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Proper initializer list support for new expressions and type construct expressions. Array new still missing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150346 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
xx0x-initializer-scalars.cpp
xx0x-initializer-stdinitializerlist.cpp
xx98-compat.cpp
3a45c0e61dfc19f27b8ebcb15dd70159a36f1f9a 12-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Change the way we store initialization kinds so that all direct inits can distinguish between list and parens form. This allows us to correctly diagnose the last test cases from litb.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150343 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
xx0x-initializer-references.cpp
xx0x-initializer-scalars.cpp
eneralized-initializers.cpp
168319c81b8f4e7addf36ad15ef24919faf23504 12-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Employ DirectList initialized entities to properly sort through some initialization edge cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150342 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
eneralized-initializers.cpp
56a04287a1c713870d1e03206cce785e985cc866 12-Feb-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Fix parsing new expressions using init lists. Probably still do the wrong thing in cases involving array new.
Show that many cases using initializer list constructors work, in that they parse and pass semantic analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150316 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
xx98-compat.cpp
eneralized-initializers.cpp
f2e4dfcd325db2c1a960697be2c750f277dcafce 11-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement core issue 5: a temporary created for copy-initialization has a
cv-unqualified type. This is essential in order to allow move-only objects of
const-qualified types to be copy-initialized via a converting constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150309 91177308-0d34-0410-b5e6-96231b3b80d8
opy-initialization.cpp
8327118ff60cd9c4812fba1e5ba4eb3cb5ed3401 11-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Make sure to try instantiating a templated type which is used in an _Atomic
before complaining that it's incomplete.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150308 91177308-0d34-0410-b5e6-96231b3b80d8
tomic-type.cxx
a73cdcbc1dc1ed98c54556c6adcd2b12301759cc 10-Feb-2012 David Blaikie <dblaikie@gmail.com> Support all null pointer literals in format strings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150276 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings-0x.cpp
ormat-strings.cpp
e3d8e737e18f0ce95d87be03f74b35413443173c 10-Feb-2012 Ted Kremenek <kremenek@apple.com> Enhance checking for null format string literal to take into account __null. Fixes <rdar://problem/8269537>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150260 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings.cpp
d37b360bf9f954af119c9805fdc79ab9d30e06c6 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11684, core issue 1417:

o Correct the handling of the restrictions on usage of cv-qualified and
ref-qualified function types.
o Fix a bug where such types were rejected in template type parameter default
arguments, due to such arguments not being treated as a template type arg
context.
o Remove the ExtWarn for usage of such types as template arguments; that was
a standard defect, not a GCC extension.
o Improve the wording and unify the code for diagnosing cv-qualifiers with the
code for diagnosing ref-qualifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150244 91177308-0d34-0410-b5e6-96231b3b80d8
lias-template.cpp
estructor.cpp
unction-type-qual.cpp
ssue547.cpp
dcd285114fe2453f47e55e4b85fb2d54b6ee87c3 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Test cleanup: prefer static_assert to handmade alternative.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150243 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-nqueens.cpp
eefb3d5b49c844347f212073a7e975b8118fe8e9 10-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Track whether a function type has a trailing return type as type sugar. Use this
to pretty-print such function types better, and to fix a case where we were not
instantiating templates in lexical order. In passing, move the Variadic bit from
Type's bitfields to FunctionProtoType to get the Type bitfields down to 32 bits.
Also ensure that we always substitute the return type of a function when
substituting explicitly-specified arguments, since that can cause us to bail
out with a SFINAE error before we hit a hard error in parameter substitution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150241 91177308-0d34-0410-b5e6-96231b3b80d8
railing-return-0x.cpp
7badd2467a1650c0c2a5fdef974f590fc32c3694 09-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make sure a variable with a C++ direct initializer triggers jump scope checking. Fixes PR10620 / <rdar://problem/9958362> .



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150204 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
54042f1bd78f1f1ea86be7d4af541462e127d2ed 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Implement return type deduction for lambdas per C++11
[expr.prim.lambda]p4, including the current suggested resolution of
core isue 975, which allows multiple return statements so long as the
types match. ExtWarn when user code is actually making use of this
extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150168 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
b326ca8ffbea96f9cc8a457b0f57be880304a6f5 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Remove the "unsupported" error for lambda expressions. It's annoying,
and rapidly becoming untrue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150165 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
b4e5e286a5cd156247720b1eb204abaa8e09568d 09-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> CWG issue 1405: mutable members are allowed in literal types, but can't undergo
lvalue-to-rvalue conversions in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150145 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
2c0bf2437089f9a297cf18530361a185e76f2150 09-Feb-2012 Aaron Ballman <aaron@aaronballman.com> Adding support for warning when a non-C compatible user-defined type is returned from an extern "C" function.

Fixes bug 6143

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150128 91177308-0d34-0410-b5e6-96231b3b80d8
unction-extern-c.cpp
503384f731b5abcbf870b0a5224eb920e631db0a 09-Feb-2012 Douglas Gregor <dgregor@apple.com> Various interrelated cleanups for lambdas:
- Complete the lambda class when we finish the lambda expression
(previously, it was left in the "being completed" state)
- Actually return the LambdaExpr object and bind to the resulting
temporary when needed.
- Detect when cleanups are needed while capturing a variable into a
lambda (e.g., due to default arguments in the copy constructor), and
make sure those cleanups apply for the whole of the lambda
expression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150123 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
2fd5983e0da447291a651a347c206aee37a1de5f 08-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1458: Taking the address of an object of incomplete class type is
not a constant expression, because we can't tell whether the complete class type
will have an overloaded operator&.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150066 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
925d8e7c0f18e03dc4bc634b3c6c1ec09373d993 08-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement the agreed resolution to DR1457: a signed left shift of a 1 bit into
the sign bit doesn't have undefined behavior, but a signed left shift of a 1 bit
out of the sign bit still does. As promised to Howard :)

The suppression of the potential constant expression checking in system headers
is also removed, since the problem it was working around is gone.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150059 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-sysheaders.cpp
59a839c5a4eecfeb495fc64224f6a949d1c5b2da 08-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make sure template argument deduction is consistently performed in an unevaluated context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150049 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
52aabafeee9e8634eceb46b1a3fdbd3cd22b1cf7 07-Feb-2012 Jean-Daniel Dupas <devlists@shadowlab.org> Implements support of format_arg attribute on C++ member.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149998 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings.cpp
0a29422eb722c0ffbb98b98d8636042b19069f1a 07-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Misc improvements to the diagnostic when a variable is odr-used in a context that is not allowed to capture variables.

Fixes PR11883.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149937 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
210386eb619ea9feef425636150bdffc0538574d 06-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in C++11 mode. PR11928.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149908 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
9ec7197796a2730d54ae7f632553b5311b2ba3b5 05-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Fix implementation of DR1311: check for volatile qualifiers in
lvalue-to-rvalue conversions on the source type of the conversion, not the
target type (which has them removed for non-class types).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149796 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
282e7e66748cc6dd14d6f7f2cb52e5373c531e61 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> In C++11 mode, when an integral constant expression is desired and we have a
value of class type, look for a unique conversion operator converting to
integral or unscoped enumeration type and use that. Implements [expr.const]p5.

Sema::VerifyIntegerConstantExpression now performs the conversion and returns
the converted result. Some important callers of Expr::isIntegralConstantExpr
have been switched over to using it (including all of those required for C++11
conformance); this switch brings a side-benefit of improved diagnostics and, in
several cases, simpler code. However, some language extensions and attributes
have not been moved across and will not perform implicit conversions on
constant expressions of literal class type where an ICE is required.

In passing, fix static_assert to perform a contextual conversion to bool on its
argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149776 91177308-0d34-0410-b5e6-96231b3b80d8
num-bitfield.cpp
-c-e-cxx.cpp
ew-delete.cpp
f39aec17b89f8f0dd78e78c50ad2fa08f12272e3 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't allow a value of a scoped enumeration to be used as the first bound for an
array new expression. This lays some groundwork for the implicit conversion to
integral or unscoped enumeration which C++11 ICEs undergo.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149772 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
ew-delete.cpp
0b458fd8b6321c11e8b22727e0e9b9960e93ff4d 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Fix a rejects-valid in C++11: array new of a negative size, or overflowing array
new, is well-formed with defined semantics of throwing (a type which can be
caught by a handler for) std::bad_array_new_length, unlike in C++98 where it is
somewhere nebulous between undefined behavior and ill-formed.

If the array size is an integral constant expression and satisfies one of these
criteria, we would previous the array new expression, but now in C++11 mode, we
merely issue a warning (the code is still rejected in C++98 mode, naturally).

We don't yet implement new C++11 semantics correctly (see PR11644), but we do
implement the overflow checking, and (for the default operator new) convert such
expressions to an exception, so accepting such code now does not seem especially
unsafe.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149767 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-cxx0x.cpp
ew-delete.cpp
507a8a3fbb2c43247474daa7ccb8dd0a46c32ec5 04-Feb-2012 Nick Lewycky <nicholas@mxc.ca> Don't warn on use of default allocator with an over-aligned type when the
allocator is given the pointer to allocate into.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149760 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/warn-new-overaligned-3.h
arn-new-overaligned-3.cpp
0cc5d40e5cb0af88c5487ac660ed259eb2b434ae 04-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Suppress the used-but-not-defined warning for static data members while I look into a rather nasty bug in the new odr-use marking code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149731 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
5ba73e1af8ef519161bd40063dc325457e21676a 04-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr:
The recent support for potential constant expressions exposed a bug in the
implementation of libstdc++4.6, where numeric_limits<int>::min() is defined
as (int)1 << 31, which isn't a constant expression. Disable the 'constexpr
function never produces a constant expression' error inside system headers
to compensate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149729 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-sysheaders.cpp
cefc7b20fdb97b989163199e0849b4325e9b7804 04-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Make explicit captures which cause implicit captures work correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149719 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
b942cb24a060435b18fef5b43eb33d77afc0d03a 03-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Implement implicit capture for lambda expressions.

Still left: explicit captures in lambdas need to cause implicit capture, and I need to take a look at the diagnostics for some cases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149718 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
2e5156274b8051217565b557bfa14c80f7990e9c 03-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Thread safety analysis:
* When we detect that a CFG block has inconsistent lock sets, point the
diagnostic at the location where we found the inconsistency, and point a note
at somewhere the inconsistently-locked mutex was locked.
* Fix the wording of the normal (non-loop, non-end-of-function) case of this
diagnostic to not suggest that the mutex is going out of scope.
* Fix the diagnostic emission code to keep a warning and its note together when
sorting the diagnostics into source location order.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149669 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
aacde7174af6c5759b52dc0ceb7b167d323afb6a 03-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> Thread safety analysis: at a CFG join point between a block terminating in a
'continue' and another block, prefer the lockset from the other block, and
diagnose the 'continue' block as being the end of a loop.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149666 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
41f4431f3989ff23029eaf2ad947f07e39fb268c 03-Feb-2012 Chad Rosier <mcrosier@apple.com> C++ 5.2.10p2 has a note that mentions that, subject to all other restrictions,
a cast to the same type is allowed so long as it does not cast away constness.

Fix for PR11747. Patch by Aaron Ballman. Reviewed by Eli.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149664 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
7a0a31ce0cd38147bfe853f71a3f7261444ddf4c 03-Feb-2012 Chad Rosier <mcrosier@apple.com> [frontend] Don't allow a mapping to a warning override an error/fatal mapping.
rdar://10736625

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149662 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
d2cce136878badcee6694b216479d7f1b72a1e68 03-Feb-2012 Eli Friedman <eli.friedman@gmail.com> Add some code to accurately perform odr-used marking for variables per the C++11 rules.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149641 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
f15fda02e9c8c82b4a716618f4010b9af8bff796 02-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr:
* support the gcc __builtin_constant_p() ? ... : ... folding hack in C++11
* check for unspecified values in pointer comparisons and pointer subtractions


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149578 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
20039ae1d9f520d8395899d807473b638fb48688 02-Feb-2012 Rafael Espindola <rafael.espindola@gmail.com> Reject mismatched "#pragma GCC visibility push" and "#pragma GCC visibility pop".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149559 91177308-0d34-0410-b5e6-96231b3b80d8
ragma-visibility.cpp
c36bedc90c687caa71748480c60707ea4608b092 01-Feb-2012 Anna Zaks <ganna@apple.com> Add a new compiler warning, which flags anti-patterns used as the size
argument in strncat.

The warning is ignored by default since it needs more qualification.

TODO: The warning message and the note are messy when
strncat is a builtin due to the macro expansion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149524 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
a1f2114d9e81923c750f6b439302ac03552c37db 01-Feb-2012 Douglas Gregor <dgregor@apple.com> Introduce the lambda scope before determining explicit captures, which
cleans up and improves a few things:
- We get rid of the ugly dance of computing all of the captures in
data structures that clone those of CapturingScopeInfo, centralizing
the logic for accessing/updating these data structures
- We re-use the existing capture logic for 'this', which actually
works now.

Cleaned up some diagnostic wording in minor ways as well.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149516 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
b02e4629f78a0c0c0adf9d66b644e5932a781c7e 01-Feb-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: add support for comparisons of pointer-to-members.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149463 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
93962e5360a43200faa70939571afc4fb9326cf7 01-Feb-2012 Douglas Gregor <dgregor@apple.com> Improve checking of explicit captures in a C++11 lambda expression:
- Actually building the var -> capture mapping properly (there was an off-by-one error)
- Keeping track of the source location of each capture
- Minor QoI improvements, e.g, highlighing the prior capture if
there are multiple captures, pointing at the variable declaration we
found if we reject it.

As part of this, add standard citations for the various semantic
checks we perform, and note where we're not performing those checks as
we should.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149462 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
d29975fd08713eb9d1777e60536addaa62df8995 31-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make sure we call MaybeCreateExprWithCleanups for the sub-expression of an indirect goto.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149441 91177308-0d34-0410-b5e6-96231b3b80d8
ndirect-goto.cpp
c6c14e56e34864c5d9343d9ea62ab688cf301eee 31-Jan-2012 Eli Friedman <eli.friedman@gmail.com> A couple minor fixes to template instantiation for for-range loops.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149440 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-examples.cpp
7da1f4679332277614b6c583df66c3bfd94ded66 31-Jan-2012 Hans Wennborg <hans@hanshq.net> Format string warnings: don't a.k.a. wchar_t with wchar_t.

This fixes the case where Clang would output:
error: format specifies type 'wchar_t *' (aka 'wchar_t *')

ArgTypeResult::getRepresentativeTypeName needs to take into account
that wchar_t can be a built-in type (as opposed to in C, where it is a
typedef).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149387 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings.cpp
6895a644ca9df03af14ad06deaa950a09dd352d2 27-Jan-2012 John McCall <rjmccall@apple.com> Be sure to emit delayed diagnostics after parsing the declaration
of a for-range variable. Fixes PR11793.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149109 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-examples.cpp
745f5147e065900267c85a5568785a1991d4838f 27-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: Implement the [dcl.constexpr]p5 check for whether a constexpr
function definition can produce a constant expression. This also provides the
last few checks for [dcl.constexpr]p3 and [dcl.constexpr]p4.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149108 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
f2e4cd760a5836ee8941d1b9be6b2e2c2dde23e6 26-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: evaluate (bool)&x as true when x is a local variable or a temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149045 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
e41b0412b0b974b5d239b2f5ff8427ea0d128ec3 26-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Add an additional testcase for a lambda with implicit void return type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149034 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
84b007fae6c0cd30fa07074d34fbe2bf61fa44f9 26-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Refactor to share code for handling return statements between lambda expressions and block literals. As it turns out, almost all the logic can be shared.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149031 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
457a377ac8566ddc0c455a64843ecf5e675cfff8 25-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Fix a crash involving a multi-dimensional dependent VLA. PR11744.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148989 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
d9b02e726262e4009dda830998bb934172ac0020 25-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: add support for anonymous struct and union members in literal types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148987 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
3943b1c0215da2a4171dd6c696cb75d19e5a04a9 25-Jan-2012 Kaelyn Uhrain <rikka@google.com> Allow typo correction to be disabled in BuildOverloadedCallExpr variant.

This suppresses typo correction for auto-generated call expressions such
as to 'begin' or 'end' within a C++0x for-range statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148979 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
cd78e612d6fa8e214e6a6bb0e739a0c3e419df91 25-Jan-2012 Kaelyn Uhrain <rikka@google.com> Avoid correcting unknown identifiers to types where types aren't allowed.

Pass a typo correction callback object from ParseCastExpr to
Sema::ActOnIdExpression to be a bit more selective about what kinds of
corrections will be allowed for unknown identifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148973 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
60a09dcc4656b82c7f96f8719a403a83247f6742 25-Jan-2012 Kaelyn Uhrain <rikka@google.com> Add custom callback object for typo correction in BuildRecoveryCallExpr.

The new callback, in addition to limiting which keywords to include in
the pool of typo correction candidates, also filters out non-keyword
candidates that don't refer to (template) functions that accept the
number of arguments that are present for the call being recovered.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148962 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
443aac9bd22624c6abb1fe7e581ac30c4e654eea 25-Jan-2012 Nick Lewycky <nicholas@mxc.ca> With a little more work in the tentative parse determining whether a statement
is a declaration-stmt or an expression, we can discern a subset of cases where
the user erred in omitting the typename keyword before a dependent type name.
Fixes PR11358!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148896 91177308-0d34-0410-b5e6-96231b3b80d8
R11358.cpp
3add9f0ac80b0a4d78611dcdb4fd89c37f1c13d8 25-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make sure we correctly treat __is_convertible_to as an unevaluated context. PR11833.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148893 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
32d4abf2d1396b4434917320872a970415c08e6e 24-Jan-2012 Nick Lewycky <nicholas@mxc.ca> Force triple on these tests to pacify the windows tester.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148858 91177308-0d34-0410-b5e6-96231b3b80d8
arn-new-overaligned-2.cpp
arn-new-overaligned-3.cpp
arn-new-overaligned.cpp
fca84b232dd74c91b2e0f963a3f8c3bd351a9037 24-Jan-2012 Nick Lewycky <nicholas@mxc.ca> Add a new warning, -Wover-aligned, which detects attempts to use the default
allocator to construct an object which declares more alignment than the default
allocator actually provides. Fixes PR9527!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148857 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/warn-new-overaligned-3.h
arn-new-overaligned-2.cpp
arn-new-overaligned-3.cpp
arn-new-overaligned.cpp
ecd7b04ae7764179d40ee4e3e49c99d1fbcb4eff 24-Jan-2012 Douglas Gregor <dgregor@apple.com> Promote the extension warning for attempts to catch a reference or
pointer to incomplete type from an ExtWarn to an error. We put the
ExtWarn in place as part of a workaround for Boost (PR6527), but it
(1) doesn't actually match a GCC extension and (2) has been fixed for
two years in Boost, and (3) causes us to emit code that fails badly at
run time, so it's a bad idea to keep it. Fixes PR11803.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148838 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
f211662199c87461f3b1475a549ab439c63ca83b 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Support decltype in member initializers.

This is the last piece of N3031 (decltype in weird places) - supporting
the use of decltype in a class ctor's member-initializer-list to
specify the base classes to initialize.

Reviewed by Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148789 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
495f42a32610c03591b49cd06ac09c5408742f86 24-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add a test for a diagnostic special case added in r148439, as requested by
Francois Pichet.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148784 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
2dd52e3815d040e340a5d953d838cd2268e25372 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Reword/rename -Wswitch-unreachable-default.

Rewording the diagnostic to be more precise/correct: "default label in switch
which covers all enumeration values" and changed the switch to
-Wcovered-switch-default

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148783 91177308-0d34-0410-b5e6-96231b3b80d8
nu-case-ranges.cpp
eturn-noreturn.cpp
23661d3e348c5f44ae89b6848bbc331829bb46f2 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Revert various template unreachability code I committed accidentally.

r148774, r148775, r148776, r148777

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148780 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
arn-unreachable.cpp
a9bb955b499c244d24d02311f0f9100ade506794 24-Jan-2012 David Blaikie <dblaikie@gmail.com> More fixes/tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148777 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
25f4c19fba097e8fa3b6884dbdd1b3571cd72741 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Test for the previous commit/crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148776 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
36b7c63664bea8e9aa85a024c515877be2ff92fa 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Simple hack to do unreachable code analysis on template patterns.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148774 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
arn-unreachable.cpp
b832f6dea893f25b40500a04781286236281cb20 23-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Minor fixups for auto deduction of initializer lists.

Fix some review comments.
Add a test for deduction when std::initializer_list isn't available yet.
Fix redundant error messages. This fixes and outstanding FIXME too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148735 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
438ee1fc5e5baaa204faede83cb999e45bb6b57e 23-Jan-2012 Kaelyn Uhrain <rikka@google.com> In CorrectTypo, use the cached correction as a starting point instead.

Previously, for unqualified lookups, a positive cache hit is used as the
only non-keyword correction and a negative cache hit immediately returns
an empty TypoCorrection. With the new callback objects, this behavior
causes false negatives by not accounting for the fact that callback
objects alter the set of potential/allowed corrections. The new behavior
is to seed the set of corrections with the cached correction (for
positive hits) to estabilishing a baseline edit distance. Negative cache
hits are only stored or used when either no callback object is provided
or when it returns true for a call to ValidateCandidate with an empty
TypoCorrection (i.e. when ValidateCandidate does not seem to be doing
any checking of the TypoCorrection, such as when an instance of the base
callback class is used solely to specify the set of keywords to be accepted).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148720 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
df1be86ef5f5d55fc23b2339ee76e076424d9ba0 23-Jan-2012 Nico Weber <nicolasweber@gmx.de> In microsoft mode, downgrade pseudo-destructors on void from error to warning.

This matches cl.exe's behavior and fixes PR11791.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148682 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
413c2c9d9c85ceb588e9cb965853f178a3a52bc9 23-Jan-2012 David Blaikie <dblaikie@gmail.com> Rename -Wswitch-enum-redundant-default to -Wswitch-redundant-default.

This is for consistency, since the flag is actually under -Wswitch now, rather
than -Wswitch-enum (since it's really valuable for the former and rather
orthogonal to the latter)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148680 91177308-0d34-0410-b5e6-96231b3b80d8
nu-case-ranges.cpp
eturn-noreturn.cpp
c14ec5a013883b891a71b0a112791693e9d1d1a8 23-Jan-2012 Nico Weber <nicolasweber@gmx.de> Convert file from 60% unix 40% dos line endings to 100% unix line endings.

No other changes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148678 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
28976604ff81048e17b4aba6f1f9bc2b29a870a3 23-Jan-2012 Nico Weber <nicolasweber@gmx.de> Eli says this should check MicrosoftMode instead.

Also change a || that I accidentally changed to && back to ||.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148677 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
icrosoft-cxx0x.cpp
afcc96a20029ac9009feefbc555a4f9d923e3e06 23-Jan-2012 Nico Weber <nicolasweber@gmx.de> In ms mode, a move assignment operator shouldn't mark a copy ctor as deleted.

MSVC2010's pair class has a move assignment operator but no explicit copy
constructor, which makes it unusable without this change.

For symmetry, let move copy constructors not mark the default assignment
operator as deleted either. Both changes match cl.exe's behavior. Fixes
pr11826.

Also update the standard excerpt to point to the right paragraph.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148675 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoft-cxx0x.cpp
adabbca569bd6c6dfe91773dea8cf7d14cb4cc5e 22-Jan-2012 David Blaikie <dblaikie@gmail.com> Move -Wswitch-enum to -Wswitch

This matches GCC's documented (& actual) behavior. What Clang had implemented
as -Wswitch-enum was actually GCC's -Wswitch behavior. -Wswitch is on by
default (part of -Wall) and warns if a switch-over-enum, without a default
case, covers all enum values.

-Wswitch-enum, on the other hand, does not have the default clause and should
fire even in the presence of a default. This warning is off by default.

With this change the -Wswitch-enum flag is off-by-default in Clang but has no
functionality at the moment. I'll add that in a future commit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148648 91177308-0d34-0410-b5e6-96231b3b80d8
witch.cpp
6b6fb4fe64684df35975fbe299d5085d70c5c178 22-Jan-2012 Francois Pichet <pichet2000@gmail.com> In Microsoft Mode, disable the C++11 strict integral conversion rules for enumerator that were introduced with r148439. Otherwise MSVC headers won't compile in C++ 11 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148642 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
icrosoftExtensions.cpp
31ceb61172bca7ebc3fb90e9125864c7a29c55c0 21-Jan-2012 David Blaikie <dblaikie@gmail.com> Add -Wswitch-enum-redundant-default.

This warning acts as the complement to the main -Wswitch-enum warning (which
warns whenever a switch over enum without a default doesn't cover all values of
the enum) & has been an an-doc coding convention in LLVM and Clang in my
experience. The purpose is to ensure there's never a "dead" default in a
switch-over-enum because this would hide future -Wswitch-enum errors.

The name warning has a separate flag name so it can be disabled but it's grouped
under -Wswitch-enum & is on-by-default because of this.

The existing violations of this rule in test cases have had the warning disabled
& I've added a specific test for the new behavior (many negative cases already
exist in the same test file - and none regressed - so I didn't add more).

Reviewed by Ted Kremenek ( http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120116/051690.html )

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148640 91177308-0d34-0410-b5e6-96231b3b80d8
nu-case-ranges.cpp
eturn-noreturn.cpp
71b8fb5d4233420d2ed2f150a54ea61431bd8684 21-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make clang's AST model sizeof and typeof with potentially-evaluated operands correctly, similar to what we already do with typeid.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148610 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
e03b2b3ca9032b18fd1c3d0fca7692e4d2551277 21-Jan-2012 DeLesley Hutchins <delesley@google.com> Handle thread safety attributes on functions with separate definitions and declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148599 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
23323e0253716ff03c95a00fb6903019daafe3aa 20-Jan-2012 DeLesley Hutchins <delesley@google.com> Delayed template instantiation of late-parsed attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148595 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
7b9ff0c09025dcbe48ec7db71330e2066d1e1863 20-Jan-2012 DeLesley Hutchins <delesley@google.com> Instantiate dependent attributes when instantiating templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148592 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
ce506ae231703a23ea95335cd4de19c60082f361 20-Jan-2012 Ted Kremenek <kremenek@apple.com> Tighten format string diagnostic and make it a bit clearer (and a bit closer to GCC's).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148579 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings-0x.cpp
8ef7b203332b0c8d65876a1f5e6d1db4e6f40e4b 19-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: converted constant expression handling for enumerator values, case
values and non-type template arguments of integral and enumeration types.

This change causes some legal C++98 code to no longer compile in C++11 mode, by
enforcing the C++11 rule that narrowing integral conversions are not permitted
in the final implicit conversion sequence for the above cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148439 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
num-scoped.cpp
43e875d2610afcf9e7017b71f46116dc86624fd9 18-Jan-2012 Kaelyn Uhrain <rikka@google.com> Convert SemaDecl.cpp to pass callback objects to CorrectTypo.

Includes tests highlighting the cases where accuracy has improved
(there is one call that does no filtering beyond selecting the set
of allowed keywords, and one call that only triggers for ObjC code
for which a test by someone who knows ObjC would be welcome). Also
fixes a small typo in one of the suggestion messages, and drops a
malformed "expected-note" for a suggestion that did not occur even
when the malformed note was committed as r145930.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148420 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
40b993a826728214c869ee4fbc9d296a2e1e1f71 18-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> A call to strlen is not a constant expression, even if we're treating it as a
builtin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148374 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-strlen.cpp
6b3014b07c40a6ed8b0c8ed63950df02eeb82c28 18-Jan-2012 Eli Friedman <eli.friedman@gmail.com> The value of a case statement is a potentially evaluated context. Found by inspection.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148373 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
93c878ee093f2a233c32b29f074e6a3f511e333f 18-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Fix a couple issues where we didn't correctly delay diagnostics in PotentiallyPotentiallyEvaluated contexts. In preparation for making sizeof() PotentiallyPotentiallyEvaluated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148367 91177308-0d34-0410-b5e6-96231b3b80d8
untimediag-ppe.cpp
62b7cfb73e202051e7ab0dad42ba213acd0dec7e 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Auto deduction support for std::initializer_list, including for-range support. This means you can now write:

for (int i : {1, 4, 512, 23, 251}) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148353 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
eneralized-initializers.cpp
84760e3a5d885ab19b5d11aafe78dfdfe2911e3a 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Template argument deduction for std::initializer_list arguments from initializer lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148352 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
fe5922809ec906390769a2cf0a765f395fa0c599 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Basic overloading support for std::initializer_list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148350 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-stdinitializerlist.cpp
2b916b8b55aaf0152ab9ad630c8454bf6373b085 17-Jan-2012 Sebastian Redl <sebastian.redl@getdesigned.at> Sema support for initialization of std::initializer_list from initializer lists.

This does not yet support CodeGen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148349 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-scalars.cpp
xx0x-initializer-stdinitializerlist.cpp
eneralized-initializers.cpp
8788491e10a24e70b7282f312c22d74ac478c899 17-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Correctly resolve an overload set passed to an overloaded operator=. PR11784.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148335 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
7d580a4e9e47dffc3c17aa2b957ac57ca3c4e451 17-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Enable constant evaluation of implicit calls to constexpr conversion operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148333 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
55693fbe18e9431dbb0ea9e20d140d8bc6bc4c72 17-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Revert r148271; this requires more thought.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148276 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
58219e7f27641bb3c635f17e79b7edc0a955a188 17-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Change the behavior of the lvalue-to-rvalue conversion for varargs in PotentiallyPotentiallyEvaluated contexts so that we model it in a sane way in most cases, and give up for the edge case which hopefully doesn't matter too much.

In preparation for correctly treating sizeof() as a PotentiallyPotentiallyEvaluated context.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148271 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
fa16125aaf667c2bd80efcea403a7a71aa65da14 15-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> decltype(e) is type-dependent if e is instantiation-dependent. Scary but true.
Don't consider decltype(e) for an instantiation-dependent, but not
type-dependent, e to be non-type-dependent but canonical(!).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148210 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype.cpp
244ee7b89a483fd3764637abdf95de2893b437d0 15-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Pedantic diagnostic correction: in C++, we have integral constant expressions,
not integer constant expressions. In passing, fix the 'folding is an extension'
diagnostic to not claim we're accepting the code, since that's not true in
-pedantic-errors mode, and add this diagnostic to -Wgnu.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148209 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression.cpp
num-bitfield.cpp
num.cpp
-c-e-cxx.cpp
28c1ce789322ab99f9b5887015d63ec5f088957a 15-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: casts to void* are allowed in constant expressions, don't set the
designator invalid. (Since we can't read the value of such a pointer, this only
affects the quality of diagnostics.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148208 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
750dc2b16fffa579f96ad053f061976a15ed4665 15-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Change linkage computation so it doesn't depend on FunctionDecl::isExternC or VarDecl::isExternC, and instead queries what it actually cares about: whether the given declaration is inside an extern "C" context. Fundamentally, figuring out whether a function/variable uses C linkage requires knowing the linkage, and the logic in FunctionDecl::isExternC and VarDecl::isExternC was getting it wrong. Given that, fix FunctionDecl::isExternC and VarDecl::isExternC to use much simpler implementations that depend on the fixed linkage computation.

Fixes a regression to test/SemaCXX/linkage.cpp caused by a new warning exposing the fact that the internal state was wrong.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148207 91177308-0d34-0410-b5e6-96231b3b80d8
inkage.cpp
dd9d64547831728dd792654bb26477f5099a2153 14-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Progress towards making isUsed() reflect whether a declaration is odr-used; don't set isUsed for local variables which are referenced in unevaluated contexts. Make other code use isReferenced() (which basically indicates that a declaration isn't dead) where appropriate.

I was forced to change test/SemaCXX/linkage.cpp because we aren't actually modeling extern "C" in the AST the way that testcase expects; we were not printing a warning only because we skipped the relevant check. Someone who actually understands the semantics here should fix that.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148158 91177308-0d34-0410-b5e6-96231b3b80d8
inkage.cpp
f6c17a439f3320ac620639a3ee66dbdabb93810c 14-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Fix a silly mistake in ComplexExprEvaluator::ZeroInitialization. <rdar://problem/10691092>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148157 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
f8ec8c9935acf77ff929b0aa51428d70c37c232a 14-Jan-2012 Kaelyn Uhrain <rikka@google.com> Convert SemaTemplate*.cpp to pass a callback object to CorrectTypo.

The change to SemaTemplateVariadic.cpp improves the typo correction
results in certain situations, while the change to SemaTemplate.cpp
does not change existing behavior.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148155 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
e4c7f90da208ed2caeab784b32f416a50eed8da3 13-Jan-2012 Kaelyn Uhrain <rikka@google.com> Convert SemaExprMember.cpp to pass a callback object to CorrectTypo,
improving the typo correction results in certain situations.

This is also the first typo correction callback conversion to affect
an existing unit test. :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148140 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
ypo-correction.cpp
059d578c7d45f687a81bcc97ab80404256a5287f 13-Jan-2012 Eli Friedman <eli.friedman@gmail.com> A few minor improvements to error recovery trying to access member of a function. In particular, this restores the cool error recovery for the example from http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html , which regressed a few months back.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148089 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
f037541d5c7dcf3553cf26e4b047be869980c23a 13-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Don't crash while trying to diagnose a function declared at block scope with an
incomplete return type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148088 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
7984de35644701c0d94336da7f2215d4c26d9f5b 13-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Improve 0-argument -Wvexing-parse diagnostic by adding notes with fix-its:

- If the declarator is at the start of a line, and the previous line contained
another declarator and ended with a comma, then that comma was probably a
typo for a semicolon:

int n = 0, m = 1, l = 2, // k = 5;
myImportantFunctionCall(); // oops!

- If removing the parentheses would correctly initialize the object, then
produce a note suggesting that fix.

- Otherwise, if there is a simple initializer we can suggest which performs
value-initialization, then provide a note suggesting a correction to that
initializer.

Sema::Declarator now tracks the location of the comma prior to the declarator in
the declaration, if there is one, to facilitate providing the note. The code to
determine an appropriate initializer from the -Wuninitialized warning has been
factored out to allow use in both that and -Wvexing-parse.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148072 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
onditional-expr.cpp
ecl-expr-ambiguity.cpp
83be12c8638a5136b937e602b3a9e25f4bc8e50d 13-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Recommit r148056 with fixes to deal with weirdness with bitfields in unions.

Original message: Make sure adding a field to a struct never reduces its size. PR11745.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148070 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
cd7a21b85ec94f9bddded4ed990dd2e2019011ab 13-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Revert r148056 while I investigate failures.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148068 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
a1796826729ba8c73c32dd49fa4945ff3cb12039 12-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Make sure adding a field to a struct never reduces its size. PR11745.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148056 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
3b4b047ff0ebaefeaed0a5f545b4fa91f18e6cdb 12-Jan-2012 Kaelyn Uhrain <rikka@google.com> Convert SemaCXXScopeSpec.cpp to pass a callback object to CorrectTypo,
improvng the typo correction results in certain situations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148052 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
425d631082699b37624a7b1d6abb87c7abd5abe6 12-Jan-2012 Kaelyn Uhrain <rikka@google.com> Convert SemaInit.cpp to pass a callback object to CorrectTypo.

And once again improve the typo correction results in certain
situations just by moving the existing checks on the correction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148037 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
ec789163a42a7be654ac34aadb750b508954d53c 12-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: initialization of a union from an empty initializer-list should
zero-initialize the first union member. Also fix a bug where initializing an
array of types compatible with wchar_t from a wide string literal failed in C,
and fortify the C++ tests in this area. This part can't be tested without a code
change to enable array evaluation in C (where an existing test fails).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148035 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
dc98cd0cdd2eee8290b624ef69c6d91ce626d85e 11-Jan-2012 Kaelyn Uhrain <rikka@google.com> Fix the caching in CorrectTypo so that other non-keyword identifiers
are still added if the cached correction fails validation.

Also fix a copy-and-paste error in a comment from my previous commit.
Finally, add an example of the benefit the typo correction callback adds
to TryNamespaceTypoCorrection--which happens to also tickle the above
caching problem, as the only way a non-namespace Decl would be added to
the possible corrections is if it was cached as the correction for a
previous instance of the same typo where the typo was corrected to a
non-namespace via a different code path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147968 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
7d5e6948e6a4e04ee67b607f931d90d3063579f2 11-Jan-2012 Kaelyn Uhrain <rikka@google.com> Add initial callback object support to Sema::CorrectTypo.

Also includes two examples of the callback: a wrapper/replacement for
the CorrectTypoContext enum, and a conversion of the two calls to
CorrectTypo in SemaDeclCXX.cpp (one of which provides verifiable
improvement to the typo correction, as demonstrated in the added test).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147962 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
7ead5c7b6fd48cf549e55b4db499c26ecf88ae75 10-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Implement the missing pieces of Evaluate for _Complex types. With that complete, remove some code from CGExprConstant which is no longer necessary. While I'm here, a couple minor tweaks to _Complex-in-C++. (Specifically, make _Complex types literal types, and don't warn for _Complex int.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147840 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
610a60c0e68e34db5a5247d6102e58f37510fef8 10-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR11724: Implement evaluation for constexpr defaulted trivial union copy/move
constructors. These are a special case whose behavior cannot be modeled as a
user-written constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147839 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
bdad7a2e21686296b78dac6190b78d11c996f6d7 10-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Update C++11 scoped enumeration support to match the final proposal:
- reject definitions of enums within friend declarations
- require 'enum', not 'enum class', for non-declaring references to scoped
enumerations


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147824 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
d18840d1e27c1b9c27bb74923b87f8ae33ec4736 10-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Don't crash with -Wlarge-by-value-copy and a dependent type. PR11726.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147812 91177308-0d34-0410-b5e6-96231b3b80d8
arn-large-by-value-copy.cpp
80a5b27fe4dfccef0c539ac5c4a7ea17a1649085 09-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Restore some parts of this test which were accidental reverted in r147649.
Thanks to David Blaikie for pointing this out.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147783 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
72899c34e3d1abfffa241ad0ce5c4bf175e5ea51 07-Jan-2012 Eli Friedman <eli.friedman@gmail.com> More lambda work: semantic analysis of capturing 'this'. It's a bit complicated, but we have to be careful about when exactly captures are marked given PotentiallyPotentiallyEvaluated contexts. (Actually, it's not 100% correct yet, but it's close enough for the moment.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147723 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
e81d7e9810eed0d805263791d761ec545d2cf779 07-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Lambdas: semantic analysis of explicit captures.

This patch (and some of my other commits related to lambdas) is heavily based off of John Freeman's work-in-progress patches.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147706 91177308-0d34-0410-b5e6-96231b3b80d8
ambda-expressions.cpp
b4fa418a72759dfe34add850837965cbc00626e4 06-Jan-2012 DeLesley Hutchins <delesley@google.com> Thread safety analysis: added support for trylock attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147672 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
b4e85ed51905fc94378d7b4ff62b06e0d08042b7 06-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expressions: implement checking and diagnostics for
pointer-arithmetic-related undefined behavior and unspecified results. We
continue to fold such values, but now notice they aren't constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147659 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstexpr-backtrace-limit.cpp
1a5d35539a16f3b2eb2426f3f23a8376b190741c 06-Jan-2012 Rafael Espindola <rafael.espindola@gmail.com> Improvements to the uninitialized variable warning: Check if the constructor
call is elidable or if the constructor is trivial instead of checking if it
is user declared.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147652 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
arn-unused-variables.cpp
2f0e88a87cea6d21429d9f5c0b1c53f24caf77cf 06-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> David Blaikie and Chandler would like us to diagnose

int f();

in function scopes under -Wvexing-parse, so now we do.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147649 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
ecl-expr-ambiguity.cpp
1d7bcf4b35f8bc0a0a40f4ea7b06b55c63725108 06-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Tweak to r147599 for PR10828: Move the check from the parser into sema, and use
the Semantic Powers to only warn on class types (or dependent types), where the
constructor or destructor could do something interesting.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147642 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
5930a4c5224eea3b0558655f7f8c9ea027ef573e 06-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Address Richard's review comments on r147561 (Evaluate support for address-of-label differences).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147631 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
6aeaa60217e1ed11a621409acf1b53df0d14b591 05-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Tweak the fix to PR8977: an empty expression-list represents value initialization, not default initialization. Fixes PR11712.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147620 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-auto.cpp
cb7709c06027448c754dd03e2e521d82d04818bf 05-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> PR10828: Produce a warning when a no-arguments function is declared in block
scope, when no other indication is provided that the user intended to declare a
function rather than a variable.

Remove some false positives from the existing 'parentheses disambiguated as a
function' warning by suppressing it when the declaration is marked as 'typedef'
or 'extern'.

Add a new warning group -Wvexing-parse containing both of these warnings.

The new warning is enabled by default; despite a number of false positives (and
one bug) in clang's test-suite, I have only found genuine bugs with it when
running it over a significant quantity of real C++ code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147599 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
ecl-expr-ambiguity.cpp
dc3b723d35067e5d13474247b94a10c869cc7e58 04-Jan-2012 Eli Friedman <eli.friedman@gmail.com> Stub out the Sema interface for lambda expressions, and change the parser to use it. Unconditionally error on lambda expressions because they don't work in any meaningful way yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147515 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
a2d8669b09363d3d3a3c67982e08a38c8ed015d0 02-Jan-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add assertion to char32_t that the value is valid, as suggested by Jordy Rose.
Add a test that such characters don't make it through to StringLiteral objects
in error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147438 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
4debc82d9d967501b8650599cd44003d7026f56c 31-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix crash when trying to pretty-print unicode or wide string literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147385 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
51201882382fb40c9456a06c7f93d6ddd4a57712 30-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Unrevert r147271, reverted in r147361.

Also temporarily remove the assumption from IR gen that we can emit IR for every
constant we can fold, since it isn't currently true in C++11, to fix PR11676.

Original comment from r147271:

constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147384 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
onstexpr-value-init.cpp
f8c2a33b6e47c494b83e68f02f4ee67ca8fd8e3b 30-Dec-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert r147271. This fixes PR11676.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147362 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
onstexpr-value-init.cpp
d7c56e1114bfe7d461786903bb720d2c6efc05a1 29-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Change the diagnostics which said 'accepted as an extension' to instead say
'is an extension'. The former is inappropriate and confusing when building with
-Werror/-pedantic-errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147357 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
R9572.cpp
99-variable-length-array.cpp
99.cpp
lass.cpp
onstant-expression-cxx11.cpp
xx0x-class.cpp
-c-e-cxx.cpp
df49782c54802ca1a4c1d36d66186aa039f32aec 29-Dec-2011 DeLesley Hutchins <delesley@google.com> Support for thread safety attributes on functions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147331 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
5294c792c715b8dba26711be482b7a32be04d4d5 28-Dec-2011 Hans Wennborg <hans@hanshq.net> Support the 'a' scanf length modifier as an extension in C++.

It should not be supported in C++11, since that uses the C99 standard
library, in which 'a' is a format specifier.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147310 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-strings-0x.cpp
ormat-strings.cpp
5df37bd0242e838e465f0bd51a70af424d152053 26-Dec-2011 Rafael Espindola <rafael.espindola@gmail.com> Delay checking of typedefs of dependent types. Fixes PR11630.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147281 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
dd4b350143c26c030a482f091908a2e077503411 25-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix constexpr handling to allow 'extern constexpr' variable declarations. We no
longer have access to the source locations we need to produce the
'replace constexpr with const' fixits, so they're gone for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147273 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
eba05b2e396e1474f7bd6e8e8e1bd7752effef4d 25-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: perform zero-initialization prior to / instead of performing a
constructor call when appropriate. Thanks to Eli for spotting this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147271 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-printing.cpp
onstexpr-value-init.cpp
cf15cef8447e8b3ae08e81ad25ae9eb443038acf 22-Dec-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Overloading for initializer list construction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147156 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
62f13c9e9e87b14c1d387891575ccf5dfac7b673 22-Dec-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Fix a parser bug that prevented it from correctly parsing explicit construct expressoins of the form T{args}.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147155 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-constructor.cpp
10f04a6267eb07d3be00db1fd0369e1398f5d0a8 22-Dec-2011 Sebastian Redl <sebastian.redl@getdesigned.at> List-initialization via constructor part 1. Still needs: pretty-printing, overloading, initializer_list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147145 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
xx0x-initializer-constructor.cpp
6180245e9f63d2927b185ec251fb75aba30f1cac 22-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11614: Mark defaulted special constructors as constexpr if their implicit
definition would satisfy the constexpr requirements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147128 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
num-bitfield.cpp
974c5f93d0ce4f0699a6f0a4402f6b367da495e3 22-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11637: implement special-case constant evaluation for char arrays initialized
by string literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147120 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
7098cbd601ad915aed22d4b5850da99359f25bf3 21-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: diagnostic improvements for invalid lvalue-to-rvalue conversions in
constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147035 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstexpr-printing.cpp
1d238ea926bbdd04356ce475934fcd4cac654c4b 21-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 half of r147023: In C++11, additionally eagerly instantiate:
- constexpr function template instantiations
- variables of reference type
- constexpr variables


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147031 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
f6702a3927147655206ae729a84339c4fda4c651 20-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Unlike in C++03, a constant-expression is not an unevaluated operand in C++11.
Split out a new ExpressionEvaluationContext flag for this case, and don't treat
it as unevaluated in C++11. This fixes some crash-on-invalids where we would
allow references to class members in potentially-evaluated constant expressions
in static member functions, and also fixes half of PR10177.

The fix to PR10177 exposed a case where template instantiation failed to provide
a source location for a diagnostic, so TreeTransform has been tweaked to supply
source locations when transforming a type. The source location is still not very
good, but MarkDeclarationsReferencedInType would need to operate on a TypeLoc to
improve it further.

Also fix MarkDeclarationReferenced in C++98 mode to trigger instantiation for
static data members of class templates which are used in constant expressions.
This fixes a link-time problem, but we still incorrectly treat the member as
non-constant. The rest of the fix for that issue is blocked on PCH support for
early-instantiated static data members, which will be added in a subsequent
patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146955 91177308-0d34-0410-b5e6-96231b3b80d8
R10177.cpp
9490ab433deef70105d817616928d700f87642d9 20-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Fix tentative parsing so it knows how to handle an ambiguous for-range-declaration. PR11601.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146953 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-no-std.cpp
9c7a925d93ff4a7b753f4fe0ba097abf82ba68f4 20-Dec-2011 Chandler Carruth <chandlerc@gmail.com> Remove some extraneous carriage returns from these files. One of the
Windows subversion clients isn't setup to default to eol:native again...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146952 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-declspec-ignored.cpp
bc6abe93a5d6b1305411f8b6f54c2caa686ddc69 19-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Evaluation support for ExprWithCleanups. We won't evaluate any expression which
actually requires non-trivial cleanups, so no cleanups need to be performed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146916 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
af2c7a194592401394233b7cbcdd3cfd0a7a38dd 19-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Improve r146813 (for PR11595) to give an appropriate diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146915 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
099e7f647ccda915513f2b2ec53352dc756082d3 19-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr handling improvements. Produce detailed diagnostics when a 'constexpr'
variable is initialized by a non-constant expression, and pass in the variable
being declared so that earlier-initialized fields' values can be used.

Rearrange VarDecl init evaluation to make this possible, and in so doing fix a
long-standing issue in our C++ constant expression handling, where we would
mishandle cases like:

extern const int a;
const int n = a;
const int a = 5;
int arr[n];

Here, n is not initialized by a constant expression, so can't be used in an ICE,
even though the initialization expression would be an ICE if it appeared later
in the TU. This requires computing whether the initializer is an ICE eagerly,
and saving that information in PCH files.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146856 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression.cpp
onstexpr-depth.cpp
onstexpr-printing.cpp
xx0x-class.cpp
-c-e-cxx.cpp
2116b144cf07f2574d20517187eb8863645376eb 18-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR11604: don't allow floating-literal-to-integer casts in ICEs if the (truncated)
floating literal value does not fit into the destination type. Such casts have
undefined behavior at translation time; treating them as non-ICE matches the
behavior of modern gcc versions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146842 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
f59ff8c777379bd54137853a58c58b72fb869152 17-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Add a missing check before trying to evaluate a temporary. PR11595.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146813 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
fc038e9ef8ed262724f42597ca5c844de97b1202 17-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Remove a non-gcc-compatible extension that would apply attributes on declarations without a declarator to structs. Add a warning for ignored attributes. Patch by Michael Han.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146796 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
ttr-declspec-ignored.cpp
08d6e032a2a0a8656d12b3b7b93942987bb12eb7 16-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 constexpr: Add note stacks containing backtraces if constant evaluation
fails within a call to a constexpr function. Add -fconstexpr-backtrace-limit
argument to driver and frontend, to control the maximum number of notes so
produced (default 10). Fix APValue printing to be able to pretty-print all
APValue types, and move the testing for this functionality from a unittest to
a -verify test now that it's visible in clang's output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146749 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstexpr-backtrace-limit.cpp
onstexpr-printing.cpp
91ec7894ec186dd36f509682f00486c98d8228ed 16-Dec-2011 David Blaikie <dblaikie@gmail.com> Support decltype in pseudo destructors and dependent destructor calls.

Reviewed by Eli Friedman.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146738 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
2fe9b7fb07dff15dd15dd8755a9a9e6de0fe46fc 15-Dec-2011 Richard Trieu <rtrieu@google.com> Modify how the -verify flag works. Currently, the verification string and
diagnostic message are compared. If either is a substring of the other, then
no error is given. This gives rise to an unexpected case:

// expect-error{{candidate function has different number of parameters}}

will match the following error messages from Clang:

candidate function has different number of parameters (expected 1 but has 2)
candidate function has different number of parameters

It will also match these other error messages:

candidate function
function has different number of parameters
number of parameters

This patch will change so that the verification string must be a substring of
the diagnostic message before accepting. Also, all the failing tests from this
change have been corrected. Some stats from this cleanup:

87 - removed extra spaces around verification strings
70 - wording updates to diagnostics
40 - extra leading or trailing characters (typos, unmatched parens or quotes)
35 - diagnostic level was included (error:, warning:, or note:)
18 - flag name put in the warning (-Wprotocol)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146619 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
ccess.cpp
ddr-of-overloaded-function.cpp
lass.cpp
omplex-overload.cpp
cl_init_aggr.cpp
xceptions.cpp
xplicit.cpp
ncomplete-call.cpp
issing-namespace-qualifier-typo-corrections.cpp
verload-call.cpp
verload-member-call.cpp
verloaded-operator.cpp
einterpret-fn-obj-pedantic.cpp
cope-check.cpp
tatements.cpp
his.cpp
ypeid.cpp
ninit-variables.cpp
arn-bool-conversion.cpp
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
daaefc5381f9aafbb1cb6f88fb5ac6aaf34d65bf 15-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Produce more detailed diagnostics when static_assert condition is not an ICE.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146607 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
tatic-assert.cpp
4805f158203017bdf575003235473284134c1071 14-Dec-2011 DeLesley Hutchins <delesley@google.com> Allow empty argument lists in thread safety attributes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146580 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
a6dc7eff27a8c59bee42809270971931b811dd44 14-Dec-2011 Richard Trieu <rtrieu@google.com> Make the diagnostic message more consistant. Update the type comparison to
handle non-pointer types. This is for the extra info printed when function
types are compared.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146525 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
c1c5f27c64dfc3332d53ad30e44d626e4f9afac3 13-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add checks and diagnostics for many of the cases which C++11 considers to not
be constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146479 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
num-bitfield.cpp
8ef8f431aaeed3d7418959c81dfaa677b44f05ed 12-Dec-2011 Matt Beaumont-Gay <matthewbg@google.com> Suppress -Warray-bounds in certain cases involving macros from system headers.

The motivation here is a "clever" implementation of strncmp(), which peels the first few comparisons via chained conditional expressions which ensure that the input arrays are known at compile time to be sufficiently large.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146430 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/array-bounds-system-header.h
rray-bounds-system-header.cpp
60f24e781484250d3602261477d16321db7a157b 12-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Further tweaking of diagnostic text for casts performing reinterpret_cast
conversions in constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146406 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
4cd9b8f7fb2cebf614e6e2bc766fad27ffd2e9de 12-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Clean up diagnostic wording for disallowed casts in C++11 constant expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146395 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
c216a01c96d83bd9a90e214af64913e93d39aacc 12-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 constant expression cast restrictions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146371 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9eed49c2bb0f37bbfefefd0998b6303a686a66c0 10-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> Mechanically convert static_assert_fold to static_assert, now we implement the
C++11 ICE rules.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146290 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
f48fdb0937e67f691393f9ffdf75653e5128ea13 09-Dec-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 constant expressions: Don't use CheckICE in C++11; instead, determine
whether an expression is a (core) constant expression as a side-effect of
evaluation. This takes us from accepting far too few expressions as ICEs to
accepting slightly too many -- fixes for the remaining cases are coming next.

The diagnostics produced when an expression is found to be non-constant are
currently quite poor (with generic wording but reasonable source locations),
and will be improved in subsequent commits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146289 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
2def77399ab3088106a2d61372344f5b7104e1a2 09-Dec-2011 David Blaikie <dblaikie@gmail.com> Add notes for suppressing and (if it's a zero-arg function returning bool) fixing the function-to-bool conversion warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146280 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
arn-func-as-bool.cpp
44d95b55711bc5c2e4055ebf1b5156e7fd3f0196 09-Dec-2011 David Blaikie <dblaikie@gmail.com> Provide a separate warning for weak vtables in explicit template instantiations. There's no (current) way to fix such templates to emit strong symbols/vtables, but perhaps users want to know about the cost being incurred anyway.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146265 91177308-0d34-0410-b5e6-96231b3b80d8
arn-weak-vtables.cpp
1fa3c0682a52c45c4ad0be3a82d0c85f26657072 08-Dec-2011 DeLesley Hutchins <delesley@google.com> This patch extends thread safety analysis with support for the scoped_lockable attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146174 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
2cad9e32e6067260f166977e64c49175be1da202 08-Dec-2011 Lang Hames <lhames@gmail.com> Added missing testcase from r145849. Thanks to Dave Blaikie for catching this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146169 91177308-0d34-0410-b5e6-96231b3b80d8
arn-func-as-bool.cpp
26b45d86085a125af036dbcf85dad3087b664ab2 06-Dec-2011 Richard Trieu <rtrieu@google.com> Switch a cast to a dyn_cast and check the pointer before using. Fixes a crash
in the following code:

void test4(bool (&x)(void)) {
while (x);
}



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145918 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
19efa3ee5a7f2232884f9cca6871329ffe85653c 06-Dec-2011 Eli Friedman <eli.friedman@gmail.com> Make sure we perform lvalue-to-rvalue conversions for enum initializers. PR11484.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145874 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
e14ca9f509dc22d8fcc5d21d70d28a5848983b42 05-Dec-2011 Lang Hames <lhames@gmail.com> Add a warning for implicit conversion from function literals (and static
methods) to bool. E.g.

void foo() {}
if (f) { ... // <- Warns here.
}

Only applies to non-weak functions, and does not apply if the function address
is taken explicitly with the addr-of operator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145849 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
649657e7d6c150136cae5ab22e39b9794cff80cc 04-Dec-2011 Fariborz Jahanian <fjahanian@apple.com> Move block return type inference diagnostic to a common place where
Function or array lvalue conversions happens.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145782 91177308-0d34-0410-b5e6-96231b3b80d8
nstantiate-blocks.cpp
5e9392ba18f5925e26cc5714d1412eda0d219826 03-Dec-2011 Douglas Gregor <dgregor@apple.com> Implement support for the __is_final type trait, to determine whether
a class is marked 'final', from Alberto Ganesh Barbati! Fixes
PR11462.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145775 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
0586520acb2f368c874943353a222be7f00c3068 03-Dec-2011 Fariborz Jahanian <fjahanian@apple.com> If block literal return type is not specified, return type of the block is
inferred from return types. All the return statements have to agree about the type.
// rdar://10466373


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145774 91177308-0d34-0410-b5e6-96231b3b80d8
nstantiate-blocks.cpp
1cdb70b20793cb88c89282c78f6afe55c7c578c3 03-Dec-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Implement overload resolution for reference-typed parameters supplied with initializer lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145769 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-references.cpp
75df4eeede7b91c22c1d63fafd4dd4142844e3b9 01-Dec-2011 Ted Kremenek <kremenek@apple.com> Further tweak -Wurneachable-code and templates by allowing the warning to run on
explicit template specializations (which represent actual functions somebody wrote).

Along the way, refactor some other code which similarly cares about whether or
not they are looking at a template instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145547 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
5dfee06daa359bbe0f3c9de055b8a02d61a05173 30-Nov-2011 Ted Kremenek <kremenek@apple.com> Don't run -Wunreachable-code on template instantiations. Different instantiations may produce different unreachable code results, and it is very difficult for us to prove that ALL instantiations of a template have specific unreachable code. If we come up with a better solution, then we can revisit this, but this approach will at least greatly reduce the noise of this warning for code that makes use of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145520 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
381711c6e7911d762f81a65e9ef4339a6a3d6524 29-Nov-2011 Matt Beaumont-Gay <matthewbg@google.com> Suppress -Warray-bounds for classes (not just structs) where the last field is
a 1-length character array.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145445 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
cfbc5b5660f49fae63acc1f5ef05df87070a2a3c 29-Nov-2011 Matt Beaumont-Gay <matthewbg@google.com> Merge branch 'yo-dawg-i-herd-u-like-arrays'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145421 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
874d253668f9ed183ca409cdff9d424925ee7800 29-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10101: Recover better from a common copy-paste error: if a function
declaration at namespace scope is followed by a semicolon and an open-brace
(or in C++, a 'try', ':' or '='), then the error is probably a function
definition with a spurious ';', rather than a mysterious '{'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145372 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
39b4fc888d2b9b8fe1a9c982964b5054ba1c3c73 28-Nov-2011 Fariborz Jahanian <fjahanian@apple.com> pinpoint name/location of deprecated/unavailable enumerator
whose enum has been made deprecated/unavailable in the warning.
// rdar://10201690


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145264 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
13dc8f98f6108dca8aaa9721567ed5a2d9911e0f 27-Nov-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Reference initialization with initializer lists.

This supports single-element initializer lists for references according to DR1288, as well as creating temporaries and binding to them for other initializer lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145186 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-references.cpp
a5aa96d01f2f8750a4756ca74c8e172384a54602 24-Nov-2011 Matt Beaumont-Gay <matthewbg@google.com> Wordsmith the -Warray-bounds diagnostic text a bit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145116 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
onstant-expression-cxx11.cpp
6efd4c55a1a481d92966a91141c03e8145234cf6 23-Nov-2011 Richard Trieu <rtrieu@google.com> Add feature to diagnostics that will provide more information on function
pointer mismatch. Cases covered are: initialization, assignment, and function
arguments. Additional text will give the extra information about the nature
of the mismatch: different classes for member functions, wrong number of
parameters, different parameter type, different return type, and function
qualifier mismatch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145114 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
c18c42345636e2866fed75c7e434fb659d747672 21-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add driver arguments -ftemplate-depth=N and -fconstexpr-depth=N, with the same
semantics and defaults as the corresponding g++ arguments. The historical g++
argument -ftemplate-depth-N is kept for compatibility, but modern g++ versions
no longer document that option.

Add -cc1 argument -fconstexpr-depth N to implement the corresponding
functionality.

The -ftemplate-depth=N part of this fixes PR9890.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145045 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-depth.cpp
e24f5fc8c763f1b5536b8d70dd510ca959db3a80 17-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: add support for evaluation of member pointers
and base-to-derived casts, and add proper handling of temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144926 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
6fe2965ce722826ae7c3af85271f900286ef20c3 17-Nov-2011 David Blaikie <dblaikie@gmail.com> Include named unions in union member init checking

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144883 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
onstructor-initializer.cpp
9c0e1ec7b3afd833c1b958ce2aeedff71c7eb4c5 15-Nov-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed plausible overloads location.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144700 91177308-0d34-0410-b5e6-96231b3b80d8
xpression-traits.cpp
2d9eb21325a0854e86de7344f54a8e6cef2a97ad 15-Nov-2011 Douglas Gregor <dgregor@apple.com> Teach the CFG builder how to properly destroy temporaries who
lifetimes have been extended via reference binding. The type of the
reference and the type of the temporary are not necessarily the same,
which could cause a crash. Fixes <rdar://problem/10398199>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144646 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
1bf9a9e6a5bdc0de7939908855dcddf46b661800 12-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Represent an APValue based on a Decl as that Decl, rather than a DeclRefExpr
or MemberExpr which refers to it. As a side-effect, MemberExprs which refer to
static member functions and static data members are now emitted as constant
expressions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144468 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
39d3196189a86803f7793cabd7ac498c761bc729 11-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Extend -Wno-bind-to-temporary-copy and -Wno-{unnamed,local}-type-template-args
to disable the corresponding -Wc++98-compat warnings in addition to the C++11
extension warnings, so that people already using these flags can switch to C++11
mode and turn on -Wc++98-compat.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144404 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-flags.cpp
f64699e8db3946e21b5f4a0421cbc58a3e439599 11-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evalation: const_cast support.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144382 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
6660ae640ad87232a6678d23ac39821347c63bca 11-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Don't recurse so deep in this test, pending APValue rework to further reduce the
stack pressure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144378 91177308-0d34-0410-b5e6-96231b3b80d8
onstexpr-factorial.cpp
59efe266b804330f4c1f3a1b0ff783e67dd90378 11-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for constexpr member functions. This
reinstates r144273; a combination of r144333's fix for NoOp rvalue-to-lvalue
casts and some corresponding changes here resolve the regression which that
caused.

This patch also adds support for some additional forms of member function call,
along with additional testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144369 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstexpr-ackermann.cpp
onstexpr-factorial.cpp
onstexpr-nqueens.cpp
ef04ecf96d83cd3cbc7bf8cf36d4c7873964194e 11-Nov-2011 Francois Pichet <pichet2000@gmail.com> Move "Unqualified lookup into dependent bases of class templates" Microsoft specific behavior from -fms-extensions to -fms-compatibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144341 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
6142ca7790aa09a6e13592b70f142cc4bbcadcae 10-Nov-2011 Devang Patel <dpatel@apple.com> Revert r144273. It causes clang self-host build failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144296 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
6c95787b25c72a1c2421e349ef3459912362714a 10-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for constexpr member functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144273 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
180f47959a066795cc0f409433023af448bb0328 10-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for evaluation of structs and unions of
literal types, as well as derived-to-base casts for lvalues and
derived-to-virtual-base casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144265 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
6b18e740495b67b439fa366367242110365cc4d9 09-Nov-2011 Douglas Gregor <dgregor@apple.com> Don't crash when transforming an ill-formed pseudo-destructor
expression. Fixes PR11339.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144159 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
3d75ca836205856077c18e30e9447accbd85f751 09-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for default arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144156 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
db1822c6de43ff4aa5fa00234bf8222f6f4816e8 08-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix a cluster of related issues involving value-dependence and constant
expression evaluation:
- When folding a non-value-dependent expression, we may try to use the
initializer of a value-dependent variable. If that happens, give up.
- In C++98, actually check that a const, non-volatile DeclRefExpr inside an ICE
is of integral or enumeration type (a reference isn't OK!)
- In C++11, DeclRefExprs for objects of const literal type initialized with
value-dependent expressions are themselves value-dependent.
- So are references initialized with value-dependent expressions (though this
case is missing from the C++11 standard, along with many others).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144056 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
onstant-expression.cpp
cc5d4f637cdf83adc174b96d2bfe27cef1cf0f36 07-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: support for arrays.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143922 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9a17a680c74ef661bf3d864029adf7e74d9cb5b8 07-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: preserve subobject designator when flattening a
core constant value down to an APValue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143909 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
cd689927139d3ab52c0c088521633c661bd2d807 07-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Allow constexpr variables' initializers to be folded in C++11 mode. This
partially undoes the revert in r143491, but does not introduce any new instances
of the underlying issue (which is not yet fixed) in code which does not use
the 'constexpr' keyword.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143905 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
545d1bbf91c01e3d72e6e5074311ace6b3f86b26 04-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Clean up C++11 constant expression testing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143720 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
0a3bdb646ee0318667f4cebec6792d2548fb9950 04-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: track the manner in which an lvalue was written,
to allow us to implement the C++11 rule that a non-active union member can't be
read, and use it to implement subobject access for string literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143677 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
fb35e8f497d180e562e2e1bd8cd4b756b2d4a846 03-Nov-2011 Douglas Gregor <dgregor@apple.com> When we're checking a friend function template in an out-of-line class
definition, we may not have a scope corresponding to the namespace
where that friend function template actually lives. Work around this
issue by faking up a scope with the appropriate DeclContext.

This is a bit of a hack, but it fixes <rdar://problem/10204947>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143614 91177308-0d34-0410-b5e6-96231b3b80d8
riend-out-of-line.cpp
ddb21473ef1ff20b3abf7ba3cd6cb29acbd5cf06 03-Nov-2011 Douglas Gregor <dgregor@apple.com> Don't build member initializers for zero-length or incomplete arrays,
and don't try to destroy them, either. Fixes
<rdar://problem/10228639>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143584 91177308-0d34-0410-b5e6-96231b3b80d8
ero-length-arrays.cpp
5d8419c12a1ffaf710fa11fb1091f10f03f2c1dc 01-Nov-2011 Douglas Gregor <dgregor@apple.com> When we run into a constructor or destructor that is defined in the
wrong class, make sure to drop it immediately; we don't want that
constructor to be available within the DeclContext. Fixes
<rdar://problem/9677163>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143506 91177308-0d34-0410-b5e6-96231b3b80d8
ember-class-11.cpp
0b4072f42f4c94c6c396b43ed3db4d1deecef9c3 01-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix r143463 to test what it was intended to test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143505 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
344d78d6a669fb324f89937fc0739f97670f4700 01-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Temporarily disable lvalue-to-rvalue conversions on const pointers while an
apparent miscompile triggered by this is investigated. This is essentially a
revert of r143298.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143491 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
177dce777596e68d111d6d3e6046f3ddfc96bd07 01-Nov-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 'constexpr calls must return constant expressions' rule, and
perform the code simplifications this rule allows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143463 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
cc7a6484d8afd6f8bede2757666c42248228e408 01-Nov-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Enable function call and some overload resolution with parameters of aggregate class type and initializer list arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143462 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
ffbda40a1fb7169591dc01771f3511178a2f727c 31-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Don't try to fold comparisons between the address of an object and an arbitrary integer constant. Fixes regression from r143334.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143374 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
7a420df78dd207d505b0c05d5f4b12a627b8b994 31-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Add missing lvalue-to-rvalue conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143364 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
bd552efbeff3a64a1c400d2bba18f13f84abd8ab 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expression handling: evaluation support for
materialized temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143335 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9e36b533af1b2fa9f32c4372c4081abdd86f47e0 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expressions: evaluate equality comparisons between
arbitrary pointers, if those pointers don't point to weak objects or literals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143334 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
625b80755b603d28f36fb4212c81484d87ad08d3 31-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> C++11 generalized constant expressions: support pointer comparisons where the
result is not unspecified.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143329 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
b78c0b66481a59dbef7ac2a454e4f89448909749 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr evaluation: allow lvalue-to-rvalue conversion on any literal type, not
just integers and floating point types. Since we don't support evaluating class
types or performing lvalue-to-rvalue conversions on array elements yet, this
just means pointer types right now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143298 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
47a1eed1cdd36edbefc318f29be6c0f3212b0c41 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr function substitution:
Track the function invocation where an lvalue referring to a constexpr function
parameter originated from, and use it to substitute the correct argument and to
determine whether such an argument's lifetime has ended.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143296 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
d0dcceae2a8ca0e37b5dd471a704de8583d49c95 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Initial support for C++11 constexpr function invocation substitution. Using
constexpr function arguments outside of their function (passing or returning
them by reference) does not work correctly yet.

Calling constexpr function templates does not work yet, since the bodies are not
instantiated until the end of the translation unit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143234 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
c49bd11f96c2378969822f1f1b814ffa8f2bfee4 28-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Reinstate r142844 (reverted in r142872) now that lvalue-to-rvalue conversions
are present in all the necessary places:

In constant expression evaluation, evaluate lvalues as lvalues and rvalues as
rvalues. Remove special case for caching reference initialization and fix a
cyclic initialization crash in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143204 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
9c129f818038e0269ba6b095722aa70176dc321d 28-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add (hopefully) the last missing lvalue-to-rvalue conversion. Add an assertion
to catch some future implicit lvalue-to-rvalue casts of inappropriate kinds.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143182 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
61ffd09797d661ae4ae18674d144a27be2d2f5f3 28-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add missing lvalue-to-rvalue conversion to vector splat casts.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143166 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
4f87062cb411d5a31cf39f1ac576bba4123930f2 28-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix some cases where a CK_IntegralCast was being used to convert an lvalue to an
rvalue. An assertion to catch this is in ImpCastExprToType will follow, but
vector operations currently trip over this (due to omitting the usual arithmetic
conversions). Also add an assert to catch missing lvalue-to-rvalue conversions
on the LHS of ->.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143155 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression-cxx11.cpp
601d2ee8dd783503f9d556e1ed3b107abf196a1e 26-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> UnresolvedMemberExprs need lvalue-to-rvalue conversions during template
instantiations too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143016 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
a01c71191c93691e592c030cc48764e52272eea5 25-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Don't forget the lvalue-to-rvalue conversion on the LHS when instantiating a
dependent ->, where the member being referred to is an anonymous struct or
union. This path was missed by the fix in r142890.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142910 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
c2c11446caaee2d5a787cc8d0310330c6364210d 25-Oct-2011 Douglas Gregor <dgregor@apple.com> Make the -Wc++11-compat warnings ignored by default, so we don't break
valid C++98/03 code. However, add these warnings to -Wall, for those
who obviously already like clean code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142903 91177308-0d34-0410-b5e6-96231b3b80d8
uto-cxx98.cpp
lass.cpp
ecltype-crash.cpp
f11e923433b62efb0fbaeb2573e8457f1c4a1b1e 25-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Tidy up testcase from r142890, spotted by Chandler.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142895 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
97f9fe06e7acd55d7d9075a41e33f54855c75eae 25-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Don't forget the lvalue-to-rvalue conversion on the LHS of an -> when rebuilding
it during template instantiation, for a known RHS decl.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142890 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
436c8898cd1c93c5bacd3fcc4ac586bc5cd77062 25-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Revert r142844, it broke selfhost. The problem appears to be a missing
lvalue-to-rvalue conversion on the LHS operand of '->'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142872 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
41bf4f38348561a0f12c10d34f1673cd19a6eb04 24-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Constant expression evaluation: evaluate lvalues as lvalues, and rvalues as
rvalues, as C++11 constant evaluation semantics require. DeclRefs referring to
references can now use the normal initialization-caching codepath, which
incidentally fixes a crash in cyclic initialization of references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142844 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
32cb47174304bc7ec11478b9497c4e10f48273d9 24-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> In accordance with the C89, C99 and C++98 standards, ICEs can only contain
floating-point literals if they are the immediate operands of casts.
ImplicitCastExpr is not a cast in the language-standards sense.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142832 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
1d26f48dc2eea1c07431ca1519d7034a21b9bcff 24-Oct-2011 Ted Kremenek <kremenek@apple.com> Rename AnalysisContext to AnalysisDeclContext. Not only is this name more accurate, but it frees up the name AnalysisContext for other uses.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142782 91177308-0d34-0410-b5e6-96231b3b80d8
issing-header.cpp
0b64ba926752110cff1344a46b36e29396cc4d25 23-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Fix grammar for C++11 alignment specifiers, and add a few FIXMEs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142760 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
0661bd0ccae381613c5967cdf2514255e1f92636 23-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Attach class template attributes to the templated CXXRecordDecl,
instead of silently discarding them.

As a side effect, this improves diagnostics for constexpr class
templates slightly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142755 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
6db51f707e93816364039a2a904d13d3968c7f05 21-Oct-2011 DeLesley Hutchins <delesley@google.com> Added support for thread safety attributes on destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142685 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
f1ac63702143d84db778d32eb185a77fc97db5f5 21-Oct-2011 DeLesley Hutchins <delesley@google.com> Thread safety analysis refactoring: invalid lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142666 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
e0eaa8531f8fd9189710aac3b6f3aadb62bb14d1 21-Oct-2011 DeLesley Hutchins <delesley@google.com> Thread safety analysis: add support for attributes on constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142665 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
b57791e5b40afa6691063c83d0e95c416fb19fde 21-Oct-2011 Douglas Gregor <dgregor@apple.com> Treat the Microsoft/Borland keyword "__except" as a context-sensitive
keyword, because both libstdc++ and libc++ use "__except" as an
identifier. Fixes <rdar://problem/10322555>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142636 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
0e9e9814a7f8313c0c02b6afea71f0e4c411873e 20-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wc++98-compat diagnostics for jumps which bypass initialization of non-POD
but trivially constructible and destructible variables in C++11 mode. Also
incidentally improve the precision of the wording for jump diagnostics in C++98
mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142619 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
xx98-compat.cpp
9324583ad2afd09db8c9967cd05c4fa44bac9555 20-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> 'extern template' is a C++11 feature. Add an Extension for C++98 (this matches
gcc's behaviour), and a -Wc++98-compat-pedantic warning for C++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142597 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
95aafb2453e1fecec8dcfd9e125cd78277f45859 20-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wc++98-compat warning for enumerations in nested name specifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142568 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
2b79c320b0801e0094df6c70ad8062da6c58bd1c 20-Oct-2011 David Blaikie <dblaikie@gmail.com> Don't provide errors for anonymous unions when they're actually anonymous classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142551 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-struct.cpp
e7d7c39be90bf654a8da0f53f6682d965426d081 19-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat: warn on nontrivial types used in unions and anonymous structs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142541 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
83da2e711902c4c54f5601c9000d646dfff06aea 19-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat: diagnose if a reference is bound to a prvalue which does not
have an unambiguous accessible copying constructor; this is ill-formed in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142533 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
53e535161dfa9850de394b300915fc250eb0fdf4 19-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add a -Wc++98-compat warning for friend functions of class templates which would
be implicitly instantiated (resulting in a redefinition) in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142468 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
77faa365cb2322cfc8edf58a4f5d68f2370cc39a 19-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat: warn if a SFINAE substitution in C++11 suppresses an access
control diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142463 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
6b13022faef260c8f49d04310f4a2c0a57f9103b 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 2.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142426 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
ebaf0e6ab743394dda086a01b457838cb6e589a8 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat and -Wc++98-compat-pedantic warnings for Sema, part 1.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142419 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
xx98-compat.cpp
5f31f0893d75203c326ddcd9808099bbfe34aec0 18-Oct-2011 David Blaikie <dblaikie@gmail.com> Switch to the C++11 warning flags in tests.
Patch by Ahmed Charles!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142340 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-compat.cpp
or-range-no-std.cpp
icrosoft-cxx0x.cpp
issing-namespace-qualifier-typo-corrections.cpp
ypo-correction.cpp
2dc7ece8a83f371cb86c2f93282cb3c8e2d010ec 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wc++11-compat warning for an inline specifier on an explicit instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142333 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-compat.cpp
3e2e91e934ecf083a7c0835b58d9627ca2faddc9 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Refactor the checking for explicit template instantiations being performed in
the right namespace in C++11 mode. Teach the code to prefer the 'must be in
precisely this namespace' diagnostic whenever that's true, and fix a defect
which resulted in the -Wc++11-compat warning in C++98 mode sometimes being
omitted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142329 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-compat.cpp
ea0114313fbfba99f7067a2464c523e96a08e365 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Perform lvalue-to-rvalue conversions on __builtin_offsetof array argument index
before typechecking, as suggested by John.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142308 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
841804baff6ea8ba1904a2ba81265aae1479e882 18-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wc++98-compat warnings for uses of the new keywords 'alignof', 'char16_t',
'char32_t', 'constexpr', 'decltype', 'noexcept', 'nullptr' and 'static_assert'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142302 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
8121639910129a2b59aa85fc597e47cacad8b978 17-Oct-2011 DeLesley Hutchins <delesley@google.com> Substitute for arguments in method calls -- functionality

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142267 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
5acb0c98b363400f6ade0ae7250f0102224e806b 17-Oct-2011 John McCall <rjmccall@apple.com> Teach the ARC compiler to not require __bridge casts when
passing/receiving CF objects at +0 to/from Objective-C methods
or audited C functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142219 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
ember-pointer.cpp
verloaded-name.cpp
verloaded-operator.cpp
nknown-anytype.cpp
a2b4e5d9292688bc67b583592918dbeecae31ea3 17-Oct-2011 Douglas Gregor <dgregor@apple.com> When we end up having to parse the initializer of a C++ member early
in -fms-extensions mode, make sure we actually use that initializer
after having handled the declaration. Fixes PR11150.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142195 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
1e12c59e8f9bb76c23628c4e0d0a1dfced0b1fa0 16-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Split apart the state accumulated during constant expression evaluation and the
end result. Use this split to propagate state information and diagnostics
through more of constant expression evaluation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142159 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
5405b817e2e56b8d37faee7ddfe4c05c16339562 16-Oct-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Implement overload resolution from init lists for scalar parameter types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142148 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-scalars.cpp
c223518ebf72e1709dc8938cd9384161ea5ec0bb 16-Oct-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Diagnose when omitting braces in direct list-initialization in C++0x.

This also applies to C99-style aggregate literals, should they be used in C++11, since they are effectively identical to constructor call list-initialization syntax.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142147 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-aggregates.cpp
eneralized-initializers.cpp
d12c9f5f8b9b6c123eb3cc6b607797713d90d80b 16-Oct-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Prove that non-overloaded function calls using init list arguments work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142144 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-scalars.cpp
0aa86c0463a881be85fd34e04c7de3379997621d 15-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wc++98-compat warning for deduced 'auto' type specifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142057 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
7fe6208c3fa91f835813bb78236ef5c2bbf81053 15-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement -Wc++98-compat warnings for the parser.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142056 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
xx98-compat.cpp
661a99690bc133bbaa029da925481d4a860dec90 15-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat warnings for the lexer.

This also adds a -Wc++98-compat-pedantic for warning on constructs which would
be diagnosed by -std=c++98 -pedantic (that is, it warns even on C++11 features
which we enable by default, with no warning, in C++98 mode).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142034 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat-pedantic.cpp
xx98-compat.cpp
41be673e93ed225b45479557b20ff19b3082bae8 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> -Wc++98-compat: warn on C++11 attributes and alignas.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141999 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
84ef8990b8f6b0f9ab57f8e2b7372dad5575364f 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Test for r141985.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141998 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
b8e778da8545624826440366a709d555332ffc73 14-Oct-2011 Douglas Gregor <dgregor@apple.com> Don't try to diagnose anything when we're passing incomplete types
through varargs. This only happens when we're in an unevaluated
context, where we don't want to trigger an error anyway. Fixes PR11131
/ <rdar://problem/10288375>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141986 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
9ce6377714a8eb8f577c87028300421e72b00dc9 14-Oct-2011 Matt Beaumont-Gay <matthewbg@google.com> Only warn in -Wliteral-conversion if the conversion loses information

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141955 91177308-0d34-0410-b5e6-96231b3b80d8
arn-literal-conversion.cpp
f38eaa4748ee6164d5e36309fecef71765ff8b2b 14-Oct-2011 Jeffrey Yasskin <jyasskin@google.com> Revert the -Wc++98-compat flag because dgregor doesn't like it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141921 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
133ca80b6b7451bf0af1bed7ef6f3928a0a1d5a3 14-Oct-2011 Richard Trieu <rtrieu@google.com> Fix a test case where FileCheck is used to test code corrected by -fixit.
If the code file is not run through the preproccessor to remove comments,
then FileCheck will match the strings within the CHECK commands rendering
the test useless.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141911 91177308-0d34-0410-b5e6-96231b3b80d8
elete.cpp
946967806a449488a91d74e2693295a2413a2835 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Convert newly-added test from -std=c++0x to -std=c++11.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141904 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
cda57822327499aeb6fe606f9cf5903cffca3444 14-Oct-2011 Nico Weber <nicolasweber@gmx.de> Extend -Wno-sizeof-array-argument to strncpy and friends.

This finds 2 bugs in chromium and 1 in hunspell, with 0 false positives.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141902 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
762bb9d0ad20320b9f97a841dce57ba5e8e48b07 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Update all tests other than Driver/std.cpp to use -std=c++11 rather than
-std=c++0x. Patch by Ahmed Charles!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141900 91177308-0d34-0410-b5e6-96231b3b80d8
R10243.cpp
R5086-ambig-resolution-enum.cpp
R8012.cpp
R9902.cpp
R9908.cpp
bstract.cpp
ggregate-initialization.cpp
lias-template.cpp
lignof-sizeof-reference.cpp
mbiguous-builtin-unary-operator.cpp
ttr-cxx0x.cpp
uto-cxx0x.cpp
uto-subst-failure.cpp
uiltin-ptrtomember-ambig.cpp
uiltin-ptrtomember-overload-1.cpp
uiltin-ptrtomember-overload.cpp
ast-conversion.cpp
onditional-expr.cpp
onversion-delete-expr.cpp
xx0x-class.cpp
xx0x-constexpr-const.cpp
xx0x-cursory-default-delete.cpp
xx0x-defaulted-functions.cpp
xx0x-delegating-ctors.cpp
xx0x-deleted-default-ctor.cpp
xx0x-initializer-scalars.cpp
xx0x-nontrivial-union.cpp
xx0x-type-convert-construct.cpp
ecl-init-ref.cpp
ecltype-overloaded-functions.cpp
ecltype-pr4444.cpp
ecltype-pr4448.cpp
ecltype-this.cpp
ecltype.cpp
efaulted-ctor-loop.cpp
eleted-function.cpp
eleted-operator.cpp
ependent-auto.cpp
ependent-noexcept-unevaluated.cpp
ependent-types.cpp
estructor.cpp
num-bitfield.cpp
num-scoped.cpp
xplicit.cpp
or-range-examples.cpp
or-range-no-std.cpp
or-range-unused.cpp
eneralized-initializers.cpp
eneric-selection.cpp
mplicit-exception-spec.cpp
ssue547.cpp
iteral-operators.cpp
iteral-type.cpp
ember-init.cpp
icrosoft-cxx0x.cpp
ullptr.cpp
ullptr_in_arithmetic_ops.cpp
verload-0x.cpp
verloaded-builtin-operators-0x.cpp
trtomember-overload-resolution.cpp
trtomember.cpp
edeclared-alias-template.cpp
edeclared-auto.cpp
ef-init-ambiguous.cpp
eturn-noreturn.cpp
val-references-examples.cpp
val-references.cpp
cope-check.cpp
tatic-assert.cpp
witch-0x.cpp
railing-return-0x.cpp
rivial-constructor.cpp
rivial-destructor.cpp
ype-traits.cpp
nderlying_type.cpp
nused-functions.cpp
alue-initialization.cpp
irtual-override.cpp
irtuals.cpp
48a9d189bbc989369155195a4ce8c7e1c02ea02a 14-Oct-2011 Jeffrey Yasskin <jyasskin@google.com> Implement the first piece of a -Wc++98-compat flag so that people can build in
C++11 mode but keep their sources compatible with C++98. This patch implements
the -Wc++98-compat-variadic-templates sub-flag and -Wc++98-compat to include
it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141898 91177308-0d34-0410-b5e6-96231b3b80d8
xx98-compat.cpp
ee697e69a2063b65bfd0534248e4848461aca3f4 13-Oct-2011 Douglas Gregor <dgregor@apple.com> Allow calling an overloaded function set by taking the address of the
functions, e.g., (&f)(0). Fixes <rdar://problem/9803316>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141877 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
verload-call.cpp
b3df1386680b3830d2f4d300d4d7eaba134135fc 12-Oct-2011 Douglas Gregor <dgregor@apple.com> Switch diagnostic text from "C++0x" over to "C++11".

We'd also like for "C++11" or "c++11" to be used for the warning
groups, but without removing the old warning flags. Patches welcome;
I've run out of time to work on this today.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141801 91177308-0d34-0410-b5e6-96231b3b80d8
R10458.cpp
R9572.cpp
uto-cxx0x.cpp
uto-cxx98.cpp
lass.cpp
onvert-to-bool.cpp
xx0x-compat.cpp
xx0x-return-init-list.cpp
ew-array-size-conv.cpp
d41679d6881d2b424d8b3600fc774308087735a7 12-Oct-2011 Douglas Gregor <dgregor@apple.com> Teach __has_nothrow_assign not to complain about access (GCC and EDG
ignore access entirely for it) and not to crash on assignment operator
templates. Fixes PR11110.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141777 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
6dbba4fc128e2e2f5b26be996392bd32c0707f13 12-Oct-2011 John McCall <rjmccall@apple.com> Catch placeholder types in DefaultLvalueConversion
and DefaultFunctionArrayLvalueConversion. To prevent
significant regression for should-this-be-a-call fixits,
and to repair some such regression from the introduction of
bound member placeholders, make those placeholder checks
try to build calls appropriately. Harden the build-a-call
logic while we're at it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141738 91177308-0d34-0410-b5e6-96231b3b80d8
R7944.cpp
lignof-sizeof-reference.cpp
ecltype-overloaded-functions.cpp
xpression-traits.cpp
ember-expr.cpp
verloaded-name.cpp
verloaded-operator.cpp
trtomember.cpp
98d86b98b3fd0bd9c546123b16fd9995509aaae1 11-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add a -Wc++0x-compat warning for C++11 keywords used as identifiers when in
C++98 mode. Only the first occurrence of each keyword will produce a warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141700 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-crash.cpp
e1677d97281d7e5059e15ed456e03cb02e475f08 11-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add more testing for -Wc++0x-compat warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141685 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-compat.cpp
257e17f9b61614a43d6317dcb5ba0801564f25b7 11-Oct-2011 Kaelyn Uhrain <rikka@google.com> Add an explanatory comment to test/SemaCXX/typo-correction.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141680 91177308-0d34-0410-b5e6-96231b3b80d8
ypo-correction.cpp
f11dbe9676832e599e046b2ed0f132a6bb858e0a 11-Oct-2011 Francois Pichet <pichet2000@gmail.com> [Microsoft] If -fms-compatibility, then downgrade missing typename error to warning at function prototype scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141630 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
fac9467d1676dc05761e12e41e13e01a3a3da52b 11-Oct-2011 Kaelyn Uhrain <rikka@google.com> Add typo correction for type names.

The main motivation was to do typo correction in C++ "new" statements,
though picking it up in other places where type names are expected was
pretty much a freebie.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141621 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
ypo-correction.cpp
2afd76618ee35193172c764d25f1f0996765b5e7 11-Oct-2011 Kaelyn Uhrain <rikka@google.com> Only accept a typo correction if it doesn't trigger additional errors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141609 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
db924224b51b153f24fbe492102d4edebcbbb7f4 11-Oct-2011 Eli Friedman <eli.friedman@gmail.com> Extend lvalue evaluation in ExprConstant.cpp to handle CK_LValueBitCast (which is completely trivial). PR8836.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141604 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
13e1bca90dc227e1e9c30900841f8bf976c0c83e 11-Oct-2011 Douglas Gregor <dgregor@apple.com> When performing a user-defined conversion via a constructor, be sure
to check whether the constructor is accessible. Fixes
<rdar://problem/10202900>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141588 91177308-0d34-0410-b5e6-96231b3b80d8
ser-defined-conversions.cpp
fcdd2cb2fdf35f806dd800b369fe0772a1c8c26c 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Don't suggest 'noreturn' for function template instantiations, because
it might be wrong for other instantiations of the same function
template. Fixes PR10801.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141559 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
1055393814ac989727aa7437a5f3c3c44b4f83e5 10-Oct-2011 Kaelyn Uhrain <rikka@google.com> Give nicer note when a member redeclaration has or lacks 'const'

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141555 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
ested-name-spec.cpp
f8b6e1591b5c5085cf4dec8df657e32a68053b12 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Don't analyze comparisons in type- or value-dependent
subexpressions. Fixes PR10291.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141552 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-comparison.cpp
147545d698972cfd34ece30a5d55e8180784161e 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Parse the initializer for a class member after handling its
declarator, so that the declarator is in scope for the
initializer. Fixes PR9989.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141539 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
6d0468b2d3aa37c699b697922cd991ae83b64a87 10-Oct-2011 Douglas Gregor <dgregor@apple.com> Push "out-of-line" declarations into scope when their lexical/semantic
redeclaration contexts are the same, as occurs within linkage
specifications. Fixes PR9162.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141521 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
44efed03b3ec16148722dfe57e0787a5b5c59741 09-Oct-2011 Douglas Gregor <dgregor@apple.com> Only allow taking the address of an expression of type 'overloaded
function type' when that expression is actually an overloaded function
reference (and not the address of an overloaded function
reference). Fixes PR11066.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141514 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of.cpp
b5a0187b12524d2c1e6ac96e81715d1e70bbe0ad 09-Oct-2011 Douglas Gregor <dgregor@apple.com> Diagnose attempts to declare a non-static data member with a
non-identifier name. Fixes PR10839.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141513 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
55dec868977ccb89cab0286122f9345f63bb5de7 30-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr functions are implicitly const. More tests to follow.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140831 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-cursory-default-delete.cpp
2d23ec29805f54edb3243022c64d752b8fbe5f46 30-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Suggest adding 'constexpr' if the GNU extension for in-class initializers for static const float members is used in C++11 mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140828 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-class.cpp
947be1941e9a1d4233116f51a45799d3904d4231 30-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Mark the ExtWarn for in-class initialization of static const float members as a GNU extension. Don't extend the scope of this extension to all literal types in C++0x mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140820 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
xx0x-class.cpp
eea0e817c609c662f3fef61bb257fddf1ae8f7b7 29-Sep-2011 Eli Friedman <eli.friedman@gmail.com> PR11040: CheckICE should not allow an lvalue bitcast as part of an integer constant expression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140812 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
2da7a51270a5f40e88d07750ebdadd774368b9f4 29-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> In C++0x, static const volatile data members cannot be initialized in-class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140809 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
xx0x-class.cpp
c6d990a767150b02337de1136fdb55ccf349f4d1 29-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> constexpr: semantic checking for constexpr variables.

We had an extension which allowed const static class members of floating-point type to have in-class initializers, 'as a C++0x extension'. However, C++0x does not allow this. The extension has been kept, and extended to all literal types in C++0x mode (with a fixit to add the 'constexpr' specifier).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140801 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
97db7265ac1993e14e5877292e23d5ed2e9cf719 29-Sep-2011 Fariborz Jahanian <fjahanian@apple.com> c - Enumerators may inherit the deprecated/unavailable
attributes from the enumeration type.
// rdar://10201690


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140800 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
82d0b0aab9088e977c2a44c4a5a90479c63149fe 29-Sep-2011 Peter Collingbourne <peter@pcc.me.uk> Add support for alignment-specifiers in C1X and C++11, remove
support for the C++0x draft [[align]] attribute and add the C1X
standard header file stdalign.h

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140796 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
8ed3adec26af254dd6df6b34546737045f353670 27-Sep-2011 Eli Friedman <eli.friedman@gmail.com> Move test, so it actually tests what it is supposed to (given that we don't have an AST verifier).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140620 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
2246368b1061ef48e00bfc95d519d4393dff9926 27-Sep-2011 Bill Wendling <isanbard@gmail.com> Revert r140589. It was causing failures during llvm compilation:

llvm[1]: Compiling CommandLine.cpp for Debug+Asserts build
if /Users/void/llvm/llvm-opt.obj/Release+Asserts/bin/clang++ -I/Users/void/llvm/llvm.obj/include -I/Users/void/llvm/llvm.obj/lib/Support -I/Users/void/llvm/llvm.src/include -I/Users/void/llvm/llvm.src/lib/Support -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-common -Woverloaded-virtual -Wcast-qual -m64 -Wall -W -Wno-unused-parameter -Wwrite-strings -c -MMD -MP -MF "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d.tmp" -MT "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.o" -MT "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d" /Users/void/llvm/llvm.src/lib/Support/CommandLine.cpp -o /Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.o ; \
then /bin/mv -f "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d.tmp" "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d"; else /bin/rm "/Users/void/llvm/llvm.obj/lib/Support/Debug+Asserts/CommandLine.d.tmp"; exit 1; fi
In file included from /Users/void/llvm/llvm.src/lib/Support/CommandLine.cpp:25:
/Users/void/llvm/llvm.src/include/llvm/Support/system_error.h:690:14: error: unknown type name 'make_error_condition'; did you mean 'error_condition'?
{*this = make_error_condition(_e);}
^~~~~~~~~~~~~~~~~~~~
error_condition
...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140599 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
104be6fc8de206c9b79b241b36ebaf9407b3be08 27-Sep-2011 Eli Friedman <eli.friedman@gmail.com> PR11009: Fix a FIXME which was leading to an assertion failure with rvalue references.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140594 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
93476ddd9ce490f9c08d78b640efad812cb019d1 27-Sep-2011 Kaelyn Uhrain <rikka@google.com> Add typo correction for the type name in C++ "new" statements

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140589 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
615eb7c477eb0523bfc1d238c57cee9497c874e3 27-Sep-2011 Ted Kremenek <kremenek@apple.com> Fix regression of -Warray-bounds involving varargs functions [PR 11007].

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140584 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
02fa1b9cd6f185fead44f910733ff1086a6c5a0b 27-Sep-2011 Richard Trieu <rtrieu@google.com> Move string literal to bool conversion into its own warning flag -Wstring-conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140574 91177308-0d34-0410-b5e6-96231b3b80d8
arn-literal-conversion.cpp
arn-string-conversion.cpp
6df6548e44a61c444bd85dccd0398cba047c79b1 24-Sep-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Correctly parse braced member initializers (even in delayed parsing) and correctly pass
the information on to Sema. There's still an incorrectness in the way template instantiation
works now, but that is due to a far larger underlying representational problem.
Also add a test case for various list initialization cases of scalars, which test this
commit as well as the previous one.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140460 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-initializer-scalars.cpp
eneralized-initializers.cpp
3117e36769bdd666f8bbb9155b17ee1c4b060e38 24-Sep-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Fix the expected error for narrowing conversions in generalized-initializers.cpp to
match what the actual implementation of the error looks like.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140458 91177308-0d34-0410-b5e6-96231b3b80d8
eneralized-initializers.cpp
fce1a3ab56879a7eb92c7e0b465c1f2c07e0c512 24-Sep-2011 Francois Pichet <pichet2000@gmail.com> [microsoft] In Microsoft mode, if we are inside a template class member function and we can't resolve an identifier then assume the identifier is type dependent. The goal is to postpone name lookup to instantiation time to be able to search into type dependent base classes.

This fixes a few errors when parsing MFC code with clang.
BTW clang trunk is now about 5 patches away to be able the parse the default wizard-generated MFC project.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140452 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
f1f8b1a404d9ce6f0eb78e97b598a220d8ca9090 23-Sep-2011 Richard Trieu <rtrieu@google.com> Add a new warning to -Wliteral-conversion to catch cases where a string literal
is cast to a boolean. An exception has been made for string literals in
logical expressions to allow the common case of use in assert statements.

bool x;
x = "hi"; // Warn here
void foo(bool x);
foo("hi"); // Warn here
assert(0 && "error");
assert("error); // Warn here



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140405 91177308-0d34-0410-b5e6-96231b3b80d8
arn-literal-conversion.cpp
a120d01c66010db47332b7ca67b737fda6c2c264 23-Sep-2011 Douglas Gregor <dgregor@apple.com> When checking for weak vtables, check whether the actual definition of
the key function is inline, rather than the original
declaration. Perhaps FunctionDecl::isInlined() is poorly named. Fixes
<rdar://problem/9979458>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140400 91177308-0d34-0410-b5e6-96231b3b80d8
arn-weak-vtables.cpp
036277e3e7bfa3ccef96fabf0b34a75d9a7c015b 21-Sep-2011 Francois Pichet <pichet2000@gmail.com> [microsoft] Move missing typename warning from -fms-extensions to -fms-compatibility. Also allow the missing typename warning at function scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140240 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
icrosoftExtensions.cpp
cc6306e96782a8da2d818bfaca003645530ffd2f 21-Sep-2011 Francois Pichet <pichet2000@gmail.com> Move Microsoft access specifier bug emulation from -fms-extensions to -fm-compatibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140189 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
icrosoftExtensions.cpp
9d8c2b61519cb05ac6737cc542e274f9e2e0552a 20-Sep-2011 John McCall <rjmccall@apple.com> Fix a crash-on-invalid with bad CV-qualification on 'this' in the
presence of an implicit move assignment operator. I think the implicit
copy assignment operator case was also wrong, but just in a "displaying
the wrong diagnostic" way.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140139 91177308-0d34-0410-b5e6-96231b3b80d8
verload-0x.cpp
3f224b2efde9b02dcc78c5c85667a62dcd1f5ab3 20-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Fix a pretty nasty bug in noreturn destructors that cascaded into lots
of false positive warnings that depend on noreturn destructors pruning
the CFGs, but only in C++0x mode!

This was really surprising as the debugger quickly reveals that the
attributes are parsed correctly (and using the same code) in both modes.
The warning fires in the same way in both modes. But between parsing and
building the destructor declaration with the noreturn attribute and the
warning, it magically disappears. The key? The 'noexcept' appears!

When we were rebuilding the destructor type with the computed implicit
noexcept we completely dropped the old type on the floor. This almost
makes sense (as the arguments and return type to a destructor aren't
exactly unpredictable), but lost any function type attributes as well.
The fix is simple, we build the new type off of the old one rather than
starting fresh.

Testing this is a bit awkward. I've done it by running the
noreturn-sensitive tests in both modes, which previous failed and now
passes, but if anyone has ideas about how to more specifically and
thoroughly test that the extended info on a destructor is preserved when
adding noexcept, I'm all ears.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140138 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
0c706c29f20b6fa36759fa41333b9c3ec0bd2969 20-Sep-2011 Eli Friedman <eli.friedman@gmail.com> Add list initialization for complex numbers in C. Essentially, this allows "_Complex float x = {1.0f, 2.0f};". See changes to docs/LanguageExtensions.html for a longer description.

<rdar://problem/9397672>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140090 91177308-0d34-0410-b5e6-96231b3b80d8
omplex-init-list.cpp
6e5218367c513fe02d1c7210023d40739ecb1572 19-Sep-2011 Matt Beaumont-Gay <matthewbg@google.com> Fix a QoI bug with overloaded operators inside macros.

We were failing to set source locations and ranges in isUnusedResultAWarning
for CXXOperatorCallExprs, leading to an "expression result unused" warning
with absolutely no context if the expression was inside a macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140036 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-value.cpp
8b3c99e0167e0565905e1b05de2b8536d8e80d27 18-Sep-2011 Francois Pichet <pichet2000@gmail.com> Move the "jump bypasses variable initialization" error -> warning downgrade from -fms-extensions to -fms-compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140008 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
icrosoftExtensions.cpp
1c98d627e5f0b79365d4e64cd4c6795ebed895f3 18-Sep-2011 Francois Pichet <pichet2000@gmail.com> In Microsoft mode(-fms-compatibility), prefer an integral conversion to a floating-to-integral conversion if the integral conversion is between types of the same size.

For example:
void f(float);
void f(int);
int main {
long a;
f(a);
}
Here, MSVC will call f(int) instead of generating a compile error as clang will do in standard mode.
This fixes a few errors when parsing MFC code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140007 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftCompatibility.cpp
16ee8191ca6953e173c983e3175a8d7504b5baae 18-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR10531. Attach an initializer to anonymous unions, since the default constructor might not be trivial (if there is an in-class initializer for some member) and might be deleted.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139991 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
de5998f1d7dcecb777257ec932142d65de636eb8 18-Sep-2011 Nico Weber <nicolasweber@gmx.de> Let -Warray-bounds handle casted array types without false positives.

Fixes PR10771.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139990 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
2e96511773c6a21291dfa5218eb8ba79f04b5318 17-Sep-2011 Francois Pichet <pichet2000@gmail.com> In Microsoft mode, warn if an indirect goto jump over a variable initialization.
Also add a test case for the non Microsoft case because such test didn't exist.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139971 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
cope-check.cpp
e5326fa87a5431830cd0df296ad5de1eedf63c59 16-Sep-2011 Eli Friedman <eli.friedman@gmail.com> Remove standard library includes from test; they explode on Windows.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139875 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
74558b4c2f4136b0d89bbaa974df1070593b355a 15-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: changing naming in error messages based on reviewer comments

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139814 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
988b5ae14c2157cef36cc5850b294130846c578e 15-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: test cases originally from gcc annotalysis branch. We are
relicensing them under the license for llvm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139812 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
cb96751b25a934b22402c1e4e0805db7608a5f2b 15-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: completeing the implementation of shared/exclusive locks required attributes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139804 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
4e4bc75d3570835e13183c66ac08974cdc016007 15-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: refactoring various out of scope warnings to use the same inteface. This eliminates a lot of unnecessary duplicated code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139801 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
df8327c28d293cf7c6952b86dba26863235dcc0f 14-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: reverting to use separate warning for requirement to hold any lock

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139723 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
194418f1db5f5f78bc3e614d1e10a863455d882c 14-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: adding test cases for unparseable lock expressions and expanding the handling of these expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139720 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
7c24334bedf59bd9af57ee53eb8f6d9f6a50ca9b 14-Sep-2011 Kaelyn Uhrain <rikka@google.com> Plug an abstraction leak and fix a crasher in DiagnoseInvalidRedeclaration

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139718 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
5d35aa041b8845545e078b69492d460640166f5b 14-Sep-2011 Kaelyn Uhrain <rikka@google.com> Split the two invalid uses of the unqualified Foobar at line 3 to two lines
so that it is clearer which use triggered which error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139653 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
c985b88efc9188845952ab524fe6d4717705257b 13-Sep-2011 Francois Pichet <pichet2000@gmail.com> In Microsoft mode, downgrade "goto into protected scope" from error to warning if we are jumping over a variable initialization via a goto.

This fixes a few errors when parsing MFC code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139595 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
c8cfc74bdcc999828bc232294d937fb191940d5b 13-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Enhance the CFG construction to detect no-return destructors for
temporary objects and local variables. When detected, these split the
block, marking the new one as having only the exit block as a successor.
This prevents a large number of false positives in warnings sensitive to
no-return constructs such as -Wreturn-type, and fixes the remainder of
PR10063 along with several variations of this bug that had not been
reported. The test cases are extended across the board to cover these
patterns.

This also checks in a stress test for these types of CFGs. The stress
test declares some 32k variables, a mixture of no-return and normal
destructors. Previously, this resulted in roughly 2500 CFG blocks, but
didn't model any of the no-return destructors. With this patch, it
results in over 33k blocks, many of them now unreachable.

The nice thing about how the analyzer is set up? This causes *no*
regression in performance of building the CFG. It actually in some cases
makes it faster, as best I can benchmark. The analysis for -Wreturn-type
(and any other that cares about no-return code paths) is technically
slower now as it has to look at many more candidate blocks, but it
computes the correct answer. I have more test cases to follow, I think
they all work now. Also I have further work that should dramatically
simplify analyses in the presence of no-return.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139586 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
ac5ecf46c51c4e9128612d68ff20d465eb192554 10-Sep-2011 David Blaikie <dblaikie@gmail.com> Correctly referring to the null pointer as 'null' not the macro 'NULL' in the boolean conversion diagnostic message.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139465 91177308-0d34-0410-b5e6-96231b3b80d8
arn-bool-conversion.cpp
4f4f349208b2b2307454e169ac7b039e989f003f 10-Sep-2011 David Blaikie <dblaikie@gmail.com> Show either a location or a fixit note, not both, for uninitialized variable warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139463 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables-conditional.cpp
ninit-variables.cpp
a1364be341550d71dff27dd8de0c6872ba6c707e 10-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Extend the Stmt AST to make it easier to look through label, default,
and case statements. Use this to make the logic in the CFG builder more
robust at finding the actual statements within a compound statement,
even when there are many layers of labels obscuring it.

Also extend the test cases for a large chunk of PR10063. Still more work
to do here though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139437 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
99107ebc0a5aea953b736e12757e0919d5249d43 09-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: This patch deals with previously unhandled cases when building lock expressions. We now resolve this expressions, avoid crashing when encountering cast expressions, and have a diagnostic for unresolved lock expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139370 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
a49d1d8a34381802040c3d7fa218e93b457d2b1d 09-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: refactoring test cases

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139368 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
634c8af0805ba33b1530470e03aa314141036aa2 09-Sep-2011 Matt Beaumont-Gay <matthewbg@google.com> Extend -Wliteral-conversion to catch "int i = -1.234"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139326 91177308-0d34-0410-b5e6-96231b3b80d8
arn-literal-conversion.cpp
8bccabeac6b98650dfd88bd1fc84e841eb42af4b 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: In C++0x Mutexes are the objects that control access to shared variables, while Locks are the objects that acquire and release Mutexes. We switch to this new terminology.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139321 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
af37061fea31f3f1d0638edb5486e8d72c701522 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: adding basic no thread safety analysis option

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139310 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
978191e0906606e32965cebcf81627d8e8711b13 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: Adding basic support for locks required and excluded attributes

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139308 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
a53257c94a4d871e64070f72edb687dcfb08c15d 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: shared vs. exclusive locks

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139307 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
3bb435809c84153bb41a631030b92039598a330c 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: small formatting change in test comments

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139306 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
ed9d84a2112e2bd56befb5f4fa8fc5bdf71fafa3 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread safety: added support for function scopes in attribute arguments.

This patch was written by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139302 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-parsing.cpp
eff98fc3561f6b717f6348f04b3f4fe03e934466 08-Sep-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: Patch to implement delayed parsing of attributes within a
class scope.

This patch was also written by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139301 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
2eef427c8666cbe9a3cad40d4947c67c3ba0c400 07-Sep-2011 Douglas Gregor <dgregor@apple.com> When parsing a function-try-block that does not have a
ctor-initializer, remember to call the Sema action to generate default
ctor-initializers. What a delightful little miscompile. Fixes PR10578
/ <rdar://problem/9877267>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139253 91177308-0d34-0410-b5e6-96231b3b80d8
ember-init.cpp
82340e8cbd353ae4ddb545f61ba9816c8d69ba8e 07-Sep-2011 Kaelyn Uhrain <rikka@google.com> Fix Sema::CorrectTypo to ignore found but unresolved symbols

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139252 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
47eb89871e020babbaddeed4ee4447bc34824b9f 07-Sep-2011 Richard Trieu <rtrieu@google.com> Change the self-reference visitor (which gives the warning for self-reference oninitalization warning of -Wuninitialized) to exclude member variables that can decay into pointers. This will cause it to no longer warn on this code:

struct foo { char a[100], *e; } bar = { .e = bar.a };


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139213 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
f1bb0b049f7292336d3e2229a56e05003820b0f4 06-Sep-2011 Ted Kremenek <kremenek@apple.com> Place 'equality comparison with extraneous parentheses...' into a subgroup of -Wparentheses called -Wparentheses-equality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139180 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
7640c0070361bd365e30fc2eb3b6a64361fa7377 06-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Advertise support for cxx_range_for as an extension in C++98 mode. Patch by Jean-Daniel Dupas!
Also provide a modicum of test coverage for ranged for in C++98.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139149 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-no-std.cpp
017ab77655b262311a3550342ca19b85380f8f20 05-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement the suggested resolution of WG21 N3307 issue 19: When determining whether a class is an aggregate in C++0x, treat all functions which are neither deleted nor defaulted as user-provided, not just special member functions. The wording of the standard only defines the term "user-provided" for special member functions, but the intent seems to be that any function can be user-provided.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139111 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
8f4fb190852d3f86787c7e2c3dfc1b96143197ae 04-Sep-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10458: Finesse behaviour of C++0x features when in pre-0x mode. Accept for-range and auto with an ExtWarn, and produce a -Wc++0x-compat warning in C++98 mode when auto is used as a storage class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139102 91177308-0d34-0410-b5e6-96231b3b80d8
R10458.cpp
uto-cxx0x.cpp
uto-cxx98.cpp
lass.cpp
bf3380a317ab09ae7f23c1bc17cb562f8175a986 03-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Teach -Wdangling-field to warn about temporaries bound to references as
well.

Also, clean up the flow of the code a bit, and factor things more
nicely.

Finally, add the test case that was missing from my previous
commit (sorry), with new tests added to cover temporaries and other fun
cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139077 91177308-0d34-0410-b5e6-96231b3b80d8
arn-dangling-field.cpp
898267f67b8131c4bed4430e2cfaf69ccf4c2de1 01-Sep-2011 Richard Trieu <rtrieu@google.com> Extend the self-reference warning to catch when a constructor references itself upon initialization, such as using itself within its own copy constructor.

struct S {};
S s(s);


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138969 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
b0656ec72e25e5c8e463c2dc39914636f0cb06d1 31-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Improve the diagnostic text for -Wmissing-noreturn to include the name
of the function in question when applicable (that is, not for blocks).
Patch by Joerg Sonnenberger with some stylistic tweaks by me.

When discussing this weth Joerg, streaming the decl directly into the
diagnostic didn't work because we have a pointer-to-const, and the
overload doesn't accept such. In order to make my style tweaks to the
patch, I first changed the overload to accept a pointer-to-const, and
then changed the diagnostic printing layer to also use
a pointer-to-const, cleaning up a gross line of code along the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138854 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
1155c42e7b1b4e401bb0a331a6d715d637958c75 31-Aug-2011 Douglas Gregor <dgregor@apple.com> Allow C99 hexfloats in C++0x mode. This change resolves the standards
collision between C99 hexfloats and C++0x user-defined literals by
giving C99 hexfloats precedence. Also, warning about user-defined
literals that conflict with hexfloats and those that have names that
are reserved by the implementation. Fixes <rdar://problem/9940194>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138839 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-operators.cpp
85ea7aa961deac1d754f610af8062ae3f8b4e2a5 30-Aug-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Declare and define implicit move constructor and assignment operator.

This makes the code duplication of implicit special member handling even worse,
but the cleanup will have to come later. For now, this works.
Follow-up with tests for explicit defaulting and enabling the __has_feature
flag to come.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138821 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
xplicit.cpp
05b436ef550837e2141c55c590fb16010b8658d8 30-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread safety: added basic handling for pt_guarded_by/var and guarded_by/var annotations. We identify situations where we are accessing (reading or writing) guarded variables, and report an error if the appropriate locks are not held.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138774 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
b4d0a9678f8c592990593233e64c59247f40a74a 29-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread safety: various minor bugfixes, with test cases

This patch is by DeLesley Hutchins.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138738 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
1795d371c3ef79c3a2316677ea2014b2952915ac 26-Aug-2011 Eli Friedman <eli.friedman@gmail.com> Make sure we don't crash printing builtin candidates for overloads of deleted operators. Fixes PR10757.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138645 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-operator.cpp
3ac1fbc303d22af2e11a14023ecee7bd7b7d0bfd 23-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread-safety analysis: adding in a basic lockset tracking system. This
system flags an error when unlocking a lock which was not held, locking
the same lock twice, having a different lockset on each iteration of a
loop, or going out of scope while still holding a lock. In order to
successfully use the lockset, this patch also makes sure that attribute
arguments are attached correctly for later parsing.

This patch was also worked on by DeLesley Hutchins.

Note: This patch has been reviewed by Chandler Carruth and Jeffrey
Yasskin. Feel free to provide post-commit review comments for a
subsequent patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138350 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety-analysis.cpp
arn-thread-safety-parsing.cpp
arn-thread-safety.cpp
903d6dc86bf3b6346d23607c850d3bc83a36b826 23-Aug-2011 Matt Beaumont-Gay <matthewbg@google.com> Fix an incorrect note.

For the test case added to function-redecl.cpp, we were previously complaining
about a mismatch in the parameter types, since the definition used the
typedef'd type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138318 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
0124839d7fb3d846795190ba2ccf3951f27784fe 22-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Fix a crash-on-valid that has been here for a very long time:

const int &x = x;

This crashed by inifinetly recursing within the lvalue evaluation
routine. I've added a (somewhat) braindead way of preventing this
recursion. If folks have better suggestions for how to avoid it I'm all
ears.

That said, we have some work to do. This doesn't trigger a single
warning for uninitialized, self-initialized or otherwise completely
wrong code. In some senses, the crash was almost better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138239 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
5c5218e188b39b2e93b541156a69ef061e11aab8 19-Aug-2011 Matt Beaumont-Gay <matthewbg@google.com> Improve the correctness and accuracy of the message for -Wdynamic-class-memaccess

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138074 91177308-0d34-0410-b5e6-96231b3b80d8
arn-bad-memaccess.cpp
d2c8972726b14313508684245aa994cccbcef248 18-Aug-2011 Kaelyn Uhrain <rikka@google.com> Don't accept a typo correction if the corrected identifier is the same as the
uncorrected identifier. Fixes a problem pointed out by Eli.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137987 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
516116308007280f0dd6661cdd94112468c3c5fc 18-Aug-2011 Kaelyn Uhrain <rikka@google.com> Rework DiagnoseInvalidRedeclaration to add the ability to correct typos when
diagnosing invalid function redeclarations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137966 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
3bd9aa4593b4332d477407d9b5a42f3c4ababb21 18-Aug-2011 Francois Pichet <pichet2000@gmail.com> Add support for MSVC __unaligned attribute. Necessary to parse MSVC headers in 64-bit mode (ie: when _M_IA64 or _M_AMD64 is defined)

more info: http://msdn.microsoft.com/en-us/library/ms177389.aspx

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137935 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
5440bfaff6aec058b60bc6da75bb4f13b7a76491 18-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Remove the last FIXMEs on -Wunused-comparison since it got moved to
entirely use the existing -Wunused-value infrastructure. This also fixes
a few missed cases for -Wunused in general.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137916 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-comparison.cpp
b0a58cd0d69d213b6cd1e6a7bb7319f4f270944b 18-Aug-2011 Francois Pichet <pichet2000@gmail.com> Downgrade "err_init_list_variable_narrowing" into a warning in Microsoft mode even if c++0x is enabled. This necessary to parse MSVC code in C++0x mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137904 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoft-cxx0x.cpp
9b10683a3f222d8dc6e139073ca96b97b439747b 17-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Whitelist operator== and operator!= as valid for unused value warnings,
even when overloaded and user-defined. These operators are both more
valuable to warn on (due to likely typos) and extremely unlikely to be
reasonable for use to trigger side-effects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137823 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
arn-unused-comparison.cpp
ec8058f64bbcd79bd47748f4cf8628123dd3bae6 17-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Treating the unused equality comparisons as something other than part of
-Wunused was a mistake. It resulted in duplicate warnings and lots of
other hacks. Instead, this should be a special sub-category to
-Wunused-value, much like -Wunused-result is.

Moved to -Wunused-comparison, moved the implementation to piggy back on
the -Wunused-value implementation instead of rolling its own, different
mechanism for catching all of the "interesting" statements.

I like the unused-value mechanism for this better, but its currently
missing several top-level statements. For now, I've FIXME-ed out those
test cases. I'll enhance the generic infrastructure to catch these
statements in a subsequent patch.

This patch also removes the cast-to-void fixit hint. This hint isn't
available on any of the other -Wunused-value diagnostics, and if we want
it to be, we should add it generically rather than in one specific case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137822 91177308-0d34-0410-b5e6-96231b3b80d8
arn-top-level-comparison.cpp
arn-unused-comparison.cpp
50bf68fc9698742e36c311fc37e6e4b7de235c4b 17-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Don't suggest assignment in implausible situation. We still warn, as the
code is very likely to be buggy, but its going to require more
significant changes on the part of the user to correct it in this case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137820 91177308-0d34-0410-b5e6-96231b3b80d8
arn-top-level-comparison.cpp
9d8eb3b2a892697aed332f6c318a8554fc2623ce 17-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Introduce a new warning, -Wtop-level-comparison. This warning is
a complement to the warnings we provide in condition expressions. Much
like we warn on conditions such as:

int x, y;
...
if (x = y) ... // Almost always a typo of '=='

This warning applies the complementary logic to "top-level" statements,
or statements whose value is not consumed or used in some way:

int x, y;
...
x == y; // Almost always a type for '='

We also mirror the '!=' vs. '|=' logic.

The warning is designed to fire even for overloaded operators for two reasons:

1) Especially in the presence of widespread templates that assume
operator== and operator!= perform the expected comparison operations,
it seems unreasonable to suppress warnings on the offchance that
a user has written a class that abuses these operators, embedding
side-effects or other magic within them.
2) There is a trivial source modification to silence the warning for
truly exceptional cases:

(void)(x == y); // No warning

A (greatly reduced) form of this warning has already caught a number of
bugs in our codebase, so there is precedent for it actually firing. That
said, its currently off by default, but enabled under -Wall.

There are several fixmes left here that I'm working on in follow-up
patches, including de-duplicating warnings from -Wunused, sharing code
with -Wunused's implementation (and creating a nice place to hook
diagnostics on "top-level" statements), and handling cases where a proxy
object with a bool conversion is returned, hiding the operation in the
cleanup AST nodes.

Suggestions for any of this code more than welcome. Also, I'd really
love suggestions for better naming than "top-level".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137819 91177308-0d34-0410-b5e6-96231b3b80d8
arn-top-level-comparison.cpp
f25a16233c26633e82a09e191ed83e3a0fdda205 16-Aug-2011 Eric Christopher <echristo@apple.com> Move test from llvm/test/FrontendCXX and update.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137682 91177308-0d34-0410-b5e6-96231b3b80d8
008-01-11-BadWarning.cpp
9b127f3b44e685cbe513595b7e0115b0884b0604 15-Aug-2011 Matt Beaumont-Gay <matthewbg@google.com> Add fixit notes for -Wconstant-logical-operand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137620 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
xpressions.cpp
5290c80eba2c96aee32912adf77bea6eddb92026 12-Aug-2011 Ted Kremenek <kremenek@apple.com> Revert "Fix crash in CFGBuilder involving implicit destructor calls and gotos jumping after an object was declared. Fixes PR 10620."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137459 91177308-0d34-0410-b5e6-96231b3b80d8
fg.cpp
ddddd48da72bc29d1c3f388ed91ea5549328129e 12-Aug-2011 NAKAMURA Takumi <geek4civic@gmail.com> De-Unicode-ify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137430 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
xpression-traits.cpp
634a43c272a918f47cfc7dd07c7bd9481772f12e 12-Aug-2011 Craig Topper <craig.topper@gmail.com> Fix a raw string literal test case to actually use a raw string literal.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137427 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-type-convert-construct.cpp
a809447c5ce90f0efe7d6b7447d4cb6812bf3429 12-Aug-2011 Ted Kremenek <kremenek@apple.com> Fix crash in CFGBuilder involving implicit destructor calls and gotos jumping after an object was declared. Fixes PR 10620.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137426 91177308-0d34-0410-b5e6-96231b3b80d8
fg.cpp
79e610a99b43b9e6df8f9b6b59dbaf5d38a682d3 12-Aug-2011 Richard Trieu <rtrieu@google.com> The current warning in -Wnull-arithmetic for comparisons between NULL and non-pointers is not very helpful. This patch will update the wording to be more helpful to users.

Old warning:

warning: use of NULL in arithmetic operation [-Wnull-arithmetic]
return 10 <= NULL;
^ ~~~~

New warning:

warning: comparison between NULL and non-pointer ('int' and NULL) [-Wnull-arithmetic]
return 10 <= NULL;
~~ ^ ~~~~


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137377 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
2fa4e86b4fdada3b9ecbbbd99965b83ed879f69b 11-Aug-2011 Craig Topper <craig.topper@gmail.com> Add support for C++0x raw string literals.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137298 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-type-convert-construct.cpp
cd9ae488ede3e26e65fe173ae90b489ce45c8b6a 10-Aug-2011 Kaelyn Uhrain <rikka@google.com> Add the new unit test that I managed to leave out of r136997 :/


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137242 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds-ptr-arith.cpp
a19950edd94c1b80e73c9f45d821b125bd0ee72f 10-Aug-2011 John McCall <rjmccall@apple.com> Change an assert into a check. I'm pretty sure there was a point
in time when this assert was valid, but it's not valid now.
Also teach this code to correctly introduce function-to-pointer
decay.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137201 91177308-0d34-0410-b5e6-96231b3b80d8
nknown-anytype.cpp
b51e0315d4ffd12670441ea2284ae1188485df14 09-Aug-2011 Caitlin Sadowski <supertri@google.com> Thread Safety: Added basic argument parsing for all new attributes.

This patch special cases the parser for thread safety attributes so that all
attribute arguments are put in the argument list (instead of a special
parameter) since arguments may not otherwise resolve correctly without two-token
lookahead.

This patch also adds checks to make sure that attribute arguments are
lockable objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137130 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety.cpp
de091aeb4658e986ed8fa5fbce7ab35ef2ae26ec 08-Aug-2011 Ted Kremenek <kremenek@apple.com> Fix another -Wuninitialized assertion failure (this one involving bit casts) resulting from the recent -Wuninitialized changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137068 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
d6c8865e6f306556b7eef972ceec2cc8ba026a0d 06-Aug-2011 Kaelyn Uhrain <rikka@google.com> Perform array bounds checking in more situations and properly handle special
case situations with the unary operators & and *. Also extend the array bounds
checking to work with pointer arithmetic; the pointer arithemtic checking can
be turned on using -Warray-bounds-pointer-arithmetic.

The changes to where CheckArrayAccess gets called is based on some trial &
error and a bunch of digging through source code and gdb backtraces in order
to have the check performed under as many situations as possible (such as for
variable initializers, arguments to function calls, and within conditional in
addition to the simpler cases of the operands to binary and unary operator)
while not being called--and triggering warnings--more than once for a given
ArraySubscriptExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136997 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
c268434b332bbe57950d977633369bf5822d9554 05-Aug-2011 Chandler Carruth <chandlerc@gmail.com> Flesh out the -Warray-bounds detection of C89 tail-padded one-element
arrays. This now suppresses the warning only in the case of
a one-element array as the last field in a struct where the array size
is a literal '1' rather than any macro expansion or template parameter.

This doesn't distinguish between the language standard in use to allow
code which dates from C89 era to compile without the warning even in C99
and C++ builds. We could add a separate warning (under a different flag)
with fixit hints to switch to a flexible array, but its not clear that
this would be desirable. Much of the code using this idiom is striving
for maximum portability.

Tests were also fleshed out a bit, and the diagnostic itself tweaked to
be more pretty w.r.t. single elment arrays. This is more ugly than
I would like due to APInt's not being supported by the diagnostic
rendering engine.

A pseudo-patch for this was proposed by Nicola Gigante, but I reworked
it both for several correctness issues and for code style.

Sorry this was so long in coming.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136965 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
cc2f30c4ed7770b6005bd55b529a55c1fcc250fc 05-Aug-2011 Matt Beaumont-Gay <matthewbg@google.com> Extend memset/memcpy/memmove checking to include memcmp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136950 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
ace5e76e5c707f4a8447abc01ef540fa6d57ff95 05-Aug-2011 Kaelyn Uhrain <rikka@google.com> Have the typo correction in DiagnoseEmptyLookup properly handle template
functions when performing function overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136948 91177308-0d34-0410-b5e6-96231b3b80d8
unction-overload-typo-crash.cpp
844d5728557a324fe10ad990dd537e59780873ef 05-Aug-2011 Kaelyn Uhrain <rikka@google.com> Fix a small bug where DiagnoseEmptyLookup would no longer print any messages
when performing typo correction involving any overloaded template functions.

The added test cases, while currently demontrating sub-optimal behavior, will
not trigger any messages without the 1-line change to SemaExpr.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136943 91177308-0d34-0410-b5e6-96231b3b80d8
unction-overload-typo-crash.cpp
57fb591a54eab7db65d73e77c632f047bca22c54 05-Aug-2011 Ted Kremenek <kremenek@apple.com> Fix assertion failure in -Wuninitialized involving no-op casts. Fixes PR 10577.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136939 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
4d9d157afb35742bc6348defbe45bc6de780ec77 04-Aug-2011 Kaelyn Uhrain <rikka@google.com> Match type names and give more info for out-of-line function definition errors.

Having a function declaration and definition with different types for a
parameter where the types have same (textual) name can occur when an unqualified
type name resolves to types in different namespaces in each location.

The error messages have been extended by adding notes that point to the first
parameter of the function definition that doesn't match the declaration, instead
of a generic "member declaration nearly matches". The generic message is still
used in cases where the mismatch is not in the paramenter list, such as
mismatched cv qualifiers on the member function itself.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136891 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ut-of-line-def-mismatch.cpp
f0c1d8f804e7854bedf3f241409185951ee67866 03-Aug-2011 Kaelyn Uhrain <rikka@google.com> Improve overloaded function handling in the typo correction code.

Change TypoCorrection to store a set of NamedDecls instead of a single
NamedDecl. Also add initial support for performing function overload
resolution to Sema::DiagnoseEmptyLookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136807 91177308-0d34-0410-b5e6-96231b3b80d8
unction-overload-typo-crash.cpp
9e6a1caf18565849cc7bec265bcb0b8af4e1d93a 02-Aug-2011 Chris Lattner <sabre@nondot.org> disable array bounds overflow warning for cases where an array
has a single element. This disables the warning in cases where
there is a clear bug, but this is really rare (who uses arrays
with one element?) and it also silences a large class of false
positive issues with C89 code that is using tail padding in structs.

A better version of this patch would detect when an array is in
a tail position in a struct, but at least patch fixes the huge
false positives that are hitting postgres and other code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136724 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
688761409155b47c39eb5dae1b8c6c8a9f43307a 30-Jul-2011 Douglas Gregor <dgregor@apple.com> Turn off __has_feature(is_empty) and __has_feature(is_pod) if the
libstdc++ hack has reverted these type traits to keywords. Icky, but
fixes <rdar://problem/9836262>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136560 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_is_pod_hack.cpp
c0a575f9b791a25c94b1c3c832dd73ec564646bb 29-Jul-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make DiagnosticErrorTrap keep a count of the errors that occurred so multiple
DiagnosticErrorTraps can be composed (e.g. a trap inside another trap).

Fixes http://llvm.org/PR10462 & rdar://9852007.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136447 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
53afad5ebbfd47e932405af5b93177ea0d68e3f4 29-Jul-2011 Douglas Gregor <dgregor@apple.com> This patch makes the string/character literal tests run in C,
C++98/03, and C++0x mode, from Craig Topper!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136443 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-type-convert-construct.cpp
ype-convert-construct.cpp
db33e14661c7a118a2d9a777ae69c0ecaa036e1e 28-Jul-2011 Caitlin Sadowski <supertri@google.com> Added basic parsing for all remaining attributes, thread safety
analysis. This includes checking that the attributes are applied in the
correct contexts and with the correct number of arguments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136383 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety.cpp
fdde9e719ad75e656a1475a36b06c2f88f0957cc 28-Jul-2011 Caitlin Sadowski <supertri@google.com> Added parsing for guarded_var, pt_guarded_var, lockable,
scoped_lockable, and no_thread_safety_analysis attributes, all for thread safety analysis

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136364 91177308-0d34-0410-b5e6-96231b3b80d8
arn-thread-safety.cpp
5cee1195584fa8672253139c86e922daeda69b9e 27-Jul-2011 Douglas Gregor <dgregor@apple.com> Add support for C++0x unicode string and character literals, from Craig Topper!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136210 91177308-0d34-0410-b5e6-96231b3b80d8
ype-convert-construct.cpp
ef8c79c52200e4f7c32f8ef2744c1557b7f3f3ea 27-Jul-2011 Eli Friedman <eli.friedman@gmail.com> Re-fix r136172 so it isn't an error; apparently, some people are fond of their undefined behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136183 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
e33f643230738400f0bf5503a87d886e9bc635de 27-Jul-2011 Eli Friedman <eli.friedman@gmail.com> Diagnose trying to delete a pointer to an abstract class with a non-virtual destructor. PR10504.

I'm not completely sure the standard allows us to reject this, but if it doesn't, it should. :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136172 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
e52c91478a144f913019591ee1839e1846345f71 27-Jul-2011 Eli Friedman <eli.friedman@gmail.com> A couple minor issues with Sema for delete:

1. Attempting to delete an expression of incomplete class type should be an error, not a warning.

2. If someone tries to delete a pointer to an incomplete class type, make sure we actually emit
the delete expression after we warn.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136161 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
2760455396abd72f0842122170dfab6126c46891 26-Jul-2011 Kaelyn Uhrain <rikka@google.com> Revert r136046 while fixing handling of e.g. &foo[index_one_past_size]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136113 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds-ptr-arith.cpp
rray-bounds.cpp
b48f7c059e74cd5395ca542c1a96be16e42f3d80 26-Jul-2011 Kaelyn Uhrain <rikka@google.com> Expand array bounds checking to work in the presence of unary & and *,
and to work with pointer arithmetic in addition to array indexing.

The new pointer arithmetic porition of the array bounds checking can be
turned on by -Warray-bounds-pointer-arithmetic (and is off by default).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136046 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds-ptr-arith.cpp
rray-bounds.cpp
bf6e3179eaf66b3eca43cbdbd09b71db40fa85fc 23-Jul-2011 Douglas Gregor <dgregor@apple.com> Tests for explicit conversion operators, along with a fix to avoid
considering explicit conversion operators when determining surrogate
functions. Fixes PR10453. Note that there are a few test cases where
Clang is still wrong because it does not implement DR899; see PR10456.

Patch by Jonathan Sauer!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135857 91177308-0d34-0410-b5e6-96231b3b80d8
xplicit.cpp
697d05d579d9f668ac29ab9d2a1bf9a0a45ee5d0 21-Jul-2011 Richard Trieu <rtrieu@google.com> Fix a test in warn-sign-conversion.cpp. Removed a part of a directory path so that the directory seperator, which may change on different platforms, is no longer part of the string checked for.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135665 91177308-0d34-0410-b5e6-96231b3b80d8
arn-sign-conversion.cpp
5254161b269829b74e7a9379b1bdfa27de72d7cc 21-Jul-2011 Richard Trieu <rtrieu@google.com> Remove warning for conditional operands of differend signedness from -Wsign-compare. Cases that previously warn on this will have a different warning emitted from -Wsign-conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135664 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
onditional-expr.cpp
arn-sign-compare.cpp
arn-sign-conversion.cpp
dd4286b5b7b02b8bb962e4b996b8f36cb7935d4f 20-Jul-2011 Ted Kremenek <kremenek@apple.com> Fix -Wuninitialized regression involving functions invalidating parameters passed by reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135610 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
0c8e5a0f70cbdb800d939c1807d05f380b2854d4 19-Jul-2011 Ted Kremenek <kremenek@apple.com> Reduce -Wuninitialized time by 22% (on sqlite) by removing the recursive AST crawl.

This is accomplished by forcing the needed expressions for -Wuninitialized to always be CFGElements in the CFG.
This allows us to remove a fair amount of the code for -Wuninitialized.

Some fallout:
- AnalysisBasedWarnings.cpp now specifically toggles the CFGBuilder to create a CFG that is suitable for -Wuninitialized. This
is a layering violation, since the logic for -Wuninitialized is in libAnalysis. This can be fixed with the proper refactoring.
- Some of the source locations for -Wunreachable-code warnings have shifted. While not ideal, this is okay because that analysis
already needs some serious reworking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135480 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
e5adf59d3a2699752d4981f03927459a38b2df18 15-Jul-2011 Richard Trieu <rtrieu@google.com> Remove warnings of constant operands of logical operators from template instantiations. Upon instantiation of template, value-dependent parameters are replaced by equivalent literals, so code like:

template<unsigned int A, unsigned int B> struct S {
int foo() {
int x = A && B;
}
}

will not warn on A && B on every instantiation. This will still warn on other cases inside templates, which will be caught on checking the template definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135222 91177308-0d34-0410-b5e6-96231b3b80d8
xpressions.cpp
12ce0a085f89f07c76bf034aa6b838ef50542241 15-Jul-2011 Rafael Espindola <rafael.espindola@gmail.com> Revert 135177 to fix PR10363.

Revert "For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either."

This reverts commit ac420c5053d6aa41d59f782caad9e46e5baaf2c2.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135210 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
eneralized-initializers.cpp
cf6b0a20c697ba8daf2dff3a4cce2a028b33cb48 14-Jul-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR10359: Template declarations which define classes are not permitted to also contain declarators. Previously we would accept code like this:

template<typename T> struct S { } f() { return 0; }

This case now produces a missing ';' diagnostic, since that seems like a much more likely error than an attempt to declare a function or variable in addition to the class template.

Treat this


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135195 91177308-0d34-0410-b5e6-96231b3b80d8
R9459.cpp
ac420c5053d6aa41d59f782caad9e46e5baaf2c2 14-Jul-2011 Sebastian Redl <sebastian.redl@getdesigned.at> For C++11, do more checking of initializer lists up-front, enabling some subset of the final functionality. C just leaves the function early. C++98 runs through the same code path, but has no changed functionality either.
This is a first baby step towards supporting generalized initializer lists. This also removes an aggregate
test case that was just plain wrong, assuming that non-aggregates couldn't be initialized with initializer lists
in C++11 mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135177 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
eneralized-initializers.cpp
dc998b44454eb39fa39d701712cb8f448f2612c1 14-Jul-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Fix problems Johannes noticed, and extend test cases further.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135176 91177308-0d34-0410-b5e6-96231b3b80d8
eneralized-initializers.cpp
87c1f1f7c400deb2eb40d4599a40006072fb948c 14-Jul-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR8800: When building a conversion to A& using a member operatorA&(), do not require A to be a complete type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135101 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
1255aaf10285ca60f236b4fe7c326b629b5cf788 13-Jul-2011 Douglas Gregor <dgregor@apple.com> Fix an incorrect namespace typo-correction diagnostic, from Kaelyn
Uhrain! Fixes PR10318.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135086 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
84ff0fccb180098b70504c03c3072a19e6d573af 13-Jul-2011 John McCall <rjmccall@apple.com> Enforce access control for the destructor in a new[] expression and mark
it as used. Otherwise, we can fail to instantiate or validate the destructor,
which can lead to crashes in IR gen like PR10351.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135073 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
701d1e77aca7e86348386fdeadcd56ca650f95ad 12-Jul-2011 Hans Wennborg <hans@hanshq.net> Fix typo correction crash on overloaded functions, pr10283.

It would be cool if we could do overload resolution to suggest
the right function, but at least this fixes the crashing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134976 91177308-0d34-0410-b5e6-96231b3b80d8
unction-overload-typo-crash.cpp
cdb8076dd9cfb975a1bcb3e7cb58a59648c35af0 11-Jul-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed PR10243.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134892 91177308-0d34-0410-b5e6-96231b3b80d8
R10243.cpp
9dc71d2fddcd283e07d45f3894c8559e2f7dd9a7 06-Jul-2011 John McCall <rjmccall@apple.com> Fixed enum types can be complete without actually being valid to use
as scope specifiers; diagnose the attempt, rather than letting it go
to an assert. The rest of PR10264.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134479 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
57c13008c634f47d8ca1b6aa9d7965d82a05c502 06-Jul-2011 John McCall <rjmccall@apple.com> Properly protect colons when parsing a nested-name-specifier as part
of an enum specifier in dialects which permit fixed underlying types.
Fixes the rejects-valid part of PR10264.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134468 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
9a30c9946e898e595eb71f23dc9a60303428998b 05-Jul-2011 Douglas Gregor <dgregor@apple.com> ActOnCXXConditionDeclaration should take into account that
ActOnDeclarator can return NULL. Fixes PR10270, from Hans Wennborg!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134416 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
31fd2b7881efc6b7b1e466823c10c64ba5ddffe3 01-Jul-2011 Richard Trieu <rtrieu@google.com> For code such as:

int f(int x) {
if (int foo = f(bar)) {}
return 0;
}

Clang produces the following error messages:

paren_imbalance.cc:2:19: error: use of undeclared identifier 'bar'
if (int foo = f(bar)) {}
^
paren_imbalance.cc:2:26: error: expected ')'
if (int foo = f(bar)) {}
^
paren_imbalance.cc:2:6: note: to match this '('
if (int foo = f(bar)) {}
^

The second error is incorrect. This patch will stop Clang from producing an error on parenthesis imbalance during error recovery when there isn't one.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134258 91177308-0d34-0410-b5e6-96231b3b80d8
opy-assignment.cpp
304e233921bcd3b55f68c6e8a2960630edf17ff0 01-Jul-2011 Richard Trieu <rtrieu@google.com> Fix for PR7410. Allow functions in a derived class that improperly overwrite a virtual function in the base class to be inserted into the derived class function list to prevent extra errors every time the derived class is used.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134251 91177308-0d34-0410-b5e6-96231b3b80d8
R7410.cpp
150fee8b2ba3ea6faa12e68cb58adc5e2fc73825 30-Jun-2011 Hans Wennborg <hans@hanshq.net> Move test/Sema/return.cpp into test/SemaCXX/return.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134171 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
ea4aba0e97ca71369a0f6e287443b670cf5c353f 30-Jun-2011 John McCall <rjmccall@apple.com> Perform lvalue-to-rvalue conversions on both operands of ->*
and the RHS of .*. Noticed by Enea Zaffanella!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134170 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
d8bba9c15230d2b1b3893e272106aa79efc50251 28-Jun-2011 Douglas Gregor <dgregor@apple.com> Add support for C++ namespace-aware typo correction, e.g., correcting

vector<int>

to

std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134007 91177308-0d34-0410-b5e6-96231b3b80d8
issing-namespace-qualifier-typo-corrections.cpp
db7abf78dedc2ef6ccb42b3dac6ab330fe2ea469 28-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Remove the call to GetTypeForDeclarator in Sema::ActOnCXXConditionDeclaration.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133984 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
2ba68b29645a1d0acb86348b61f137e0ade8864b 28-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Cut down a few of the excess errors in the test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133983 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
239cad79cb5be7a0b29f9e0883203695d40079a8 27-Jun-2011 John McCall <rjmccall@apple.com> Update test for r133934.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133942 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ae19806d2cae48b3ba8160fe5914b6436e51cf62 27-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Fix missing braces around two statements that were intended to be part
of a single if block. This is really annoying to track down and test.
Silly changes to the test case caused it to stop showing up. I wish
there were a more concrete way of asserting that a note attaches to the
intended diagnostic.

This fixes PR10195.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133907 91177308-0d34-0410-b5e6-96231b3b80d8
arn-pure-virtual-call-from-ctor-dtor.cpp
13b21be065e9feb0759303bd51b8e8653130f0fb 27-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Factor out (some of) the checking for invalid forms of pointer
arithmetic into a couple of common routines. Use these to make the
messages more consistent in the various contexts, especially in terms of
consistently diagnosing binary operators with invalid types on both the
left- and right-hand side. Also, improve the grammar and wording of the
messages some, handling both two pointers and two (different) types.

The wording of function pointer arithmetic diagnostics still strikes me
as poorly phrased, and I worry this makes them slightly more awkward if
more consistent. I'm hoping to fix that with a follow-on patch and test
case that will also make them more helpful when a typedef or template
type parameter makes the type completely opaque.

Suggestions on better wording are very welcome, thanks to Richard Smith
for some initial help on that front.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133906 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
1ab0d90af489b5441d0bf25338d420ddae3ece74 25-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix a couple more issues related to r133854:

When performing semantic analysis on a member declaration, fix the check for whether we are declaring a function to check for parenthesized declarators, declaration via decltype, etc.

Also fix the semantic check to not treat FuncType* as a function type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133862 91177308-0d34-0410-b5e6-96231b3b80d8
irtuals.cpp
555f57e3549fb5cc963a2ce38180c4f3643a6f95 25-Jun-2011 Douglas Gregor <dgregor@apple.com> When deciding how to parse "= something" as part of a member
declaration, determine whether the declaration will end up declaring a
function using semantic criteria (e.g., it will have function type)
rather than purely syntactic criteria (e.g., it has the form of a
function declarator). Fixes <rdar://problem/9670557>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133854 91177308-0d34-0410-b5e6-96231b3b80d8
irtuals.cpp
a7bf7bbdb1f89c35a09bc525c6862525ae82778f 24-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Only do delayed diagnostics if there were no errors when parsing the decl.

Fixes crash in http://llvm.org/PR10109 & rdar://9584039.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133816 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
c39b6bc958982171b45c658389840a6241739a5e 24-Jun-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> This patch started as an attempt to fix up the horrid naming
conventions. I then discovered a typo in the using declaration bit in
LookupSpecialMember. This led to discovering [namespace.udecl]p15, which
clang implements incorrectly. Thus I've added a comment and implemented
the code consistently with the rest of clang - that is incorrectly.

And because I don't want to include tests of something incorrect, I've
ripped the test out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133784 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-assignment-cache.cpp
b9b4b789ebd28d6fde1c42de820b036ffaf95162 23-Jun-2011 Eli Friedman <eli.friedman@gmail.com> Fix Sema::CheckVectorOperands so that it doesn't try to insert a cast expression into the LHS of a compound assignment. Fixes compound assignment of various "compatible" vector types, including NEON-vector and gcc-vector types.

<rdar://problem/9640356>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133737 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
572bbec2e0e23f684108e3a410a67c8c60ff9179 23-Jun-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Allow unavailable function calls inside unavailable functions in C++/ObjC++ as well. rdar://9660196

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133672 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
4cc12c6e47a200cf166ac21efc09dd033f34c9b2 23-Jun-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Clean up the heart of the caching code and miss fewer edge cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133671 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-assignment-cache.cpp
4f0845ec62d5fb8be5d07adc09c54944ab952e5c 23-Jun-2011 Douglas Gregor <dgregor@apple.com> Check for placeholders early on in
Sema::CreateUnaryExprOrTypeTraitExpr() rather than recursing in some
cases. Fixes <rdar://problem/9659191>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133663 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
e3499cae8e5323ac553ad56977bf1cd42b9a5a35 22-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR10168: don't warn for unused non-dependent variables in both the template definition and each instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133580 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-unused.cpp
arn-unused-variables.cpp
cd6f36693ed40cef8c8639c04438d865187c1f73 22-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> First part of PR9968: the __range variable in a dependent C++11 for-range statement is implicitly used by that statement.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133572 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-unused.cpp
bc9bd0e79a235a0f406695658fa503dd2a3cc65c 20-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Use an explicitly 64-bit triple flag to ensure we can easily verify the
types printed in various diagnostics.

We could omit checking for the types, but that can mask errors where the
wrong type is streamed into the diagnostic. There was at least one of
these caught by this test already.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133429 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
ae0bafa229d076a0fb90b5aeccea7e3039c58751 20-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Fix a problem with the diagnostics of invalid arithmetic with function
pointers I found while working on the NULL arithmetic warning. We here
always assuming the LHS was the pointer, instead of using the selected
pointer expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133428 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
1567a8ba8daaaa91a5de3c23026c9c19de017bd1 20-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Move away from the poor "abstraction" I added to Type. John argued
effectively that this abstraction simply doesn't exist. That is
highlighted by the fact that by using it we were papering over a more
serious error in this warning: the fact that we warned for *invalid*
constructs involving member pointers and block pointers.

I've fixed the obvious issues with the warning here, but this is
confirming an original suspicion that this warning's implementation is
flawed. I'm looking into how we can implement this more reasonably. WIP
on that front.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133425 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
2af68e4761ed30181540dafb5572993daffa4910 19-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Add test cases for false positives on -Wnull-arithmetic from Richard
Trieu, and fix them by checking for array and function types as well as
pointer types.

I've added a predicate method on Type to bundle together the logic we're
using here: isPointerLikeType(). I'd welcome better names for this
predicate, this is the best I came up with. It's implemented as a switch
to be a touch lighter weight than all the chained isa<...> casts that
would result otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133383 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
ullptr_in_arithmetic_ops.cpp
e3d49b44ad0596b2998ecf2e7ca78d59188920e5 19-Jun-2011 Francois Pichet <pichet2000@gmail.com> Handle decltype keyword in Parser::isDeclarationSpecifier.
Fixes PR10154. Found by parsing MFC 2010 code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133380 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype.cpp
4e938df04897ebc196d92b4f7f77b19f204e9d24 17-Jun-2011 Richard Trieu <rtrieu@google.com> Put the new warning from revision 133196 on NULL arithmetic behind the flag -Wnull-arthimetic and set to DefaultIgnore. A few edge cases need to be worked out before this can be set to default.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133287 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
8d5e18c69e007f5d0f447b4a716088589a827857 17-Jun-2011 Douglas Gregor <dgregor@apple.com> Check for placeholder expressions before promoting an argument passed
through an ellipsis. Fixes <rdar://problem/9623945>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133219 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-name.cpp
3e95ba94fd34c5f6420c57d7732f601875074681 16-Jun-2011 Richard Trieu <rtrieu@google.com> Add a new warning when a NULL constant is used in arithmetic operations. The warning will fire on cases such as:

int x = 1 + NULL;



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133196 91177308-0d34-0410-b5e6-96231b3b80d8
ull_in_arithmetic_ops.cpp
ullptr_in_arithmetic_ops.cpp
707a23e8b87410332b55bb4534fa1c799edef38a 16-Jun-2011 Douglas Gregor <dgregor@apple.com> Teach the warning about non-POD memset/memcpy/memmove to deal with the
__builtin_ versions of these functions as well as the normal function
versions, so that it works on platforms where memset/memcpy/memmove
are macros that map down to the builtins (e.g., Darwin). Fixes
<rdar://problem/9372688>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133173 91177308-0d34-0410-b5e6-96231b3b80d8
arn-bad-memaccess.cpp
000d428347f352979e0f6dffcf0a64e73af0a2b5 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Rework the warning for 'memset(p, 0, sizeof(p))' where 'p' is a pointer
and the programmer intended to write 'sizeof(*p)'. There are several
elements to the new version:

1) The actual expressions are compared in order to more accurately flag
the case where the pattern that works for an array has been used, or
a '*' has been omitted.
2) Only do a loose type-based check for record types. This prevents us
from warning when we happen to be copying around chunks of data the
size of a pointer and the pointer types for the sizeof and
source/dest match.
3) Move all the diagnostics behind the runtime diagnostic filter. Not
sure this is really important for this particular diagnostic, but
almost everything else in SemaChecking.cpp does so.
4) Make the wording of the diagnostic more precise and informative. At
least to my eyes.
5) Provide highlighting for the two expressions which had the unexpected
similarity.
6) Place this diagnostic under a flag: -Wsizeof-pointer-memaccess

This uses the Stmt::Profile system for computing #1. Because of the
potential cost, this is guarded by the warning flag. I'd be interested
in feedback on how bad this is in practice; I would expect it to be
quite cheap in practice. Ideas for a cheaper / better way to do this are
also welcome.

The diagnostic wording could likely use some further wordsmithing.
Suggestions welcome here. The goals I had were to: clarify that its the
interaction of 'memset' and 'sizeof' and give more reasonable
suggestions for a resolution.

An open question is whether these diagnostics should have the note
attached for silencing by casting the dest/source pointer to void*.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133155 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
c7b993b4dfc14ca2389087f21467259de8af7e91 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Fix my test case from r133136 so that it actually represents the code
pattern found in the wild where this warning was firing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133143 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
5546e69729b9f195afd0410948e013206618b717 16-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Skip both character pointers and void pointers when diagnosing bad
argument types for mem{set,cpy,move}. Character pointers, much like void
pointers, often point to generic "memory", so trying to check whether
they match the type of the argument to 'sizeof' (or other checks) is
unproductive and often results in false positives.

Nico, please review; does this miss any of the bugs you were trying to
find with this warning? The array test case you had should be caught by
the array-specific sizeof warning I think.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133136 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
55080a78c81733021b45fc3a47541619e4470883 15-Jun-2011 Nico Weber <nicolasweber@gmx.de> Build fix attempt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133039 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
e4a1c64700304459ac436fe29cb498f2da3b6194 14-Jun-2011 Nico Weber <nicolasweber@gmx.de> Warn on memset(ptr, 0, sizeof(ptr)). Diagnostic wording by Jordy Rose.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132996 91177308-0d34-0410-b5e6-96231b3b80d8
arn-memset-bad-sizeof.cpp
e1eed38733ed47d44f9d8c7731817c411eaf4141 14-Jun-2011 Chris Lattner <sabre@nondot.org> when compiling in a GNU mode (e.g. gnu99) treat VLAs with a size that can be folded to a constant
as constant size arrays. This has slightly different semantics in some insane cases, but allows
us to accept some constructs that GCC does. Continue to be pedantic in -std=c99 and other
modes. This addressed rdar://8733881 - error "variable-sized object may not be initialized"; g++ accepts same code


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132983 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
24c38e1ff057ce49c866294bf486444255e18f31 14-Jun-2011 Chris Lattner <sabre@nondot.org> fix rdar://9204520 - Accept int(0.85 * 10) as an initializer in a class member
as an extension.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132980 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
0adde128d96a73864569516e684faa570e3c0333 14-Jun-2011 David Majnemer <david.majnemer@gmail.com> Properly diagnose using abstract and incomplete types in va_arg

- Move a test from test/SemaTemplate/instantiate-expr-3.cpp, it did not belong there
- Incomplete and abstract types are considered hard errors


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132979 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
c2cdd5354aba8d6a74c45231829f3bbbbfeb2781 12-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> Don't assert on initialized typedef declarations in classes:

struct {
typedef int A = 0;
};

According to the C++11 standard, this is not ill-formed, but does not have any ascribed meaning. We can't reasonably accept it, so treat it as ill-formed.

Also switch C++ from an incorrect 'fields can only be initialized in constructors' diagnostic for this case to C's 'illegal initializer (only variables can be initialized)'



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132890 91177308-0d34-0410-b5e6-96231b3b80d8
ember-init.cpp
7a614d8380297fcd2bc23986241905d97222948c 11-Jun-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for C++11 in-class initialization of non-static data members.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132878 91177308-0d34-0410-b5e6-96231b3b80d8
R9572.cpp
lass.cpp
mplicit-exception-spec.cpp
ember-init.cpp
ype-traits.cpp
6f95f1be1807ca0695edf4c8773b70218a9ab731 10-Jun-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Uncomment this testcase now that we pass it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132842 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
bbf34c024398e7bae825686dcff4c3b901ec9f89 10-Jun-2011 Richard Trieu <rtrieu@google.com> Made changes to how 'struct'/'class' mismatches are handled in -Wmismatched-tags.
- Removed fix-it hints from template instaniations since changes to the
templates are rarely helpful.
- Changed the caret in template instaniations from the class/struct name to the
class/struct keyword, matching the other warnings.
- Do not offer fix-it hints when multiple declarations disagree. Warnings are
still given.
- Once a definition is found, offer a fix-it hint to all previous declarations
with wrong tag.
- Declarations that disagree with a previous definition will get a fix-it hint
to change the declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132831 91177308-0d34-0410-b5e6-96231b3b80d8
truct-class-redecl.cpp
2e283f00fe9502150cf41bb1db70a5cd16693794 06-Jun-2011 Eli Friedman <eli.friedman@gmail.com> Start fixing up clang tests to work on the clang-native-arm-cortex-a9 builder.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132691 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-regparm.cpp
064e2366cc42ef81e939afbdaf3099af58e6620e 05-Jun-2011 Sebastian Redl <sebastian.redl@getdesigned.at> More std::initializer_list tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132663 91177308-0d34-0410-b5e6-96231b3b80d8
eneralized-initializers.cpp
dbef1bb8a8118b7b73e184e08fccfe0eaf914dda 05-Jun-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Parse C++0x generalized initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132662 91177308-0d34-0410-b5e6-96231b3b80d8
eneralized-initializers.cpp
262b62b8f4d9495ad411941b10cffe92317fc9b8 05-Jun-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Expand on braced init list tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132661 91177308-0d34-0410-b5e6-96231b3b80d8
eneralized-initializers.cpp
4ae5b7208ef72dec2a79d3d1c602cb47e9750d69 05-Jun-2011 Douglas Gregor <dgregor@apple.com> Identity and non-identity standard conversion sequences can be
compared even when one is a reference binding and the other is not
(<rdar://problem/9173984>), but the definition of an identity sequence
does not involve lvalue-to-rvalue adjustments (PR9507). Fix both
inter-related issues.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132660 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
0a62984eab0ab25ed0d0d974e6753a75447e404e 03-Jun-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> I've had too much to drink, apparently.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132566 91177308-0d34-0410-b5e6-96231b3b80d8
efault-arg-special-member.cpp
78e9c55c9acc85d82f4dd53a49c05310b4b56a1b 03-Jun-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a warning flag for the warning about default arguments making
special member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132564 91177308-0d34-0410-b5e6-96231b3b80d8
efault-arg-special-member.cpp
a08fcb8105bf53f3640ad17f61bdcde2d8ace78a 03-Jun-2011 Hans Wennborg <hans@hanshq.net> Make -Wignored-qualifiers point to the first ignored qualifier.

In code such as "char* volatile const j()", Clang warns that "volatile
const" will be ignored. Make it point to the first ignored qualifier,
and simplify the code a bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132563 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
929f0135ab60166202f52e0dd19835c0490d792a 03-Jun-2011 Chandler Carruth <chandlerc@gmail.com> Clean up the "non-POD memaccess" stuff some. This adds a properly named
diagnostic group to cover the cases where we have definitively bad
behavior: dynamic classes.

It also rips out the existing support for POD-based checking. This
didn't work well, and triggered too many false positives. I'm looking
into a possibly more principled way to warn on the fundamental buggy
construct here. POD-ness isn't the critical aspect anyways, so a clean
slate is better. This also removes some silliness from the code until
the new checks arrive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132534 91177308-0d34-0410-b5e6-96231b3b80d8
arn-bad-memaccess.cpp
arn-non-pod-memset.cpp
8d7946151cd15c0e7c34250c122d59b2f5027999 01-Jun-2011 Nick Lewycky <nicholas@mxc.ca> Even a return statement of an expression with a dependent type in a void
function might need to clean up its temporaries. Fixes PR10057.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132390 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
b4746036322385bf27d33ec1fc3c82a8bb3d1e58 01-Jun-2011 Francois Pichet <pichet2000@gmail.com> Microsoft friend acting as a forward declaration; try#2. Now only 2 lines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132387 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
5aecb786a32d321e8d3462cd49e50092e8d55cd3 01-Jun-2011 Francois Pichet <pichet2000@gmail.com> Revert 132332 (Microsoft friend as a forward declaration), John McCall pointed out a better/simpler way to do it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132369 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
eea06c609b73afc7bcfdf3e101efb8d9e7b3560c 31-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Ensure we enter an unevaluated context when instantiating a noexcept
expression. Fixes bug raised by hhinnant to cfe-dev

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132350 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-noexcept-unevaluated.cpp
8adc227de934e23c72eb8d9abf5c0e3dfffec131 31-May-2011 Francois Pichet <pichet2000@gmail.com> For compatibility with MSVC, a friend declaration also act as a forward declaration if the tag name is not already declared. The tag name is declared in the next outermost non record scope.
Example:

class A {
friend class B;
B* b;
};
B* global_b;


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132332 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
8155910a192dafa423d6b932b7d127d48e4641e8 31-May-2011 Nick Lewycky <nicholas@mxc.ca> Whenever we instantiate a static data member, make sure to define any new
vtables! Fixes PR10020

This also allows us to revert the part of r130023 which added a big loop around
the template instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132331 91177308-0d34-0410-b5e6-96231b3b80d8
table-instantiation.cc
0683a1418b28b289eca4cb602ac69780f9e0a609 31-May-2011 Chandler Carruth <chandlerc@gmail.com> Expand the coverage of the warning for constants on the RHS of logical operands:

return f() || -1;

where the user meant to write '|'.

This bootstraps without any additional warnings.

Patch by Richard Trieu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132327 91177308-0d34-0410-b5e6-96231b3b80d8
xpressions.cpp
witch.cpp
1838ca5618bc6c84ca3d13d84717bf32d9862bb3 29-May-2011 Richard Trieu <rtrieu@google.com> Add a new warning on NULL pointer constant to integer conversion.

This path was reviewed by Chandler Carruth at http://codereview.appspot.com/4538074/



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132297 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
9ae60d54e4454192384933f3020968ea5c8c3540 26-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a new warning for when adding a default argument to a method
makes it into a special member function. This is very bad and can lead
to all sorts of nastiness including implicit member functions violating
the One Definition Rule. This should probably be made ill-formed in a
later version of the standard, but for now we'll just warn.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132104 91177308-0d34-0410-b5e6-96231b3b80d8
opy-constructor-error.cpp
efault-arg-special-member.cpp
ca63c200346c0ca9e00194ec6e34a5a7b0ed9321 25-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a new type node, UnaryTransformType, designed to represent a
type that turns one type into another. This is used as the basis to
implement __underlying_type properly - with TypeSourceInfo and proper
behavior in the face of templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132017 91177308-0d34-0410-b5e6-96231b3b80d8
nderlying_type.cpp
6f0074ae2f466bae9f415da268d61a2dc1fabe26 24-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add new warning that warns when invoking 'delete' on a polymorphic, non-final, class without a virtual destructor.

Patch by Matthieu Monrocq!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131989 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
1f8f2d52ff3712770a49f318a687b0c8b0ada9d0 24-May-2011 Chandler Carruth <chandlerc@gmail.com> Fix a bug in -Wundefined-reinterpret-cast where we failed to look
through sugared types when testing for TagTypes. This was the actual
cause of the only false positive in Clang+LLVM.

Next evaluation will be over a much larger selection of code including
large amounts of open source code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131957 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
0f161593b36584ec447e5268dbed2953489854d8 24-May-2011 Francois Pichet <pichet2000@gmail.com> MSVC doesn't do any validation regarding exception specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131950 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
b2ee8305f878259613b65d0f96a03f7f852977ea 23-May-2011 Francois Pichet <pichet2000@gmail.com> Emulate a MSVC bug where if during an using declaration name lookup, the declaration found is unaccessible (private) and that declaration was bring into scope via another using declaration whose target declaration is accessible (public) then no error is generated.

Example:
class A { public: int f(); };
class B : public A { private: using A::f; };
class C : public B { private: using B::f; };

Here, B::f is private so this should fail in Standard C++, but because B::f refers to A::f which is public MSVC accepts it.

This fixes 1 error when parsing MFC code with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131896 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
84ee2eeec9f63e4938bafd060105fa4f0c9cd89b 22-May-2011 Douglas Gregor <dgregor@apple.com> Audit and finish the implementation of C++0x nullptr, fixing two
minor issues along the way:
- Non-type template parameters of type 'std::nullptr_t' were not
permitted.
- We didn't properly introduce built-in operators for nullptr ==,
!=, <, <=, >=, or > as candidate functions .

To my knowledge, there's only one (minor but annoying) part of nullptr
that hasn't been implemented: catching a thrown 'nullptr' as a pointer
or pointer-to-member, per C++0x [except.handle]p4.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131813 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
b0844c6f07d8c9c6c9c3095201879593611b9e79 21-May-2011 Douglas Gregor <dgregor@apple.com> Classify bound member function types are member function types. Fixes
PR9973 / <rdar://problem/9479191>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131810 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
930a9abb7eb171d706c9e17a27bbcd267f0d9b3d 21-May-2011 Douglas Gregor <dgregor@apple.com> Fix our handling of the warning when one tries to pass a
non-POD/non-trivial object throuugh a C-style varargs. The warning
itself was default-mapped to error, but can be downgraded, but we were
treating it in Sema like a hard error, silently dropping the call.

Instead, treat this problem like a warning, and do what the warning
says we do: abort at runtime. To do so, we fake up a __builtin_trap()
expression that gets evaluated as part of the argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131805 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
e3406826db726960ede77dd18361eb327d30c108 20-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Add a missing case for default constructor deletion.

This case is tested by the fact that the modified test produces
significatly worse diagnostics. That's on the list.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131759 91177308-0d34-0410-b5e6-96231b3b80d8
alue-initialization.cpp
ce7cd26dd03f514cb772ac8d95ef0a1e6cbfc846 20-May-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Introduce XFAILed test for braced initializer lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131754 91177308-0d34-0410-b5e6-96231b3b80d8
eneralized-initializers.cpp
dca3973d4a92f9cd681408964fb705c6f66becd7 20-May-2011 Eli Friedman <eli.friedman@gmail.com> Fix test on Windows.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131691 91177308-0d34-0410-b5e6-96231b3b80d8
nderlying_type.cpp
c9858bcf499078f58ebe7dcbede928cc0fa7a203 19-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Add a test for __underlying_type

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131670 91177308-0d34-0410-b5e6-96231b3b80d8
nderlying_type.cpp
0ee33912f8ec3453856c8a32ed2c2e8007bed614 19-May-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Reapply r121528, fixing PR9941 by delaying the exception specification check for destructors until the class is complete and destructors have been adjusted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131632 91177308-0d34-0410-b5e6-96231b3b80d8
r9941.cpp
1d78032167c2f2d470e4270aadcb07ff71e6c7e1 18-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Revert r121528 as it breaks a simple testcase, which leads to, among
other things, libcxx not building.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131573 91177308-0d34-0410-b5e6-96231b3b80d8
r9941.cpp
71a682f98a1e79c84e95e45f94041bcd7a694ef5 18-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement an additional fix for infinite recursion of deleted special
member functions by making sure that they're on the record before
checking for deletion.

Also make sure source locations are valid to avoid crashes.

Unfortunately, the declare-all-implicit-members approach is still
required in order to ensure that dependency loops do not result in
incorrectly deleting functions (since they are to be deleted at the
declaration point per the standard).

Fixes PR9917

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131520 91177308-0d34-0410-b5e6-96231b3b80d8
efaulted-ctor-loop.cpp
be63122e65ea06010c4ce06a77276bcb29a575b6 17-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Fix some minor bugs and add a lot more test cases for defaulted
constructors, including two more FIXMEs (one of which I don't actually
understand).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131487 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-cursory-default-delete.cpp
f1922d299be143f65b9c349e7f7b4ed5d0a90965 17-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Add some more tests.

I have on that's #if 0'ed out, and I don't know why it's failing to
delete the constructor. I'd appreciate if someone familiar with access
control could look into ShouldDeleteDefaultConstructor - thanks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131486 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-deleted-default-ctor.cpp
1f2f384eb7d0ea368819fe9cc4cc20a4b337ebea 17-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement some tests for defaulted constructors. To do this I had to
suppress an error we were previously emitting on valid union code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131440 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-defaulted-functions.cpp
xx0x-deleted-default-ctor.cpp
efault-constructor-initializers.cpp
cf34e757b968f1fa7965cab1464212ade4d9f991 17-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement the new C++0x rules for non-trivial things in unions so that
my defaulted constructor tests stop yelling at me about them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131432 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-nontrivial-union.cpp
e1e96a6201168c232a06ec81685f948e05fddd39 14-May-2011 Francois Pichet <pichet2000@gmail.com> Revert 131347. It asserts if the specialization in within a class template:

template<class U>
struct X1 {
template<class T> void f(T*);
template<> void f(int*) { }
};

Won't be so simple. I need to think more about it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131362 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
1fa8028d9ff5de64f8b9d55731ca83a2d3423a77 14-May-2011 Francois Pichet <pichet2000@gmail.com> In Microsoft mode, allow template function explicit specialization at class scope.
Necessary to parse MFC and MSVC standard lib code.

Example:
struct X {
template<class T> void f(T) { }
template<> void f(int) { }
}


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131347 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
1804174e1591bf59118f317775b48edd0382c3f0 14-May-2011 Richard Smith <richard-llvm@metafoo.co.uk> PR9908: Fix the broken fix for PR9902 to get the template argument lists in the right order.
Also, don't reject alias templates in all ElaboratedTypes: some ElaboratedTypes do not correspond to elaborated-type-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131342 91177308-0d34-0410-b5e6-96231b3b80d8
R9908.cpp
7880bc34fd5818d8f1eb827fdce136c1de643ab5 13-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a few basic tests for defaulted and deleted functions.

More comprehensive testing once copy {constructors,assignment operators}
can be defaulted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131275 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function-extension.cpp
feb375d31b7e9108b04a9f55b721d5e0c793a558 13-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement the __is_trivially_copyable type trait

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131270 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
aff37b48f1362dd29cc481dadebf07900ce79248 12-May-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR9902: correctly substitute alias templates within the template in which they are defined: provide an empty list of arguments for each containing template context during substitution.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131211 91177308-0d34-0410-b5e6-96231b3b80d8
R9902.cpp
30aff5b794599fac45cd8716412caf32f29ccb7e 12-May-2011 Francois Pichet <pichet2000@gmail.com> In Microsoft mode, allow conversion from pointer to integral type no matter what size the integral type is. Necessary to parse MFC code.

Example:
void f(char *ptr) {
char var = (char)ptr;
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131201 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
1de85338543dd6228eb518185e385d94d377f4cb 11-May-2011 John McCall <rjmccall@apple.com> Teach CFG building how to deal with CXXMemberCallExprs and BoundMemberTy,
then teach -Wreturn-type to handle the same. Net effect: we now correctly
handle noreturn attributes on member calls in the CFG.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131178 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-noreturn.cpp
f961ea5716867b5e426fb2136edd6d1f04c3a7ca 10-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Re-do R131114 without breaking code.

I've edited one diagnostic which would print "copy constructor" for copy
constructors and "constructor" for any other constructor. If anyone is
extremely enamored with this, it can be reinstated with a simple boolean
flag rather than calling getSpecialMember, which is inappropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131143 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-member-functions.cpp
8d6dd72e79a847e8eb4a72f108362664b237c44b 10-May-2011 Rafael Espindola <rafael.espindola@gmail.com> Add test for PR9884.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131127 91177308-0d34-0410-b5e6-96231b3b80d8
R9884.cpp
7604f64a865bdba86c05cab76bcd47fd10372eb8 10-May-2011 Douglas Gregor <dgregor@apple.com> Ignore const/volatile/restrict qualifiers on anonymous structs and
unions. Fixes PR8326.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131109 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
93b6bceb0f009942e8a9e97d8c5c316ad10338f2 09-May-2011 Douglas Gregor <dgregor@apple.com> Extend the tag-ambiguity hack I committed in r130810 for tag
definitions to also include tag declarations. Fixes PR8151.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131102 91177308-0d34-0410-b5e6-96231b3b80d8
ag-ambig.cpp
37b8c9ee7cf2b4d5ce3ccd3be1fcadd18a783a57 09-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Clean up trivial default constructors now.

hasTrivialDefaultConstructor() really really means it now.

Also implement a fun standards bug regarding aggregates. Doug, if you'd
like, I can un-implement that bug if you think it is truly a defect.

The bug is that non-special-member constructors are never considered
user-provided, so the following is an aggregate:

struct foo {
foo(int);
};

It's kind of bad, but the solution isn't obvious - should

struct foo {
foo (int) = delete;
};

be an aggregate or not?

Lastly, add a missing initialization to FunctionDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131101 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
b594fac7007281ef52e2746349abf970348661ff 09-May-2011 Francois Pichet <pichet2000@gmail.com> Fix test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131077 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
a8ef3ac9fa7637fad33d52614794b92e2261d65b 09-May-2011 Francois Pichet <pichet2000@gmail.com> Allow implicit conversion from function pointer to void* in Microsoft mode.
Necessary to parse MFC code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131076 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
10620eb5164e31208fcbf0437cd79ae535ed0559 06-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Modify some deleted function methods to better reflect reality:

- New isDefined() function checks for deletedness
- isThisDeclarationADefinition checks for deletedness
- New doesThisDeclarationHaveABody() does what
isThisDeclarationADefinition() used to do
- The IsDeleted bit is not propagated across redeclarations
- isDeleted() now checks the canoncial declaration
- New isDeletedAsWritten() does what it says on the tin.
- isUserProvided() now correct (thanks Richard!)

This fixes the bug that we weren't catching

void foo() = delete;
void foo() {}

as being a redefinition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131013 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
2174d4c11c1544a6729637790637b765e35b67a3 06-May-2011 Anders Carlsson <andersca@mac.com> Warn when trying to call a pure virtual member function in a class from the class constructor/destructor. Fixes PR7966.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130982 91177308-0d34-0410-b5e6-96231b3b80d8
arn-pure-virtual-call-from-ctor-dtor.cpp
3e4c6c4c79a03f5cb0c4671d7c282d623c6dc35e 05-May-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement support for C++0x alias templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130953 91177308-0d34-0410-b5e6-96231b3b80d8
lias-template.cpp
ttr-cxx0x.cpp
ependent-types.cpp
edeclared-alias-template.cpp
b6adf2c889bb17c1be44e6c8e67e3b2762e9cecc 05-May-2011 Douglas Gregor <dgregor@apple.com> Scoped enumerations should not be treated as integer types (in the C
sense). Fixes <rdar://problem/9366066> by eliminating an inconsistency
between C++ overloading (which handled scoped enumerations correctly)
and C binary operator type-checking (which didn't).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130924 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
439d3c3d76f858df5f25239f2a70f04312eacb5b 05-May-2011 Douglas Gregor <dgregor@apple.com> With invalid overloaded operators, we can get into funny cases where
the overloading of member and non-member functions results in arity
mismatches that don't fit well into our overload-printing scheme. This
only happens for invalid code (which breaks the arity invariants for
these cases), so just suppress the diagnostic rather than inventing
anything new. Fixes <rdar://problem/9222009>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130902 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
c9366ba8fff6461a5b7f0fd2626d1bce3e98e629 05-May-2011 Matt Beaumont-Gay <matthewbg@google.com> Implement Sema::isExprCallable.

We can use this to produce nice diagnostics (and try to fixit-and-recover) in
various cases where we might see "MyFunction" instead of "MyFunction()". The
changes in SemaExpr are an example of how to use isExprCallable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130878 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
fe57eef44cc80e5bb51e4f484835be08b8d84256 04-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement a better version of delegating constructor cycle detection.

This is more efficient as it's all done at once at the end of the TU.
This could still get expensive, so a flag is provided to disable it. As
an added bonus, the diagnostics will now print out a cycle.

The PCH test is XFAILed because we currently can't deal with a note
emitted in the header and I, being tired, see no other way to verify the
serialization of delegating constructors. We should probably address
this problem /somehow/ but no good solution comes to mind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130836 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-delegating-ctors.cpp
fa74c2344addf92826c938758fb4dc612a004eb9 04-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Ensure that delegating constructor loop detection uses canonical
declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130821 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-delegating-ctors.cpp
61c6c4415d0f73bd033128ac85f054a0211e7c42 04-May-2011 Douglas Gregor <dgregor@apple.com> When tag lookup finds something ambiguous, and we're defining a new
tag, filter out those ambiguous names that we found if they aren't
within the declaration context where this newly-defined tag will be
visible.

This is basically a hack, because we really need to fix the lookup of
tag declarations in this case to not find things it
shouldn't. However, it's better than what we had before, and it fixes
<rdar://problem/9168556>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130810 91177308-0d34-0410-b5e6-96231b3b80d8
ag-ambig.cpp
b76af9c969558b4484be87933e89e76e7ee87e21 04-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Ensure that destructors are properly inovked when an exception leaves
the body of a delegating constructor call.

This means that the delegating constructor implementation should be
complete and correct, though there are some rough edges (diagnostic
quality with the cycle detection and using a deleted destructor).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130803 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-delegating-ctors.cpp
06bc9eb9908e42696775b395b290827bde468c8b 03-May-2011 Douglas Gregor <dgregor@apple.com> Extend -Wnon-pod-memset to also encompass memcpy() and memmove(),
checking both the source and the destination operands, renaming the
warning group to -Wnon-pod-memaccess and tweaking the diagnostic text
in the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130786 91177308-0d34-0410-b5e6-96231b3b80d8
arn-non-pod-memset.cpp
2a053a33707eba9e642adedb557b1a6aace103b5 03-May-2011 Douglas Gregor <dgregor@apple.com> Separate the -Wnon-pod-memset warnings into two separate warnings:
- a default-on warning for pointers to dynamic classes (= classes with vtables)
- a default-off warning for other non-POD types



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130781 91177308-0d34-0410-b5e6-96231b3b80d8
arn-non-pod-memset.cpp
e452c78072156c14cd9998733e3b4b28b6fc7fd7 03-May-2011 Douglas Gregor <dgregor@apple.com> Only check the use of memset() if we're refering to a C function named
'memset' with external linkage.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130770 91177308-0d34-0410-b5e6-96231b3b80d8
arn-non-pod-memset.cpp
f4bbbf0aaf741cc7d014e2cf059670a6756f8cbd 02-May-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a warning for when reinterpret_cast leads to undefined behavior, patch by Richard Trieu!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130703 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
059ce0d92eb5a7da900ae735dc0a2ea3d64f4b0b 01-May-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Fully implement delegating constructors!

As far as I know, this implementation is complete but might be missing a
few optimizations. Exceptions and virtual bases are handled correctly.

Because I'm an optimist, the web page has appropriately been updated. If
I'm wrong, feel free to downgrade its support categories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130642 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-delegating-ctors.cpp
e11c38d05c80ddd06042d20de79dd31fc9e8141e 01-May-2011 Francois Pichet <pichet2000@gmail.com> Add a triple to this test, otherwise it fails under MSVC because wchar_t is unsigned with the i686-pc-win32 triple.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130636 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
d3d77cd138f8e830f6547b6f83fcd5721ccf5f5d 30-Apr-2011 Eli Friedman <eli.friedman@gmail.com> PR9792: Make sure to use the right definition of wchar_t when the default
wchar_t is an unsigned type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130620 91177308-0d34-0410-b5e6-96231b3b80d8
hort-wchar-sign.cpp
25df423cfc6689cf21d51a66af84ea1e70d489df 30-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Make type-traits reflect that Clang's vectors act like scalar types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130606 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-type.cpp
ype-traits.cpp
018a088b3b30e500efa9173f7cd4b1b1f6a065a8 30-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Switch the type-trait like APIs on the AST to only check for incomplete
types after looking through arrays. Arrays with an unknown bound seem to
be specifically allowed in the library type traits in C++0x, and GCC's
builtin __is_trivial returns 'true' for the type 'int[]'. Now Clang
agrees with GCC about __is_trivial here.

Also hardens these methods against dependent types by just returning false.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130605 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
202e123d0d680af6d1754b22246ea63fb3604931 29-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Disable -Wnon-pod-memset for now while I try to reduce the false
positives still further.

The plan is to:

1) Create a more targeted warning for memset of memory pointing at
a type with virtual methods or bases where a vptr would be
overwritten.
2) Consider turning the above warning back on by default.
3) Evaluate whether any false positives in the existing warning can be
detected and white listed in the warning implementation.
4) If #3 lowers the noise floor enough, enable the full warning in -Wall
or -Wextra.

Comments or suggestions welcome. Even more welcome are specific test
cases which trigger the warning and shouldn't.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130538 91177308-0d34-0410-b5e6-96231b3b80d8
arn-non-pod-memset.cpp
43fa33b4bedc28d2faa17d678ad1f40eb42817a1 29-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Relax the non-POD memset warning to use the less restrictive C++11
definition of POD. Specifically, this allows certain non-aggregate
types due to their data members being private.

The representation of C++11 POD testing is pretty gross. Any suggestions
for improvements there are welcome. Especially the name
'isCXX11PODType()' seems truly unfortunate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130492 91177308-0d34-0410-b5e6-96231b3b80d8
arn-non-pod-memset.cpp
2cc702e52127512a67cbcbb3af6d73fb06d8b6bf 29-Apr-2011 Douglas Gregor <dgregor@apple.com> Oops

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130469 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_is_pod_hack.cpp
877222e2491bbc40a5c74cc100c540983f306b70 29-Apr-2011 Douglas Gregor <dgregor@apple.com> libstdc++ 4.2 also uses __is_same as a struct name, which conflicts with our new type trait __is_same

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130468 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_is_pod_hack.cpp
a6ce3e6513f56e4d46399da9e35a3165b097f59e 28-Apr-2011 Douglas Gregor <dgregor@apple.com> When determining whether two types are reference-compatible, check
non-CVR qualifiers as well as CVR qualifiers. For example, don't allow
a reference to an integer in address space 1 to bind to an integer in
address space 2.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130411 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-space-references.cpp
bfad9150bfa894195a43c5f487117672a449f90f 28-Apr-2011 Douglas Gregor <dgregor@apple.com> libstdc++ 4.4 uses __is_signed as an identifier, while Clang treats it
as a keyword for the __is_signed type trait. Cope with this conflict
via some hackish recovery: if we see a declaration of the form

static const bool __is_signed

then we stop treating __is_signed as a keyword and instead treat it as
an identifier. It's ugly, but it's better than making the __is_signed
type trait conditional on some language flag. Fixes PR9804.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130399 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_is_pod_hack.cpp
28bbe4b8acc338476fe0825769b41fb32b423c72 28-Apr-2011 John Wiegley <johnw@boostpro.com> Parsing/AST support for Structured Exception Handling

Patch authored by Sohail Somani.

Provide parsing and AST support for Windows structured exception handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130366 91177308-0d34-0410-b5e6-96231b3b80d8
_try.cpp
21ff2e516b0e0bc8c1dbf965cb3d44bac3c64330 28-Apr-2011 John Wiegley <johnw@boostpro.com> Implementation of Embarcadero array type traits

Patch authored by John Wiegley.

These are array type traits used for parsing code that employs certain
features of the Embarcadero C++ compiler: __array_rank(T) and
__array_extent(T, Dim).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130351 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
20c0da7787c9a7d2529e42a4a91d777778595d74 28-Apr-2011 John Wiegley <johnw@boostpro.com> t/clang/type-traits

Patch authored by John Wiegley.

These type traits are used for parsing code that employs certain features of
the Embarcadero C++ compiler. Several of these constructs are also desired by
libc++, according to its project pages (such as __is_standard_layout).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130342 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
134cb4442d6205e0226944ead4c7ede425fba206 27-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Heh, funny thing, 'void' isn't a POD type. Nice of us to suggest it to
silence this warning. ;]

Fixed that obvious bug and added a bit more testing as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130318 91177308-0d34-0410-b5e6-96231b3b80d8
arn-non-pod-memset.cpp
7ccc95bceebb2d1c8fbe277c9e33bde7dc1ccbb1 27-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Add a warning (-Wnon-pod-memset) for calls to memset() with
a destination pointer that points to a non-POD type. This can flag such
horrible bugs as overwriting vptrs when a previously POD structure is
suddenly given a virtual method, or creating objects that crash on
practically any use by zero-ing out a member when its changed from
a const char* to a std::string, etc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130299 91177308-0d34-0410-b5e6-96231b3b80d8
arn-non-pod-memset.cpp
d46a1125d43bcfd47fbd1206ebd1226863549390 27-Apr-2011 John McCall <rjmccall@apple.com> Diagnose attempts to implicitly instantiate a template before it is
fully defined. Somehow this escaped notice for a very long time.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130298 91177308-0d34-0410-b5e6-96231b3b80d8
R9460.cpp
R9461.cpp
eeeb2a25505d304b354fcfa3b8361e546387bc1b 27-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Add the test that I intended to submit with r130055, but forgot to add.
Apologies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130291 91177308-0d34-0410-b5e6-96231b3b80d8
arn-deprecated-header.cpp
3b887354b1b667c97d070ddc67b5354353c4c07b 27-Apr-2011 Douglas Gregor <dgregor@apple.com> Extend Sema::ClassifyName() to support C++, ironing out a few issues
in the classification of template names and using declarations. We now
properly typo-correct the leading identifiers in statements to types,
templates, values, etc. As an added bonus, this reduces the number of
lookups required for disambiguation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130288 91177308-0d34-0410-b5e6-96231b3b80d8
R9459.cpp
864c041e118155c2b1ce0ba36942a3da5a4a055e 26-Apr-2011 John McCall <rjmccall@apple.com> Make yet another placeholder type, this one marking that an expression is a bound
member function, i.e. something of the form 'x.f' where 'f' is a non-static
member function. Diagnose this in the general case. Some of the new diagnostics
are probably worse than the old ones, but we now get this right much more
universally, and there's certainly room for improvement in the diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130239 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
xpression-traits.cpp
verloaded-operator.cpp
trtomember.cpp
865dd8c8fe65d7743cfbc412316e59e6c149624d 25-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> 'extern' variables in functions don't shadow externs in global scope. Fixes rdar://8883302, this time for C++ as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130157 91177308-0d34-0410-b5e6-96231b3b80d8
arn-shadow.cpp
223de2497fdaacf3a6b0a123c12265ca837abf19 25-Apr-2011 Chris Lattner <sabre@nondot.org> fix PR9474, a crash with -fshort-enum and C++ templates: when instantiating
the enum decl, we need to use an integer type the same size as the enumerator,
which may not be the promoted type with packed enums.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130148 91177308-0d34-0410-b5e6-96231b3b80d8
hort-enums.cpp
552622067dc45013d240f73952fece703f5e63bd 25-Apr-2011 John Wiegley <johnw@boostpro.com> t/clang/expr-traits

Patch authored by David Abrahams.

These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for
parsing code that employs certain features of the Embarcadero C++ compiler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130122 91177308-0d34-0410-b5e6-96231b3b80d8
xpression-traits.cpp
9b6347cd410be55425f7062d22fd6e4ecb4e1a58 24-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Implement most of the remaining logic in __is_literal type trait. This
should now support all of the C++98 types, and all of the C++0x types
Clang supports.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130079 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-type.cpp
3840281126e7d10552c55f6fd8b1ec9483898906 24-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Add support for '__is_literal_type' spelling of the existing
'__is_literal' type trait for GCC compatibility. At least one relased
version if libstdc++ uses this name for the trait despite it not being
documented anywhere.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130078 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-type.cpp
4d6e5a22d9481bb83b82d911727540096d171c0b 24-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Begin tracking trivialness of move constructors and move assignment
operators in C++ record declarations.

This patch starts off by updating a bunch of the standard citations to
refer to the draft 0x standard so that the semantics intended for move
varianst is clear. Where necessary these are duplicated so they'll be
available in doxygen.

It adds bit fields to keep track of the state for the move constructs,
and updates all the code necessary to track this state (I think) as
members are declared for a class. It also wires the state into the
various trait-like accessors in the AST's API, and tests that the type
trait expressions now behave correctly in the presence of move
constructors and move assignment operators.

This isn't complete yet due to these glaring FIXMEs:
1) No synthesis of implicit move constructors or assignment operators.
2) I don't think we correctly enforce the new logic for both copy and
move trivial checks: that the *selected* copy/move
constructor/operator is trivial. Currently this requires *all* of them
to be trivial.
3) Some of the trait logic needs to be folded into the fine-grained
trivial bits to more closely match the wording of the standard. For
example, many of the places we currently set a bit to track POD-ness
could be removed by querying other more fine grained traits on
demand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130076 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
c69f636a32485b64d571490e3980463dd7752aaa 23-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Flesh out these tests just a tad more. This provides targeted
'DerivesHasFoo' types for various non-POD constructs in the base class.
Only __is_pod and __is_trivial are wired up to these, not sure how much
more of this type of exhaustive testing is really interesting.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130075 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
43a56a0622917ae996244d76d5f20c4d31cc119c 23-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Test POD and trivial type traits given a class derived from a generic
non-POD type.

It might be nicer to have a Derives* variant for each of HasCons,
HasCopy, etc. Then we could test each of those and also test the __has_*
traits. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130074 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
34eaaa523c3820dd32bcd9530148e76e87dcfa90 23-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Use a more precise name for some of the types here, and re-group several
of the tests using those types to have a (hopefully) more logical
ordering now that doing so doesn't cause unreadable deltas of counters
changing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130073 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
e567e837feee4a05d0d8e02049421e286ea7f70d 23-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Mechanical change moving all of the test statements away from a pattern
that requires needless noise in every patch (due to numbers changing) or
poorly grouped test cases in order to have strictly increasing numbers.
This will make my subsequent patches much less ugly. =D

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130072 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
b7e9589bce9852b4db9575f55ac9137572147eb5 23-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Implement basic __is_trivial type-trait support, enough to close PR9472.
This introduces a few APIs on the AST to bundle up the standard-based
logic so that programmatic clients have access to exactly the same
behavior.

There is only one serious FIXME here: checking for non-trivial move
constructors and move assignment operators. Those bits need to be added
to the declaration and accessors provided.

This implementation should be enough for the uses of __is_trivial in
libstdc++ 4.6's C++98 library implementation.

Ideas for more thorough test cases or any edge cases missing would be
appreciated. =D

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130057 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
f3babb93eba416ff30c4408d843b7408221e1d4e 23-Apr-2011 Chandler Carruth <chandlerc@gmail.com> GCC overloads -Wwrite-strings just to make it extra confusing. While it
changes language semantics in C and ObjC (which Clang has supported for
a while), in C++ it's the name used for Clang's
-Wdeprecated-writable-strings.

Clang's name is at least less overloaded if still confusing (the string
isn't writable, we just allow converting to a non-const pointer without
warning), so I've left it in place and made the GCC name an alias for
compatibility.

With this I've implemented all the aspects of GCC's -Wwrite-strings I've
encountered which didn't work with Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130052 91177308-0d34-0410-b5e6-96231b3b80d8
ritable-strings-deprecated.cpp
bb29d1ba8b0895e3923c724f49845636f35b4bde 23-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't allow reinterpret_cast to reference of vector element and property expression. Thanks goes to Eli Friedman!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130036 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
b464a5b18916b467ed884d07f9e34295d39cec0a 23-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> reinterpret_cast to reference of a bit-field is not allowed.

Fixes rdar://9202628 & http://llvm.org/PR9564.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130024 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
788440378c442562497c09610939cbe6218ab43d 23-Apr-2011 Douglas Gregor <dgregor@apple.com> At the end of the translation unit, defining a vtable can introduce
new templates that need to be instantiated and vice-versa. Iterate
until we've instantiated all required templates and defined all
required vtables. Fixed PR9325 / <rdar://problem/9055177>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130023 91177308-0d34-0410-b5e6-96231b3b80d8
table-instantiation.cc
cfe38c4db48f188db3f48dc48030d8be6f6e3e03 22-Apr-2011 Chandler Carruth <chandlerc@gmail.com> I concur with DPG here. This does indeed apply in 0x mode. Added test
cases that demonstrates exactly why this does indeed apply in 0x mode.

If isPOD is currently broken in 0x mode, we should fix that directly
rather than papering over it here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130007 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
b65abda449dfb17aba39794be6ce41111d40fda0 22-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't enter a qualified scope for an invalid decl.

Fixes assertion later on. rdar://9122937 & http://llvm.org/PR9459

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130006 91177308-0d34-0410-b5e6-96231b3b80d8
R9459.cpp
e36bca6f2abd868b9ae68ff1c0d691de7520ca8c 22-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In IsUserDefinedConversion try to recover from RequireCompleteType returning true.

Fixes an assertion later on, rdar://9122862 & http://llvm.org/PR9460.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130000 91177308-0d34-0410-b5e6-96231b3b80d8
R9460.cpp
2e510a0c0f7afa7951aa19c65a06c2da579535a8 22-Apr-2011 Francois Pichet <pichet2000@gmail.com> Downgrade error "static declaration of 'foo' follows non-static declaration" to a warning in Microsoft mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129985 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
34f52d14742914bbaa975ce7de45957cccf256bc 22-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix crashing rdar://9122854 & http://llvm.org/PR9461.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129967 91177308-0d34-0410-b5e6-96231b3b80d8
R9461.cpp
6b6b42aed07726178f61954ac6e51f47da00275c 19-Apr-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> We regard a function as 'unused' from the codegen perspective, so our warnings diverge from
gcc's unused warnings which don't get emitted if the function is referenced even in an unevaluated context
(e.g. in templates, sizeof, etc.). Also, saying that a function is 'unused' because it won't get codegen'ed
is somewhat misleading.

- Don't emit 'unused' warnings for functions that are referenced in any part of the user's code.
- A warning that an internal function/variable won't get emitted is useful though, so introduce
-Wunneeded-internal-declaration which will warn if a function/variable with internal linkage is not
"needed" ('used' from the codegen perspective), e.g:

static void foo() { }

template <int>
void bar() {
foo();
}

test.cpp:1:13: warning: function 'foo' is not needed and will not be emitted
static void foo() { }
^

Addresses rdar://8733476.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129794 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
5666d36cce566b59be271670364794de9803af04 15-Apr-2011 Douglas Gregor <dgregor@apple.com> Forbid the use of C++ new/delete to allocate/free objects within an
address space. I could see that this functionality would be useful,
but not in its current form (where the address space is ignored):
rather, we'd want to encode the address space into the parameter list
passed to operator new/operator delete somehow, which would require a
bunch more semantic analysis.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129593 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-space-newdelete.cpp
d4c5f84bbed2ecb5ddd0f0e8316c553b2084772a 15-Apr-2011 Douglas Gregor <dgregor@apple.com> Implement appropriate semantics for C++ casting and conversion when
dealing with address-space- and GC-qualified pointers. Previously,
these qualifiers were being treated just like cvr-qualifiers (in some
cases) or were completely ignored, leading to uneven behavior. For
example, const_cast would allow conversion between pointers to
different address spaces.

The new semantics are fairly simple: reinterpret_cast can be used to
explicitly cast between pointers to different address spaces
(including adding/removing addresss spaces), while
static_cast/dynamic_cast/const_cast do not tolerate any changes in the
address space. C-style casts can add/remove/change address spaces
through the reinterpret_cast mechanism. Other non-CVR qualifiers
(e.g., Objective-C GC qualifiers) work similarly.

As part of this change, I tweaked the "casts away constness"
diagnostic to use the term "casts away qualifiers". The term
"constness" actually comes from the C++ standard, despite the fact
that removing "volatile" also falls under that category. In Clang, we
also have restrict, address spaces, ObjC GC attributes, etc., so the
more general "qualifiers" is clearer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129583 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-space-conversion.cpp
einterpret-cast.cpp
tatic-cast.cpp
f111d935722ed488144600cea5ed03a6b5069e8f 15-Apr-2011 Peter Collingbourne <peter@pcc.me.uk> C1X: implement generic selections

As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
eneric-selection.cpp
ad762fcdc16b9e4705b12b09d92b8c026212b906 15-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129541 91177308-0d34-0410-b5e6-96231b3b80d8
or-range-examples.cpp
or-range-no-std.cpp
5da3c08728d3d1091f4f3fa01f9d813a45d150f5 14-Apr-2011 Fariborz Jahanian <fjahanian@apple.com> Match pointer of compatible vection types.
// rdar://9208404


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129536 91177308-0d34-0410-b5e6-96231b3b80d8
eon-vector-types.cpp
b8fc45f8d0fdcc7908590115942d425bf4a924f1 14-Apr-2011 Anders Carlsson <andersca@mac.com> In C++, when initializing an array from a pascal string, it's OK if the array
is 1 element smaller than the string, because we can just strip off the last
null character. This matches GCC.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129490 91177308-0d34-0410-b5e6-96231b3b80d8
ascal-strings.cpp
ddd7a3d6dc98c5c6e807910d255b738d8559a231 14-Apr-2011 Anders Carlsson <andersca@mac.com> Rename test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129486 91177308-0d34-0410-b5e6-96231b3b80d8
ascal-strings.cpp
ascal-wchar-strings.cpp
866849498461cf9022316034516475188b25955b 13-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Teach -Wuninitialized about C++'s typeid expression, including both the
evaluated and unevaluated contexts. Add some testing of sizeof and
typeid.

Both of the typeid tests added here were triggering warnings previously.
Now the one false positive is suppressed without suppressing the warning
on actually buggy code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129431 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
6943e9befee204becfae55de1298b3d5fee87934 13-Apr-2011 Francois Pichet <pichet2000@gmail.com> In Microsoft mode, within class scope, if a CXXScopeSpec's type is equal to the type of one of the base classes then downgrade the missing typename error to a warning. Up to now this is the only case I found where MSVC doesn't require "typename" at class scope. Really strange!
This fixes 1 error when parsing the MSVC 2008 header files.
Example:

template<class T> class A {
public:
typedef int TYPE;
};
template<class T> class B : public A<T> {
public:
A<T>::TYPE a; // no typename required because A<T> is a base class.
};


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129425 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
755d8497e39071aa24acc173ff07083e3256b8f8 12-Apr-2011 John McCall <rjmccall@apple.com> After some discussion with Doug, we decided that it made a lot more sense
for __unknown_anytype resolution to destructively modify the AST. So that's
what it does now, which significantly simplifies some of the implementation.
Normal member calls work pretty cleanly now, and I added support for
propagating unknown-ness through &.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129331 91177308-0d34-0410-b5e6-96231b3b80d8
nknown-anytype.cpp
379b5155b4566f63679e1da6b0ceb5fdfa2aec6d 11-Apr-2011 John McCall <rjmccall@apple.com> More __unknown_anytype work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129269 91177308-0d34-0410-b5e6-96231b3b80d8
nknown-anytype.cpp
bc34b1d7f4f371bfdebf68d66086f54586d68abe 11-Apr-2011 Eli Friedman <eli.friedman@gmail.com> PR9669: implement correct checking for [dcl.init.string]p2.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129260 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
f65076ebf5e8bc5ae7b77fe3c3a65dc5db8d763f 10-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Enhance the diagnostic for literal float -> int conversions to suggest
rewriting the literal when the value is integral. It is not uncommon to
see code written as:

const int kBigNumber = 42e5;

Without any real awareness that this is no longer an ICE. The note helps
automate and ease the process of fixing code that violates the warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129243 91177308-0d34-0410-b5e6-96231b3b80d8
arn-literal-conversion.cpp
8d051e00ad674754d476cc1fa0442da0bc47b2c8 10-Apr-2011 Francois Pichet <pichet2000@gmail.com> MSVC accepts that default parameters be redefined for member functions
of template class. The new value is ignored.

This fixes 1 error when parsing MSVC 2010 header files with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129240 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
a5fc472b353b88be3b4981da946fb01f5a5cc0c6 10-Apr-2011 John McCall <rjmccall@apple.com> Fix a bunch of major problems with __unknown_anytype and properly test
for them. The only major missing feature is references.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129234 91177308-0d34-0410-b5e6-96231b3b80d8
nknown-anytype.cpp
b6006696358572a668d6de773af8f550e54259bf 09-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Clean up the bool conversion warning. Group it with other conversion
warnings, and make its text appropriate for constant bool expressions
other than 'false'. This should finish off PR9612.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129205 91177308-0d34-0410-b5e6-96231b3b80d8
arn-bool-conversion.cpp
arn_false_to_pointer.cpp
88f0aed95d2a0faf3cad66af2dc54596495a7d41 09-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Add support for warning on general null pointer expressions of boolean
type rather than just the literal 'false'. This begins fixing PR9612,
but the message is now wrong. WIP, the cleanup of the messaging is next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129204 91177308-0d34-0410-b5e6-96231b3b80d8
arn_false_to_pointer.cpp
584b9d6bd0ce199787900695fe75528fcde405fe 08-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Switch 'is possibly uninitialized' to 'may be uninitialized' based on
Chris's feedback.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129127 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables-conditional.cpp
f04eb2de1f17dce4dfaebbf9002844087b7d357d 08-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Now that the analyzer is distinguishing between uninitialized uses that
definitely have a path leading to them, and possibly have a path leading
to them; reflect that distinction in the warning text emitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129126 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
a21612f95792c1ea8b4362f0861f0c724c39388e 07-Apr-2011 Ted Kremenek <kremenek@apple.com> Teach -Wuninitialized to not warn about variables declared in C++ catch statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129102 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
1de4d4e8cb2e9c88809fea8092bc6e835a5473d2 07-Apr-2011 John McCall <rjmccall@apple.com> Basic, untested implementation for an "unknown any" type requested by LLDB.
The idea is that you can create a VarDecl with an unknown type, or a
FunctionDecl with an unknown return type, and it will still be valid to
access that object as long as you explicitly cast it at every use. I'm
still going back and forth about how I want to test this effectively, but
I wanted to go ahead and provide a skeletal implementation for the LLDB
folks' benefit and because it also improves some diagnostic goodness for
placeholder expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129065 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
96b4adce3bd41a33e3f1d98dc4e74046585f6dce 06-Apr-2011 Anders Carlsson <andersca@mac.com> Wide Pascal strings should be of type wchar_t[] and not unsigned char[].

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129017 91177308-0d34-0410-b5e6-96231b3b80d8
ascal-wchar-strings.cpp
b414c4fae51c5792d3074b4b78fc8737b1d8387c 05-Apr-2011 Chandler Carruth <chandlerc@gmail.com> Fix PR9624 by explicitly disabling uninitialized warnings for direct self-init:

int x = x;

GCC disables its warnings on this construct as a way of indicating that
the programmer intentionally wants the variable to be uninitialized.
Only the warning on the initializer is turned off in this iteration.

This makes the code a lot more ugly, but starts commenting the
surprising behavior here. This is a WIP, I want to refactor it
substantially for clarity, and to determine whether subsequent warnings
should be suppressed or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128894 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
d40066b0fb883839a9100e5455e33190b9b8abac 05-Apr-2011 Ted Kremenek <kremenek@apple.com> Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with numerous CFG and UninitializedValues analysis changes:

1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt.
2) Update ExprEngine (the static analyzer) to understand (1), so not to regress.
3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method.
4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases.

The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer
contained control-flow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128858 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
f8adeefa9e9882bff402e092024dd457f8574673 04-Apr-2011 Ted Kremenek <kremenek@apple.com> -Wuninitialized: don't warn about uninitialized variables in unreachable code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128840 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
cccc02ac215ffc16fc4b3ebfee5ee87c40e30505 04-Apr-2011 Eli Friedman <eli.friedman@gmail.com> PR9585: add __decltype as a keyword. While I'm here, alphabetize the list.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128809 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-98.cpp
d593190132244b0194d480ec3e55f94f369c8863 04-Apr-2011 Eli Friedman <eli.friedman@gmail.com> PR9615: make sure we destroy any temporaries returned by operator->.

I'm pretty sure this is the right fix, but I would appreciate it if someone
else would double-check.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128806 91177308-0d34-0410-b5e6-96231b3b80d8
perator-arrow-temporary.cpp
2166948cc721b138b3aaf4358d28ec2dada22901 02-Apr-2011 Nico Weber <nicolasweber@gmx.de> Make -Wheader-hygiene not complain about USING_NAMESPACE_THROUGH_MACRO in a non-header file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128780 91177308-0d34-0410-b5e6-96231b3b80d8
arn-using-namespace-in-header.cpp
arn-using-namespace-in-header.h
dde385dd9b87b791736750114b2e0790195e373b 29-Mar-2011 Francois Pichet <pichet2000@gmail.com> Add a triple to make the test friendly on no windows platform.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128459 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
b613cd6862a80126666c46a41de36c1ba7704c2e 29-Mar-2011 Francois Pichet <pichet2000@gmail.com> Accept __declspec(dllimport) for function defined at class scope in Microsoft mode.

This fixes a bunch of errors when compiling MSVC header files with the -DDLL flag.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128457 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
b831c673621c5587642343cace9def134916a17b 29-Mar-2011 Ted Kremenek <kremenek@apple.com> Add workaround for Sema issue found in <rdar://problem/9188004>, which leads to an assertion failure in the uninitialized variables analysis. The problem is that Sema isn't properly registering a variable in a DeclContext (which -Wuninitialized relies on), but
my expertise on the template instantiation logic isn't good enough to fix this problem for real. This patch worksaround the
problem in -Wuninitialized, but we should fix it for real later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128443 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
170a6a229b6cb0c411be5edaa587a1b1436bd147 29-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't do the checks of Sema::DiagnoseEqualityWithExtraParens() on type-dependent expressions. Fixes rdar://9027658.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128437 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
3334b0b13ad3bf568a16cda29434b18d084f6dcb 28-Mar-2011 Matt Beaumont-Gay <matthewbg@google.com> Fix PR9572 and neighboring lurking crashers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128401 91177308-0d34-0410-b5e6-96231b3b80d8
R9572.cpp
349894ec70777da4f8fe714670aca43acd2e844e 27-Mar-2011 Chandler Carruth <chandlerc@gmail.com> Add tests for the uninitialized checks added in r128376. Also clean up
and flesh out the existing uninitialized testing for field initializers.

The tests come from Richard's original patch, but I've cleaned them up
a bit and ordered them more naturally.

Also, I added a test for the most simple base case:
int x = x;

And it turns out we miss this one! =[ That and another bad FIXME on the
field initializer checking are left in the test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128394 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
9172aa685f3a1cbf991a2c1cd40905e4d64bfdf6 26-Mar-2011 Douglas Gregor <dgregor@apple.com> Improve -Wheader-hygiene to warn about using directives inside linkage
specifications within the global scope, from Elliot Glaysher.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128352 91177308-0d34-0410-b5e6-96231b3b80d8
arn-using-namespace-in-header.cpp
arn-using-namespace-in-header.h
379246d29b1c7ef2659beadf41b4cb79806c0e63 26-Mar-2011 John McCall <rjmccall@apple.com> Don't warn about the 'extern' in 'extern "C"' on a tag decl. This is
usually useless, but not always.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128326 91177308-0d34-0410-b5e6-96231b3b80d8
torage-class.cpp
909a70d8a185f701c20bacc3c76f8f5979cbbc7c 25-Mar-2011 Nick Lewycky <nicholas@mxc.ca> Apply the nonnull attribute to constructor expressions too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128253 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-nonnull.cpp
1d2de76c75fc1ac870c6df84c5368206c00d9a5e 24-Mar-2011 Douglas Gregor <dgregor@apple.com> Minor fix in the injection of labels, since we want to look at the redeclaration context of each declaration in the identifier chain. Should fix Linux self-host

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128210 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
fa7b8ced6f3318879b39f44b5ace8346e979826e 24-Mar-2011 Douglas Gregor <dgregor@apple.com> Fix the insertion of label declarations into the identifier chain in
the case where we only have a single identifier with that name in the
chain. Fixes PR9463 for real this time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128208 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
oto2.cpp
2b32dad701ef3e666e3b9cea02e1d094a1078c6f 24-Mar-2011 Anders Carlsson <andersca@mac.com> Add a new warning for exit-time destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128188 91177308-0d34-0410-b5e6-96231b3b80d8
arn-exit-time-destructors.cpp
bec7343433f6d4feee6af3a3a664f0301d41960e 23-Mar-2011 Douglas Gregor <dgregor@apple.com> Unbreak test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128168 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
trtomember.cpp
31798a6bddc5265c50ece1aecf4d2abc66be7554 23-Mar-2011 Marshall Clow <mclow@qualcomm.com> Add a test for !ptr-to-member (should fail)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128158 91177308-0d34-0410-b5e6-96231b3b80d8
trtomember.cpp
0a0d2b179085a52c10402feebeb6db8b4d96a140 23-Mar-2011 Douglas Gregor <dgregor@apple.com> Implement a new 'availability' attribute, that allows one to specify
which versions of an OS provide a certain facility. For example,

void foo()
__attribute__((availability(macosx,introduced=10.2,deprecated=10.4,obsoleted=10.6)));

says that the function "foo" was introduced in 10.2, deprecated in
10.4, and completely obsoleted in 10.6. This attribute ties in with
the deployment targets (e.g., -mmacosx-version-min=10.1 specifies that
we want to deploy back to Mac OS X 10.1). There are several concrete
behaviors that this attribute enables, as illustrated with the
function foo() above:

- If we choose a deployment target >= Mac OS X 10.4, uses of "foo"
will result in a deprecation warning, as if we had placed
attribute((deprecated)) on it (but with a better diagnostic)
- If we choose a deployment target >= Mac OS X 10.6, uses of "foo"
will result in an "unavailable" warning (in C)/error (in C++), as
if we had placed attribute((unavailable)) on it
- If we choose a deployment target prior to 10.2, foo() is
weak-imported (if it is a kind of entity that can be weak
imported), as if we had placed the weak_import attribute on it.

Naturally, there can be multiple availability attributes on a
declaration, for different platforms; only the current platform
matters when checking availability attributes.

The only platforms this attribute currently works for are "ios" and
"macosx", since we already have -mxxxx-version-min flags for them and we
have experience there with macro tricks translating down to the
deprecated/unavailable/weak_import attributes. The end goal is to open
this up to other platforms, and even extension to other "platforms"
that are really libraries (say, through a #pragma clang
define_system), but that hasn't yet been designed and we may want to
shake out more issues with this narrower problem first.

Addresses <rdar://problem/6690412>.

As a drive-by bug-fix, if an entity is both deprecated and
unavailable, we only emit the "unavailable" diagnostic.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128127 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
850d3b304b69b40c0292d433743aba82f3add4a8 22-Mar-2011 John McCall <rjmccall@apple.com> Apply Jonathan Sauer's proposed solution to PR9519. Thanks!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128075 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-prototypes.cpp
148f1f7936afd718bac7be95089e77673e43f16f 20-Mar-2011 Peter Collingbourne <peter@pcc.me.uk> Only objects are declared const by a constexpr specifier, per C++0x [dcl.constexpr]p9

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127967 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-constexpr-const.cpp
eedd4670b2eb7e4d67d11b2f26ed1ad304b70596 20-Mar-2011 Francois Pichet <pichet2000@gmail.com> Downgrade err_mismatched_exception_spec to a ExtWarning in Microsoft mode. MSVC doesn't do any validation on exception specifications.

This remove 1 error when parsing MSVC stl lib with clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127961 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
e5da3e6e5671728007b720bd3afdef3332351358 19-Mar-2011 Anton Yartsev <anton.yartsev@gmail.com> makes vec_step operator work when AltiVec support is enabled

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127949 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
d6a49bb69fadcb04119433278c808797a87d2d31 18-Mar-2011 Douglas Gregor <dgregor@apple.com> Add an opt-in -Wheader-hygiene, which current diagnoses the use of
global using directives in C++ headers, from Elliot Glaysher!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127881 91177308-0d34-0410-b5e6-96231b3b80d8
arn-using-namespace-in-header.cpp
arn-using-namespace-in-header.h
a085da86242c9b8e3466f8cf6f4397e9f248fd20 17-Mar-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR9488: 'auto' type substitution can fail (for instance, if it creates a reference-to-void type). Don't crash if it does.
Also fix an issue where type source information for the resulting type was being lost.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127811 91177308-0d34-0410-b5e6-96231b3b80d8
uto-subst-failure.cpp
53b24ebc37e6edd14ed31e2ef7cbed094ee87e51 17-Mar-2011 Ted Kremenek <kremenek@apple.com> Fix test to test the right thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127803 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables-conditional.cpp
c5e43c19ddb40b8a1371291f73ae66fe54951ca5 17-Mar-2011 Ted Kremenek <kremenek@apple.com> Don't construct two CFGs just to run -Wuninitialized. While this causes new warnings to be flagged under -Wconditional-uninitialized, this is something we
can improve over time.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127802 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables-conditional.cpp
0daaf32723ac78549c507c2a68a5300502703673 16-Mar-2011 Abramo Bagnara <abramo.bagnara@gmail.com> Use ElaboratedType also for C.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127755 91177308-0d34-0410-b5e6-96231b3b80d8
ourceranges.cpp
db2eae639d3b7ed61ceb56890b73168517ef57f1 16-Mar-2011 Douglas Gregor <dgregor@apple.com> Clean up our handling of template-ids that resolve down to a single
overload, so that we actually do the resolution for full expressions
and emit more consistent, useful diagnostics. Also fixes an IRGen
crasher, where Sema wouldn't diagnose a resolvable bound member
function template-id used in a full-expression (<rdar://problem/9108698>).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127747 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
ecltype-overloaded-functions.cpp
verloaded-name.cpp
60b3e38d421cab497de1c62c06be6a6a5f321edf 16-Mar-2011 Douglas Gregor <dgregor@apple.com> Don't indescriminately print overload candidates when we have invalid
operands to a binary expression; it doesn't make sense in all
contexts. The right answer would be to see if the user forgot at ().

Fixes <rdar://problem/9136502>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127740 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
eed5ddc25539e14de11888ec69007217e777c02a 16-Mar-2011 Douglas Gregor <dgregor@apple.com> Allow function calls to dereferenced member pointers of
pointer-to-function type. Fixes <rdar://problem/9065289>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127739 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointers-2.cpp
c9977d09a2de7f7d2245973413d4caf86c736640 16-Mar-2011 Douglas Gregor <dgregor@apple.com> Make sure that we always pop a function's scope *before* we call
ActOnFinishFunctionBody/ActOnBlockStmtExpr. This way, we ensure that
we diagnose undefined labels before the jump-scope checker gets run,
since the jump-scope checker requires (as its invariant) that all of
the GotoStmts be wired up correctly.

Fixes PR9495.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127738 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
250e7a74d5a23db5bd7202ecb0bb4a8fef6016b4 16-Mar-2011 Douglas Gregor <dgregor@apple.com> When we're inserting a synthesized label declaration for a
forward-looking "goto" statement, make sure to insert it *after* the
last declaration in the identifier resolver's declaration chain that
is either outside of the function/block/method's scope or that is
declared in that function/block/method's specific scope. Previously,
we could end up inserting the label ahead of declarations in inner
scopes, confusing C++ name lookup.

Fixes PR9491/<rdar://problem/9140426> and <rdar://problem/9135994>.

Note that the crash-on-invalid PR9495 is *not* fixed. That's a
separate issue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127737 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
432c478fe0fec3946610d5dc7905daf5fbadf47b 16-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGBuilder that the 'default' branch of a switch statement is dead if all enum values in a switch conditioned are handled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127727 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
908c09f64e50db64c935255089ffcf4615ca4b0e 15-Mar-2011 Ted Kremenek <kremenek@apple.com> Take 2: merge -Wuninitialized-experimental into -Wuninitialized. Only *must-be-uninitialized* warnings are reported, with *maybe-uninitialized* under a separate flag. I await any fallout/comments/feedback, although hopefully this will produce no noise for users.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127670 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
7cbc558ffda5877ec4d2e432534e3d3d4ac10050 14-Mar-2011 Douglas Gregor <dgregor@apple.com> When synthesizing a label declaration based on a goto statement that
cannot yet be resolved, be sure to push the new label declaration into
the right place within the identifier chain. Otherwise, name lookup in
C++ gets confused when searching for names that are lexically closer
than the label. Fixes PR9463.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127623 91177308-0d34-0410-b5e6-96231b3b80d8
oto.cpp
069a6da34a86c97ffe78c379da246fc8116daaff 14-Mar-2011 Douglas Gregor <dgregor@apple.com> -fwritable-strings should silence warnings about the deprecated string
-literal to char* conversion. Make it so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127586 91177308-0d34-0410-b5e6-96231b3b80d8
ritable-strings-deprecated.cpp
60618fa7f88d5162bb5b40988b6b38d4d75d6fc6 12-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127537 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
6f4596cfb70ec706dd2da38db1be3663c214ff7a 12-Mar-2011 Douglas Gregor <dgregor@apple.com> Implement a hack intended to allow Clang to parse libstdc++ 4.5's
headers, which use C++0x generalized initializer lists. Per PR7069, it
appears that the only use is as the return type of a function, so this
commit enables this extension just in that narrow case. If it's enough
for libstdc++ 4.5, or if it can be trivially extended to work with
libstdc++ 4.5, we'll keep it. Otherwise, or if this breaks anything,
we'll revert and wait for the real feature.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127507 91177308-0d34-0410-b5e6-96231b3b80d8
xx0x-return-init-list.cpp
1e15394853bfae25112d9cc6b445504905e1f34a 11-Mar-2011 Rafael Espindola <rafael.espindola@gmail.com> Fix PR9453 by not trying to print a warning about ignored qualifiers
in conversion functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127460 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
6e40035988965340555c942d6e7afb6c7527beb1 07-Mar-2011 Ted Kremenek <kremenek@apple.com> Fix null dereference in CFGBlock::FilterEdge that was reported in PR 9412.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127176 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
d97cec3deb6e34f0f9d4f5f8ec11b28e44812727 07-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> g++ is more permissive regarding flexible arrays.
It will accept flexible array in union and also as the sole element of a struct/class.

Fixes rdar://9065507.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127171 91177308-0d34-0410-b5e6-96231b3b80d8
lexible-array-test.cpp
5453d93ab8668f2d9d0bc02182695b02d207e32d 06-Mar-2011 Douglas Gregor <dgregor@apple.com> When performing template argument deduction for a non-reference
conversion function when we're binding the result to a reference, drop
cv-qualifiers on the type we're referring to, since we should be
deducing a type that can be adjusted (via cv-qualification) to the
requested type. Fixes PR9336, and the remaining Boost.Assign failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127117 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
fbe599465021a37b2275af93466064ba08c06a68 05-Mar-2011 Matt Beaumont-Gay <matthewbg@google.com> Much to my surprise, OverloadExprs can also point to function template decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127061 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
cb710a4df50b79659399f0722ea29e90251ea834 04-Mar-2011 Douglas Gregor <dgregor@apple.com> Diagnose destructor templates. Fixes PR7904.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127042 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
7ec1873d694cf870264694d2b61219a03492bc30 04-Mar-2011 Douglas Gregor <dgregor@apple.com> When clearing a LookupResult structure, clear out the naming class,
too. Fixes PR7900.

While I'm in this area, improve the diagnostic when the type being
destroyed doesn't match either of the types we found.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127041 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
seudo-destructors.cpp
0498247f87ea0d716e0c2931fea812280649e33d 04-Mar-2011 Ted Kremenek <kremenek@apple.com> Correctly handle nested switch statements in CFGBuilder when on switch statement has a condition that evaluates to a constant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126977 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
0266aa37802a486e65f9259014bb60848fc4be23 03-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> -Woverloaded-virtual shouldn't warn for static functions. Fixes rdar://9083431 & http://llvm.org/PR9396.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126966 91177308-0d34-0410-b5e6-96231b3b80d8
arn-overloaded-virtual.cpp
48b89590f61575cbf365ba996a2bd1ba1561a4ab 03-Mar-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't emit unused warning for deleted functions. Fixes rdar://8365684 & http://llvm.org/PR9391.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126950 91177308-0d34-0410-b5e6-96231b3b80d8
nused-functions.cpp
9ca957aaa2c2e5ee07f5e98d6eca8f426dcb4a8e 03-Mar-2011 Ted Kremenek <kremenek@apple.com> Add coverage test for CFGImplicitDtor::getDestructorDecl() when handling typedefs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126947 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
0f0ea2a96534c615ff5fdd81363989b23cf2164a 03-Mar-2011 Douglas Gregor <dgregor@apple.com> Eliminate redundant nested-name-specifiers on
TemplateSpecializationTypes, which also fixes PR9388.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126946 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
c5aff4497e5bfd7523e00b87560c1a5aa65136cc 03-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGImplicitDtor::getDestructorDecl() about arrays of objects with destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126910 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
697d42db6cba7a5994d955ce31be2c097902cf0c 03-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGImplicitDtor::getDestructorDecl() about reference types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126909 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
c9f8f5a726bbb562e4b2d4b19d66e6202dcb2657 02-Mar-2011 Ted Kremenek <kremenek@apple.com> Introduce CFGImplicitDtor::isNoReturn() to query whether a destructor actually returns. Use this for -Wreturn-type to prune false positives reported in PR 6884.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126875 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
b6744efecba58792cce20d2d7b9ee39927c5422e 02-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into template
template arguments. I believe that this is the last place in the AST
where we were storing a source range for a nested-name-specifier
rather than a proper nested-name-specifier location structure. (Yay!)

There is still a lot of cleanup to do in the TreeTransform, which
doesn't take advantage of nested-name-specifiers with source-location
information everywhere it could.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126844 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
bdc49d360f98c1194d50b8bbb24885bf8d4c1ac4 02-Mar-2011 John McCall <rjmccall@apple.com> Pretty up the wrong-number-of-arguments-for-attribute diagnostic by
using a custom plural form. Split out the range diagnostics as their
own message.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126840 91177308-0d34-0410-b5e6-96231b3b80d8
nit-priority-attr.cpp
018591f524ca4f3a1e657d0d0a66eadf9dbd55f6 02-Mar-2011 John McCall <rjmccall@apple.com> Semantic checking for exception specifications should be triggered by
whether C++ exceptions are enabled, not exceptions in general. PR9358.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126820 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
xception-spec-no-exceptions.cpp
xception-spec.cpp
059101f922de6eb765601459925f4c8914420b23 02-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source-location information into dependent
template specialization types. This also required some parser tweaks,
since we were losing track of the nested-name-specifier's source
location information in several places in the parser. Other notable
changes this required:

- Sema::ActOnTagTemplateIdType now type-checks and forms the
appropriate type nodes (+ source-location information) for an
elaborated-type-specifier ending in a template-id. Previously, we
used a combination of ActOnTemplateIdType and
ActOnTagTemplateIdType that resulted in an ElaboratedType wrapped
around a DependentTemplateSpecializationType, which duplicated the
keyword ("class", "struct", etc.) and nested-name-specifier
storage.

- Sema::ActOnTemplateIdType now gets a nested-name-specifier, which
it places into the returned type-source location information.

- Sema::ActOnDependentTag now creates types with source-location
information.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126808 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
e71f3d587844110d836c82250830b27b1651afdb 02-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGBuilder to prune trivially unreachable case statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126797 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
94fdffa4a572fc14ac296f5f1aae9db3734c72f1 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source-location information into dependent
template specialization types. There are still a few rough edges to
clean up with some of the parser actions dropping
nested-name-specifiers too early.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126776 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
3aea4dac830cb03d883a13ab30c28a3a53beca58 01-Mar-2011 Ted Kremenek <kremenek@apple.com> For C++, enhance -Warray-bounds to recursively analyze array subscript accesses in ?: expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126766 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
90566c0e7b61de9bdfdf66f6dee440adb4e5b631 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Implement comparison of C++0x scoped enumeration types. Fixes PR9333.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126752 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
fff951371dfc309160a99d423e43a7841aeb35aa 01-Mar-2011 Douglas Gregor <dgregor@apple.com> When digging into a cv-qualified return type that is a pointer type to
diagnose ignored qualifiers on return types, only assume that there is
a pointer chunk if the type is *structurally* a pointer type, not if
it's a typedef of a pointer type. Fixes PR9328/<rdar://problem/9055428>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126751 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
e34e3f16580c586b032035e2612d12ae4569f21e 01-Mar-2011 Chandler Carruth <chandlerc@gmail.com> Move the bool-conversions behind the DiagRuntimeBehavior logic. It's
possible for these to show up due to metaprogramming both in unevaluated
contexts and compile-time dead branches.

Those aren't the bugs we're looking for.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126739 91177308-0d34-0410-b5e6-96231b3b80d8
arn_false_to_pointer.cpp
2494dd024b392b8def58bf067cc94b51c214cf77 01-Mar-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into
DependentNameTypeLoc. Teach the recursive AST visitor and libclang how to
walk DependentNameTypeLoc nodes.

Also, teach libclang about TypedefDecl source ranges, so that we get
those. The massive churn in test/Index/recursive-cxx-member-calls.cpp
is a good thing: we're annotating a lot more of this test correctly
now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126729 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
7c3179cf463c3b3b8c21dbb955f933ba50b74f28 28-Feb-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into
CXXDependentScopeMemberExpr, and clean up instantiation of
nested-name-specifiers with dependent template specialization types in
the process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126663 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
abea951c34876a5374d0e3678c7989b225c5c895 28-Feb-2011 Anders Carlsson <andersca@mac.com> Add -fcxx-exceptions to all tests that use C++ exceptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126599 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
xceptions.cpp
ullptr.cpp
eturn.cpp
val-references.cpp
nreachable-catch-clauses.cpp
nreachable-code.cpp
arn-unreachable.cpp
5e24f2a4ad3a3623349f058e99c7c71e1c8d705f 25-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> Sprinkle optional text of the "unavailable' attribute
where ever such attribute causes an error diagnostic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126509 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
00cf3cc2718671aa48e8da264a523b0058a8591e 25-Feb-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source location information into
DependentScopeDeclRefExpr. Plus, give NestedNameSpecifierLoc == and !=
operators, since we're going to need 'em elsewhere.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126508 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
09f3462e0713cfbf21fce3b80d838db63f14c789 25-Feb-2011 Matt Beaumont-Gay <matthewbg@google.com> s/clang-cc1/clang_cc1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126501 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
2b982b778d265c337af5d1b4c74ce49479cbda7d 25-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> Print optional message for attr(unavailable) in C++ mode.
// rdar://9046492


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126499 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
f3db29fff6a583ecda823cf909ab7737d8d30129 25-Feb-2011 Douglas Gregor <dgregor@apple.com> Push nested-name-specifier source-location information into
pseudo-destructor expressions. Also, clean up some
template-instantiation and type-checking issues with
pseudo-destructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126498 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
5149f37cfc736d03233bf92b5ba7c6e866c6647b 25-Feb-2011 Douglas Gregor <dgregor@apple.com> Maintain nested-name-specifier source-location information through
instantiation of using declarations (all three forms).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126485 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec-locations.cpp
30028234f38945981ebf9c8a2cb915fc2f9a63a4 25-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Rough fix for PR9323 that prevents Clang from marking copy constructor
declarations as referenced when in fact we're not going to even form
a call in the AST. This is significant because we attempt to allow as an
extension classes with intentionally private and undefined copy
constructors to have temporaries bound to references, and so shouldn't
warn about the lack of definition for that copy constructor when the
class is internal.

Doug, John wasn't really satisfied with the presence of overloading at
all. This is a stop-gap and there may be a better solution. If you can
give me some hints for how you'd prefer to see this solved, I'll happily
switch things over.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126480 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
10aad449dfbb5b43611d45b99c88dfc26db7fac9 25-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Fix the rest of PR9316 along with some other bugs spotted by inspection.
I tried to add test cases for these, but I can't because variables
aren't warned on the way functions are and the codegen layer appears to
use different logic for determining that 'a' and 'g' in the test case
should receive C mangling. I've included the test so that if we ever
switch the codegen layer to use these functions, we won't regress due to
latent bugs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126453 91177308-0d34-0410-b5e6-96231b3b80d8
inkage.cpp
094b64336495496ca29bc1e4774f5e2ceed79096 24-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Likely fix for PR9316 and other unknown bugs: don't use the anonynmous
namespace blanket rule for variables and functions declared 'extern
"C"'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126400 91177308-0d34-0410-b5e6-96231b3b80d8
inkage.cpp
5fa05cb906e9ddd34ef2ae2a872014aeaf4bc04d 24-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Simplify messages as requested by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126389 91177308-0d34-0410-b5e6-96231b3b80d8
hift.cpp
1d6ab7af99a1fc059a6aa5da083640c1d94b07f7 24-Feb-2011 Chris Lattner <sabre@nondot.org> compute the integer width, not the memory width here. We want to know that
_Bool is 1 bit, not 8. This fixes an assertion on the testcase, which is
PR9304 and rdar://9045501.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126368 91177308-0d34-0410-b5e6-96231b3b80d8
witch.cpp
fa0b48fd2af19f862242dc3643e4e95baea25d4e 24-Feb-2011 Douglas Gregor <dgregor@apple.com> Test case for previous commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126360 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
6c3c3f53b32288f0be38e010c96da271f264f2ad 24-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Handle value dependent LHS as well as RHS. Test both of these, they
don't seem to have been covered by our tests previously.

This should fix bootstrap failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126345 91177308-0d34-0410-b5e6-96231b3b80d8
hift.cpp
9e060ca641a1f845cecb3371b3a3018d306a5198 24-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix bogus -Warray-bounds warning involving 'array[true]' reported in PR 9296.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126341 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
d067c07c6cbf099b25aba38bcb66f38e79d0c420 23-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Fix the behavior of -Wignored-qualifiers on return type qualifiers in
several ways. We now warn for more of the return types, and correctly
locate the ignored ones. Also adds fix-it hints to remove the ignored
qualifiers. Fixes much of PR9058, although not all of it.

Patch by Hans Wennborg, a couple of minor style tweaks from me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126321 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
3bcc2be17b5cab730a70df07aa8316885535f564 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Add test case for PR 9284, a false positive for -Warray-bounds that is now addressed using basic reachability analysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126291 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
351ba91eaa6d30e523587b2d7ed676a5172c6e56 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Enhance Sema::DiagRuntimeBehavior() to delay some diagnostics to see if the related code is reachable. This suppresses some
diagnostics that occur in unreachable code (e.g., -Warray-bound).

We only pay the cost of doing the reachability analysis when we issue one of these diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126290 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
406c38e8c1f105acfd438f94dfbc17af817aa4a5 23-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR9276: We were missing the checks for auto deducing to different types in the same declaration group in the template instantiation case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126279 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-auto.cpp
65b34d7bc314c7d4b448164e1a889311bd30b375 23-Feb-2011 Matt Beaumont-Gay <matthewbg@google.com> Clean up the error recovery at the bottom of Sema::LookupMemberExpr. This
mostly just shuffles various possibilities for recovery into a more
straightforward order, but also unifies a couple of diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126266 91177308-0d34-0410-b5e6-96231b3b80d8
R7944.cpp
ember-expr.cpp
7019186f3c05539698b589a59729b0adfb8ea0a1 23-Feb-2011 Douglas Gregor <dgregor@apple.com> When checking for abstract types, don't crash when we have a
FunctionProtoTypeLoc with NULL function parameter types, which can
occur in invalid code. Fixes PR9247 / <rdar://problem/9037911>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126262 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
12e3ecec906f65580059a9d8555849a272c2db81 23-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> Provide Fixit warning when 'auto' is intended as storage
specifier in legacy code. Patch is reviewed offline by Doug.
// rdar://9036633.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126261 91177308-0d34-0410-b5e6-96231b3b80d8
uto-cxx0x.cpp
1756ce44b0e03d6a6fd2d42add6e3227d4d04d34 22-Feb-2011 Douglas Gregor <dgregor@apple.com> We need a longer long when testing this pathe Microsoft fixed-underlying-type extension for enumeration types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126250 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
86f208c1a112c3e8984e63daec15ccf0a1a84329 22-Feb-2011 Douglas Gregor <dgregor@apple.com> Enable enumeration types with a fixed underlying type, e.g.,

enum X : long { Value = 0x100000000 };

when in Microsoft-extension mode (-fms-extensions). This (now C++0x)
feature has been supported since Microsoft Visual Studio .NET 2003.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126243 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
b9075601840893a8f7a21918ac4c7e28dcb67f1a 22-Feb-2011 Douglas Gregor <dgregor@apple.com> Fix a little bug in the handling of enumeration types with a fixed
underlying type: we weren't parsing unnamed enumeration types with a
fixed underlying type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126184 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
77efc680156bc28d3c0d2e70f156904f91328b21 21-Feb-2011 John McCall <rjmccall@apple.com> Don't warn about static const integral data members with in-line constant
initializers just because they don't have a proper out-of-line definition.
Such code is technically ill-formed but is too common and too unlikely to be
a problem to be seriously worth worrying about.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126137 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
34d49471e0b6386aefdc0f6bd15e4a4876ce5db1 21-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Clean up the tests for warning about unused function results given the
appropriate attribute. Add a bit more testing that finds a pretty bad
regression (since ~forever) in this warning. Fix it with a nice 2 line
change. =]

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126098 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-result.cpp
arn-unused-variables.cpp
34b41d939a1328f484511c6002ba2456db879a29 20-Feb-2011 Richard Smith <richard-llvm@metafoo.co.uk> Implement the C++0x deduced 'auto' feature.

This fixes PR 8738, 9060 and 9132.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126069 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-auto.cpp
edeclared-auto.cpp
railing-return-0x.cpp
3e026e323f1bd820fb9c880b1db951c87df94bb4 19-Feb-2011 Douglas Gregor <dgregor@apple.com> Don't produce "comparison is always (true|false)" warnings when the
comparison itself is a constant expression. Fixes PR7536.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126057 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
ype-dependent-exprs.cpp
1be8eec3ddd2a23c19b453c2639226174eb5d4a8 19-Feb-2011 Douglas Gregor <dgregor@apple.com> Handle the resolution of a reference to a function template (which
includes explicitly-specified template arguments) to a function
template specialization in cases where no deduction is performed or
deduction fails. Patch by Faisal Vali, fixes PR7505!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126048 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function-casting.cpp
ddr-of-overloaded-function.cpp
7f11d9cf5df1f8ce82af46eabc4ec5cec7d580b0 19-Feb-2011 Anders Carlsson <andersca@mac.com> Disallow try/catch/throw when exceptions are disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126039 91177308-0d34-0410-b5e6-96231b3b80d8
o-exceptions.cpp
e41721e7dfabcc15cb50be9075a4153f1ad648ea 19-Feb-2011 Anders Carlsson <andersca@mac.com> Pass -fexceptions to all tests that use try/catch/throw.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126037 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
xceptions.cpp
ullptr.cpp
eturn.cpp
val-references.cpp
nreachable-catch-clauses.cpp
nreachable-code.cpp
arn-unreachable.cpp
f4b793ceb60418b64d3593ba3c8240e3594bff8f 19-Feb-2011 Douglas Gregor <dgregor@apple.com> Teach the virtual-functions-without-virtual-destructor warning to only
warn about polymorphic classes (which have virtual functions) rather
than dynamic classes (which are polymorphic or have virtual bases).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126036 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
15e310a3b970b64a84cb30f0005bc396b4d978cb 19-Feb-2011 John McCall <rjmccall@apple.com> Warn about code that uses variables and functions with internal linkage
without defining them. This should be an error, but I'm paranoid about
"uses" that end up not actually requiring a definition. I'll revisit later.

Also, teach IR generation to not set internal linkage on variable
declarations, just for safety's sake. Doing so produces an invalid module
if the variable is not ultimately defined.

Also, fix several places in the test suite where we were using internal
functions without definitions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126016 91177308-0d34-0410-b5e6-96231b3b80d8
ndefined-internal.cpp
7ef932429ed0edcc5e4bf44e516f5f4be6a8a03f 19-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Fix a missed case in the NULL operand to conditional operator
diagnostics.

Patch by Stephen Hines.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125998 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
ullptr.cpp
0a8709a4744f6a80a006edf78b27597d9232ee30 19-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Update the test error messages to match the update I made to the actual
messages.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125997 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
45f11b78750590b1b1bcec6746c7639a256ce2a2 19-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Fix PR8767, improve diagnostic wording when allocating an object of an
abstract class type.

Patch by Stephen Hines, with a wording tweak from Doug applied by me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125996 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
xceptions.cpp
irtual-override.cpp
82214a80c0163e01e4d8dec1426023c89277dbb4 19-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Initial steps to improve diagnostics when there is a NULL and
a non-pointer on the two sides of a conditional expression.

Patch by Stephen Hines and Mihai Rusu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125995 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
onditional-expr.cpp
ullptr.cpp
25b3b849e3ad340b04442707038c86980035765b 18-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix assertion failure on -Warray-bounds for 32-bit builds of Clang.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125821 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
a85f5284c34f3969701a6f2121e8fcfc2fc5e81d 17-Feb-2011 Ted Kremenek <kremenek@apple.com> Add -Warray-bounds test showing how the warning currently interoperates with macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125781 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
35001ca261f895817916b468379b696d6d45959d 17-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Enhance the array bounds checking to work for several other constructs,
especially C++ code, and generally expand the test coverage.

Logic adapted from a patch by Kaelyn Uhrain <rikka@google.com> and
another Googler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125775 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
a5b9332418f25338f118358e27303cd510d54107 17-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Implement a sub-group of -Wconversion: -Wliteral-conversion. This
specifically targets literals which are implicitly converted, a those
are more often unintended and trivial to fix. This can be especially
helpful for diagnosing what makes 'const int x = 1e6' not an ICE.

Original patch authored by Jim Meehan with contributions from other
Googlers and a few cleanups from myself.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125745 91177308-0d34-0410-b5e6-96231b3b80d8
arn-literal-conversion.cpp
543cb655b174087f6c2d22009934c9fed6c32114 17-Feb-2011 Chandler Carruth <chandlerc@gmail.com> Implement -Wenum-compare, which warns when comparing two enums of
different types. We omit the warning when the enum types are anonymous.
Unlike GCC, this warning does not distinguish between C++ and C/ObjC for
controling whether it is on by default, it is always on by default.

Original patch contributed by Richard Trieu (@ Google), I fixed some
style issues, and cleaned it up for submission.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125739 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
arn-enum-compare.cpp
c6daf0b29d6c48a99cb1ad707973a7e6dfcafd58 17-Feb-2011 Douglas Gregor <dgregor@apple.com> When printing a qualified type, look through a substituted template
parameter type to see what's behind it, so that we don't end up
printing silly things like "float const *" when "const float *" would
make more sense. Also, replace the pile of "isa" tests with a simple
switch enumerating all of the cases, making a few more obvious cases
use prefix qualifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125729 91177308-0d34-0410-b5e6-96231b3b80d8
ype-formatting.cpp
26ae5dd9cfc561527eca418571323d90589a4b92 17-Feb-2011 Matt Beaumont-Gay <matthewbg@google.com> Fix PR9025 and add a diagnostic (and sometimes a fixit) for an overloaded
function name used as the base of a member expression. Early feedback from
Chandler Carruth, and code review from Nick Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125714 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
c71a2c0ce03ec74391ff2b43b0a966860f23786e 17-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix assertion failure in -Warray-bounds on template parameters used as arrays.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125693 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bounds.cpp
79ab2c8104ef5df233d271560ccc734836738e56 14-Feb-2011 John McCall <rjmccall@apple.com> Provide overload diagnostics when explicit casts involving class types fail.
PR8626.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125506 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
ector-casts.cpp
eee1d5434ebfa955ffc3c493aecd68bb7b3f4838 14-Feb-2011 John McCall <rjmccall@apple.com> When parsing an out-of-line member function declaration, we must delay
access-control diagnostics which arise from the portion of the declarator
following the scope specifier, just in case access is granted by
friending the individual method. This can also happen with in-line
member function declarations of class templates due to templated-scope
friend declarations.

We were really playing fast-and-loose before with this sort of thing,
and it turned out to work because *most* friend functions are in file
scope. Making us delay regardless of context exposed several bugs with
how we were manipulating delay. I ended up needing a concept of a
context that's independent of the declarations in which it appears,
and then I actually had to make some things save contexts correctly,
but delay should be much cleaner now.

I also encapsulated all the delayed-diagnostics machinery in a single
subobject of Sema; this is a pattern we might want to consider rolling
out to other components of Sema.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125485 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
e3c8c64e7735c3589e1a34e6000c93183a55920c 12-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> Implement objective-c++'s block pointer type matching involving
types which are contravariance in argument types and covariance
in return types. // rdar://8979379.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125445 91177308-0d34-0410-b5e6-96231b3b80d8
lock-call.cpp
74b47f9173ccd2c22686b8fbf9d69852d6f46ac6 10-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> For -Woverloaded-virtual take into account canonical methods. Fixes rdar://8979966 & http://llvm.org/PR9182.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125296 91177308-0d34-0410-b5e6-96231b3b80d8
arn-overloaded-virtual.cpp
af8ca37a7fa45bff84831706c6d85f9e5b4e1d15 10-Feb-2011 John McCall <rjmccall@apple.com> Move the check that gives functions with unique-external types unique-external
linkage into Decl.cpp. Disable this logic for extern "C" functions, because
the operative rule there is weaker. Fixes rdar://problem/8898466



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125268 91177308-0d34-0410-b5e6-96231b3b80d8
inkage.cpp
arn-unused-filescoped.cpp
332bb2a2e3cd0a5af85758847a8050ae8ceee5f3 08-Feb-2011 John McCall <rjmccall@apple.com> When checking the 'weak' and 'weakref' attributes, look for non-external
linkage rather than the presence of the 'static' storage class specifier.
Fixes rdar://problem/8814626.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125126 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-weak.cpp
ttr-weakref.cpp
f9536f4c843c6df49f1083b4b0300da8a0883645 08-Feb-2011 John McCall <rjmccall@apple.com> Test case accidentally left out of my last commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125119 91177308-0d34-0410-b5e6-96231b3b80d8
inkage.cpp
651f86fb6b0f1a251c65a9be6d3fa83e67d5988d 08-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> In Sema::CheckShadow, get the DeclContext from the variable that we are checking
instead from the Scope; Inner scopes in bodies don't have DeclContexts associated with them.

Fixes http://llvm.org/PR9160 & rdar://problem/8966163.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125097 91177308-0d34-0410-b5e6-96231b3b80d8
arn-shadow.cpp
1b528445016c2dba23babeea07e352ca8b816262 07-Feb-2011 Ted Kremenek <kremenek@apple.com> Move uninitialized variable checking back under -Wuninitialized-experimental. It is clear from user feedback that this warning is not quite ready.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125007 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
683564a7a93c952f1fbe573b55c542418d29d859 07-Feb-2011 Anton Yartsev <anton.yartsev@gmail.com> pre/post ++/-- for AltiVec vectors. (with builtins-ppc-altivec.c failure fixed)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125000 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
1de34dd8a6932fbb316e35304bf468ddb4a0841b 05-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> When the out-of-line definition differs from the declaration in the return type,
say "out-of-line definition differ from the declaration in the return type" instead of
the silly "functions that differ only in their return type cannot be overloaded".

Addresses rdar://7980179.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124939 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
09f57b966c2a6c0a1c8d2e0be9862f6b2c89f9f4 05-Feb-2011 Ted Kremenek <kremenek@apple.com> Don't suggest -Wuninitialized fixits for uninitialized enum types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124924 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
799ef666685d6c97d64d1970a6f68bf7923360c2 03-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement -Woverloaded-virtual.

The difference with gcc is that it warns if you overload virtual methods only if
the method doesn't also override any method. This is to cut down on the number of warnings
and make it more useful like reported here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20423.
If we want to warn that not all overloads are overriden we can have an additional
warning like -Wpartial-override.

-Woverloaded-virtual, unlike gcc, is added to -Wmost. Addresses rdar://8757630.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124805 91177308-0d34-0410-b5e6-96231b3b80d8
arn-overloaded-virtual.cpp
609e3170841dac81c3b7b6b9eccb9c520e42c9b2 03-Feb-2011 Ted Kremenek <kremenek@apple.com> Based on user feedback, swap -Wuninitialized diagnostics to have the warning refer to the bad use, and the note to the variable declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124758 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
8d2968cc527fc775e1e1e72a25b581820a51225d 02-Feb-2011 Fariborz Jahanian <fjahanian@apple.com> Turn test for // rdar://8945175 into a sema test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124748 91177308-0d34-0410-b5e6-96231b3b80d8
on-empty-class-size-zero.cpp
668fdd8578c85aa2692ffdeb7614acabf1aaab25 02-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't warn for -Wnon-virtual-dtor for dependent classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124735 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
f7275cd4b930e658930b8a319aa06c0168a4720a 02-Feb-2011 Ted Kremenek <kremenek@apple.com> Remove redundant check to not warn for warn_equality_with_extra_parens if we are in a macro. This is checked twice.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124714 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
006ae38a494d6b2389b7c67728705dc8da996754 01-Feb-2011 Ted Kremenek <kremenek@apple.com> Don't warn about extraneous '()' around a comparison if it occurs within a macro.

Macros frequently contain extra '()' to make instantiation less error prone.
This warning was flagging a ton of times on postgresql because of its use of macros.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124695 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
cf1620a0ef7f6dc71f4fad5c46fbb0a2de6c6308 01-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't warn for "if ((a == b))" if the parens came from a macro. Thanks to Fariborz for the hint!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124689 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
70f233017bd3091137dcfbc00f6b2baea56edba9 01-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> For "if ((a == b))" only warn if 'a' is a modifiable l-value. Caught by John!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124675 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
0e2dc3a1159806c8303b0979be1ce1526cc64ed3 01-Feb-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Warn for "if ((a == b))" where the equality expression is needlessly wrapped inside parentheses.
It's highly likely that the user intended an assignment used as condition.

Addresses rdar://8848646.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124668 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
d880f52be3e4a8ccad92ac31932eeae5e0870a93 01-Feb-2011 Douglas Gregor <dgregor@apple.com> Implement access checking for the "delete" operator. Fixes PR9050,
from Alex Miller!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124663 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
9641fc8e43f53b1ae8ed7742017e0a320d75fa8a 31-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Only warn for -Wnon-virtual-dtor for public destructors. Thanks to Benjamin Kramer for the hint!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124585 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
683a81f4373cf1fa9d41a751dca6f7c36125b058 31-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the suggested resolution to core issue 547, extended to also
allow ref-qualifiers on function types used as template type
arguments. GNU actually allows cv-qualifiers on function types in many
places where it shouldn't, so we currently categorize this as a GNU
extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124584 91177308-0d34-0410-b5e6-96231b3b80d8
ssue547.cpp
def4e2a405a15eb8381ca305725285d27a4bab65 31-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Warn if the class has virtual methods but non-virtual destructor. Addresses rdar://8756445.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124582 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
36eb5e43bcdbe291da4df696755009ffd6a35ac2 31-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't warn that variables in C++ static member functions shadow fields. Fixes rdar://8900456.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124581 91177308-0d34-0410-b5e6-96231b3b80d8
arn-shadow.cpp
43f0a7c8e06e55092b43d4dd46fe09a4d57298e9 31-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> If there were errors, disable 'unused' warnings since they will mostly be noise.
Fixes rdar://8736362.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124577 91177308-0d34-0410-b5e6-96231b3b80d8
nused-with-error.cpp
6ad5df132a0bcb3f6975362901270be5bf60dc56 31-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Error for use of field from anonymous struct or union should say "invalid use of nonstatic data member"
not "call to non-static member function without an object argument".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124576 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
d89d30fdd9e3061fb100fb8f976aab5c6cf2c901 28-Jan-2011 John McCall <rjmccall@apple.com> Fix some corner cases in the __is_base_of logic.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124505 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
b608b987718c6d841115464f79ab2d1820a63e17 28-Jan-2011 Douglas Gregor <dgregor@apple.com> Give OpaqueValueExpr a source location, because its source location
might be queried in places where we absolutely require a valid
location (e.g., for template instantiation). Fixes some major
brokenness in the use of __is_convertible_to.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124465 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
1eee5dc0465c0ab4810e21d365e881152d7f53c0 27-Jan-2011 Douglas Gregor <dgregor@apple.com> Teach the evaluation of the __is_convertible_to trait to translate
access control errors into SFINAE errors, so that the trait provides
enough support to implement the C++0x std::is_convertible type trait.

To get there, the SFINAETrap now knows how to set up a SFINAE context
independent of any template instantiations or template argument
deduction steps, and (separately) can set a Sema flag to translate
access control errors into SFINAE errors. The latter can also be
useful if we decide that access control errors during template argument
deduction should cause substitution failure (rather than a hard error)
as has been proposed for C++0x.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124446 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
9f3611365d0f2297a910cf246e056708726ed10a 27-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the Microsoft __is_convertible_to type trait, modeling the
semantics after the C++0x is_convertible type trait. This
implementation is not 100% complete, because it allows access errors
to be hard errors (rather than just evaluating false).

Original patch by Steven Watanabe!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124425 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
b7ee2e5cc999a45ec4fd7b879477816714aabb7e 27-Jan-2011 Jeffrey Yasskin <jyasskin@google.com> Revert r124217 because it didn't catch the actual error case it was trying to
catch:

lock_guard(my_mutex);

declares a variable instead of creating a temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124398 91177308-0d34-0410-b5e6-96231b3b80d8
orbid-temporaries.cpp
5811f5978feaa7b89bd89e174fa7ad077b48413e 26-Jan-2011 Ted Kremenek <kremenek@apple.com> Teach -Wreturn-type that destructors can appear
after a 'return' in a CFGBlock. This accidentally
was working before, but the false assumption that
'return' always appeared at the end of the block
was uncovered by a recent change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124280 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
fd6b874f3af26bc64a1d5781833c197b314afb8b 26-Jan-2011 Ted Kremenek <kremenek@apple.com> Merge -Wuninitialized-experimental into -Wuninitialized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124279 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
df8dc5d772d23bb760aeeda374c39001d12e4497 26-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix infinite loop during error diagnostics. Fixes rdar://8875304.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124243 91177308-0d34-0410-b5e6-96231b3b80d8
rrow-operator.cpp
8b3b3db2f6eef4080c9c99c3c3af582f9e8fa41e 25-Jan-2011 Ted Kremenek <kremenek@apple.com> Tweak return-noreturn.cpp test to have its original
contents, with the additional warning flag (and still marked XFAIL).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124239 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn-XFAIL.cpp
eturn-noreturn.cpp
arn-missing-noreturn.cpp
f39e6a388aaa2f155b46c61e655784b2473218eb 25-Jan-2011 Ted Kremenek <kremenek@apple.com> Fix regression in -Wreturn-type caused by not
handling all CFGElement kinds. While writing
the test case, it turned out that return-noreturn.cpp
wasn't actually testing anything since it has the wrong -W
flag. That uncovered another regression with
the handling of destructors marked noreturn. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124238 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn-XFAIL.cpp
eturn-noreturn.cpp
c60e13aeff96515d27638129154b1308c15ded3d 25-Jan-2011 Jeffrey Yasskin <jyasskin@google.com> Add an attribute to forbid temporary instances of a type. This allows class
authors to write

class __attribute__((forbid_temporaries)) Name { ... };

when they want to force users to name all variables of the type. This protects
people from doing things like creating a scoped_lock that only lives for a
single statement instead of an entire scope.

The warning produced by this attribute can be disabled by
-Wno-forbid-temporaries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124217 91177308-0d34-0410-b5e6-96231b3b80d8
orbid-temporaries.cpp
5af1f066230be7571cffb408048479ad0f06f75e 25-Jan-2011 Eric Christopher <echristo@apple.com> Revert r124146 for now. It appears to be failing on a few platforms.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124153 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
e07ae4ee00baedcfc2c59fb2a7500dbec08371e9 24-Jan-2011 Anton Yartsev <anton.yartsev@gmail.com> pre/post increase/decrease for AltiVec vectors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124146 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
446e4029c75b651475e9055dc9dd18fbc7b6dabe 24-Jan-2011 Nick Lewycky <nicholas@mxc.ca> Enhance the diagnostic for referring to a typedef with an elaborated name to be
as useful in a templated context as it is without templates. Fixes PR8755!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124136 91177308-0d34-0410-b5e6-96231b3b80d8
R8755.cpp
8dde14e7f43a4b29e592b3e8e576eb467ddb6c6e 24-Jan-2011 Douglas Gregor <dgregor@apple.com> Re-instate r123977/r123978, my updates of the reference-binding
implementation used by overload resolution to support rvalue
references. The original commits caused PR9026 and some
hard-to-reproduce self-host breakage.

The only (crucial!) difference between this commit and the previous
commits is that we now properly check the SuppressUserConversions flag
before attempting to perform a second user-defined conversion in
reference binding, breaking the infinite recursion chain of
user-defined conversions.

Rvalue references should be working a bit better now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124121 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
ecl-init-ref.cpp
f502d93b0ea970bfbd897e657f8d940a20984de2 24-Jan-2011 Anders Carlsson <andersca@mac.com> Mark VTables and RTTI data linkonce_odr instead of weak_odr, with the exception of explicit template instantiations, which have to be weak_odr.

This fixes PR6996.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124089 91177308-0d34-0410-b5e6-96231b3b80d8
ypeid-ref.cpp
15e14a289583616e582a23b320933e846a742626 23-Jan-2011 Anders Carlsson <andersca@mac.com> Get rid of [[hiding]], [[override]] and [[base_check]].

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124087 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
f89e0424b8903438179f4a2f16dddd5e5bdc814e 23-Jan-2011 Anders Carlsson <andersca@mac.com> Get rid of the [[final]] C++0x attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124083 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
f3beabfcbb35961b44afc093eb435df7f2a6b785 22-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Add test from PR9026.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124034 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
aa5952c53f6c6a844a22fa2294186e16018b31e1 22-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> revert r123977 and r123978 to fix PR9026.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124033 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
5232011c942820bba5d033fbd4aa06d4bcbeb6c6 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Add a test for "perfect" forwarding

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124005 91177308-0d34-0410-b5e6-96231b3b80d8
val-references-examples.cpp
dcfb360f6e1aaab0754a98e1e245c2607c46058a 21-Jan-2011 Ted Kremenek <kremenek@apple.com> Provide -Wuninitialized-experimental fixits
for floats, and also check if 'nil' is declared
when suggesting it for initializing ObjC pointers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124004 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
94b1b4d785bc0f09f6af4be394e59d51f35dda60 21-Jan-2011 Ted Kremenek <kremenek@apple.com> Enhance -Wuninitialized-experimental diagnostics
to issue the warning at an uninitialized variable's
declaration, but to issue notes at possible
uninitialized uses (which could be multiple).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123994 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
cc15f010672a13b38104a32e3cefc7adc07ffbf7 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Implement the preference for move-construction over copy-construction
when returning an NRVO candidate expression. For example, this
properly picks the move constructor when dealing with code such as

MoveOnlyType f() { MoveOnlyType mot; return mot; }

The previously-XFAIL'd rvalue-references test case now works, and has
been moved into the appropriate paragraph-specific test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123992 91177308-0d34-0410-b5e6-96231b3b80d8
val-references-examples.cpp
val-references-xfail.cpp
71fdb354520178c2663f56f466f7abca538b877f 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Add unique_ptr example to test the use of rvalue references. I'll grow
this example further as more rvalue-reference features come online.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123980 91177308-0d34-0410-b5e6-96231b3b80d8
val-references-examples.cpp
68ed68b227c25babfbdd38d9a5b4b423d501951f 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Update the reference-binding implementation used for overload
resolution to match the latest C++0x working paper's semantics. The
implementation now matching up with the reference-binding
implementation used for initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123977 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
fb5d7efc279335bde2cdc0a73da525d6b28201e9 21-Jan-2011 Douglas Gregor <dgregor@apple.com> Improve the diagnostic that complains about binding an rvalue
reference to an lvalue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123953 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
b2855ad68d93824faf47c09bbef90ba74157f0f4 21-Jan-2011 Douglas Gregor <dgregor@apple.com> More work to bring reference binding up to the latest C++0x
specification. In particular, an rvalue reference can bind to an
initializer expression that is an lvalue if the referent type and the
initializer expression type are not reference-related. This is a newer
formulation to the previous "rvalue references can never bind to
lvalues" rule.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123952 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
2d4bed140f65d713673d2d32ec3adadc960078c6 20-Jan-2011 Ted Kremenek <kremenek@apple.com> Relax CFG assertions in UninitializedValuesV2 when
handling pseudo-path sensitivity, and instead
use those assertion conditions as dynamic checks.
These assertions would be violated when analyzing
a CFG where some branches where optimized away
during CFG construction because their branch
conditions could be trivially determined.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123943 91177308-0d34-0410-b5e6-96231b3b80d8
ninit-variables.cpp
ac6a858f6b7df4e83e4ad5921565a0b425ea00c3 20-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Merge test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123914 91177308-0d34-0410-b5e6-96231b3b80d8
R9007.cpp
rashes.cpp
15c6c0ef323fd60bcf4d8a975eea58713c3736ca 20-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Turns out that the previous commit also fixes this :-)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123873 91177308-0d34-0410-b5e6-96231b3b80d8
R9007.cpp
706df2fb3f00450cea6809c363eee35bfb3e1025 20-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Fix PR8884 by skipping transparent contexts. The test is for LikageSpec. I
failed to find a case where an enum context would make a difference, but
found PR9007 on the way.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123871 91177308-0d34-0410-b5e6-96231b3b80d8
R8884.cpp
f2ae52605a49e5fc7a581f2c1ae02f1811034578 20-Jan-2011 Douglas Gregor <dgregor@apple.com> Sema::BuildCXXMemberCallExpr() can fail due to access or ambiguities,
so allow it to propagate the failure outward. Fixes the crashing part
of <rdar://problem/8876150>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123863 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
92c3a04f3ec683f279814b0eb6d6271b3fd3a219 19-Jan-2011 Douglas Gregor <dgregor@apple.com> Warn about the use of unparenthesized |= in conditionals (which may be
a typo for !=). Fixes PR9001, from Hans Wennborg!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123836 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
c21fed361c11f13db345cba69101578578d8fb79 18-Jan-2011 Ted Kremenek <kremenek@apple.com> 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
ninit-variables.cpp
22c412060e82dbe577dd8374677219dc68baec87 17-Jan-2011 Anders Carlsson <andersca@mac.com> Handle base and member destructors in CheckFallThrough.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123667 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
b918d0f5d8f147e1e26c34e6cf42a79af2d2ec41 17-Jan-2011 Argyrios Kyrtzidis <akyrtzi@gmail.com> 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
ragma-unused.cpp
5be38be82a6631786624625d010d695d529802a8 17-Jan-2011 Francois Pichet <pichet2000@gmail.com> Remove a c++ file test I inadvertently added in Sema last week.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123608 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
0dc5f9aea3597f2ed400dd0c1bf45ebbb4a051f3 16-Jan-2011 Anders Carlsson <andersca@mac.com> 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
arn-missing-noreturn.cpp
2d75bbd36e273f7b958aefc766424220ad158bd9 16-Jan-2011 Douglas Gregor <dgregor@apple.com> 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
99.cpp
57244f69e2e780bb5584a37a12e31be83b1eaadb 12-Jan-2011 Rafael Espindola <rafael.espindola@gmail.com> Set unnamed_addr in every type info.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123293 91177308-0d34-0410-b5e6-96231b3b80d8
ypeid-ref.cpp
eeef924c4fcb79a3bcc8782afce343e641bbcb83 08-Jan-2011 Chandler Carruth <chandlerc@gmail.com> 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
eturn-noreturn.cpp
ebfde17d96960808fdc8d39098968818a18f2f42 06-Jan-2011 Fariborz Jahanian <fjahanian@apple.com> Put warning about makeing a string writable into
its own deprecated diagnostics group so it can be
turned off selectively. // rdar://8827606


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122967 91177308-0d34-0410-b5e6-96231b3b80d8
ritable-strings-deprecated.cpp
914c9a61b7ef96ed259a464f20e51d166b5f68b0 06-Jan-2011 Chandler Carruth <chandlerc@gmail.com> Tweak the wording of this warning further based on a suggestion from Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122951 91177308-0d34-0410-b5e6-96231b3b80d8
trtomember.cpp
2fdc5e8199e1e239620f2faae88997153703e16f 05-Jan-2011 Douglas Gregor <dgregor@apple.com> 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
verloaded-builtin-operators.cpp
9f7a6eeee441bcbb1b17208cb3abd65a0017525a 04-Jan-2011 Chandler Carruth <chandlerc@gmail.com> 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
arn-self-assign.cpp
b2b5cc0cf908d516a107d373db963f692449a8a8 04-Jan-2011 Chandler Carruth <chandlerc@gmail.com> 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
irtual-override.cpp
ef9d09c4699a2a61d6f28b59b7583b2b28c0a531 03-Jan-2011 Chandler Carruth <chandlerc@gmail.com> 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
arn-unused-filescoped.cpp
6fb0729241ab204e9bed9a5ff2f5bd396db111d4 21-Dec-2010 Douglas Gregor <dgregor@apple.com> When checking a using declaration, make sure that the context we're
looking in is complete. Fixes PR8756.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122323 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
7dd3c73b7d984d5cd6e0d94e5016ebed03bddfdf 16-Dec-2010 Ted Kremenek <kremenek@apple.com> Tweak location of diagnostic for -Wunreachable-code
test due to recent changes to the CFG. The
diagnostic is somewhat in the wrong place, but
the -Wunreachable-code diagnostic needs to be
revamped anyway since most of the diagnostics
in this test case are redundant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121961 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
de43632a5951abf3f357e2f79dcddda4dc6ec8ff 15-Dec-2010 Douglas Gregor <dgregor@apple.com> __attribute__((nonnull)) can apply to reference-to-pointer
parameters. Fixes <rdar://problem/8769025>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121864 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-nonnull.cpp
1192fff983d1b28cf7c8dd2e3dcf50734afc6f75 13-Dec-2010 Chandler Carruth <chandlerc@gmail.com> Remove a type that got reduced away from this test case but not actually deleted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121694 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-stack-addr.cpp
e7f85047d0dd5ebb03d851fab0afa9db07ec2925 13-Dec-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR8774 by restricting when hasInit returns true. Previously, it
would return true if the initializer pointer union had *any* non-null
pointer in it, even if the pointer wasn't one that would actually be
returned via getInit(). This makes it more accurately model the logic of
'getInit() != NULL'.

This still isn't completely satisfying. From a principled stance,
I suspect we should make hasInit() and getInit() *always* return false
and NULL (resp.) for ParmVarDecl. We shouldn't at the API level treat
initializers and default arguments as the same thing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121692 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-stack-addr.cpp
5a821198203bdd469175408c4c4c805cc3240159 09-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix another unnecessary-struct-padding issue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121352 91177308-0d34-0410-b5e6-96231b3b80d8
ragma-pack.cpp
43ddd9f2027bdd9c36336a342e9c0dd2aa13f836 09-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Before determining the effect the alignment of base struct will have in the aligment of the sub-struct,
take into account if the sub-struct is packed and its maximum field alignment.

Fixes rdar://8745206

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121335 91177308-0d34-0410-b5e6-96231b3b80d8
ragma-pack.cpp
346af03b21db01264852afb8a86719c9284855fe 08-Dec-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Handle parameter attributes when tentative parsing for function/variable disambiguation.
Fixes rdar://8739801.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121228 91177308-0d34-0410-b5e6-96231b3b80d8
cl_ambig_res.cpp
f5fe2925b87cf382f2f13983c81679e38067122b 07-Dec-2010 Rafael Espindola <rafael.espindola@gmail.com> Fix PR8720 by printing an error message with a substring that the gcc testsuite searches for.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121137 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-weakref.cpp
6ad6f2848d7652ab2991286eb48be440d3493b28 07-Dec-2010 Francois Pichet <pichet2000@gmail.com> Type traits intrinsic implementation: __is_base_of(T, U)
New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121074 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
abc56c726178fc7c8a3f45185768426a6e9d584e 04-Dec-2010 John McCall <rjmccall@apple.com> When deciding whether to complain about the type of a boolean condition, use
the type of the expression *after* array/function decay.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120895 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
f6a1648197562e0b133440d612d9af297d0a86cc 04-Dec-2010 John McCall <rjmccall@apple.com> Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ. So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the
compiler.

In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.

This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.

Ted Kremenek kindly contributed the analyzer workarounds in this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120890 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
a61b3e7443056f8d05b24ca4cbea90fe66235d6b 01-Dec-2010 Douglas Gregor <dgregor@apple.com> After parsing a ':' in an enum-specifier within class context,
disambiguate between an expression (for a bit-field width) and a type
(for a fixed underlying type). Since the disambiguation can be
expensive (due to tentative parsing), we perform a simplistic
disambiguation based on one-token lookahead before going into the
full-blown tentative parsing. Based on a patch by Daniel Wallin.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120582 91177308-0d34-0410-b5e6-96231b3b80d8
num-bitfield.cpp
26e10bea3d2e9d2979194890e51b98ecea165a96 30-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Follow through references to catch returned stack addresses, local blocks, label addresses or references to temporaries, e.g:

const int& g2() {
int s1;
int &s2 = s1; // expected-note {{binding reference variable 's2' here}}
return s2; // expected-warning {{reference to stack memory associated with local variable 's1' returned}}
}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120483 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of-temporary.cpp
val-references.cpp
15d5c83ce698a6b6ae1166f9008c6ead34ae7a5d 30-Nov-2010 Nico Weber <nicolasweber@gmx.de> Fix bug in r120299 spotted by dgregor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120389 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
d976ca4fcacdd965446bcfbe8cb03b4ee67cd827 30-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert r120331 since it causes spurious warnings and a possible assertion hit when self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120351 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
8b2f01b56209f4bb7331292225c5300753880044 29-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Emit warnings if we are returning a reference to a local temporary.
The issue was brought to our attention by Matthieu Monrocq.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120331 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
08e41a656575ee63f8eefc7805493055c645fa85 29-Nov-2010 Nico Weber <nicolasweber@gmx.de> Always use a function's decl context when building default arguments. Fixes http://http://llvm.org/pr8479.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120299 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
7ff776eb7d874913588f55df4e6b459d15e20175 28-Nov-2010 Nico Weber <nicolasweber@gmx.de> Revert parts of r120266 that I did not mean to commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120267 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
6bb4dcb412d53d05a80017df81d41e447e2aa3ea 28-Nov-2010 Nico Weber <nicolasweber@gmx.de> Minor whitespace and comment fixes. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120266 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
2a5f99eb4e2af771faacfceb9f78e230129c5e5a 25-Nov-2010 Nick Lewycky <nicholas@mxc.ca> Tie DefineVTablesUsed() in with recursive function instantiation so that we emit
a useful template instantiation stack. Fixes PR8640.

This also causes a slight change to where the "instantianted from" note shows up
in truly esoteric cases (see the change to test/SemaCXX/destructor.cpp), but
that isn't directly the fault of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120135 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
table-instantiation.cc
76f11c953adb0df7ed4c7776538a592435cd7463 22-Nov-2010 Nico Weber <nicolasweber@gmx.de> Remove one I just added, add a more focused test for why the current code is correct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119969 91177308-0d34-0410-b5e6-96231b3b80d8
ourceranges.cpp
253e80b019727451edb4cbcad71277fcbe05ff0e 22-Nov-2010 Nico Weber <nicolasweber@gmx.de> Fix the source range of CXXNewExprs. Fixes http://llvm.org/pr8661.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119966 91177308-0d34-0410-b5e6-96231b3b80d8
ourceranges.cpp
a25b6a4b43e8b9611f7506e5fe1b448833b10a46 19-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't warn for empty 'if' body if there is a macro that expands to nothing, e.g:

if (condition)
CALL(0); // empty macro but don't warn for empty body.

Fixes rdar://8436021.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119838 91177308-0d34-0410-b5e6-96231b3b80d8
f-empty-body.cpp
0bc5c66a1c5a69d8ea067c86c63480d3feb210fa 19-Nov-2010 Fariborz Jahanian <fjahanian@apple.com> objc_msgSend is not a builtin type in non-objc mode.
Fixes //rdar://8686888


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119813 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin_objc_msgSend.cpp
aa4fe05939ffbfd746b8f0065cc0b5e06ea94fe2 18-Nov-2010 Anton Yartsev <anton.yartsev@gmail.com> comparison of AltiVec vectors now gives bool result (fix for 7533)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119678 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
1380a147d4578b619c215b23aa79ce17036d3c46 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> -Rename -Wargument-larger-than -> -Wlarge-by-value-copy
-Improve the diagnostic message
-Add some comments

Suggestions by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119594 91177308-0d34-0410-b5e6-96231b3b80d8
arn-argument-larger-than.cpp
arn-large-by-value-copy.cpp
3532fdd1db8ff6f353f2a5b215cebe3e0e2ff3c2 18-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce option -Wargument-larger-than[=N] which warns about function definitions if they take by-value
or return by-value any POD that is larger than some threshold (default is 64 bytes).

Implements rdar://8548050.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119583 91177308-0d34-0410-b5e6-96231b3b80d8
arn-argument-larger-than.cpp
9263a3060087eb7b5954ec4ee1ff2c22227b422e 16-Nov-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR8625 and correctly interpret member-calls to static members when
producing warnings.

This feels really fragile, and I've not audited all other argument index-based
warnings. I suspect we'll grow this bug on another warning eventually. It might
be nice to adjust the argument indices when building up the attribute AST node,
as we already have to remember about the 'this' argument within that code to
produce correct errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119340 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-format.cpp
07d7e7a6b10f798459f350b792713db2fb3e9365 16-Nov-2010 Chandler Carruth <chandlerc@gmail.com> Re-work the handling of implicit 'this' arguments and silly GCC-style attribute
argument indexes. This handles the offsets in a consistent manner for all of
the attributes which I saw working with these concepts. I've also added tests
for the attribute that motivated this: nonnull.

I consolidated the tests for format attributes into one file, and fleshed them
out a bit to trigger more of the warning cases. Also improved the quality of
some of the diagnostics that occur with invalid argument indices.

The only really questionable change here is supporting the implicit this
argument for the ownership attribute. I'm not sure it's really a sensible
concept there, but implemented the logic for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119339 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-format.cpp
ttr-nonnull.cpp
ormat-attribute.cpp
64ccf2480609f4b5c27b31f6beaa157e6ec4f065 16-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Improve diagnostic for calling non-const method on const object. Fixes rdar://7743000

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119336 91177308-0d34-0410-b5e6-96231b3b80d8
opy-initialization.cpp
5082d34e4107a44ac7f07b62f7a6c917e0e6e71e 16-Nov-2010 John McCall <rjmccall@apple.com> Add another case to the whitelist of cast kinds that can convert to bool.
Fixes PR8608.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119293 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
ae2cf767de457df939d07c44b162de5fe0b5e607 13-Nov-2010 Douglas Gregor <dgregor@apple.com> When complaining about ambiguous overload resolution for a unary or
binary operator, provide the types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119008 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
8ff338bfd8abd9ac5d0c1d89c1b05e2c02727174 12-Nov-2010 Douglas Gregor <dgregor@apple.com> When performing initialization of a copy of a temporary object, use
direct-initialization (rather than copy-initialization) to initialize
the temporary, allowing explicit constructors. Fixes PR8342.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118880 91177308-0d34-0410-b5e6-96231b3b80d8
opy-initialization.cpp
15d7d12226f83de24f96f4bf4e27ebba30fef51e 11-Nov-2010 John McCall <rjmccall@apple.com> Extend the bitfield-truncation warning to initializations.
rdar://problem/8652606



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118773 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
d7945c6bfd9e0cc7ed451e6c4acd8860f2d0eaba 10-Nov-2010 John McCall <rjmccall@apple.com> Friend function declarations can overload with tag declarations.
Fixes PR7915.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118670 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
78b810559d89e996e00684335407443936ce34a1 10-Nov-2010 John McCall <rjmccall@apple.com> Diagnose attempst to template using declarations and using directives.
Recover from the latter and fail early for the former. Fixes PR8022.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118669 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
sing-directive.cpp
7ad5d421d9f12bd287aa17fdb00e0f4d5971d76f 09-Nov-2010 Douglas Gregor <dgregor@apple.com> Attempt to resolve overloaded functions in comma expressions and
conditional operators. Fixes PR7863.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118631 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-name.cpp
ef9b1497908ab1684e04f244289f1ebe8d44274e 09-Nov-2010 Douglas Gregor <dgregor@apple.com> Revert the fix for PR8013.

That bug concerned the well-formedness of code such as (&ovl)(a, b,
c). GCC rejects the code, while EDG accepts it. On further study of the
standard, I see no support for EDG's position: in particular, C++
[over.over] does not list this as a context where we can take the
address of an overloaded function, C++ [over.call.func] does not
reference the address-of operator at any point, and C++ [expr.call]
claims that the function argument in a call is either a function
lvalue or a pointer-to-function; (&ovl) is neither.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118620 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
9a0f2b6d89ae16abb882cd0ec0be2222e15c3785 09-Nov-2010 Douglas Gregor <dgregor@apple.com> Handle overload resolution when calling an overloaded function set
with, e.g., (&f)(a, b, c). Fixes PR8013.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118508 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
268f89e02de7bddbc9d7d7a147a3003bd81cf0d7 09-Nov-2010 Douglas Gregor <dgregor@apple.com> Make #pragma unused work for static local variables.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118500 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
b2d57ae3086bb87216c76f89400f5935c3b47f86 09-Nov-2010 Douglas Gregor <dgregor@apple.com> Add __nullptr as a C++0x nullptr literal, available in C++98

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118482 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr-98.cpp
e6fe9a28bc5ceec284099c1e5bc90e2316ade3de 08-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> When building a compound literal, check that the base element of the array is complete.
Fixes rdar://8620582 & http://llvm.org/PR7905

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118428 91177308-0d34-0410-b5e6-96231b3b80d8
ompound-literal.cpp
3afb97700200f629d6036e437267af9c1fd37c90 08-Nov-2010 Douglas Gregor <dgregor@apple.com> When attempting reference binding to an overloaded function, also
consider that we might be trying to bind a reference to a class type,
which involves a constructor call. Fixes PR7425.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118407 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
717a2bf760ef1daf74f839eb3c9ad73ad2aa6d60 08-Nov-2010 Douglas Gregor <dgregor@apple.com> Add missing test case for PR8230

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118402 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function-casting.cpp
8e960435696b4ccf6a8ad0ed0530e3280b77af8b 08-Nov-2010 Douglas Gregor <dgregor@apple.com> Properly diagnose invalid casts to function references. Patch by
Faisal Vali, tweaked by me. Fixes PR8230.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118400 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
tatic-cast.cpp
dfdfc584f2a8d9f1eebd6e6eaa9b1bbff519d8f9 07-Nov-2010 Anders Carlsson <andersca@mac.com> A union cannot contain static data members or data members of reference type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118381 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr-anonymous-union.cpp
624259984448cf19f4e94b7e31c7c32e99a39ea5 06-Nov-2010 Anders Carlsson <andersca@mac.com> Don't warn when matching %p to nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118344 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
2c4792c731690dbbcbe69dd0625977adffc2961a 06-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> When determining which template partial specialization is more specialized,
make sure to setup the instantiation stack. Fixes rdar://8620775 & http://llvm.org/PR8234

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118314 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
343e6ffa70459b1afdb488c69fb651434a5016c0 05-Nov-2010 Anders Carlsson <andersca@mac.com> Expressions of type std::nullptr_t can be used as sentinels.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118276 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
c8df0b634ee5ca8573852fdc96252b8bba5a10db 05-Nov-2010 Anders Carlsson <andersca@mac.com> Implement [over.ics.rank]p4: A conversion that does not convert an std::nullptr_t to bool is better than one than does.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118269 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
c80117e7971c34088f3e254c849ec3a40205d2c3 04-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't be so eager to replace UsingDecls in a DeclContext's lookup table;
check that the TargetNestedNameDecl is the same first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118239 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
0c8209e40b405fd32f047e95aafdc94054406a58 04-Nov-2010 Anders Carlsson <andersca@mac.com> It's OK to use nullptr in relational operators if the other side is a null pointer constant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118234 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
9fa8e569407e02148888136609431a3fe083096d 03-Nov-2010 Nick Lewycky <nicholas@mxc.ca> Make this error less specific but also less likely to cause confusion. Fixes
PR7702.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118181 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-member-expr.cpp
ember-operator-expr.cpp
ew-delete.cpp
fec56e7e341cd1d9a861d64bffc80a97aed89802 03-Nov-2010 Douglas Gregor <dgregor@apple.com> When producing overload candidates for binary built-in operators, keep
the sets of available conversions for the first and second arguments
separate. This is apparently the indent of C++ [over.built], and
reduces the number of overload candidates generated, eliminating some
ambiguities. Fixes PR8477.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118178 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
7533a5b65f81a4eed1e0f0afeb859e26bc0c056b 03-Nov-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Provide an error when a non-identifier name (such as an operator) is used as a
parameter name.

Fixes PR8012.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118138 91177308-0d34-0410-b5e6-96231b3b80d8
R8012.cpp
bf8cafadb9d4e0d7a90fe78fc175efb80ae34d42 02-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Properly handle temporaries that are created in a AsmStmt.

Previously the temporaries would get destroyed before the asm call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118001 91177308-0d34-0410-b5e6-96231b3b80d8
sm.cpp
65e7a6b5f077827964570a7fdabffa62fcc2319e 01-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Clean up temporaries created by an asm statement. Fixes rdar://8540491

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117961 91177308-0d34-0410-b5e6-96231b3b80d8
sm.cpp
11ab79030938209f50691acae0ddb65e72a58ca9 01-Nov-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Emit error when using a bound member function for something other than calling it.

Also avoids IRGen crashes due to accepting invalid code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117943 91177308-0d34-0410-b5e6-96231b3b80d8
trtomember.cpp
0f279e756e3df69f9e071c572805e5d3e89123a2 30-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Emit an error when trying to form a pointer-to-member to a bitfield.

As a bonus, avoids a crash on the IRGen side due to accepting invalid code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117842 91177308-0d34-0410-b5e6-96231b3b80d8
trtomember.cpp
c92bbb4429dfce891d7f4000f0dabcc9ddaa68b7 30-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> renamed: test/SemaCXX/ptrtomember-badcall.cpp -> test/SemaCXX/ptrtomember.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117841 91177308-0d34-0410-b5e6-96231b3b80d8
trtomember-badcall.cpp
trtomember.cpp
d86132d52c1dd99ad5519abaad92533712692a8b 30-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't remove the init expression from the initializer list if it had a semantic error.

We already flag the error with InitListChecker's hadError and we mess up the AST unnecessarily.
Fixes rdar://8605381.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117760 91177308-0d34-0410-b5e6-96231b3b80d8
rashes.cpp
6a622dfde49ff06df4e0487fa9782a9a137971ac 30-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add test/SemaCXX/crash-PR7625.cpp into test/SemaCXX/crashes.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117759 91177308-0d34-0410-b5e6-96231b3b80d8
rash-PR7625.cpp
rashes.cpp
387fb7104ebf7e1dbffffbbe2c7f9178fa89097e 30-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> test/SemaCXX/crash-8124080.cpp -> test/SemaCXX/crashes.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117758 91177308-0d34-0410-b5e6-96231b3b80d8
rash-8124080.cpp
rashes.cpp
c75f6180d10e7ac5cd414569b7cbd90cd1295101 30-Oct-2010 Ted Kremenek <kremenek@apple.com> Add test case for <rdar://problem/8610363> (a bogus report of using an uninitialized field). This was
already fixed, but this serves for detecting regressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117754 91177308-0d34-0410-b5e6-96231b3b80d8
ninitialized.cpp
78f5911a4ef8742c51a7f7643957e1aaa0098324 29-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> When doing name lookup for members don't look into global/namespace scope.
Better performance and fixes rdar://8603569.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117656 91177308-0d34-0410-b5e6-96231b3b80d8
ookup-member.cpp
95c225de9fa3d79f70ef5008c0279580a7d9dcad 28-Oct-2010 John McCall <rjmccall@apple.com> Implement an indirect-goto optimization for goto *&&lbl and respect this
in the scope checker. With that done, turn an indirect goto into a
protected scope into a hard error; otherwise IR generation has to start
worrying about declarations not dominating their scopes, as exemplified
in PR8473.

If this really affects anyone, I can probably adjust this to only hard-error
on possible indirect gotos into VLA scopes rather than arbitrary scopes.
But we'll see how people cope with the aggressive change on the marginal
feature.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117539 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
5b629aa86c987f276d00453b6c9ab8424f7903fe 23-Oct-2010 John McCall <rjmccall@apple.com> Parse attributes on enumerators and instantiate attributes on enum decls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117182 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
0b8ddb9a4743465cd76e9f134a2f55ab2330a0a4 21-Oct-2010 Douglas Gregor <dgregor@apple.com> Implement the integral promotion rules for the C++0x char16_t and
char32_t character types and enable built-in overloaded operator
candidates for these types. Fixes PR8432.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117038 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators-0x.cpp
842e7a22c6a0fbf0ccdb4bb9308d92ca9e9621f6 18-Oct-2010 Francois Pichet <pichet2000@gmail.com> Microsoft enum extensions. 2 things will change on -fms-extensions:
1. enum underlying type is int by default.
2. Error "enumerator value is not representable in the underlying type"is a ExtWarning

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116704 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
3d6c45d8f8df76d6a0a71d3ef36f835a0d5e515f 15-Oct-2010 Nick Lewycky <nicholas@mxc.ca> Report the location of the syntax error inside a macro. Fixes PR7944.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116624 91177308-0d34-0410-b5e6-96231b3b80d8
R7944.cpp
a6e937ce32474934778346f4d51c3beec40e77ec 15-Oct-2010 Douglas Gregor <dgregor@apple.com> Diagnose C++ [class.mem]p13-14, where a class member has the same name
as the class itself. Fixes PR7082.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116573 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
66c42d443982a0891ce58deb7391d641ca87adc5 15-Oct-2010 Douglas Gregor <dgregor@apple.com> Don't complain about a variable within a linkage-specification that is
initialized. Fixes PR7076.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116553 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
a6c1e3a56afb76876cd06e3646fd7ca57a38d4bb 14-Oct-2010 Douglas Gregor <dgregor@apple.com> Diagnose when a 'static' member function overrides a virtual function
in a base class. Fixes PR8168.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116448 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
922fff2c9ef458fc04839e45a79552513f41ec7e 14-Oct-2010 Douglas Gregor <dgregor@apple.com> Generalize the checking for qualification of (non-friend) class
members. Provide a hard error when the qualification doesn't match the
current class type, or a warning + Fix-it if it does match the current
class type. Fixes PR8159.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116445 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
7d520baec9b762633a09d31ee0db12e41fe2758a 13-Oct-2010 Douglas Gregor <dgregor@apple.com> There is no reason for dereferencing a pointer-to-member to require
that the class type into which the pointer points be complete, even
though the standard requires it. GCC/EDG do not require a complete
type here, so we're calling this a problem with the standard. Fixes
PR8328.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116429 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
d54eb4410330383f48d3cc22b2ad8d23f120836b 12-Oct-2010 Douglas Gregor <dgregor@apple.com> Parse default arguments within member functions in source order, from
Manuel Klimek! Fixes PR7715.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116311 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
f9c5afb8df90d2711fdb0d3699aba99f1db0b848 12-Oct-2010 John McCall <rjmccall@apple.com> Flesh out test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116292 91177308-0d34-0410-b5e6-96231b3b80d8
xpressions.cpp
2bf6f49ffa839c966f692420491145adeac4f1e2 12-Oct-2010 John McCall <rjmccall@apple.com> I just do what the comments tell me to do.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116289 91177308-0d34-0410-b5e6-96231b3b80d8
xpressions.cpp
2cd11fefb62c580651e4269e1488381c2d6d07ad 12-Oct-2010 John McCall <rjmccall@apple.com> Progress.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116287 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
ecltype-overloaded-functions.cpp
2a984cad5ac3fdceeff2bd99daa7b90979313475 12-Oct-2010 John McCall <rjmccall@apple.com> Add some infrastructure for dealing with expressions of 'placeholder' type,
i.e. expressions with an internally-convenient type which should not be
appearing in generally valid, complete ASTs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116281 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
ecltype-overloaded-functions.cpp
1d1e70ec6545c8ca863e00aaca14287269a23c1c 09-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix g++.dg regressions introduced at r115347 (rdar://8529993)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116144 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
1274ccd90aec0b205fc838c3d504821ccfb55482 09-Oct-2010 Douglas Gregor <dgregor@apple.com> Implement C++0x scoped enumerations, from Daniel Wallin! (and tweaked a
bit by me).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116122 91177308-0d34-0410-b5e6-96231b3b80d8
num-scoped.cpp
4081a5c5f1381c4ec77f8ab3866693917e4329c4 08-Oct-2010 John McCall <rjmccall@apple.com> __attribute__((aligned(n))) directly specifies the alignment of a declaration
unless it's a non-packed field, in which case it can only increase the
alignment. [[align]] effectively works the same way for well-formed code
(because it's ill-formed for [[align]] to decrease alignment ever).

Fixes rdar://problem/8335865



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116070 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
63b57aeeebb5bb758ecebf9b41b5131781f32bf3 07-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix an infinite loop, caused by unintended syntax bug (the 'break;' after 'default:' was intended to break out of the while loop).
Fixes rdar://8518859&8520617.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115985 91177308-0d34-0410-b5e6-96231b3b80d8
ype-dependent-exprs.cpp
a0750768718bb5d05150641b5bba74847a21bc09 06-Oct-2010 Douglas Gregor <dgregor@apple.com> Reject the allocation of variably-modified types in C++ 'new'
expressions. Fixes PR8209 in the narrowest way possible. I'm still
considering whether I want to implement the extension that permits the
use of VLA types in a 'new' expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115790 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
175ffbf7db893181b301e201c561ac928266f4be 06-Oct-2010 Anders Carlsson <andersca@mac.com> When checking for uninitialized fields in member initializers, special case static variables and enums. Fixes PR8075.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115732 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
25e7e1672886b78a00ce25a084c0581704b73a7b 05-Oct-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add test case for r115588.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115590 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
011cf8924fc1b69df8439ee06cb451de7472f164 02-Oct-2010 Gabor Greif <ggreif@gmail.com> Doug's feedback

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115356 91177308-0d34-0410-b5e6-96231b3b80d8
nu-case-ranges.cpp
28164ab2ac1deea68cdb989f941728bf1860ce41 02-Oct-2010 Gabor Greif <ggreif@gmail.com> Factor out enumerator APSInt adjustment into
a helper function (AdjustAPSInt) and use that
for adjusting the high bounds of case ranges
before APSInt comparisons. Fixes
http://llvm.org/bugs/show_bug.cgi?id=8135

Some minor refacorings while I am here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115355 91177308-0d34-0410-b5e6-96231b3b80d8
nu-case-ranges.cpp
c71d8eb6592ae3ef498fc57db3563d1dfae48dff 01-Oct-2010 Francois Pichet <pichet2000@gmail.com> Better diagnostic for superfluous scope specifier inside a class definition for member functions. + Fixit.

Example:
class A {
void A::foo(); //warning: extra qualification on member 'foo'
};


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115347 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
ested-name-spec.cpp
dab60ad68a3a98d687305941a3852e793705f945 01-Oct-2010 Douglas Gregor <dgregor@apple.com> Implement the C++0x "trailing return type" feature, e.g.,

auto f(int) -> int

from Daniel Wallin!

(With a few minor bug fixes from me).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115322 91177308-0d34-0410-b5e6-96231b3b80d8
railing-return-0x.cpp
fbb6fad63acac2bef36cfa13e0706fa3e2a1ed7d 29-Sep-2010 Douglas Gregor <dgregor@apple.com> When performing template argument deduction of a function template
against a function type, be sure to check the type of the resulting
function template specialization against the desired function type
after substituting the deduced/defaulted template arguments. Fixes PR8196.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115086 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
2cf9d656f6283f2a8be0549da110d7cfbb1ea4b2 28-Sep-2010 Douglas Gregor <dgregor@apple.com> Centralize the management of CXXRecordDecl::DefinitionData's Empty bit
in CXXRecordDecl itself. Yes, this is also part of <rdar://problem/8459981>.

This reinstates r114924, with one crucial bug fix: we were ignoring
the implicit fields created by anonymous structs/unions when updating
the bits in CXXRecordDecl, which means that a class/struct containing
only an anonymous class/struct would be considered "empty". Hilarity
follows.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114980 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
b3358724d985dc08889f7905f20284718361e885 28-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't warn with -Wbool-conversions if the user wrote an explicit cast like "(void *)false".
Fixes rdar://8459342.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114955 91177308-0d34-0410-b5e6-96231b3b80d8
arn_false_to_pointer.cpp
37bf9d2bb74944c9d9a52522412bc077629977f1 24-Sep-2010 Anders Carlsson <andersca@mac.com> Allow the use of C++0x deleted functions as an extension in C++98.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114762 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function-extension.cpp
2b64239a8ef4829be7b2c32eff60d8de204b4e2c 23-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix bogus compiler errors when declaring anonymous union, outside a class, with
members with the same name as a decl outside the scope where the members are actually introduced.
Fixes http://llvm.org/PR6741

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114641 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
ff8819be64c53d71dcc0200ece9b2738041c80e2 21-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Do not warn with -Wuninitialized when the member is used in a sizeof or address-of expression.
Fixes rdar://8331312.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114426 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
1b2ad2fd9e2d5352144481aa1fd995d333d9adc9 20-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert r114316, -Wunused-value enabled by default was intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114318 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
ecl-expr-ambiguity.cpp
verloaded-operator.cpp
arn-unused-variables.cpp
6dff2288a8054bdbc97217568e5831bcce809db8 19-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Make -Wunused-value off by default, matching GCC. Fixes rdar://7126194.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114316 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
ecl-expr-ambiguity.cpp
verloaded-operator.cpp
arn-unused-variables.cpp
ae79222014a7a90a2c2d4a04e67deac0012a0461 18-Sep-2010 John McCall <rjmccall@apple.com> static local variables with destructors don't require a global destructor
unless we're on a platform without __cxa_atexit (or use thereof has been
disabled). This patch actually just disables the check completely for
static locals, but I've filed http://llvm.org/bugs/show_bug.cgi?id=8176 to
track the platform-specific fix.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114269 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
ac5fd8404fa8ecfae28be76f98fd0d926350354c 18-Sep-2010 Douglas Gregor <dgregor@apple.com> Continue parsing more postfix expressions, even after semantic
errors. Improves code completion in yet another case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114255 91177308-0d34-0410-b5e6-96231b3b80d8
opy-assignment.cpp
200b2921390bd75a659be3c77011e9a5548b7273 18-Sep-2010 Douglas Gregor <dgregor@apple.com> When we run into an error parsing or type-checking the left-hand side
of a binary expression, continue on and parse the right-hand side of
the binary expression anyway, but don't call the semantic actions to
type-check. Previously, we would see the error and then, effectively,
skip tokens until the end of the statement.

The result should be more useful recovery, both in the normal case
(we'll actually see errors beyond the first one in a statement), but
it also helps code completion do a much better job, because we do
"real" code completion on the right-hand side of an invalid binary
expression rather than completing with the recovery completion. For
example, given

x = p->y

if there is no variable named "x", we can still complete after the p->
as a member expression. Along the recovery path, we would have
completed after the "->" as if we were in an expression context, which
is mostly useless.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114225 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
laborated-type-specifier.cpp
558d2abc7f9fd6801cc7677200992313ae90b5d8 15-Sep-2010 John McCall <rjmccall@apple.com> one piece of code is responsible for the lifetime of every aggregate
slot. The easiest way to do that was to bundle up the information
we care about for aggregate slots into a new structure which demands
that its creators at least consider the question.

I could probably be convinced that the ObjC 'needs GC' bit should
be rolled into this structure.
Implement generalized copy elision. The main obstacle here is that
IR-generation must be much more careful about making sure that exactly



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113962 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
f8aca8664512c80a018eb4a4a93c61ad6793abcd 15-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Fix destructor and assignment operator lookup in the has_nothrow traits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113897 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
edeb6c9b47e802da1a9a149ea1ea4f1ddd7f6182 14-Sep-2010 John McCall <rjmccall@apple.com> The paired 'operator delete' for a placement 'operator new' is always a
placement 'operator delete', even if there are no placement args (i.e.
overload resolution selected an operator new with default arguments).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113861 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
08295a592d7e54e6bea00daeb2abe7ac79a3aaba 14-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Don't crash when using type traits on a class with a constructor template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113796 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
751025d5d174ab75dc3788211581d9fbe6224841 14-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Remove CXXRecordDecl::getDefaultConstructor(), an inherently unsafe function due to lazy declaration of default constructors. Now that __has_nothrow_constructor doesn't use it anymore, part of PR8101 is fixed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113794 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
5f4e8999aa30e2986e99fbfa4c43e61e99a18687 13-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Have __has_nothrow_copy use Sema's lookup routines. This fixes the problem with not finding implicitly declared copy constructors, part of PR8107.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113784 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
4076dacf1497fb95cb298b9d964fbdbdaf9bde6c 13-Sep-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> When applying 'delete' on a pointer-to-array type match GCC and EDG behavior and treat it as 'delete[]'.
Also offer a fix-it hint adding '[]'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113778 91177308-0d34-0410-b5e6-96231b3b80d8
elete.cpp
78c057e5a16b3ba186cc6453ca26b15745f2b79d 12-Sep-2010 Douglas Gregor <dgregor@apple.com> Don't assert when attempting to take the address of an overloaded
function fails due to ambiguities in partial ordering of function
templates. Fixes PR8033.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113725 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
8fcc516a5d5b2fec0023a9dced29285a38b95355 12-Sep-2010 Douglas Gregor <dgregor@apple.com> When performing overload resolution, only compare the final conversion
sequences for two conversion functions when in fact we are in the text
of initialization by a user-defined conversion sequences. Fixes PR8034.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113724 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
da0fd9a7faa8b8a666e3c31ff0b5897e0f73f892 12-Sep-2010 Douglas Gregor <dgregor@apple.com> Don't complain about useless user-defined conversion functions when
they were instantiated from a template. In template metaprogramming,
stuff happens. Fixes PR8065.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113722 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
8dc3abcc36df883324461daad0c05364158f3cf0 12-Sep-2010 Francois Pichet <pichet2000@gmail.com> Add basic support for Microsoft enum forward declaration.
Assigning an underlying integral type to an enum forward declaration will come in a next patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113716 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
5dde1605da5e6db8a9214f4a5d094ae0bbc64a4e 12-Sep-2010 Douglas Gregor <dgregor@apple.com> Don't perform integral promotions from an incompletion enumeration
type. Fixes PR8089 in a slightly different way than had been suggested.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113711 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
4e6356426fcfef84e2484820814a8eaaaf547eda 11-Sep-2010 John McCall <rjmccall@apple.com> Support in-class initialization of static const floating-point data members.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113663 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
8df7622c65f13f95e6e1f4cf6f51592fddae3afb 09-Sep-2010 Dawn Perchik <dawn@burble.org> Add support for a few MS extensions supported by the Borland compiler
(__uuidof, _fastcall, etc.).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113434 91177308-0d34-0410-b5e6-96231b3b80d8
orland-extensions.cpp
19311e70edaa2d7bb0d709344aebea4fbbae2da4 08-Sep-2010 Douglas Gregor <dgregor@apple.com> Use the new-initialization code for initializing scalars with a
function-style cast. Previously, we had a (redundant, incorrect)
semantic-checking path for non-class types, which allowed
value-initialization of a reference type and then crashed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113415 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
unctional-cast.cpp
ualified-id-lookup.cpp
ype-convert-construct.cpp
538e0d0292cab16198a4fce5c388ff06adc74d0c 08-Sep-2010 Francois Pichet <pichet2000@gmail.com> Allow type definitions inside anonymous struct/union in Microsoft mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113354 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
36281c6fd792a254ade72caf825bad7b7c63b0e0 08-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Don't give 'global constructor' warnings for function statics, even if they have a direct initializer. Fixes PR8095.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113344 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
607a1788d9529c8e8494ac528764aa2c678a1a97 08-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Allow (cv) void and incomplete arrays to be passed to the type traits.

Fixes PR8110, and thus PR8109, PR8097, and parts of PR8101, PR8105 and PR8107. Only a few traits have tests for incomplete arrays, since I'm not yet clear what the result for them should be; Howards wants to file a DR to change the standard.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113326 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits-incomplete.cpp
ype-traits.cpp
c79f767941fdfedb02d20296a042ad951a593890 08-Sep-2010 Daniel Dunbar <daniel@zuster.org> tests: Use -ffreestanding when including stdint.h, to avoid platform dependencies.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113301 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
einterpret-cast.cpp
32212f9d000e6bb631499afce43cd13fc0387413 06-Sep-2010 Chris Lattner <sabre@nondot.org> remove curly quotes, patch by Dimitry Andric!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113156 91177308-0d34-0410-b5e6-96231b3b80d8
nit-priority-attr.cpp
60b4d049ae53bf837aee6def125df2fdb941a8ec 06-Sep-2010 Eli Friedman <eli.friedman@gmail.com> Update test for r113128.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113131 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
957c094bd435c9ae367a9fcf375a5fadcc0c2bff 06-Sep-2010 Eli Friedman <eli.friedman@gmail.com> PR8023: Don't crash on invalid uses of __real__ on class types in C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113124 91177308-0d34-0410-b5e6-96231b3b80d8
nary-real-imag.cpp
0c42bb653dc40b1caae010618831e320af824b18 05-Sep-2010 Chris Lattner <sabre@nondot.org> 'const std::type_info*' instead of 'std::type_info const*'



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113092 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin-ptrtomember-ambig.cpp
onditional-expr.cpp
opy-initialization.cpp
ecl-init-ref.cpp
irect-initializer.cpp
verload-member-call.cpp
verloaded-operator.cpp
ef-init-ambiguous.cpp
tatic-cast.cpp
irtual-override.cpp
66cf2d1290c598fcbaf1c6b50411f2513daf3b3e 05-Sep-2010 Chris Lattner <sabre@nondot.org> print "const intptr_t" instead of "intptr_t const"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113091 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
58f9e13e87e57236fee4b914eea9be6f92a1c345 05-Sep-2010 Chris Lattner <sabre@nondot.org> make clang print types as "const int *" instead of "int const*",
which is should have done from the beginning. As usual, the most
fun with this sort of change is updating all the testcases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113090 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
mbiguous-builtin-unary-operator.cpp
uiltin-ptrtomember-ambig.cpp
lass.cpp
omposite-pointer-type.cpp
onst-cast.cpp
onversion-function.cpp
style-cast.cpp
cl_init_aggr.cpp
ecl-init-ref.cpp
unctional-cast.cpp
ew-delete.cpp
verload-call.cpp
verload-member-call.cpp
eferences.cpp
einterpret-cast.cpp
tatic-cast.cpp
469a20de757ff872c90ff6b1134f6346909ff652 04-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Truncate block variable of bool type to i1 when its
value is used. This matches with non-block variable
use of bool type. (Fixes radar 8390062).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113027 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
e63438b34b075a65849b9dee022adffc7c222ae5 03-Sep-2010 Anders Carlsson <andersca@mac.com> It's OK for classes to have flexible array elements (but not unions).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113018 91177308-0d34-0410-b5e6-96231b3b80d8
lexible-array-test.cpp
7925561e702430c0d632c5e5db1a74673b44ea18 03-Sep-2010 Fariborz Jahanian <fjahanian@apple.com> Cope with llvm's reference to bool type of 'i1' vs. clang's
type of 'i8' for the same for __block variables of
type bool. refixes radar 8382559.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113015 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
52fc314e1b5e1baee6305067cf831763d02bd243 03-Sep-2010 Dawn Perchik <dawn@burble.org> Add symantic support for the Pascal calling convention via
"__attribute((pascal))" or "__pascal" (and "_pascal" under
-fborland-extensions). Support still needs to be added to llvm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112939 91177308-0d34-0410-b5e6-96231b3b80d8
orland-extensions.cpp
4938f2385f82e54df019b2fb1128a58ebad98bec 03-Sep-2010 Anders Carlsson <andersca@mac.com> Static local variables don't result in global constructors being emitted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112933 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
5d1d7ae120c2c8e6cba5d2a712b33500a5aecc10 03-Sep-2010 Anders Carlsson <andersca@mac.com> Get rid of the "functions declared 'noreturn' should have a 'void' result type" warning.

The rationale behind this is that it is normal for callback functions to have a non-void return type
and it should still be possible to mark them noreturn. (JavaScriptCore is a good example of this).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112918 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-noreturn.cpp
arn-unreachable.cpp
400b607546a8dbfcee3b690f3d0a2fee0ea6480b 03-Sep-2010 Dawn Perchik <dawn@burble.org> Add support for Borland extensions via option -fborland-extensions
(original patch r112791 was reverted due to a bug).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112915 91177308-0d34-0410-b5e6-96231b3b80d8
orland-extensions.cpp
d4b25cbde13fc973673234f26de48c940723e679 03-Sep-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Implement __has_virtual_destructor. Patch by Steven Watanabe.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112905 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
d0b4e7c8723c031cd8d743b2ff63943a3d0563ff 02-Sep-2010 Dawn Perchik <dawn@burble.org> Reverting rev 112791 - apparently -fborland-extensions is on all the time?!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112797 91177308-0d34-0410-b5e6-96231b3b80d8
orland-extensions.cpp
a423e81a4d04b7c1882d2787d1189cbc14540c16 02-Sep-2010 Ted Kremenek <kremenek@apple.com> Enhance return-stack-address check (in Sema) to handle fields that themselves are references. (Fixes PR 7999; fix by Chandler Carruth).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112792 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-stack-addr.cpp
621a2f36af707747d70b8103bda6f65237fce899 02-Sep-2010 Dawn Perchik <dawn@burble.org> Add support for Borland extensions via option -fborland-extensions


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112791 91177308-0d34-0410-b5e6-96231b3b80d8
orland-extensions.cpp
afac01d7e76f28d5e5a5c377369cc400919387ee 01-Sep-2010 Douglas Gregor <dgregor@apple.com> Transfer calling-convention attributes down to member function pointers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112715 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
c238f09a268cd87a2568f6c97181252687ae07b1 31-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Implement the __has_nothrow trait family, by Steven Watanabe.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112577 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
6cf750298d3621d8a10a6dd07fcee8e274b9d94d 30-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-operator-dcls.cpp
iteral-operators.cpp
5b6f769a6abda4da44186cc8e6a2d6ed37dc9344 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Emulate (some of) Microsoft's looser semantic checking of exception
specifications, from Martin Vejnar!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112482 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
xception-spec.cpp
5c0ca52e40e0b9e3c2da7abba47b18e468c84060 30-Aug-2010 Douglas Gregor <dgregor@apple.com> Predeclare class type_info in Microsoft mode, from Francois Pichet!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112478 91177308-0d34-0410-b5e6-96231b3b80d8
icrosoftExtensions.cpp
0016d519b831859526b79405cdae4c64c73731c8 29-Aug-2010 Sean Hunt <scshunt@csclub.uwaterloo.ca> Implement C++0x user-defined string literals.

The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-operator-dcls.cpp
iteral-operators.cpp
2c1b9c3fa3d920aa6ccf843b40c1eb0f1ad04d58 28-Aug-2010 Ted Kremenek <kremenek@apple.com> Update test case, with comment to later investigate the correct behavior. Now the behavior is at least consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112335 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
47e331ed28c2536bec227c5e2fa094ab3d46eed1 28-Aug-2010 Ted Kremenek <kremenek@apple.com> Explicitly handle CXXExprWithTemporaries during CFG construction by just visiting the subexpression. While we don't do anything intelligent right now, this obviates a bogus -Wunreahable-code warning reported in PR 6130.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112334 91177308-0d34-0410-b5e6-96231b3b80d8
nreachable-code.cpp
520441eb82202702688750860fd98148421ea0ed 27-Aug-2010 Douglas Gregor <dgregor@apple.com> Improve wording of diagnostic complaining about a non-void* pointer as the first parameter of operator delete

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112298 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
7114cbab7eb6e8b714eb22f014327daf2c741c08 27-Aug-2010 John McCall <rjmccall@apple.com> Continue to instantiate sub-statements in a CompoundStmt as long as
we don't see a DeclStmt (failure to instantiate which generally causes
panic).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112282 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
9c72c6088d591ace8503b842d39448c2040f3033 27-Aug-2010 John McCall <rjmccall@apple.com> Propagate whether an id-expression is the immediate argument of
an '&' expression from the second caller of ActOnIdExpression.

Teach template argument deduction that an overloaded id-expression
doesn't give a valid type for deduction purposes to a non-static
member function unless the expression has the correct syntactic
form.

Teach ActOnIdExpression that it shouldn't try to create implicit
member expressions for '&function', because this isn't a
permitted form of use for member functions.

Teach CheckAddressOfOperand to diagnose these more carefully.
Some of these cases aren't reachable right now because earlier
diagnostics interrupt them.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112258 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
e84f9ebf8c89d5600f5930b65a0df0de890791b2 26-Aug-2010 Eric Christopher <echristo@apple.com> With lax vector conversions (the default) make sure we convert between two
vectors that are the same size. Fix up testcases accordingly and add a new one
to make sure we still error if lax vector conversions are disabled.

Fixes rdar://8328190


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112122 91177308-0d34-0410-b5e6-96231b3b80d8
ector-no-lax.cpp
ector.cpp
957355ebf618ce6deb7d2d4182b23de9cd9c873a 25-Aug-2010 Fariborz Jahanian <fjahanian@apple.com> Move the test for radar 8018252 to
SemaCXX/expressions.cpp.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111988 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of-register-var.cpp
xpressions.cpp
4020f8703a8822fe0d4efe4a0dc74f0b8040bd9f 25-Aug-2010 Fariborz Jahanian <fjahanian@apple.com> It is not error in c++ to take address of
register variable (c++03 7.1.1P3). radar 8108252.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111977 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of-register-var.cpp
09a63c97b95eb4dc6fd6b2323929e8cf12af03ff 24-Aug-2010 Douglas Gregor <dgregor@apple.com> Parse all kinds of declarations as part of a linkage-specification,
from Francois Pichet! Fixes PR7754.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111912 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
fb3bb31af0bdf25b869d42599133d590cdf8c2c1 24-Aug-2010 Eli Friedman <eli.friedman@gmail.com> PR7971: Compute the correct type for an address-of expression containing an
UnresolvedMemberExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111899 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
4e6fbce4277fbc7c574fb2393c7dfe06f014c21a 23-Aug-2010 Chandler Carruth <chandlerc@gmail.com> Relax the construction of a definition for implicit, trivial default
constructors. We perform semantic checking when creating the definition, and
this isn't needed in certain contexts (value initialization) but is in others
(default initialization). This fixes PR7948.

We add explicit code to the default initialization path to ensure the
definition is both present and valid.

Doug, please review. I think this follows your latest suggestion, and it ended
up remarkably cleaner than I anticipated. Also let me know if similar logic
should be followed for destructors and copy-constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111802 91177308-0d34-0410-b5e6-96231b3b80d8
efault-constructor-initializers.cpp
06ebc98ff017fadfaed515bc06f50ce94ca468d6 19-Aug-2010 Douglas Gregor <dgregor@apple.com> We don't actually need to check the implicit object argument's
conversion a second time for a conversion candidate (with the real
acting context), because the only problems we would find are access or
ambiguity issues that won't be diagnosed until we pick this
candidate. Add a test case to prove it to myself.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111526 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
c774b2f66478008196f497a227d5ab88ea157582 19-Aug-2010 Douglas Gregor <dgregor@apple.com> Properly implement the part of C++ [over.match.funcs]p4 that treats
conversion functions as if their acting context were the class that
we're converting from (the implicit object argument's
type). Retroactively tweaking the implicit conversion sequence, as we
were trying to do before, breaks the invariants of that implicit
conversion sequence (e.g., the types and conversions don't match
up). Fixes <rdar://problem/8018274>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111520 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
34fd628d22f54baddf30cf80c401b2f862a31b23 19-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Fix for PR7911 and PR7921: make isIntegralOrEnumerationType return false
for incomplete enum types. An incomplete enum can't really be treated as
an "integral or enumeration" type, and the incorrect treatment leads to
bad behavior for many callers.

This makes isIntegralOrEnumerationType equivalent to isIntegerType; I think
we should globally replace the latter with the former; thoughts?



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111512 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
35a38d95da89d48778019c37b5f8c9a20f7e309c 19-Aug-2010 John McCall <rjmccall@apple.com> On second thought, don't warn about reinterpret_casts under -Wcast-align.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111497 91177308-0d34-0410-b5e6-96231b3b80d8
arn-cast-align.cpp
58f281f7d54976f23ed4fa23a10ff1ab9c7037fe 19-Aug-2010 Ted Kremenek <kremenek@apple.com> Add warning for functions/blocks that have attribute 'noreturn' but return a non-void result. (<rdar://problem/7562925>)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111492 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-noreturn.cpp
arn-unreachable.cpp
4e938f57bdd68b3716a4476acf151cdd27bb8a50 18-Aug-2010 Douglas Gregor <dgregor@apple.com> There is no pointer conversion between to similar types (i.e., same
type ignoring cv-qualifiers). These are qualification
conversions. Fixes PR7934.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111428 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
6aa03e6dc72623f04af415527bf580ec189ab7f6 18-Aug-2010 John McCall <rjmccall@apple.com> Flesh out the test cases a little.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111359 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
94c3b561a4f24c5c44a1e2ee6f28f530e6a041ba 18-Aug-2010 John McCall <rjmccall@apple.com> Rip out the existing retroactive abstract-class usage checker,
which in a fit of zeal wanted to walk the entire translation unit,
and replace it with a new checker that walks the types of declarations
nested within the class. Also, look into templates when doing this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111357 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
42cbd782cf17223076e5b6c0607414d9d68aae19 18-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Rename -Wunused-method -> -Wunused-member-function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111305 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
3d27b107c515ab1a8fd47b33c41adcf5a65f465b 17-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce -Wunused-method option for warning on unused class methods in anonymous namespace.

This option is not part of the Unused diagnostic group until the warnings on llvm codebase are fixed
and we are ready to turn it on. Suggestion by Daniel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111298 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
45975531e3e93033b41e04974340e4e8f7481d61 17-Aug-2010 Douglas Gregor <dgregor@apple.com> A member function never has "C" linkage. Fixes <rdar://problem/8318976>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111238 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
572fc62b52b5b113cbaf528bd3ec00fcde19a46e 17-Aug-2010 John McCall <rjmccall@apple.com> Don't try to initialize a reference with a constructed temporary if either
of the classes is invalid. A class is invalid if a base is invalid.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111227 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
2d7d2d99bc450ac1472086a6d57e77a1995297f8 17-Aug-2010 John McCall <rjmccall@apple.com> A field of incomplete type is sufficiently disruptive that we should mark
the record invalid.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111211 91177308-0d34-0410-b5e6-96231b3b80d8
opy-assignment.cpp
dd7744d01e513e941f47893b16dfebae2c1c9911 16-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Emit diagnostic error when the field of an anonymous struct is non trivial.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111158 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-struct.cpp
f231df318d8d937adb24f3db23c23c31ab378a82 16-Aug-2010 Charles Davis <cdavis@mines.edu> Error out if reinterpret_casting between member pointers of two different
sizes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111119 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer-ms.cpp
d18f9f965bcfe56edcdf9b0d8375ffaad9866b3f 16-Aug-2010 Charles Davis <cdavis@mines.edu> Err on incomplete class types in member pointers when compiling for the
Microsoft C++ ABI, for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111118 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer-ms.cpp
06999f8ff61de3c63a52871bd7ac61e7ada9180b 15-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Don't warn for the common pattern of disallowing copying:

class S {
S(const S&); // DO NOT IMPLEMENT
void operator=(const S&); // DO NOT IMPLEMENT
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111100 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
bbc6454bb98d6a6ecbaafa715222c5db834307f2 15-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Commit improved version of 111026 & 111027.

Unused warnings for functions:
-static functions
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

Unused warnings for variables:
-static variables
-variables in anonymous namespace
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

Reveals lots of opportunities for dead code removal in llvm codebase that will
interest my esteemed colleagues.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111086 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
05eac86d547892847ca95b5350e28d681150fa68 13-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Revert 111026 & 111027, build breakage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111036 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
30c0dd86f0dc3c1a1fba29581d04e8ed0bdb659d 13-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> The unused warnings extravaganza continues. Warn for:

-static variables
-variables in anonymous namespace (fixes rdar://7794535)
-static data members in anonymous namespace
-static data members specializations in anonymous namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111027 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
f6d1d43d68016e975f22264343631a55b9701495 13-Aug-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Expand the unused warnings for functions. Warn for:

-static function declarations
-functions in anonymous namespace
-class methods in anonymous namespace
-class method specializations in anonymous namespace
-function specializations in anonymous namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111026 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-filescoped.cpp
279b5eb6910d64a293e9c0e2887a05c65d8737d7 13-Aug-2010 John McCall <rjmccall@apple.com> Just disable the hidden-visibility optimization for now by hiding it behind
a -cc1 option. The Darwin linker complains about mixed visibility when linking
gcc-built objects with clang-built objects, and the optimization isn't really
that valuable. Platforms with less ornery linkers can feel free to enable this.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110979 91177308-0d34-0410-b5e6-96231b3b80d8
ypeid-ref.cpp
b7f4ffe073fa419613946461a2583ba2fcb72280 12-Aug-2010 John McCall <rjmccall@apple.com> Implement -Wcast-align. The initial design of this diagnostic diverges
from GCC's in that we warn on *any* increase in alignment requirements, not
just those that are enforced by hardware. Please let us know if this causes
major problems for you (which it shouldn't, since it's an optional warning).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110959 91177308-0d34-0410-b5e6-96231b3b80d8
arn-cast-align.cpp
7b49202090678f45fa0c0bb5fa560d8a27b0c604 12-Aug-2010 John McCall <rjmccall@apple.com> Handle the obvious case for diagnosing redeclarations of extern "C" functions.

Fixes PR7859.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110906 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
fcadea2556be268121a6216e367bbe3598c4008e 12-Aug-2010 John McCall <rjmccall@apple.com> Fix a crash on invalid when declaring an implicit member of a class with an
invalid destructor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110891 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
604eb65686590f73551d4ea608b174d2244cdd0f 11-Aug-2010 Douglas Gregor <dgregor@apple.com> Improve our handling of user-defined conversions when computing
implicit conversion sequences. In particular, model the "standard
conversion" from a class to its own type (or a base type) directly as
a standard conversion in the normal path *without* trying to determine
if there is a valid copy constructor. This appears to match the intent
of C++ [over.best.ics]p6 and more closely matches GCC and EDG.

As part of this, model non-lvalue reference initialization via
user-defined conversion in overloading the same way we handle it in
InitializationSequence, separating the "general user-defined
conversion" and "conversion to compatible class type" cases.

The churn in the overload-call-copycon.cpp test case is because the
test case was originally wrong; it assumed that we should do more
checking for copy constructors that we actually should, which affected
overload resolution.

Fixes PR7055. Bootstrapped okay.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110773 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
verload-call-copycon.cpp
e26f0432c20de7034f414809628d10bfd961ca04 10-Aug-2010 Douglas Gregor <dgregor@apple.com> When attempting to recover from a failed unqualified name lookup, make
sure to clear out the LookupResult structure after looking into each class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110615 91177308-0d34-0410-b5e6-96231b3b80d8
rash-PR7625.cpp
09556fd1fb576144e2beda023bf3386f2292243b 08-Aug-2010 Chandler Carruth <chandlerc@gmail.com> Fix a crash on template delete operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110542 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
a570260357155454465815c292a14a1c43d9213a 08-Aug-2010 Eli Friedman <eli.friedman@gmail.com> Make this test check a few more cases which didn't work correctly before
r110526.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110540 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-base-used.cpp
0d30a87e124bb0273fedce3b62401039073fdece 08-Aug-2010 Eli Friedman <eli.friedman@gmail.com> PR7800: both virtual and non-virtual bases must be marked as used for VTTs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110526 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-base-used.cpp
d42066343b3bda72362178e7ece78b9afb709e17 06-Aug-2010 Douglas Gregor <dgregor@apple.com> The pre-increment/pre-decrement grammar in C++ differs from that in C,
but we were parsing the C grammar. Handle the C++ grammar
appropriately. Fixes PR7794.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110445 91177308-0d34-0410-b5e6-96231b3b80d8
nc-decrement-qualifiers.cpp
ncrement-decrement.cpp
255210ef415b9893f0e3794e8d9a704194c12f3c 06-Aug-2010 Douglas Gregor <dgregor@apple.com> Introduce implicit conversions between AltiVec vectors and GCC
vectors, from Anton Yartsev!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110437 91177308-0d34-0410-b5e6-96231b3b80d8
ltivec.cpp
19410a7e8ff6df550eb776574950d352a1de2bd8 05-Aug-2010 Eli Friedman <eli.friedman@gmail.com> PR7769: Fix references to anonymous structs/unions in base classes in
offsetof expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110327 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
c133e9ea17d61062bcfb3bd6009c300c9a78161f 05-Aug-2010 Nick Lewycky <nicholas@mxc.ca> Remove the warning for variables declared in the if-expression being used in
the else clause. The problem is that it's overly zealous and will respond to
uses in assignments, or after assignments. We should bring this back once we
can do it right. Fixes PR7100.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110314 91177308-0d34-0410-b5e6-96231b3b80d8
arn-for-var-in-else.cpp
58e5539df7d9d1f003912fccb8d524d4f2c6846a 05-Aug-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Remove a redundant and broken check. Fixes PR7810.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110294 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
cbfe50224b19119e759802bd0c1463269dffd09e 04-Aug-2010 John McCall <rjmccall@apple.com> Emit standard-library RTTI with external linkage, not weak_odr.

Apply hidden visibility to most RTTI; libstdc++ does not rely on exact
pointer equality for the type info (just the type info names). Apply
the same optimization to RTTI that we do to vtables.

Fixes PR5962.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110192 91177308-0d34-0410-b5e6-96231b3b80d8
ypeid-ref.cpp
15442825bb2c3f2cc48f3ed753d172beb8ed1232 04-Aug-2010 John McCall <rjmccall@apple.com> Only look up an 'operator delete' on the definition of a destructor, not on
a declaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110175 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
97ba481f3f45e5b63b4a354bfb471ce146b7de57 03-Aug-2010 John McCall <rjmccall@apple.com> Labels (and case statement) don't create independent scope parents for the
purposes of the jump checker. Also extend Ted's iteration fix to labels.

Fixes PR7789.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110082 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
4204f07fc8bffe6d320b2de95fea274ccf37a17b 02-Aug-2010 John McCall <rjmccall@apple.com> Further adjustments to -Wglobal-constructors; works for references and direct
initializations now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110063 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
b4b9b15c597a923a03ad0a33cdc49b67e5cc4450 01-Aug-2010 John McCall <rjmccall@apple.com> Kill off RequiresGlobalConstructor in favor of isConstantInitializer.
Note some obvious false positives in the test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109986 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
626e96e2874698a6736fd33672fa9c28da91d77e 01-Aug-2010 John McCall <rjmccall@apple.com> Make a first pass at implementing -Wglobal-constructors. I'm worried that this
will end up bizarrely mirroring CGExprConstant, but that might be the hazard of
this feature.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109984 91177308-0d34-0410-b5e6-96231b3b80d8
arn-global-constructors.cpp
e46f62cbaaa6294d84be09f3c9b910a2031be913 01-Aug-2010 John McCall <rjmccall@apple.com> Don't consider all local variables in C++ to mandate scope-checking, just
those with initializers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109964 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
35f9a196ef897b9559de25aaecd957208f0b4f59 30-Jul-2010 Abramo Bagnara <abramo.bagnara@gmail.com> Fixed typedef inside extern "C".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109865 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
254a9427ff84d694724fdecd0642dad8ceaa0645 29-Jul-2010 Douglas Gregor <dgregor@apple.com> When deleting a value of class type, make sure that type is complete
before looking for conversions to pointer type. Fixes <rdar://problem/8248780>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109749 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
9d4bb946269303996edadffce642301bee87a62f 29-Jul-2010 Douglas Gregor <dgregor@apple.com> Don't die when a member access refers to a non-class member via a
qualified name. Fixes <rdar://problem/8231724>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109682 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
0246376203474718e0ec7e4025b1820c6e72a3da 27-Jul-2010 Eli Friedman <eli.friedman@gmail.com> Fix a minor crash bug with constructs like Obj.Class::ENUM_VALUE.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109537 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-member-enum.cpp
b7690b425845b636849f25074d64d30aad646473 24-Jul-2010 Chris Lattner <sabre@nondot.org> turn down the logical bitwise confusion warning to not warn
when the RHS of the ||/&& is ever 0 or 1. This handles a variety of
creative idioms for "true" used in C programs and fixes many false
positives at the expense of a few false negatives. This fixes
rdar://8230351.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109314 91177308-0d34-0410-b5e6-96231b3b80d8
witch.cpp
0fab8cd9bd9093ce16b6ce64a152d861ba408652 23-Jul-2010 Eli Friedman <eli.friedman@gmail.com> Fix for PR7694: make sure to pass in a RecordType to CheckBaseClassAccess;
fixes crashes on both valid and invalid code. The diagnostic here could
potentially be improved, but it's good enough as-is.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109257 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-member-pointer.cpp
b92caa5aa6f428ab1bf1a71bea5a35e15c309d8c 23-Jul-2010 John McCall <rjmccall@apple.com> Ted pointed out that this test case could be using access control instead of
__attribute__((unavailable)). I've done so, but unfortunately there's still a case
of redundant diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109192 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
042411cc447f9b120086a6e4650583044f66fd12 21-Jul-2010 Ted Kremenek <kremenek@apple.com> Upgrade "'X' is unavailable" from a warning to an error. This matches GCC's behavior. Note that
GCC emits a warning instead of an error when using an unavailable Objective-C protocol, so now
Clang's behavior is more strict in this case, but more consistent. We will need to see how much
this fires on real code and determine whether this case should be downgraded to a warning.

Fixes <rdar://problem/8213093>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109033 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
34fa29485d6e0b22f1f32852f34e483db0f90b0d 16-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Make this grossness default to the error it should always be.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108511 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
b21fc4a4c17fdf7d3de4fd3cd36a1ad4d8af6f55 16-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Butcher a perfectly reasonable diagnostic to pacify old versions of SWIG.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108505 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
35e12c90c1b107a75c5615aa76fdbd403661aaa6 15-Jul-2010 Douglas Gregor <dgregor@apple.com> Make the "unused result" warning a warning about run-time behavior, so
that we don't warn when there isn't going to be any computation anyway.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108442 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype.cpp
f801dcff43b49509bf758e213de56288bd3e2a2e 15-Jul-2010 Douglas Gregor <dgregor@apple.com> Add test case for PR5290; this bug was fixed with the non-class rvalue
de-cv-qualification fixes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108437 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype.cpp
5495f37302f7c82192dab1ce8d9c9fe76ed0ee37 14-Jul-2010 Chandler Carruth <chandlerc@gmail.com> Wire up '-Wignored-qualifiers' to the warning on 'const' in 'const int f()'.
This flag and warning match GCC semantics. Also, move it to -Wextra as this is
a largely cosmetic issue and doesn't seem to mask problems. Subsequent fixes to
the tests which no longer by default emit the warning. Added explicit test
cases for both C and C++ behavior with the warning turned on.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108325 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
onditional-expr.cpp
riend.cpp
eturn.cpp
90a8f27f144233b53cac0c88a1595f7f05105b7e 13-Jul-2010 Chris Lattner <sabre@nondot.org> Add a warning to catch a bug recently caught by code review, like this:
t2.c:2:12: warning: use of logical && with constant operand; switch to bitwise &
or remove constant [-Wlogical-bitwise-confusion]
return x && 4;
^ ~

wording improvement suggestions are welcome.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108260 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
witch.cpp
6398235d7890a81b785ea5af3b6e66d86bf184cc 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Whenever we're creating an expression that is typically an rvalue
(e.g., a call, cast, etc.), immediately adjust the expression's type
to strip cv-qualifiers off of all non-class types (in C++) or all
types (in C). This effectively extends my previous fix for PR7463,
which was restricted to calls, to other kinds of expressions within
similar characteristics. I've audited every use of
getNonReferenceType() in the code base, switching to the newly-renamed
getNonLValueExprType() where necessary.

Big thanks to Eli for pointing out just how incomplete my original fix
for PR7463 actually was. We've been handling cv-qualifiers on rvalues
wrong for a very, very long time. Fixes PR7463.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108253 91177308-0d34-0410-b5e6-96231b3b80d8
v-unqual-rvalues.cpp
4bd40318cbea15310a37343db46de96c4fcc15e6 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Downgrade the "when type is in parentheses, array cannot have dynamic
size" error for code like

new (int [size])

to a warning, add a Fix-It to remove the parentheses, and make this
diagnostic work properly when it occurs in a template
instantiation. <rdar://problem/8018245>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108242 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
de80ec1fa947855d2e53722a8cd71367ff513481 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Improve diagnostics for the "type qualifier on return type has no
effect warning" by printing the qualifiers we saw and correctly
pluralizing the message, e.g.,

test/SemaCXX/conditional-expr.cpp:295:3: warning: 'const volatile' type
qualifiers on return type have no effect
const volatile Enum g2() {
^~~~~ ~~~~~~~~





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108236 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
riend.cpp
5291c3cec0dbe8ad1d8e7e67e93af2b1586d5400 13-Jul-2010 Douglas Gregor <dgregor@apple.com> When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls
for it: in C, that's all the time, while C++ only does it for
non-class types.

Centralized the computation of the call expression type in
QualType::getCallResultType() and some helper functions in other nodes
(FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant
callers of getResultType() to getCallResultType().

Fixes PR7598 and PR7463, along with a bunch of getResultType() call
sites that weren't stripping references off the result type (nothing
stripped cv-qualifiers properly before this change).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108234 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
onditional-expr.cpp
riend.cpp
aef01998af5bbfc1cdfac091248ff7d30ec31456 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Diagnose typedef of an operator name. Fixes PR7462

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108233 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
ecda6fb71288b1dc3b70ade0c8c75db26ceb1426 13-Jul-2010 John McCall <rjmccall@apple.com> Check in this -Wconversion C++ test case that's been sitting on my machine
for awhile.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108232 91177308-0d34-0410-b5e6-96231b3b80d8
onversion.cpp
a131d0fc0af9f79c90e7654231041b2495d355a9 13-Jul-2010 Douglas Gregor <dgregor@apple.com> Complain when an unnamed enumeration has no enumerations (in
C++). Fixes PR7466.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108231 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
f9ea1f392ab8946f7bfc3f98802a8e5e6fe073f3 13-Jul-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Produce an error on encountering a pointer or reference to a qualified function type. Fixes PR7470.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108209 91177308-0d34-0410-b5e6-96231b3b80d8
unction-type-qual.cpp
5750b81beb0d508278011c410b01acabc9c7ca05 09-Jul-2010 Fariborz Jahanian <fjahanian@apple.com> Instantiation of byref variable in
block literal expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108019 91177308-0d34-0410-b5e6-96231b3b80d8
nstantiate-blocks.cpp
c61bb2056148891375bfa591fa2859b9b6ec2734 09-Jul-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Slightly improve the diagnostic when using a qualified function typedef to declare nonmember or static member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108018 91177308-0d34-0410-b5e6-96231b3b80d8
unction-type-qual.cpp
cddc69fc3fe17b043a287a41e3706766c3d09a79 09-Jul-2010 Sebastian Redl <sebastian.redl@getdesigned.at> When looking for an entity's Scope, don't consider scopes that can't contain declarations. Fixes PR7594.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107927 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-member-functions.cpp
bf9fb88e29e565061c1e91d790af6b43c25915a7 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Allow C-style casts and reinterpret_casts between block pointers and
either integer values or other pointers. Fixes <rdar://problem/8134521>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107905 91177308-0d34-0410-b5e6-96231b3b80d8
locks-1.cpp
6d82ef45d624da4fc88a2fbf7dd1dc144aeb05b0 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Bowing to popular demand, reduce the "comma at end of enumerator list"
ExtWarn to an Extension. Let the broken code propagate!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107875 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
ed8abf18329df67b0abcbb3a10458bd8c1d2a595 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate the fix for PR7556. A silly use of isTrivial() was
suppressing copies of objects with trivial copy constructors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107857 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
84745677f64863e025a6733cb29d0b94bc3a6ae2 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Revert r107828 and r107827, the fix for PR7556, which seems to be
breaking bootstrap on Linux.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107837 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
63ef464c3fad1e8b9f9360baa6c81f974b712e90 08-Jul-2010 Douglas Gregor <dgregor@apple.com> Do not use CXXZeroValueInitExpr for class types. Instead, use
CXXConstructExpr/CXXTemporaryObjectExpr/CXXNewExpr as
appropriate. Fixes PR7556, and provides a slide codegen improvement
when copy-initializing a POD class type from a value-initialized
temporary. Previously, we weren't eliding the copy.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107827 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
6b855121f3c23e9cf2b548cbf2dd3d16fdcf610c 03-Jul-2010 Benjamin Kramer <benny.kra@googlemail.com> Unbreak test on platforms where size_t != unsigned long.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107574 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
5efd91a3b58e59006f8a3e8c9256ec00c38dba95 03-Jul-2010 John McCall <rjmccall@apple.com> Mark the operator delete associated with a virtual destructor as referenced.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107573 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
fe2dd6ceeeb31a7c681b2873a8459c5de5d1a3e9 02-Jul-2010 Douglas Gregor <dgregor@apple.com> By default, warn about commas at the end of an enumerator list in C++/C89.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107485 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
d92ec474faeb6133e0d41f0de4526b22778476f2 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Reinstate fix for PR7526, which was failing because, now that we
aren't dropping all exception specifications on destructors, the
exception specifications on implicitly-declared destructors were
detected as being wrong (which they were).

Introduce logic to provide a proper exception-specification for
implicitly-declared destructors. This also fixes PR6972.

Note that the other implicitly-declared special member functions also
need to get exception-specifications. I'll deal with that in a
subsequent commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107385 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
4712c02c1550a72612c07f5aaee455dcd8273b96 01-Jul-2010 Douglas Gregor <dgregor@apple.com> When performing copy initialization via user-defined conversions,
don't allow two user-defined conversions. Fixes PR6595 (again).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107379 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
4b662a5684d41ea4ff6b52711929e00fefb00db1 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Revert r107374, which broke bootstrap.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107378 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
2fef752aebece6786e5f3d54984272ef85564af8 01-Jul-2010 Douglas Gregor <dgregor@apple.com> When building the type of a destructor, make sure to keep the
exception specification. Fixes PR7526.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107374 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
2f9d8740f557bc1f8746a2d5c4498b324b63eeb9 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Extend the "cannot convert from base class pointer to derived class
pointer" diagnostic to handle references, too.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107372 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
025291b591a528d8a3f303991f65e19fa1e90a9d 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Be a bit more careful with undefined CXXRecordDecls. Fixes
rdar://problem/8124080 and PR7118.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107358 91177308-0d34-0410-b5e6-96231b3b80d8
rash-8124080.cpp
8578981ada66dae44a5a0752f949a5e65b477588 01-Jul-2010 Douglas Gregor <dgregor@apple.com> Improve diagnostic when we fail to pick an overload because it would
require a base-to-derived pointer conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107349 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
4680bf233caeebe89aa297eb5a25709dd15a4b11 30-Jun-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Make both old and new versions of reference binding use the new classification functions, and updated them for N3092.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107301 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
25973455aed1cdc9c40b208c792b5db4f8f1297d 30-Jun-2010 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix rdar://8139785 "implement warning on dead expression in comma operator"

As a bonus, fix the warning for || and && operators; it was emitted even if one of the operands had side effects, e.g:

x || test_logical_foo1();

emitted a bogus "expression result unused" for 'x'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107274 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
e861c60bde74cf495447f50844d7ee7ea3a8a7a0 30-Jun-2010 Chandler Carruth <chandlerc@gmail.com> Reapply r107235, this time with both my typo fixed, and a logical bug fixed.
Previously we relied on the presence of a member which needs no initialization
to prevent us from creating an additional initialization of the outer anonymous
union field. We have already correctly marked that field as initialized by the
member of the union (repeatedly due to the original bug this patch fixes) so we
simply need to bail out.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107242 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
ec29b352b7ab2a2e99f7a9b78ce27c5e2a08d0e1 30-Jun-2010 Chandler Carruth <chandlerc@gmail.com> Revert r107235, it had a silly typo in it, and fixing the typo breaks something
else. Get the build bots happy while I debug. Very sorry for the delay fixing
this...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107239 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
e9c9d15ef9429257136564c5bab76dbe286e37c7 30-Jun-2010 Chandler Carruth <chandlerc@gmail.com> Fix PR7402: We were creating implicit member initializers for every field in an
anonymous union under the presumption that they didn't do anything. While this
is true, our checks for redundant initialization of an anonymous union still
fire when these overlap with explicit user initialization. A cleaner approach
is to avoid initializing multiple members of a union altogether, but this still
is in a rather fuzzy are especially when C++0x allows non-POD types into
unions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107235 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
6bc574daab3d3571d888cc4a21df67f2e2a14792 30-Jun-2010 Douglas Gregor <dgregor@apple.com> Implement C++ DR299, which allows an implicit conversion from a class
type to an integral or enumeration type in the size of an array new
expression, e.g.,

new int[ConvertibleToInt(10)];

This is a GNU and C++0x extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107229 91177308-0d34-0410-b5e6-96231b3b80d8
ew-array-size-conv.cpp
ew-delete.cpp
12eb5d6aa882eb247a6c22225b625eee04217105 29-Jun-2010 Douglas Gregor <dgregor@apple.com> When typo correction produces a result that is not of the kind we're
looking for, reset the name within the LookupResult structure in
addition to clearing out the results. Fixes PR7508.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107197 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
6699220f73f11e471b5e5aa42eaf064afeaa079e 29-Jun-2010 Douglas Gregor <dgregor@apple.com> Allow a using directive to refer to the implicitly-defined namespace
"std", with a warning, to improve GCC compatibility. Fixes PR7517.

As a drive-by, add typo correction for using directives.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107172 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
9fde9c424f734e1ef45177999e3a04faad127414 29-Jun-2010 Daniel Dunbar <daniel@zuster.org> tests: Use %clangxx when using driver for C++, in case C++ support is disabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107153 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
2389324eb73a1c99d5dfc1dc9eed047ddc96a7b4 28-Jun-2010 Chandler Carruth <chandlerc@gmail.com> Suppress diagnosing access violations while looking up deallocation functions
much as we already do for allocation function lookup. Explicitly check access
for the function we actually select in one case that was previously missing,
but being caught behind the blanket diagnostics for all overload candidates.
This fixs PR7436.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106986 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
1984eb9a1522ad56e1310643a85f66b2b3424c91 23-Jun-2010 Douglas Gregor <dgregor@apple.com> String literals enclosed in parentheses are still string
literals. Fixes PR7488.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106607 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
7c5b1097f5833326b4f5046d6a7d5cb7b9060145 22-Jun-2010 Douglas Gregor <dgregor@apple.com> Don't allow vector conversions to sneak in under the guise of
floating-point conversions or floating-integral conversions. We
really, really, really need to make isFloatingType() and friends not
apply to vector types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106551 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
f3a7b7cfacf802db5458874842b71a74845f0023 22-Jun-2010 Douglas Gregor <dgregor@apple.com> In C++, allow a declaration of an enum to follow a definition of that
enum as a GNU extension.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106540 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
b9d5c22529c3f2bf3b03348021c0fd1c723d8516 19-Jun-2010 Fariborz Jahanian <fjahanian@apple.com> More Sema Check and a test case for init_priority attr.
(radar 8076356).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106350 91177308-0d34-0410-b5e6-96231b3b80d8
nit-priority-attr.cpp
d2c6490385555eaabfaf611d1cf6e89544163c4a 18-Jun-2010 Douglas Gregor <dgregor@apple.com> Merge the "regparm" attribute from a previous declaration of a
function to redeclarations of that function. Fixes PR7025.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106317 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-regparm.cpp
e0cc047b1984fc301bbe6e98b6d197bed39ad562 17-Jun-2010 Douglas Gregor <dgregor@apple.com> When parsing cached C++ method declarations/definitions, save the
"previous token" location at the end of the class definition. This
eliminates a badly-placed error + Fix-It when the ';' following a
class definition is missing. Fixes <rdar://problem/8066414>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106175 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
52a02758fb81723e16c46721152c6ad0528b2fc3 16-Jun-2010 John McCall <rjmccall@apple.com> Fix the build. Using declarations should not be considering when looking
for overridden virtual methods.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106096 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
ad00b7705f9bbee81beeac428e7c6587734ab5a6 16-Jun-2010 John McCall <rjmccall@apple.com> Fix a point of semantics with using declaration hiding: method templates
introduced by using decls are hidden even if their template parameter lists
or return types differ from the "overriding" declaration.

Propagate using shadow declarations around more effectively when looking up
template-ids. Reperform lookup for template-ids in member expressions so that
access control is properly set up.

Fix some number of latent bugs involving template-ids with totally invalid
base types. You can only actually get these with a scope specifier, since
otherwise the template-id won't parse as a template-id.

Fixes PR7384.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106093 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
6e5122c8ce152e19355b707d952ab53fe58bd7ad 15-Jun-2010 Douglas Gregor <dgregor@apple.com> Update equality and relationship comparisons of pointers to reflect
C++ semantics, eliminating an extension diagnostic that doesn't match
C++ semantics (ordered comparison with NULL) and tightening some
extwarns to errors in C++ to match GCC and maintain conformance in
SFINAE contexts. Fixes <rdar://problem/7941392>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106050 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
37dd3ecbfc555c3ee0a1922f4bd5ab999c1e5461 15-Jun-2010 Chris Lattner <sabre@nondot.org> Remove a dead argument to ProcessUCNEscape.

Fix string concatenation to treat escapes in concatenated strings that
are wide because of other string chunks to process the escapes as wide
themselves. Before we would warn about and miscompile the attached testcase.

This fixes rdar://8040728 - miscompile + warning: hex escape sequence out of range


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106012 91177308-0d34-0410-b5e6-96231b3b80d8
char_t.cpp
81e317a444dd756a1cafe94031e4b3f3c138dac6 11-Jun-2010 John McCall <rjmccall@apple.com> Allow pseudo-destructors to be called on qualified pointers. Patch by
Troy Straszheim!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105823 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
5edbdcc62098e305cd55654814dcf783a3f3c477 11-Jun-2010 Jeffrey Yasskin <jyasskin@google.com> Add an option -fshow-overloads=best|all to limit the number of overload
candidates printed. We default to 'all'. At the moment, 'best' prints only
the first 4 overloads, but we'll improve that over time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105815 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
5a57efd7bf88a4a13018e0471ded8063a4abe8af 09-Jun-2010 Douglas Gregor <dgregor@apple.com> Tweak our handling of the notion of a standard conversion sequence
being a subsequence of another standard conversion sequence. Instead
of requiring exact type equality for the second conversion step,
require type *similarity*, which is type equality with cv-qualifiers
removed at all levels. This appears to match the behavior of EDG and
VC++ (albeit not GCC), and feels more intuitive. Big thanks to John
for the line of reasoning that supports this change: since
cv-qualifiers are orthogonal to the second conversion step, we should
ignore them in the type comparison.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105678 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
e1aa9f3a5d3e2c0f8a5606e82eef3c65a6f30672 08-Jun-2010 Douglas Gregor <dgregor@apple.com> When referring to a tag that was previously declared only as a friend,
build a new declaration for that tag type that will be visible for
future lookups of that tag.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105643 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
ccd471341d2edbb18ac9c46a7c65d280d9c6223e 08-Jun-2010 Douglas Gregor <dgregor@apple.com> A built-in overload candidate is consider a non-template function when
determining whether one overload candidate is better than
another. Fixes PR7319.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105642 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
d64fdd0c056f1e50488519254f852fa8050f0470 08-Jun-2010 Douglas Gregor <dgregor@apple.com> Warn about comparisons between arrays and improve self-comparison
warnings, from Troy Straszheim! Fixes PR6163.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105631 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
arn-self-comparisons.cpp
45f5b54d67215639ae6585d12df5133e99180c2b 08-Jun-2010 Anders Carlsson <andersca@mac.com> Correctly handle fields with virtual bases containing empty subobjects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105628 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
d7a95971bd91b21922e5e878ba05bbe42b585cc9 08-Jun-2010 Douglas Gregor <dgregor@apple.com> Implement a warning when converting the literal 'false' to a
pointer. Original patch by Troy D. Straszheim; fixes PR7283.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105621 91177308-0d34-0410-b5e6-96231b3b80d8
arn_false_to_pointer.cpp
52647c63c3cbdf0c87fe8db3ef6f475bfd49725d 05-Jun-2010 Anders Carlsson <andersca@mac.com> When deciding whether reinterpret_cast casts away constness we need to look at array qualifiers. Fixes rdar://problem/8018292.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105494 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
83a45e7dab892e9efd3515eca4eb5b81bc3f2126 30-May-2010 Anders Carlsson <andersca@mac.com> Turn on the new empty base subobject tracking code. It's a bit faster than the previous code. However, it still has quadratic performance, something which I intend to fix shortly in a subsequent patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105161 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
3cd09ccbb1a750a7b40593a7b0a2d95ee2a0ba0e 29-May-2010 Anders Carlsson <andersca@mac.com> Rework the way virtual primary bases are added when laying out classes. Instead of doing it as a separate step, we now use the BaseSubobjectInfo and use it when laying out the bases. This fixes a bug where we would either not add a primary virtual base at all, or add it at the wrong offset.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105110 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
811d0bec4d4eb6a8ff373f97f98354d6e0e54ecb 28-May-2010 John McCall <rjmccall@apple.com> Disable exception-spec compatibility checking under -fno-exceptions.
Fixes PR7243.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104942 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec-no-exceptions.cpp
76ef658c703faf72c00f324fb9edc03169718e3e 28-May-2010 Douglas Gregor <dgregor@apple.com> When we complain about a member being inaccessible due to a constraint
along an access path, add another note pointing at the member we
actually found.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104937 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
bff9eb73031494a7a728ced66d1de150f28fd99f 27-May-2010 Anders Carlsson <andersca@mac.com> Another empty class layout test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104839 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
1a8d1511cde781787550576306085bd9300feb5a 27-May-2010 Anders Carlsson <andersca@mac.com> Add more empty class layout tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104838 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
2c0a54031c98721460806e78e0e10da093d3fd72 26-May-2010 Fariborz Jahanian <fjahanian@apple.com> Improve on flexible array diagnostics (PR7029).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104739 91177308-0d34-0410-b5e6-96231b3b80d8
lexible-array-test.cpp
4142cebf70fe6c3855570c98b8042431797a65fd 26-May-2010 Fariborz Jahanian <fjahanian@apple.com> Fixes misc. flexible array bugs in c++ (PR7029).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104733 91177308-0d34-0410-b5e6-96231b3b80d8
lexible-array-test.cpp
af7bea5fb496921c386459dc695485490bb06963 25-May-2010 Douglas Gregor <dgregor@apple.com> Make sure to strip off top-level cv-qualifiers as part of a
derived-to-base conversion on a pointer. Fixes PR7224.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104607 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
204ce17e0cfd9bbe229627e1e5a20c3f2f587c8c 24-May-2010 Douglas Gregor <dgregor@apple.com> Don't complain about VLAs of non-POD types when the array type is
dependent. Fixes <rdar://problem/8021385>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104550 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
836adf6771d5170d936599dfcce21687e37e9bbf 24-May-2010 Douglas Gregor <dgregor@apple.com> Make sure that we instantiate variably modified types, even if they
aren't dependent. Fixes <rdar://problem/8020206>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104511 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
94a615718d06704816c6e31a811f823c05e39f52 24-May-2010 Douglas Gregor <dgregor@apple.com> Downgrade deletion of a void* from an error (which is should be) to an
extension warning (which other compilers seem to use). Works around a
known bug in Xalan.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104509 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
ae65f4bd588f5f5ec26ed188830bf6d14800b09e 24-May-2010 Douglas Gregor <dgregor@apple.com> An identity conversion is better than any non-identity
conversion. Fixes PR7095.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104476 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
88623ade9599d2a2f4e21e80bce00fb4cb9e7d5f 23-May-2010 Douglas Gregor <dgregor@apple.com> In C++, one cannot assign from an arithmetic type to an enumeration
type. Fixes PR7051.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104475 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
a481ec4150ad203440852a2bfee0883dd26f7530 23-May-2010 Douglas Gregor <dgregor@apple.com> It turns out that people love using VLAs in templates, too. Weaken our
VLA restrictions so that one can use VLAs in templates (even
accidentally), but not as part of a non-type template parameter (which
would be very bad).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104471 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
9ba6af8bedba28d10a6906c62c19d43f81c5d386 23-May-2010 Douglas Gregor <dgregor@apple.com> Complain about sizeof(overloaded function) rather than crashing.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104470 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
bfcdc40cbc213d91d91513ba8e1fbde65734ddf4 23-May-2010 Anders Carlsson <andersca@mac.com> When recording empty subobjects we should always look at the primary virtual base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104464 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
db4da82e7248eb0eec249028506ed082c6807c2a 23-May-2010 Douglas Gregor <dgregor@apple.com> Put the VLA-is-an-extension warning into its own warning group (-Wvla)
so that it can be selectively enabled/disabled.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104462 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
715e9c8a39437347e838aa108df443fe1086d359 23-May-2010 Douglas Gregor <dgregor@apple.com> Even though we don't unique VLA types, we still need to build a
canonical type where the element type is canonical. Fixes PR7206.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104461 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
d9008318fe395dcbb9049cfb4f2b87cfb5a75f3a 22-May-2010 Douglas Gregor <dgregor@apple.com> When determining whether we can use "this", make sure to look through
enum contexts (along with block contexts, which we already did). Fixes
PR7196.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104444 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
0fddb97901dbe36a8253dee29961cba8e0a87cf6 22-May-2010 Douglas Gregor <dgregor@apple.com> Implement support for variable length arrays in C++. VLAs are limited
in several important ways:

- VLAs of non-POD types are not permitted.
- VLAs cannot be used in conjunction with C++ templates.

These restrictions are intended to keep VLAs out of the parts of the
C++ type system where they cause the most trouble. Fixes PR5678 and
<rdar://problem/8013618>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104443 91177308-0d34-0410-b5e6-96231b3b80d8
99-variable-length-array.cpp
99.cpp
ffsetof.cpp
aec0371e62be013a2e6466688ccf6a7460880262 21-May-2010 John McCall <rjmccall@apple.com> Propagate access specifiers to anonymous union members nested within classes.
Fixes <rdar://problem/7987650>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104376 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
e0d5fe2a417b84ac8b51927ebeb8f1c9ae492760 21-May-2010 Douglas Gregor <dgregor@apple.com> Use CanQualType to enforce the use of a canonical type argument to
CXXBasePaths::isAmbiguous(), rather than just asserting that we have a
canonical type. Fixes PR7176.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104374 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
fe2d379dbf570d49dc5d98a086cf43c4e675f5ce 21-May-2010 Douglas Gregor <dgregor@apple.com> Fix a crasher in constructor-initializer reordering warnings (PR7179).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104299 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reorder-ctor-initialization.cpp
4e58c25aa579d30cd1e4b0bfb36321c14652be12 20-May-2010 Douglas Gregor <dgregor@apple.com> Remove accidental commit

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104207 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-adl.cpp
68dd3ee3b5ae5b7694b4a21e34b4355431ed0457 20-May-2010 Douglas Gregor <dgregor@apple.com> Various small fixes for construction/destruction of Objective-C++
instance variables:
- Use isRecordType() rather than isa<RecordType>(), so that we see
through typedefs in ivar types.
- Mark the destructor as referenced
- Perform C++ access control on the destructor


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104206 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-adl.cpp
ea1471e0e967548c596a71469702f8846dbaf3c0 20-May-2010 John McCall <rjmccall@apple.com> Support implicitly closing on 'this' in a block. Fixed PR7165.

(the codegen works here, too, but that's annoying to test without execution)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104202 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
b65a45835afcc93fa99e22b14b4c9734c261d831 20-May-2010 Douglas Gregor <dgregor@apple.com> When a conditional operator is an rvalue of class type, we need to
create a temporary copy of both the "true" and "false" results. Fixes
the Boost.Interprocess failures.

Daniel did all the hard work of tracking down the issue, I get to type
up the trivial fix for this horrible miscompile.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104184 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
26bcf67d0156e2aec6ea184f8c2fb6186ec7b1e3 19-May-2010 Douglas Gregor <dgregor@apple.com> Implement C++ builtin operator candidates for vector types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104105 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
a1158558305290c461f874757eedb68913b5420f 19-May-2010 Douglas Gregor <dgregor@apple.com> Basic test for user-defined conversions involving vector types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104085 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
fb4a5436839aae5f5599f2970997e23ee6b895b6 19-May-2010 Douglas Gregor <dgregor@apple.com> Implement C++ support for vector and extended vector types. This
involves extending implicit conversion sequences to model vector
conversions and vector splats, along with teaching the C++ conditional
operator-checking code about vector types.

Fixes <rdar://problem/7983501>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104081 91177308-0d34-0410-b5e6-96231b3b80d8
ector.cpp
0fb97083cc0f8a82e404e22991ae80d2216e71d5 18-May-2010 John McCall <rjmccall@apple.com> If a switch condition is constant, don't warn about missing enum cases.
If a switch condition is constant, warn if there's no case for it.

Constant switch conditions do come up in reasonable template code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104010 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
-c-e-cxx.cpp
witch.cpp
00e9cbb13d3e5deb8ee27288e0ed816266ec9e5b 18-May-2010 Chandler Carruth <chandlerc@gmail.com> Add a hack to silence warnings about failing to return from functions after
a temporary with a noreturn destructor has been created. Fixes PR6884 for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104000 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-noreturn.cpp
293279ae4351f4f17ce44aa4f72861d0bc74c918 17-May-2010 Douglas Gregor <dgregor@apple.com> Test that mutability of class members that involve class definitions actually works

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103959 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
9dadd94e1c17fa030d1f88d8f2113ff59ccc6714 17-May-2010 Douglas Gregor <dgregor@apple.com> Teach ASTContext::getUnqualifiedArrayType() how to look through
typedefs. As a drive-by, teach hit how to build VLA types, since those
will eventually be supported in C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103958 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
33f992425213f381fc503699b26ee8cf9b60494e 17-May-2010 Douglas Gregor <dgregor@apple.com> mutable is a storage class that can follow a class/struct/union definition. Fixes PR7153

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103954 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
9614dc0f76af9707a07d656056d2ec08cdd04b3a 17-May-2010 Fariborz Jahanian <fjahanian@apple.com> Don't attempt to poke into an invalid field's class type
to mark its destructors as referenced which may cause
a crash. Fixes radar 7896920


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103953 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-instantiated-field-decl.cpp
55cbd6e51fdca832c31bf8c179c40978a5d1f892 16-May-2010 Anders Carlsson <andersca@mac.com> Correctly diagnose array 'new' with initialization arguments when the new type is a typedef to an array type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103909 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
3caf04ea0c01ff6822209c4621c3fa64a48029a4 16-May-2010 Douglas Gregor <dgregor@apple.com> When the type-id or new-type-id of a C++ "new" expression is a typedef
of an array type, use the outermost array bound as the number of
elements to allocate. Fixes PR7147.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103908 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
4bb3bf98704c98d2953381b484a9127f0909678f 16-May-2010 Chris Lattner <sabre@nondot.org> really use valist.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103900 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
403783337fc06ce46bc2adeb7f09e0c0471f758e 16-May-2010 Chris Lattner <sabre@nondot.org> fix rdar://7985267 - Don't emit an error about a non-pod argument
passed to va_start, it doesn't actually pass it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103899 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
00b4b039f02d338ae4774797053235a7e65abbde 14-May-2010 Douglas Gregor <dgregor@apple.com> Make sure to search semantic scopes and appropriate template-parameter
scopes during unqualified name lookup that has fallen out to namespace
scope. Fixes PR7133.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103766 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
6fb745bdf1ff1e32caf07e42093a7920726892c1 13-May-2010 Douglas Gregor <dgregor@apple.com> Rework when and how vtables are emitted, by tracking where vtables are
"used" (e.g., we will refer to the vtable in the generated code) and
when they are defined (i.e., because we've seen the key function
definition). Previously, we were effectively tracking "potential
definitions" rather than uses, so we were a bit too eager about emitting
vtables for classes without key functions.

The new scheme:
- For every use of a vtable, Sema calls MarkVTableUsed() to indicate
the use. For example, this occurs when calling a virtual member
function of the class, defining a constructor of that class type,
dynamic_cast'ing from that type to a derived class, casting
to/through a virtual base class, etc.
- For every definition of a vtable, Sema calls MarkVTableUsed() to
indicate the definition. This happens at the end of the translation
unit for classes whose key function has been defined (so we can
delay computation of the key function; see PR6564), and will also
occur with explicit template instantiation definitions.
- For every vtable defined/used, we mark all of the virtual member
functions of that vtable as defined/used, unless we know that the key
function is in another translation unit. This instantiates virtual
member functions when needed.
- At the end of the translation unit, Sema tells CodeGen (via the
ASTConsumer) which vtables must be defined (CodeGen will define
them) and which may be used (for which CodeGen will define the
vtables lazily).

From a language perspective, both the old and the new schemes are
permissible: we're allowed to instantiate virtual member functions
whenever we want per the standard. However, all other C++ compilers
were more lazy than we were, and our eagerness was both a performance
issue (we instantiated too much) and a portability problem (we broke
Boost test cases, which now pass).

Notes:
(1) There's a ton of churn in the tests, because the order in which
vtables get emitted to IR has changed. I've tried to isolate some of
the larger tests from these issues.
(2) Some diagnostics related to
implicitly-instantiated/implicitly-defined virtual member functions
have moved to the point of first use/definition. It's better this
way.
(3) I could use a review of the places where we MarkVTableUsed, to
see if I missed any place where the language effectively requires a
vtable.

Fixes PR7114 and PR6564.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103718 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-virtual-member-functions.cpp
irtual-member-functions-key-function.cpp
arn-weak-vtables.cpp
01b0cfaf653eead65aa1eeab3dcb4f2500c91385 13-May-2010 Ted Kremenek <kremenek@apple.com> Add test case for <rdar://problem/7880658>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103701 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
c63d2c8469d6b96712b324f76b4af07e1852313f 12-May-2010 Douglas Gregor <dgregor@apple.com> When we emit an error during the implicit definition of a special
member function (default constructor, copy constructor, copy
assignment operator, destructor), emit a note showing where that
implicit definition was required.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103619 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
ddb0b4d5391d3e6bc9dcf93dc42310b20c96b6fc 12-May-2010 John McCall <rjmccall@apple.com> When checking scopes for indirect goto, be more permissive (but still safe)
about the permitted scopes. Specifically:
1) Permit labels and gotos to appear after a prologue of variable initializations.
2) Permit indirect gotos to jump out of scopes that don't require cleanup.
3) Diagnose possible attempts to indirect-jump out of scopes that do require
cleanup.
This requires a substantial reinvention of the algorithm for checking indirect
goto. The current algorithm is Omega(M*N), with M = the number of unique
scopes being jumped from and N = the number of unique scopes being jumped to,
with an additional factor that is probably (worst-case) linear in the depth
of scopes. Thus the entire thing is likely cubic given some truly bizarre
ill-formed code; on well-formed code the additional factor collapses to
an amortized constant (when amortized over the entire function) and so
the algorithm is quadratic. Even this requires every label to appear in
its own scope, which would be very unusual for indirect-goto code (and
extremely unlikely for well-formed code); it is far more likely that
all labels will be in the same scope and so the algorithm becomes linear.
For such a marginal feature, I am fairly happy with this result.

(this is using JumpDiagnostic's definition of scope, where successive
variables in a block appear in their own scope)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103536 91177308-0d34-0410-b5e6-96231b3b80d8
cope-check.cpp
380c2139959d8608782292984b457640a143a70d 11-May-2010 Daniel Dunbar <daniel@zuster.org> Speculatively revert r103497, "Do not mark the virtual members of an
implicitly-instantiated class as ...", which seems to have broken bootstrap.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103515 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
bbbe074566a8defed299ff676bc65b3631861768 11-May-2010 Douglas Gregor <dgregor@apple.com> Do not mark the virtual members of an implicitly-instantiated class as
referenced unless we see one of them defined (or the key function
defined, if it as one) or if we need the vtable for something. Fixes
PR7114.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103497 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
6ad9ac097918fbdeb443ea7b99d4db9e49b28534 07-May-2010 Chris Lattner <sabre@nondot.org> add PCH support for a bunch of C++ Decls, patch by
Andrew Sutton!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103301 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
b697e084341185a08b3946df032fbc75f76a66e0 06-May-2010 John McCall <rjmccall@apple.com> Diagnose deprecated/unavailable functions selected by overload resolution.
Fixes rdar://problem/4232969, or at least the clang parts of it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103191 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
323ed74658bc8375278eabf074b4777458376540 06-May-2010 John McCall <rjmccall@apple.com> Rearchitect -Wconversion and -Wsign-compare. Instead of computing them
"bottom-up" when implicit casts and comparisons are inserted, compute them
"top-down" when the full expression is finished. Makes it easier to
coordinate warnings and thus implement -Wconversion for signedness
conversions without double-warning with -Wsign-compare. Also makes it possible
to realize that a signedness conversion is okay because the context is
performing the inverse conversion. Also simplifies some logic that was
trying to calculate the ultimate comparison/result type and getting it wrong.
Also fixes a problem with the C++ explicit casts which are often "implemented"
in the AST with a series of implicit cast expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103174 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
onditional-expr.cpp
60a8fbb4242e2535ccddd1fa2d8257ec1bf749c2 06-May-2010 Douglas Gregor <dgregor@apple.com> When implicit definition of the copy-assignment operator fails,
provide a note that shows where the copy-assignment operator was
needed. We used to have this, but I broke it during refactoring.

Finishes PR6999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103127 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
6cdc161527a513f28dfc6f6ec27eb287f8268024 04-May-2010 Douglas Gregor <dgregor@apple.com> When creating a call to a base subobject's operator= in an
implicitly-defined copy assignment operator, suppress the protected
access check. This eliminates the remaining failure in the
Boost.SmartPtr library (that was a product of the copy-assignment
generation rewrite) and, presumably, the Boost.TR1 library as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103010 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
48c950137e4318abb1080f438208fda8c14ca8b9 03-May-2010 Anders Carlsson <andersca@mac.com> The array form of 'new' can never have initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102917 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
ae374759fce6c74d5be29dfe058d4a727154115c 03-May-2010 Douglas Gregor <dgregor@apple.com> When declaring a namespace alias, ignore previous declarations that
aren't in scope. Fixes PR7014.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102915 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
06a9f3680d22529a2fcf20c52d71cf221d99d910 01-May-2010 Douglas Gregor <dgregor@apple.com> Complete reimplementation of the synthesis for implicitly-defined copy
assignment operators.

Previously, Sema provided type-checking and template instantiation for
copy assignment operators, then CodeGen would synthesize the actual
body of the copy constructor. Unfortunately, the two were not in sync,
and CodeGen might pick a copy-assignment operator that is different
from what Sema chose, leading to strange failures, e.g., link-time
failures when CodeGen called a copy-assignment operator that was not
instantiation, run-time failures when copy-assignment operators were
overloaded for const/non-const references and the wrong one was
picked, and run-time failures when by-value copy-assignment operators
did not have their arguments properly copy-initialized.

This implementation synthesizes the implicitly-defined copy assignment
operator bodies in Sema, so that the resulting ASTs encode exactly
what CodeGen needs to do; there is no longer any special code in
CodeGen to synthesize copy-assignment operators. The synthesis of the
body is relatively simple, and we generate one of three different
kinds of copy statements for each base or member:

- For a class subobject, call the appropriate copy-assignment
operator, after overload resolution has determined what that is.
- For an array of scalar types or an array of class types that have
trivial copy assignment operators, construct a call to
__builtin_memcpy.
- For an array of class types with non-trivial copy assignment
operators, synthesize a (possibly nested!) for loop whose inner
statement calls the copy constructor.
- For a scalar type, use built-in assignment.

This patch fixes at least a few tests cases in Boost.Spirit that were
failing because CodeGen picked the wrong copy-assignment operator
(leading to link-time failures), and I suspect a number of undiagnosed
problems will also go away with this change.

Some of the diagnostics we had previously have gotten worse with this
change, since we're going through generic code for our
type-checking. I will improve this in a subsequent patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102853 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
259d48e1486044093131c8c078f70a28b1503e70 30-Apr-2010 John McCall <rjmccall@apple.com> An edge from a call expression to the exit block is only an abnormal edge
if *none* of the successors of the call expression is the exit block.
This matters when a call of bool type is the condition of (say) a while
loop in a function with no statements after the loop. This *can* happen
in C, but it's much more common in C++ because of overloaded operators.

Suppresses some substantial number of spurious -Wmissing-noreturn warnings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102696 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
cc8a5d5f90bbbbcb46f342117b851b7e07ec34f1 29-Apr-2010 Douglas Gregor <dgregor@apple.com> Teach __builtin_offsetof to compute the offsets of members of base
classes, since we only warn (not error) on offsetof() for non-POD
types. We store the base path within the OffsetOfExpr itself, then
evaluate the offsets within the constant evaluator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102571 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
1e3f5bab00661c612044675c1a9d3ec3237802da 29-Apr-2010 Sean Hunt <rideau3@gmail.com> Ensure that cv-qualifiers are correctly removed for post-inc/decrements
as well as pre- and post-inc/decrements in C (not that I think it
matters for any C code).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102552 91177308-0d34-0410-b5e6-96231b3b80d8
nc-decrement-qualifiers.cpp
9d5d60ff8d7991234abcc6a9fe9903db930be0a1 29-Apr-2010 Douglas Gregor <dgregor@apple.com> Diagnose __builtin_offsetof expressions that refer to bit-fields

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102548 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
8ecdb65716cd7914ffb2eeee993fa9039fcd31e8 29-Apr-2010 Douglas Gregor <dgregor@apple.com> Completely reimplement __builtin_offsetof, based on a patch by Roberto
Amadini.

This change introduces a new expression node type, OffsetOfExpr, that
describes __builtin_offsetof. Previously, __builtin_offsetof was
implemented using a unary operator whose subexpression involved
various synthesized array-subscript and member-reference expressions,
which was ugly and made it very hard to instantiate as a
template. OffsetOfExpr represents the AST more faithfully, with proper
type source information and a more compact representation.

OffsetOfExpr also has support for dependent __builtin_offsetof
expressions; it can be value-dependent, but will never be
type-dependent (like sizeof or alignof). This commit introduces
template instantiation for __builtin_offsetof as well.

There are two major caveats to this patch:

1) CodeGen cannot handle the case where __builtin_offsetof is not a
constant expression, so it produces an error. So, to avoid
regressing in C, we retain the old UnaryOperator-based
__builtin_offsetof implementation in C while using the shiny new
OffsetOfExpr implementation in C++. The old implementation can go
away once we have proper CodeGen support for this case, which we
expect won't cause much trouble in C++.

2) __builtin_offsetof doesn't work well with non-POD class types,
particularly when the designated field is found within a base
class. I will address this in a subsequent patch.

Fixes PR5880 and a bunch of assertions when building Boost.Python
tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102542 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
15dedf067b65151f0fd89dd9f80cea96a0528db1 27-Apr-2010 Douglas Gregor <dgregor@apple.com> It's okay to refer to non-type template parameters anywhere they are
visible. Fixes the remaining two failures in Boost.ScopeExit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102466 91177308-0d34-0410-b5e6-96231b3b80d8
ocal-classes.cpp
138bb2366baa3856088bae94f36f2d96b2c995b9 27-Apr-2010 Douglas Gregor <dgregor@apple.com> Diagnose the use of abstract types as array element types. Previously,
we were relying on checking for abstract class types when an array
type was actually used to declare a variable, parameter, etc. However,
we need to check when the construct the array for, e.g., SFINAE
purposes (see DR337). Fixes problems with Boost's is_abstract type
trait.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102452 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
c8fd2dae17a0fc631a07ab7b66c9d3ebe90a0cc6 27-Apr-2010 Douglas Gregor <dgregor@apple.com> When checking the redeclaration context of a typedef that refers to a
tag of the same name, compare the lookup contexts rather than the
actual contexts. Fixes PR6923.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102437 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
a6a292b4dc47da42b2fc0662af7fe278c9e9fb33 27-Apr-2010 Douglas Gregor <dgregor@apple.com> Don't look into incomplete types when trying to warn about unused
variables. Fixes PR6948.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102436 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
110acc1ae8d978f9b423394eaf0cace61b1339f0 27-Apr-2010 John McCall <rjmccall@apple.com> Improve the diagnostic you get when making a qualified member access
with a qualifier referencing a different type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102409 91177308-0d34-0410-b5e6-96231b3b80d8
ual-id-test.cpp
57fdc8a4382164955c7b30d09f4ce46fc7e67659 27-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve source-location information in a C++ typeid (type) expression
by using TypeSourceInfo, cleaning up the representation
somewhat. Teach getTypeOperand() to strip references and
cv-qualifiers, providing the semantic view of the type without
requiring any extra storage (the unmodified type remains within the
TypeSourceInfo). This fixes a bug found by Boost's call_traits test.

Finally, clean up semantic analysis, by splitting the ActOnCXXTypeid
routine into ActOnCXXTypeId (the parser action) and two BuildCXXTypeId
functions, which perform the semantic analysis for typeid(type) and
typeid(expression), respectively. We now perform less work at template
instantiation time (we don't look for std::type_info again) and can
give better diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102393 91177308-0d34-0410-b5e6-96231b3b80d8
ypeid-ref.cpp
ypeid.cpp
fb87b89fc9eb103e19fb8e4b925c23f0bd091b99 26-Apr-2010 Douglas Gregor <dgregor@apple.com> Introduce Type::isStructureOrClassType(), which does the obvious
thing. Audit all uses of Type::isStructure(), changing those calls to
isStructureOrClassType() as needed (which is alsmost
everywhere). Fixes the remaining failure in Boost.Utility/Swap.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102386 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
2b147f072b118607aafafd2f05843243abfe4488 25-Apr-2010 Douglas Gregor <dgregor@apple.com> When name lookup finds a single declaration that was imported via a
using declaration, look at its underlying declaration to determine the
lookup result kind (e.g., overloaded, unresolved). Fixes at least one
issue in Boost.Bimap.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102317 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
b0fd483ad64865cc0233981cfddc36a7c9795e5e 25-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve the diagnostic when we find something we did not expect in a
member expression (p-> or x.), by showing the type we looked into and
what we did actually find.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102315 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
6bf356fb8f769575d5e6e54a3bf81436ddec106a 25-Apr-2010 Douglas Gregor <dgregor@apple.com> When performing name lookup for an operator name, be sure to look
through using declarations. Fixes ~18 tests in Boost.Fusion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102311 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
9fd682b960bf0628299c46a1a07a7cc5a6dcba01 25-Apr-2010 Anders Carlsson <andersca@mac.com> Land this test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102292 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
8e142ccf1196c9ae31f10f9caa97670e343971e7 25-Apr-2010 Anders Carlsson <andersca@mac.com> Revert enough of my patches to fix self-host again :(

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102289 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
e127abe8bbcff7fef0326d68731bc178182a9990 25-Apr-2010 Anders Carlsson <andersca@mac.com> DefineImplicitCopyConstructor now uses SetBaseOrMemberInitializers to create implicit base initializers. (Member initializers are still handled by CodeGenFunction::SynthesizeCXXCopyConstructor for now).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102279 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
d1a272204cef9304df3930d94f66713b05db27d6 24-Apr-2010 Douglas Gregor <dgregor@apple.com> When we are performing copy initialization of a class type via its
copy constructor, suppress user-defined conversions on the
argument. Otherwise, we can end up in a recursion loop where the
bind the argument of the copy constructor to another copy constructor call,
whose argument is then a copy constructor call...

Found by Boost.Regex which, alas, still isn't building.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102269 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
onversion-function.cpp
verload-call.cpp
0d6b1640eb4d1a4a0203235cfdfcdaf3335af36d 23-Apr-2010 John McCall <rjmccall@apple.com> Recommit my change to how C++ does elaborated type lookups, now with
two bugfixes which fix selfhost and (hopefully) the nightly tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102198 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
ypedef-redecl.cpp
17e1d35848247cbc5ff31df58f0b67e85b64837c 23-Apr-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Require a complete type for the lhs of member pointer dereference operations if the type isn't exactly the same as the container class. Fixes PR6783.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102186 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
00b40d3f2fb8b2f9043daf3dd4558bff98346b3c 23-Apr-2010 Daniel Dunbar <daniel@zuster.org> Revert "C++ doesn't really use "namespaces" for different kinds of names the same", which seems to break most C++ nightly test apps.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102174 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
114a297ef02a722b3afcd719210c060811d431e0 23-Apr-2010 Anders Carlsson <andersca@mac.com> Fix a think-o that broke self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102165 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
d04efc98d08731e31bd73f430803acc5ffa9040a 23-Apr-2010 John McCall <rjmccall@apple.com> C++ doesn't really use "namespaces" for different kinds of names the same
way that C does. Among other differences, elaborated type specifiers
are defined to skip "non-types", which, as you might imagine, does not
include typedefs. Rework our use of IDNS masks to capture the semantics
of different kinds of declarations better, and remove most current lookup
filters. Removing the last remaining filter is more complicated and will
happen in a separate patch.

Fixes PR 6885 as well some spectrum of unfiled bugs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102164 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
d1aa800a19c956c72319025dd302ae78ed47f9ee 23-Apr-2010 Anders Carlsson <andersca@mac.com> Change the 'declared at' diagnostic to say 'declared here'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102163 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
efault-constructor-initializers.cpp
llegal-member-initialization.cpp
verloaded-operator.cpp
alue-initialization.cpp
ddfb75f22d89c773ade4fa0df1e3a99d8b125d40 23-Apr-2010 Anders Carlsson <andersca@mac.com> Factor code to initialize an implicit member out into a separate function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102162 91177308-0d34-0410-b5e6-96231b3b80d8
llegal-member-initialization.cpp
4074eefc4c2dc0c554f2e79f7114b309053f9885 23-Apr-2010 Douglas Gregor <dgregor@apple.com> When parsing a cast-expression that starts with a scope annotation,
try to annotate as a type first to determine whether we have a
functional-style cast. Patch by Eli Friedman, fixes PR6830.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102161 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
e9ee23edd17c4bb7f271e67f8790792b4de677fc 22-Apr-2010 John McCall <rjmccall@apple.com> Use the naming class from the overloaded lookup when access-checking an
address of overloaded function, instead of assuming that a nested name
specifier was used. A nested name specifier is not required for static
functions.

Fixes PR6886.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102107 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
66dd9394994654b5af2c62ed24f311432bacede5 22-Apr-2010 Douglas Gregor <dgregor@apple.com> When checking whether to diagnose an initialized "extern" variable,
look for the const on the base type rather than on the top-level
type. Fixes PR6495 properly.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102066 91177308-0d34-0410-b5e6-96231b3b80d8
torage-class.cpp
a41a8c5972c2632247ae7913cf6ce65d45f7e702 22-Apr-2010 Douglas Gregor <dgregor@apple.com> Whenever we complain about a failed initialization of a function or
method parameter, provide a note pointing at the parameter itself so
the user does not have to manually look for the function/method being
called and match up parameters to arguments. For example, we now get:

t.c:4:5: warning: incompatible pointer types passing 'long *' to
parameter of
type 'int *' [-pedantic]
f(long_ptr);
^~~~~~~~
t.c:1:13: note: passing argument to parameter 'x' here
void f(int *x);
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102038 91177308-0d34-0410-b5e6-96231b3b80d8
efault1.cpp
efault2.cpp
laborated-type-specifier.cpp
ember-location.cpp
verload-call.cpp
ef-init-ambiguous.cpp
9c82afc7d1f57b427053e6679d87539b0dc63b1a 20-Apr-2010 John McCall <rjmccall@apple.com> Restore r101841 without modification. Also mark 'operator delete' as used for
actual delete expressions, not just new expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101861 91177308-0d34-0410-b5e6-96231b3b80d8
o-exceptions.cpp
3609432178ae63977d575065509238ca2fedf455 20-Apr-2010 John McCall <rjmccall@apple.com> Revert r101841 and follow-up.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101859 91177308-0d34-0410-b5e6-96231b3b80d8
o-exceptions.cpp
bc34139888606ce956ba6b0b7a0a73a7c5da6b03 20-Apr-2010 John McCall <rjmccall@apple.com> Use __SIZE_TYPE__ as suggested by dgregor.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101857 91177308-0d34-0410-b5e6-96231b3b80d8
o-exceptions.cpp
af5ece5017d59bd43ccd6dbe172a1f5b57132ff9 20-Apr-2010 John McCall <rjmccall@apple.com> Don't bother looking for (or diagnosing problems with) the 'operator delete'
associated with a new expression if -fno-exceptions is set.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101841 91177308-0d34-0410-b5e6-96231b3b80d8
o-exceptions.cpp
c077e45fa9395c4fd97d8a43c708ee07f982fe2c 20-Apr-2010 Douglas Gregor <dgregor@apple.com> Do not diagnose unused-parameter errors in template instantiations. We
will already have done so when the template is declared.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101838 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-parameters.cpp
63c323d7584e3d91549fae23fb30b426d3b19042 20-Apr-2010 Douglas Gregor <dgregor@apple.com> Only suppress the "extern variable has an initializer" warning when the extern entity being initialized is const.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101821 91177308-0d34-0410-b5e6-96231b3b80d8
torage-class.cpp
41b1d6ba40a5c856f3d0bfed1b825154f87b6127 19-Apr-2010 Douglas Gregor <dgregor@apple.com> Disable the "'extern' variable has an initializer" warning in C++,
since it makes sense there to have const extern variables. Fixes
PR6495.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101818 91177308-0d34-0410-b5e6-96231b3b80d8
torage-class.cpp
66821b5515df8a366579d023e472f843ecfa59b2 18-Apr-2010 Douglas Gregor <dgregor@apple.com> When performing reference initialization for the purposes of overload
resolution ([over.ics.ref]), we take some shortcuts required by the
standard that effectively permit binding of a const volatile reference
to an rvalue. We have to treat lightly here to avoid infinite
recursion.

Fixes PR6177.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101712 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
153b3ba7a61f3228fd3a8c67b9bff94db3e13a2e 18-Apr-2010 Douglas Gregor <dgregor@apple.com> Do not consider explicit constructors when performing a copy to a
temporary object. This is blindingly obvious from reading C++
[over.match.ctor]p1, but somehow I'd missed it and it took DR152 to
educate me. Adjust one test that was relying on this non-standard
behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101688 91177308-0d34-0410-b5e6-96231b3b80d8
opy-initialization.cpp
3fbaf3e5d524bfff219d1e3e9ac4801a8411590f 18-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve our handling of user-defined conversions as part of overload
resolution. There are two sources of problems involving user-defined
conversions that this change eliminates, along with providing simpler
interfaces for checking implicit conversions:

- It eliminates a case of infinite recursion found in Boost.

- It eliminates the search for the constructor needed to copy a temporary
generated by an implicit conversion from overload
resolution. Overload resolution assumes that, if it gets a value
of the parameter's class type (or a derived class thereof), there
is a way to copy if... even if there isn't. We now model this
properly.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101680 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
onditional-expr.cpp
onversion-function.cpp
opy-initialization.cpp
ser-defined-conversions.cpp
ca7eaeeed817001dc7cee4852a7e41f0982da1ef 17-Apr-2010 Douglas Gregor <dgregor@apple.com> If a non-noreturn virtual member function is guaranteed not to return,
do *not* suggest that the function could be attribute 'noreturn';
overridden functions may end up returning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101572 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
4cf6f5fdc529f0b4412505e2e6af099370a479b3 16-Apr-2010 Anders Carlsson <andersca@mac.com> More work on wide bit-fields, WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101467 91177308-0d34-0410-b5e6-96231b3b80d8
itfield-layout.cpp
72468ecb98efa158c5f1e2eb39ad413c8e28ebe0 16-Apr-2010 Anders Carlsson <andersca@mac.com> Start working on handling wide bitfields in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101464 91177308-0d34-0410-b5e6-96231b3b80d8
itfield-layout.cpp
c0b39640de335809ca7544f802751112619f30cc 16-Apr-2010 Douglas Gregor <dgregor@apple.com> Audit uses of Sema::LookupSingleName for those lookups that are
intended for redeclarations, fixing those that need it. Fixes PR6831.

This uncovered an issue where the C++ type-specifier-seq parsing logic
would try to perform name lookup on an identifier after it already had
a type-specifier, which could also lead to spurious ambiguity errors
(as in PR6831, but with a different test case).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101419 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
bf422f9d7e2e3454b2296b02202f4d5ae12644f6 15-Apr-2010 Douglas Gregor <dgregor@apple.com> Diagnose attempts to throw an abstract class type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101381 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
af68d4ed6da11634e2915b3ca31da354369e4bc1 15-Apr-2010 Douglas Gregor <dgregor@apple.com> Fix a few cases where enum constant handling was using
ASTContext::getTypeSize() rather than ASTContext::getIntWidth() for
the width of an integral type. The former includes padding for bools
(to the target's size) while the latter does not, so we woud end up
zero-extending bools to the target width when we shouldn't. Fixes a
crash-on-valid in the included test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101372 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
325e593a83b20d9bce3628aa78fda983b554814e 15-Apr-2010 Douglas Gregor <dgregor@apple.com> Warn about non-aggregate classes with no user-declared constructors
that have reference or const scalar members, since those members can
never be initializer or modified. Fixes <rdar://problem/7804350>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101316 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
eferences.cpp
alue-initialization.cpp
1a8cf73a825ef35917eede448817237b5fd47b05 15-Apr-2010 Douglas Gregor <dgregor@apple.com> Always diagnose and complain about problems in
ResolveAddressOfOverloadedFunction when asked to complain. Previously,
we had some weird handshake where ResolveAddressOfOverloadedFunction
expected its caller to handle some of the diagnostics but not others,
and yet there was no way for the caller to know which case we were
in. Eliminate this madness, fixing <rdar://problem/7765884>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101312 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
1864f2eb59471d07db51adfc3e5b1a229eed631a 15-Apr-2010 Douglas Gregor <dgregor@apple.com> Once we've emitted a fatal diagnostic, keep counting errors but with a
separate count of "suppressed" errors. This way, semantic analysis
bits that depend on the error count to determine whether problems
occured (e.g., some template argument deduction failures, jump-scope
checking) will not get confused.

The actual problem here is that a missing #include (which is a fatal
error) could cause the jump-scope checker to run on invalid code,
which it is not prepared to do. Trivial fix for both
<rdar://problem/7775941> and <rdar://problem/7775709>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101297 91177308-0d34-0410-b5e6-96231b3b80d8
issing-header.cpp
55b38842d12ffd9f9ff3a0e16fae2cfe61ab0fe6 14-Apr-2010 Douglas Gregor <dgregor@apple.com> When diagnosing suspicious precedence or assignments, move the fix-it
that adds parentheses from the main diagnostic down to a new
note. This way, when the fix-it represents a choice between two
options, each of the options is associted with a note. There is no
default option in such cases. For example:

/Users/dgregor/t.c:2:9: warning: & has lower precedence than ==; ==
will be
evaluated first [-Wparentheses]
if (x & y == 0) {
^~~~~~~~
/Users/dgregor/t.c:2:9: note: place parentheses around the &
expression to
evaluate it first
if (x & y == 0) {
^
( )
/Users/dgregor/t.c:2:9: note: place parentheses around the ==
expression to
silence this warning
if (x & y == 0) {
^
( )



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101249 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
aa0be17ee35e3218b722d90b74789f9e7c602bda 13-Apr-2010 Douglas Gregor <dgregor@apple.com> When returning the result of a call to an object of class type, do not
return a NULL expression; return either an error or a proper
expression. Fixes PR6078.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101133 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
3d04336baf091b16e9d8f85b48b82dafd2695874 13-Apr-2010 John McCall <rjmccall@apple.com> Allow classes to befriend implicitly-declared members. Fixes PR6207 for
members of non-templated classes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101122 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-member-functions.cpp
a3f8137d9f7cd1af7a6cbe736b9419f7eb99e86c 13-Apr-2010 John McCall <rjmccall@apple.com> Diagnose declarations of conversion functions with declarators other than '()'.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101098 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
05baacbfd67017b2724f3e0503fd23609f5d32bc 13-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve source-location information for C++ conversion functions, by
copying the type location information from the conversion-type-id into
the type location information for the function type. Do something
similar for constructors and destructors, by giving their "void"
return type source-location information.

In all of these cases, we previously left this type-source information
uninitialized, which led to various unfortunate crashes.

We still aren't tracking good source-location information for the
actual names. That's PR6357.

John, please check my sanity on this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101088 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
6275e0cac39b76204644154fd99a449f57c589d4 12-Apr-2010 Douglas Gregor <dgregor@apple.com> When creating the implicitly-declared special member functions, be
sure to introduce them into the current Scope (when we have one) in
addition to the DeclContext for the class, so that they can be found
by name lookup for inline members of the class. Fixes PR6570.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101047 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-member-functions.cpp
59fc2690e622e9db7f7a8f5036562b19d3bfb2b5 10-Apr-2010 Sebastian Redl <sebastian.redl@getdesigned.at> When a member pointer is dereferenced, the class it points into must be complete. Enforce this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100925 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
3c3ccdbe73cb43bdf39a9102f5f7eb842fb71952 10-Apr-2010 John McCall <rjmccall@apple.com> Diagnose more cases of initializing distinct members of an anonymous union
member. Use a better diagnostic for this case. Also fix a bug with nested
anonymous structs/unions for -Wreorder; this last was PR6575.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100923 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
onstructor-initializer.cpp
arn-reorder-ctor-initialization.cpp
d6ca8da0f5a4115813055729faaa5128e994806d 10-Apr-2010 John McCall <rjmccall@apple.com> Diagnose misordered initializers in constructor templates immediately instead of
when they're instantiated. Merge the note into the -Wreorder warning; it
doesn't really contribute much, and it was splitting a thought across diagnostics
anyway. Don't crash in the parser when a constructor's initializers end in a
comma and there's no body; the recovery here is still terrible, but anything's
better than a crash.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100922 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
arn-reorder-ctor-initialization.cpp
7002f4c03c2d0544f4e8bea8d3a5636519081e35 09-Apr-2010 John McCall <rjmccall@apple.com> Turn access control on by default in -cc1.
Remove -faccess-control from -cc1; add -fno-access-control.
Make the driver pass -fno-access-control by default.
Update a bunch of tests to be correct under access control.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100880 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
ccess-control-check.cpp
onditional-expr.cpp
onstructor-initializer.cpp
style-cast.cpp
irect-initializer.cpp
unctional-cast.cpp
ested-name-spec.cpp
ew-delete.cpp
verloaded-operator.cpp
tatic-cast.cpp
irtual-override.cpp
47268a3f2843a8d64f3a6fef1e9a9dde1feb4a8c 09-Apr-2010 Douglas Gregor <dgregor@apple.com> Remove all "used" static functions *after* we have performed all of
the implicit template instantiations we need to perform. Otherwise, we
end up erroneously diagnosing static functions as used if they were
only used within an implicit template instantiation. Fixes a bunch of
spurious failures when building Clang with Clang.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100872 91177308-0d34-0410-b5e6-96231b3b80d8
nused-functions.cpp
d4eea8362605807327735727a9098abe1eb23b19 09-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as

t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
expected 'char *' [-pedantic]
char *name = __func__;
^ ~~~~~~~~

We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:

t.c:2:9: warning: initializing 'char *' from an expression of type
'char const [2]' discards qualifiers [-pedantic]
char *name = __func__;
^ ~~~~~~~~

Fixes <rdar://problem/7447179>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100832 91177308-0d34-0410-b5e6-96231b3b80d8
opy-assignment.cpp
erived-to-base-ambig.cpp
ember-pointer.cpp
cb821d045f5e445384f34d05a526955036073c4a 08-Apr-2010 Douglas Gregor <dgregor@apple.com> Downgrade the "declaration does not declare anything" error to a
warning. It's not harmful to have such pointless declarations, and GCC
does not diagnose this issue consistently.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100814 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
lass.cpp
c53d0d762010217d02da5aa14be171817d63e3fe 08-Apr-2010 Douglas Gregor <dgregor@apple.com> Introduce an egregious hack to work around a bug in libstdc++ 4.2.x's
<tr1/hashtable> header, where a friend class template
std::tr1::__detail::_Map_base is declared with the wrong template
parameters. GCC doesn't catch the problem, so Clang does a little
back-flip to avoid diagnosing just this one instance of the problem.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100790 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_is_pod_hack.cpp
ibstdcxx_map_base_hack.cpp
9ab14541716928894821cf5d53d6b4c95ffdf3a3 08-Apr-2010 Jeffrey Yasskin <jyasskin@google.com> Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it. This fixes several redundant errors and bad
recoveries.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100779 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
edc287751a4b05e3b4d8ff2b38fa30c5b59a548b 08-Apr-2010 Jeffrey Yasskin <jyasskin@google.com> Fix some redundant errors by changing CXXScopeSpec::isSet calls into
isNotEmpty calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100722 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
83e7a78a9fa3fc495a575bca0e3d4d7ce26184ef 08-Apr-2010 Chris Lattner <sabre@nondot.org> rename llvm::llvm_report_error -> llvm::report_fatal_error



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100708 91177308-0d34-0410-b5e6-96231b3b80d8
arn-weak-vtables.cpp
2f59979a7cc7929f53c9984423b0abeb83113442 02-Apr-2010 Douglas Gregor <dgregor@apple.com> Rework our handling of copy construction of temporaries, which was a
poor (and wrong) approximation of the actual rules governing when to
build a copy and when it can be elided.

The correct implementation is actually simpler than the
approximation. When we only enumerate constructors as part of
initialization (e.g., for direct initialization or when we're copying
from a class type or one of its derived classes), we don't create a
copy. When we enumerate all conversion functions, we do create a
copy. Before, we created some extra copies and missed some
others. The new test copy-initialization.cpp shows a case where we
missed creating a (required, non-elidable) copy as part of a
user-defined conversion, which resulted in a miscompile. This commit
also fixes PR6757, where the missing copy made us reject well-formed
code in the ternary operator.

This commit also cleans up our handling of copy elision in the case
where we create an extra copy of a temporary object, which became
necessary now that we produce the right copies. The code that seeks to
find the temporary object being copied has moved into
Expr::getTemporaryObject(); it used to have two different
not-quite-the-same implementations, one in Sema and one in CodeGen.

Note that we still do not attempt to perform the named return value
optimization, so we miss copy elisions for return values and throw
expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100196 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
opy-initialization.cpp
ea356fb65cc844abeab1176f6333a86b69644735 02-Apr-2010 Anders Carlsson <andersca@mac.com> Diagnose multiple base and member initializers in class templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100179 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
1eabb7d0c30f6a876b0fd03ad4656c096c26b8d0 01-Apr-2010 Douglas Gregor <dgregor@apple.com> Improve diagnostics when an elaborated-type-specifer containing a
nested-name-specifier (e.g., "class T::foo") fails to find a tag
member in the scope nominated by the
nested-name-specifier. Previously, we gave a bland

error: 'Nested' does not name a tag member in the specified scope

which didn't actually say where we were looking, which was rather
horrible when the nested-name-specifier was instantiated. Now, we give
something a bit better:

error: no class named 'Nested' in 'NoDepBase<T>'




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100060 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
7727acf243ee61c0757d86c95b69dbee56a3d898 31-Mar-2010 John McCall <rjmccall@apple.com> Fix PR6327: restore invariants when there's a parse error in an initializer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99980 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-member-expr.cpp
ee11b2dd530f3fb873e108f21341626168758a45 30-Mar-2010 Anders Carlsson <andersca@mac.com> Fix a bug where we would incorrectly report an error about initializing two fields in an anonymous struct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99891 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
0b4c9b5834a0a5520d2cd32227a53cf7f73fedca 29-Mar-2010 Douglas Gregor <dgregor@apple.com> Support __attribute__((packed)) (along with other attributes) at the
end of a struct/class/union in C++, from Justin Bogner!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99811 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
6f6de731808ffd3664f0a179d1cb694c4e7e5342 29-Mar-2010 Anders Carlsson <andersca@mac.com> Fix a nasty bug in the virtual base computation which would lead to us initializing virtual bases in the wrong order.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99806 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reorder-ctor-initialization.cpp
c67b03260dbf4127e09b03302ff844a24e41394f 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Compare namespaces properly when looking for redeclarations of
namespace aliases. Fixes PR6341.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99664 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
0fd8ff73630adab9a33123f23ef62fcf5c3cf326 26-Mar-2010 Douglas Gregor <dgregor@apple.com> When trying to determine whether one operand of a conditional
expression can be converted to the type of another, only apply the
lvalue-to-rvalue conversion to the type of the expression we're
converting, *not* the array-to-pointer or function-to-pointer
conversions. Fixes PR6595.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99652 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
b70cf44bf1b1956e0c6b98373c4f69b23afa0052 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Switch semantic analysis of the conditional operator from using
CheckReferenceInit to using the new initialization sequence code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99647 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
9c127392efe91dadacbe28ca16b8a9a5fa7990b3 26-Mar-2010 Douglas Gregor <dgregor@apple.com> Do not mark the destructor of a function parameter's type. Fixes PR6709.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99615 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
c6e378e7d4e14b451f50158968d012dace6646d2 25-Mar-2010 Douglas Gregor <dgregor@apple.com> Switch static_cast from the old reference-initialization code (via
CheckReferenceInit) over to the new initialization code
(InitializationSequence), which is better-tested and doesn't require
us to compute the entire conversion sequence twice.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99452 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
2eef829b19bdc59976a827fa39b409440e352bff 24-Mar-2010 Douglas Gregor <dgregor@apple.com> When a declaration of a function is missing an exception specification
that was present in a prior declaration, emit a warning rather than a
hard error (which we did before, and still do with mismatched
exception specifications). Moreover, provide a fix-it hint with the
throw() clause that should be added, e.g.,

t.C:10:7: warning: 'operator new' is missing exception specification
'throw(std::bad_alloc)'
void *operator new(unsigned long sz)
^
throw(std::bad_alloc)

As part of this, disable the warning when we're missing an exception
specification on operator new, operator new[], operator delete, or
operator delete[] when exceptions are turned off (-fno-exceptions).

Fixes PR5957.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99388 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
b5b2ccbbb69f49146d937e1dc6d7dc11d631908c 24-Mar-2010 Douglas Gregor <dgregor@apple.com> When performing name lookup for the allocation or deallocation
operators, make sure that the implicitly-declared global new and
delete operators are always available. Fixes PR5904.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99382 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-predefined-decl-2.cpp
a418147c61a14cd21d4cce8f9c7a8750d2a59803 24-Mar-2010 Douglas Gregor <dgregor@apple.com> Make sure to properly track the anonymous namespace that lives inside
each namespace, even when the outer namespace has multiple
definitions. As part of this, collapsed two pointers worth of storage
(original namespace and inner anonymous namespace) into a single
pointer with a distinguishing bit, since the two are mutually
exclusive, saving a pointer per NamespaceDecl. Fixes PR6620.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99368 91177308-0d34-0410-b5e6-96231b3b80d8
amespace.cpp
9de672f6eb4a1f076163fd826418ca179e1341ec 23-Mar-2010 Douglas Gregor <dgregor@apple.com> When recovering from a qualified typedef name, don't clear out the
DeclContext because we don't want a NULL DeclContext. Instead, use the
current context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99281 91177308-0d34-0410-b5e6-96231b3b80d8
ual-id-test.cpp
01620704304f819b82ecef769ec114e541a364d7 21-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Fix PR6618.

If a struct has an invalid field, mark it as invalid. Also avoid producing
errors about incomplete types that are invalid.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99150 91177308-0d34-0410-b5e6-96231b3b80d8
R6618.cpp
a369a95f756b6190b5611ff4118b4cabfc704dc0 20-Mar-2010 John McCall <rjmccall@apple.com> Implement -Wshadow for parameter declarations as well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99037 91177308-0d34-0410-b5e6-96231b3b80d8
arn-shadow.cpp
a2936be04fb800d93a0a8d3358f35c7b3b2ded16 19-Mar-2010 John McCall <rjmccall@apple.com> Promote enum types during -Wsign-compare. Fixes some spurious warnings,
mostly during conditional expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98975 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
arn-sign-compare.cpp
73061d054128e486e70e0f2874b23d6eca067e5b 19-Mar-2010 John McCall <rjmccall@apple.com> Pretty-print anonymous types using their kind and presumed location.
Fixes PR6643. Patch by Mike M!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98946 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
7aceaf8cee77c98478e8934dc283910292711a7e 19-Mar-2010 John McCall <rjmccall@apple.com> When elevating access along an inheritance path, initialize the computed
access to the (elevated) access of the accessed declaration, if applicable,
rather than plunking that access onto the end after we've calculated the
inheritance access.

Also, being a friend of a derived class gives you public access to its
members (subject to later modification by further inheritance); it does
not simply ignore a single location of restricted inheritance.

Also, when computing the best unprivileged path to a subobject, preserve
the information that the worst path might be AS_none (forbidden) rather
than a minimum of AS_private.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98899 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
4ad287edcc7c019c413484b86feb8457701eaccd 17-Mar-2010 John McCall <rjmccall@apple.com> Provide a test case for PR6629.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98702 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
9a8cb8d4bdbb3eaf6e8cd8cb3e47b343694c01f8 16-Mar-2010 John McCall <rjmccall@apple.com> Forgot the testcases.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98685 91177308-0d34-0410-b5e6-96231b3b80d8
arn-shadow.cpp
961b167bcea8fe37465b2770c90bf9bf6b349470 13-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Fix PR6562. If a type is dependent, we don't know if it will have implicit
destructors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98440 91177308-0d34-0410-b5e6-96231b3b80d8
R6562.cpp
0faede6f31b07bcec7b776f2b420c3ea9bb3e58c 12-Mar-2010 John McCall <rjmccall@apple.com> Improve the unused-value check to look into comma expressions and filter out
voids in sub-expressions. Patch by Mike M!

Fixes PR4806.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98335 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
arn-unused-value.cpp
266e05ca8a77fa26fa136b5e45b58cba42e1d818 10-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Move test and also test codegen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98154 91177308-0d34-0410-b5e6-96231b3b80d8
R6474.cpp
7c2342dd4c9947806842e5aca3d2bb2e542853c9 10-Mar-2010 John McCall <rjmccall@apple.com> When pretty-printing tag types, only print the tag if we're in C (and
therefore not creating ElaboratedTypes, which are still pretty-printed
with the written tag).

Most of these testcase changes were done by script, so don't feel too
sorry for my fingers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98149 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
ccess-control-check.cpp
ggregate-initialization.cpp
mbig-user-defined-conversions.cpp
rrow-operator.cpp
ttr-cxx0x.cpp
uiltin-ptrtomember-overload-1.cpp
ast-conversion.cpp
lass-base-member-init.cpp
onditional-expr.cpp
onst-cast.cpp
onstructor-initializer.cpp
onversion-delete-expr.cpp
onversion-function.cpp
onvert-to-bool.cpp
opy-assignment.cpp
opy-initialization.cpp
style-cast.cpp
cl_init_aggr.cpp
ecl-init-ref.cpp
ecltype-overloaded-functions.cpp
efault-assignment-operator.cpp
efault-constructor-initializers.cpp
efault2.cpp
eleted-function.cpp
erived-to-base-ambig.cpp
estructor.cpp
irect-initializer.cpp
ynamic-cast.cpp
laborated-type-specifier.cpp
xception-spec.cpp
xceptions.cpp
unctional-cast.cpp
llegal-member-initialization.cpp
mplicit-virtual-member-functions.cpp
ncomplete-call.cpp
nherit.cpp
ember-name-lookup.cpp
ember-pointer.cpp
issing-members.cpp
ested-name-spec.cpp
ew-delete.cpp
ffsetof.cpp
verload-member-call.cpp
verloaded-operator.cpp
ual-id-test.cpp
ualified-id-lookup.cpp
ualified-names-diag.cpp
ef-init-ambiguous.cpp
eferences.cpp
einterpret-cast.cpp
val-references.cpp
tatic-assert.cpp
tatic-cast-complete-type.cpp
tatic-cast.cpp
ype-traits-incomplete.cpp
ypedef-redecl.cpp
ypeid.cpp
nknown-type-name.cpp
sing-decl-templates.cpp
alue-initialization.cpp
ararg-non-pod.cpp
ector-casts.cpp
irtual-member-functions-key-function.cpp
irtual-override.cpp
arn-reorder-ctor-initialization.cpp
3c1c4aaa4609e77f6df642504f4d4a650dbfb13b 10-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> add missing test


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98129 91177308-0d34-0410-b5e6-96231b3b80d8
R6474.cpp
516a6bc399f1f4595423e80c9d4bc687f870acd1 08-Mar-2010 Douglas Gregor <dgregor@apple.com> In C++98/03, an uninitialized variable that has POD class type will be
uninitialized. This seems not to be the case in C++0x, where we still
call the (trivial) default constructor for a POD class
(!). Previously, we had implemented only the C++0x rules; now we
implement both. Fixes PR6536.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97928 91177308-0d34-0410-b5e6-96231b3b80d8
tatements.cpp
a2762918ecc636c9af207ce2a9ce705edad2a444 08-Mar-2010 Douglas Gregor <dgregor@apple.com> Downgrade errors when trying to catch a pointer or reference to
incomplete type to warnings; GCC (and EDG in GCC compatibility mode)
permit such handles. Fixes PR6527.

(For real this time)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97927 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
3604160c2c791e043d22ed6d09b7835fc06c4e68 08-Mar-2010 Chandler Carruth <chandlerc@gmail.com> Revert r97925, it only contained the test updates not the actual fix.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97926 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
d7bf93c190e62d7714827ba255393e143e2c9a81 08-Mar-2010 Douglas Gregor <dgregor@apple.com> Downgrade errors when trying to catch a pointer or reference to
incomplete type to warnings; GCC (and EDG in GCC compatibility mode)
permit such handles. Fixes PR6527.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97925 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
4ce46c2db2b17ef52b34dbeeec01e448025c8edc 08-Mar-2010 Douglas Gregor <dgregor@apple.com> Perform overload resolution when static_cast'ing from a
pointer-to-member-to-derived to a pointer-to-member-to-base. Fixes
PR6072.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97923 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
a1a9f035852e35ed88f4902a855eb952cf08bebb 08-Mar-2010 Douglas Gregor <dgregor@apple.com> Reference binding via user-defined conversion can compute a binding
that is not reference-related (because it requires another implicit
conversion to which we can find). Fixes PR6483.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97922 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
4e6ba4be8ddeca2978da6b9bae02cbe9594f2ef4 03-Mar-2010 Douglas Gregor <dgregor@apple.com> Implement name hiding for names found through virtual base subobjects
that are hidden by other derived base subobjects reached along a
lookup path that does *not* pass through the hiding subobject (C++
[class.member.lookup]p6). Fixes PR6462.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97640 91177308-0d34-0410-b5e6-96231b3b80d8
ember-name-lookup.cpp
7b9a5aa7c0d76f577699d25ce6afe21ecccb60b7 02-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> During codegen assert that any copy assignment, destructor or constructor that
we need to synthesize has been marked as used by Sema.

Change Sema to avoid these asserts.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97589 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-virtual-member-functions.cpp
2366cd5d0400a99dc8c220709510733691738ef6 02-Mar-2010 Douglas Gregor <dgregor@apple.com> Add test case from PR6064, which now works

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97575 91177308-0d34-0410-b5e6-96231b3b80d8
opy-constructor-error.cpp
8f8210c47797f013e0fb24a26f9c4751b10783fe 02-Mar-2010 Douglas Gregor <dgregor@apple.com> Fix an amusing typo that completely the re-introduction of parameters
for the purposes of parsing default arguments. In effect, we would
re-introduce the parameter with a default argument N times (where N is
the number of parameters preceding the parameter with a default
argument). This showed up when a defaulted parameter of a member
function of a local class shadowed a parameter of the enclosing
function. Fixes PR6383.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97534 91177308-0d34-0410-b5e6-96231b3b80d8
ocal-classes.cpp
9ea9bdbc14374f7bacdb50d3e52c664ff12150ff 02-Mar-2010 Douglas Gregor <dgregor@apple.com> Keep an explicit stack of function and block scopes, each element of
which has the label map, switch statement stack, etc. Previously, we
had a single set of maps in Sema (for the function) along with a stack
of block scopes. However, this lead to funky behavior with nested
functions, e.g., in the member functions of local classes.

The explicit-stack approach is far cleaner, and we retain a 1-element
cache so that we're not malloc/free'ing every time we enter a
function. Fixes PR6382.

Also, tweaked the unused-variable warning suppression logic to look at
errors within a given Scope rather than within a given function. The
prior code wasn't looking at the right number-of-errors count when
dealing with blocks, since the block's count would be deallocated
before we got to ActOnPopScope. This approach works with nested
blocks/functions, and gives tighter error recovery.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97518 91177308-0d34-0410-b5e6-96231b3b80d8
ocal-classes.cpp
6d97e5e4b7abdae710c2548b51f4ed0298e86d80 01-Mar-2010 Chris Lattner <sabre@nondot.org> Implement jump checking for initialized c++ variables, implementing
a fixme and PR6451.

Only perform jump checking if the containing function has no errors,
and add the infrastructure needed to do this.

On the testcase in the PR, we produce:

t.cc:6:3: error: illegal goto into protected scope
goto later;
^
t.cc:7:5: note: jump bypasses variable initialization
X x;
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97497 91177308-0d34-0410-b5e6-96231b3b80d8
tatements.cpp
a9bff30776888977f580c9cac212fd1583ee963e 28-Feb-2010 Douglas Gregor <dgregor@apple.com> Warn about the deprecated string literal -> char* conversion. Fixes PR6428.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97404 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
verload-call.cpp
ype-convert-construct.cpp
9ba6166f4a78722e7df8ffbd64eb788bfdf2764a 26-Feb-2010 John McCall <rjmccall@apple.com> Fix an assertion-on-error during tentative constructor parsing by
propagating error conditions out of the various annotate-me-a-snowflake
routines. Generally (but not universally) removes redundant diagnostics
as well as, you know, not crashing on bad code. On the other hand,
I have just signed myself up to fix fiddly parser errors for the next
week. Again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97221 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
ested-name-spec.cpp
b2cb1cbd727469e1567a6f2535895e6b64e12c35 25-Feb-2010 Douglas Gregor <dgregor@apple.com> When computing the composite pointer type for relational comparisons,
equality comparisons, and conditional operators, produce a composite
pointer type with the appropriate additional "const" qualifiers if the
pointer types would otherwise be incompatible. This is a small
extension (also present in GCC and EDG in a slightly different form)
that permits code like:

void** i; void const** j;
i == j;

with the following extwarn:

t.cpp:5:5: warning: comparison of distinct pointer types ('void **' and
'void const **') uses non-standard composite pointer type
'void const *const *' [-pedantic]
i == j;
~ ^ ~

Fixes PR6346, and I'll be filing a core issue about this with the C++
committee.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97177 91177308-0d34-0410-b5e6-96231b3b80d8
omposite-pointer-type.cpp
9e23932aca7997315a78ea50e9415631a1880fa0 25-Feb-2010 Douglas Gregor <dgregor@apple.com> Allow us to compare derived-to-base conversions between a reference
binding and a copy-construction. Fixes an overloading problem in the
Clang-on-Clang build.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97161 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
333de066a0c018170142150d563f3acdb2ad80f2 25-Feb-2010 Douglas Gregor <dgregor@apple.com> Don't try to finalize an ill-formed variable or one whose class type is ill-formed. Fixes PR6421

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97152 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
3a8133727659077d0c918226e5dad6c16c8274f6 25-Feb-2010 John McCall <rjmccall@apple.com> When comparing two method overload candidates during overload diagnostics,
skip the object argument conversion if either of the candidates didn't
initialize it.

Fixes PR6421, which is such a very straightforward extension of PR6398 that I
should have worked it into the last test case (and therefore caught it then).
Ah well.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97135 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
23a370f9455698e5501101aea7ad8a884a8d4556 25-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Add a new conversion rank to classify conversions between complex and scalar
types. Rank these conversions below other conversions. This allows overload
resolution when the only distinction is between a complex and scalar type. It
also brings the complex overload resolutin in line with GCC's.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97128 91177308-0d34-0410-b5e6-96231b3b80d8
omplex-overload.cpp
b1bdc6232d7b4d8574b5436982435ad57f429a91 25-Feb-2010 John McCall <rjmccall@apple.com> Catch more uses of uninitialized implicit conversion sequences.
When diagnosing bad conversions, skip the conversion for ignored object
arguments. Fixes PR 6398.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97090 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
77549080fb7b9af31606b3c1b4830a94429fb1fd 24-Feb-2010 Douglas Gregor <dgregor@apple.com> ActOnPseudoDestructorExpr now performs all semantic analysis for
pseudo-destructor expressions, and builds the CXXPseudoDestructorExpr
node directly. Currently, this only affects pseudo-destructor
expressions when they are parsed, but not after template
instantiation. That's coming next...

Improve parsing of pseudo-destructor-names. When parsing the
nested-name-specifier and we hit the sequence of tokens X :: ~, query
the actual module to determine whether X is a type-name (in which case
the X :: is part of the pseudo-destructor-name but not the
nested-name-specifier) or not (in which case the X :: is part of the
nested-name-specifier).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97058 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
f604a5648d201d2350e1631a755121e9b837f9f2 24-Feb-2010 John McCall <rjmccall@apple.com> References to const int parameters with ICE default arguments are not ICEs.
Fixes PR6373.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97037 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
910716678e8af41432f3dfb16b340168597f8c45 24-Feb-2010 Zhongxing Xu <xuzhongxing@gmail.com> Always add CallExpr as block-level expression. Inline-based interprocedural
analysis needs this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97014 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
11e8ce7380856abee188b237c2600272df2ed09d 23-Feb-2010 Rafael Espindola <rafael.espindola@gmail.com> Add support for the weakref attribute. We still produce "alias weak" as llvm-gcc does, but are more strict on what uses of weakref we accept.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96992 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-weakref.cpp
93649fdc5e0c46e26bcba06ad39aa80196d3df27 23-Feb-2010 Douglas Gregor <dgregor@apple.com> Implement crazy destructor name lookup semantics differently in
C++98/03 and C++0x, since the '0x semantics break valid C++98/03
code. This new mess is tracked by core issue 399, which is still
unresolved.

Fixes PR6358 and PR6359.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96836 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
d84aac17180075e0ede53d7762b73d3bd079b52f 22-Feb-2010 Chris Lattner <sabre@nondot.org> Add 'previous declaration is here' note for param redefinition
errors, e.g.:

t.c:1:21: error: redefinition of parameter 'x'
int test(int x, int x);
^
t.c:1:14: note: previous declaration is here
int test(int x, int x);
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96769 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
b10cd04880672103660e5844e51ee91af7361a20 21-Feb-2010 Douglas Gregor <dgregor@apple.com> Implement support for parsing pseudo-destructor expression with a nested-name-specifier, e.g.,

typedef int Int;
int *p;
p->Int::~Int();

This weakens the invariant that the only types in nested-name-specifiers are tag types (restricted to class types in C++98/03). However, we weaken this invariant as little as possible, accepting arbitrary types in nested-name-specifiers only when we're in a member access expression that looks like a pseudo-destructor expression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96743 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
5e895a87d001ea2e97f5201d22cc5241992ca5a2 21-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Commiting a revert from dgregor of a bit of destructor logic until we can
figure out how not to break lots of code using this. See PR6358 and PR6359 for
motivating examples. FIXME's left in the code and the test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96733 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
b372b0ff1f1a0c6814163e0fe2f22f343bac87a8 18-Feb-2010 Fariborz Jahanian <fjahanian@apple.com> Fixed a crash specific to blocks in c++ uncovered by an internal
test suite.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96608 91177308-0d34-0410-b5e6-96231b3b80d8
locks-1.cpp
30ab37122300a5f6664b8ae2d0b43b4396eb6bcb 18-Feb-2010 Douglas Gregor <dgregor@apple.com> For -Wswitch-enum warnings, be sure to look through typedefs of enum
types. Fixes <rdar://problem/7643909>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96531 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
e873fb74219f48407ae0b8fa083aa7f0b6ff1427 16-Feb-2010 Douglas Gregor <dgregor@apple.com> Introduce a new kind of failed result for isLvalue/isModifiableLvalue
which describes temporary objects of class type in C++. Use this to
provide a more-specific, remappable diagnostic when takin the address
of such a temporary.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96396 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of-temporary.cpp
2fa98001f832836e3f652c211a9d2f80501d659a 16-Feb-2010 Douglas Gregor <dgregor@apple.com> Do not try to instantiate invalid declarations. It's a recipe for
disaster. Fixes PR6161.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96371 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
124b878dba5007df0a268ea128a6ad8dc5dd2c5e 16-Feb-2010 Douglas Gregor <dgregor@apple.com> Improve parsing and instantiation of destructor names, so that we can
now cope with the destruction of types named as dependent templates,
e.g.,

y->template Y<T>::~Y()

Nominally, we implement C++0x [basic.lookup.qual]p6. However, we don't
follow the letter of the standard here because that would fail to
parse

template<typename T, typename U>
X0<T, U>::~X0() { }

properly. The problem is captured in core issue 339, which gives some
(but not enough!) guidance. I expect to revisit this code when the
resolution of 339 is clear, and/or we start capturing better source
information for DeclarationNames.

Fixes PR6152.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96367 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
nvalid-member-expr.cpp
seudo-destructors.cpp
3dbd3d5c04cd5abd7dfd83b15f51d7c610a3c512 16-Feb-2010 John McCall <rjmccall@apple.com> Support local namespace aliases and permit them to be instantiated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96335 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
7385779796f48e234b4fbea27ff205d7dfb34ce8 15-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Defer covariance checks for dependent types. Add test cases that also ensure
they are re-checked on instantiation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96217 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
e13ad837709cd7730e18d8af1cf6b7d35a56d6b7 12-Feb-2010 Douglas Gregor <dgregor@apple.com> Work around an annoying, non-standard optimization in the glibc
headers, where malloc (and many other libc functions) are declared
with empty throw specifications, e.g.,

extern void *malloc (__SIZE_TYPE__ __size) throw () __attribute__
((__malloc__)) ;

The C++ standard doesn't seem to allow this, and redeclaring malloc as
the standard permits (as follows) resulted in Clang (rightfully!)
complaining about mis-matched exception specifications.

void *malloc(size_t size);

We work around this by silently propagating an empty throw
specification "throw()" from a function with C linkage declared in a
system header to a redeclaration that has no throw specifier.

Ick.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95969 91177308-0d34-0410-b5e6-96231b3b80d8
nputs/lit.local.cfg
nputs/malloc.h
uiltin-exception-spec.cpp
a301ac3f4b5c36593e84a4db78e66445232c949b 12-Feb-2010 Douglas Gregor <dgregor@apple.com> Improve a test slightly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95967 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-predefined-decl.cpp
85910986c4ab01927c192aea86b2234fec568259 12-Feb-2010 Douglas Gregor <dgregor@apple.com> In C++, allow builtins to be referred to via qualified name lookup, e.g.,

::__builtin_va_copy

Fixes one of the Firefox issues in PR5511.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95966 91177308-0d34-0410-b5e6-96231b3b80d8
uiltins.cpp
4dffad64c5c7106dc5ac506be94944299c8f7bc3 11-Feb-2010 Douglas Gregor <dgregor@apple.com> When we have a dependent direct initializer but not a dependent
variable type, we can (and should) still check for completeness of the
variable's type. Do so, to work around an assertion that shows up in
Boost's shared_ptr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95934 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
6b2accb4793e16b2e93a8c2589f5df702231f17a 10-Feb-2010 John McCall <rjmccall@apple.com> Improve access control diagnostics. Perform access control on member-pointer
conversions. Fix an access-control bug where privileges were not considered
at intermediate points along the inheritance path. Prepare for friends.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95775 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
ccess-control-check.cpp
onditional-expr.cpp
tatic-cast.cpp
irtual-override.cpp
60c93c9981c467738369702e7aa23fd58c2b6aac 09-Feb-2010 Douglas Gregor <dgregor@apple.com> Migrate the mish-mash of declaration checks in
Sema::ActOnUninitializedDecl over to InitializationSequence (with
default initialization), eliminating redundancy. More importantly, we
now check that a const definition in C++ has an initilizer, which was
an #if 0'd code for many, many months. A few other tweaks were needed
to get everything working again:

- Fix all of the places in the testsuite where we defined const
objects without initializers (now that we diagnose this issue)
- Teach instantiation of static data members to find the previous
declaration, so that we build proper redeclaration
chains. Previously, we had the redeclaration chain but built it
too late to be useful, because...
- Teach instantiation of static data member definitions not to try
to check an initializer if a previous declaration already had an
initializer. This makes sure that we don't complain about static
const data members with in-class initializers and out-of-line
definitions.
- Move all of the incomplete-type checking logic out of
Sema::FinalizeDeclaratorGroup; it makes more sense in
ActOnUnitializedDecl.

There may still be a few places where we can improve these
diagnostics. I'll address that as a separate commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95657 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
cl_ambig_res.cpp
e180ed2f014d49587bc49f09313cabf38080d6fa 09-Feb-2010 Douglas Gregor <dgregor@apple.com> Fix PR number in test case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95640 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-init-ref.cpp
2c79281ef66cb5001f0ebadf6b317250c21a1c01 09-Feb-2010 Douglas Gregor <dgregor@apple.com> Be more careful when checking initializer lists that involve reference
types; we don't want to give an expression reference type. Fixes PR6177.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95635 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-init-ref.cpp
4c72d3ec68b88868a75b3e6bbe5520dcefe86a95 08-Feb-2010 John McCall <rjmccall@apple.com> Fix the crash-on-invalid from PR6259.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95554 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
e228ba97c9aff14dcf788773b8af455b9d85f210 08-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Ensure that a operator delete overload is rocognized regardless of cv-quals.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95553 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
63644fae3970d4146200e4cb25dd9aace34a3398 07-Feb-2010 Douglas Gregor <dgregor@apple.com> Workaround for friend template instantiation crash in PR5848, from Keir Mierle!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95517 91177308-0d34-0410-b5e6-96231b3b80d8
emplated-friend-decl.cpp
4855a52d2a4598883deafefea9029f454a4343ee 06-Feb-2010 Anders Carlsson <andersca@mac.com> Don't diagnose missing noreturns for uninstantiated templates. Fixes PR6247.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95487 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-noreturn.cpp
1610b8198e31eb6d77d4d6904d6af88ef5cc6d3b 06-Feb-2010 Anders Carlsson <andersca@mac.com> Implement a warning diagnostic for weak vtables. Fixes PR6116.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95472 91177308-0d34-0410-b5e6-96231b3b80d8
arn-weak-vtables.cpp
1f1b3b3bdec84e2204f18732e3241f6907a17309 06-Feb-2010 John McCall <rjmccall@apple.com> Per discussion, remove the explicit restriction on static const data members with
out-of-line initializers as integer constant expressions. Fixes PR6206.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95463 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
6f7a17b718385464966251ee421b314570d32731 05-Feb-2010 Douglas Gregor <dgregor@apple.com> A function declarator with a non-identifier name in an anonymous class
is a constructor for that class, right? Fixes PR6238.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95367 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
4a73ea9c4e87aa111901f3c27b08f0571b58a4cf 03-Feb-2010 Chandler Carruth <chandlerc@gmail.com> Teach the allocation function overload handling to deal with templates, and
prevent a crash on templates when looking for an existing declaration of the
predefined global operators. This fixes PR5918.

Added an easy test case for the overload handling, but testing the crash is
a bit trickier. Created a new test that can use multiple runs with a define to
trigger which test case is used so we can test this type of issue.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95220 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete-predefined-decl.cpp
ew-delete.cpp
a873dfc9e7314681bb37efd9ab185045de121e43 03-Feb-2010 Douglas Gregor <dgregor@apple.com> Implement the lvalue-to-rvalue conversion where needed. The
lvalue-to-rvalue conversion adjusts lvalues of qualified, non-class
type to rvalue expressions of the unqualified variant of that
type. For example, given:

const int i;
(void)(i + 17);

the lvalue-to-rvalue conversion for the subexpression "i" will turn it
from an lvalue expression (a DeclRefExpr) with type 'const int' into
an rvalue expression with type 'int'. Both C and C++ mandate this
conversion, and somehow we've slid through without implementing it.

We now have both DefaultFunctionArrayConversion and
DefaultFunctionArrayLvalueConversion, and which gets used depends on
whether we do the lvalue-to-rvalue conversion or not. Generally, we do
the lvalue-to-rvalue conversion, but there are a few notable
exceptions:
- the left-hand side of a '.' operator
- the left-hand side of an assignment
- a C++ throw expression
- a subscript expression that's subscripting a vector

Making this change exposed two issues with blocks:
- we were deducing const-qualified return types of non-class type
from a block return, which doesn't fit well
- we weren't always setting the known return type of a block when it
was provided with the ^return-type syntax

Fixes the current Clang-on-Clang compile failure and PR6076.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95167 91177308-0d34-0410-b5e6-96231b3b80d8
omma.cpp
num.cpp
einterpret-cast.cpp
093802675b1548f2a5f44c29938d65cce00d58bb 31-Jan-2010 Anders Carlsson <andersca@mac.com> Diagnose binding a non-const reference to a vector element.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94963 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
e1cd3374a8762d56c49d9abbc0c973a99e236422 31-Jan-2010 Chandler Carruth <chandlerc@gmail.com> Fix my dyslexia.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94958 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
c099d9bc4842afc0e724eddab661cbb386c82117 31-Jan-2010 Chandler Carruth <chandlerc@gmail.com> Add a test case for a fixed PR just to ensure we don't regress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94957 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
9db7dbb918ca49f4ee6c181e4917e7b6ec547353 31-Jan-2010 Douglas Gregor <dgregor@apple.com> Rework base and member initialization in constructors, with several
(necessarily simultaneous) changes:

- CXXBaseOrMemberInitializer now contains only a single initializer
rather than a set of initialiation arguments + a constructor. The
single initializer covers all aspects of initialization, including
constructor calls as necessary but also cleanup of temporaries
created by the initializer (which we never handled
before!).

- Rework + simplify code generation for CXXBaseOrMemberInitializers,
since we can now just emit the initializer as an initializer.

- Switched base and member initialization over to the new
initialization code (InitializationSequence), so that it

- Improved diagnostics for the new initialization code when
initializing bases and members, to match the diagnostics produced
by the previous (special-purpose) code.

- Simplify the representation of type-checked constructor initializers in
templates; instead of keeping the fully-type-checked AST, which is
rather hard to undo at template instantiation time, throw away the
type-checked AST and store the raw expressions in the AST. This
simplifies instantiation, but loses a little but of information in
the AST.

- When type-checking implicit base or member initializers within a
dependent context, don't add the generated initializers into the
AST, because they'll look like they were explicit.

- Record in CXXConstructExpr when the constructor call is to
initialize a base class, so that CodeGen does not have to infer it
from context. This ensures that we call the right kind of
constructor.

There are also a few "opportunity" fixes here that were needed to not
regress, for example:

- Diagnose default-initialization of a const-qualified class that
does not have a user-declared default constructor. We had this
diagnostic specifically for bases and members, but missed it for
variables. That's fixed now.

- When defining the implicit constructors, destructor, and
copy-assignment operator, set the CurContext to that constructor
when we're defining the body.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94952 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
opy-assignment.cpp
llegal-member-initialization.cpp
verload-member-call.cpp
verloaded-operator.cpp
ad323a856c0bf759e07d37d749510ddf4f8c6b96 27-Jan-2010 Douglas Gregor <dgregor@apple.com> Fix a major oversight in the comparison of standard conversion
sequences, where we would occasionally determine (incorrectly) that
one standard conversion sequence was a proper subset of another when,
in fact, they contained completely incomparable conversions.

This change records the types in each step within a standard
conversion sequence, so that we can check the specific comparison
types to determine when one sequence is a proper subset of the
other. Fixes this testcase (thanks, Anders!), which was distilled from
PR6095 (also thanks to Anders).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94660 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call-copycon.cpp
verload-call.cpp
78a527af9995e936c0fc7dc01a061810cabf4c31 26-Jan-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Fix two redefinitions in test cases that weren't diagnosed yet, but will be soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94565 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
7edb5fdf9703e1abd780417db691b77d5fcbc610 26-Jan-2010 John McCall <rjmccall@apple.com> Handle redeclarations found by ADL deterministically and reasonably.

This solution relies on an O(n) scan of redeclarations, which means it might
scale poorly in crazy cases with tons of redeclarations brought in by a ton
of distinct associated namespaces. I believe that avoiding this
is not worth the common-case cost.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94530 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
a113e7263c5337731c65fada9de7ff72af25423b 26-Jan-2010 John McCall <rjmccall@apple.com> Allow ADL to find functions imported by using decls. Leave wordy comment
about interaction between ADL and default arguments. Shrug shoulders, commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94524 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
7a6e13aa2e3874fecf45043ed1a26900b8c13b98 24-Jan-2010 Anders Carlsson <andersca@mac.com> Fix a pretty bad bug where if a constructor (or conversion function) was marked as 'explicit', but then defined out-of-line, we would not treat it as being explicit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94366 91177308-0d34-0410-b5e6-96231b3b80d8
xplicit.cpp
1b36a2fcb2cea310c01fc2a80a9da915e5d2ceb0 24-Jan-2010 Anders Carlsson <andersca@mac.com> Use new initialization code when dealing with [dcl.init.aggr]p12. This fixes the bug where array elements and member initializers weren't copied correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94340 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
2bbae5de98f486d03e10c039668182075b5569dd 23-Jan-2010 Anders Carlsson <andersca@mac.com> Use the new init code for member subobjects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94329 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
cl_init_aggr.cpp
784f69940755dd66cf244dd84f57a57d358e5c43 23-Jan-2010 Anders Carlsson <andersca@mac.com> Switch some array initialization over to the new init code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94327 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
46f4659f9d012ca2e2050c1fc39a59666114b3f9 23-Jan-2010 Anders Carlsson <andersca@mac.com> Baby steps towards migrating the InitListChecker over to the new initialization code. Pass an InitializedEntity pointer through to most init checker functions. Right now, it's ignored everywhere except when initializing vectors in C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94325 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
258b203b853e1c684c290fccd0088d1f340c137f 23-Jan-2010 John McCall <rjmccall@apple.com> Produce a special diagnostic when users call a function with an argument of
incomplete type (or a pointer/reference to such).

The causes of this problem are different enough to justify a different "design"
for the diagnostic. Most notably, it doesn't give an operand index:
it's usually pretty obvious which operand is the problem, it adds a lot of
clutter to mention it, and the fix is usually in a different part of the file
anyway.

This is yet another diagnostic that should really have an analogue in the
non-overloaded case --- which should be much easier to write because of
the weaker space constraints.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94303 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
a729bbb739ca97a8dc52b6b0495725590a0367dc 23-Jan-2010 Anders Carlsson <andersca@mac.com> Fix the EntityKind order so that all entity kinds that can be copied (using copy constructors) come first. Also, fix a bug where EK_New was left out of the err_init_conversion_failed diagnostic (It is now reported as 'new value'). Please review Doug :)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94289 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
92f883177b162928a8e632e4e3b93fafd2b26072 23-Jan-2010 John McCall <rjmccall@apple.com> Implement elementary access control.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94268 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-control-check.cpp
588a4ad562d717ccbbdbbc36f57e967c0b1ca147 22-Jan-2010 Fariborz Jahanian <fjahanian@apple.com> Patch fixes a lookup bug in c++'s anonymous union member
lookup. Fixes radar 7562438.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94191 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
f2a04bf1689cd88dd04012c311ba86e9d8b2b1b2 22-Jan-2010 Anders Carlsson <andersca@mac.com> No need to canonicalize the type and use dyn_cast. Also, correctly diagnose trying to override a function returning an lvalue reference with a function overriding an rvalue reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94183 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
ceb7e001c488a7ea09dc631518515290518db47a 22-Jan-2010 Chandler Carruth <chandlerc@gmail.com> Fix an obvious goof that caused us to only see the top level of return types
when checking for covariance. Added some fun test cases, fixes PR6110.

This felt obvious enough to just commit. ;] Let me know if anything needs
tweaking.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94173 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
b5c775575b496c03d862ea03587a9f1d74193c9f 22-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings with respect to dead member and
dead array references.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94115 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
2d6ceab0ad062989ecb7b8666c85e58a2fcd95ce 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings for with respect to dead functional casts in C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94106 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
e5fba7058ce34cc3d75e16e777ec6fc8096183f8 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings for with respect to ? :.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94093 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
55f988efeb08b84c2dd9e4c05990b88c81fe2b58 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings with respect to dead binary and
unary operators.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94084 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
4c45aa1b00b91847acfb082acfaced3ffa294d1d 21-Jan-2010 Mike Stump <mrs@apple.com> Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls. Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.

This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges. All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94074 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unreachable.cpp
e39fe72df7da662c195ef4bcd542d58ec87d5422 19-Jan-2010 Douglas Gregor <dgregor@apple.com> When looking up enumerator names for redeclaration, use the
ForRedeclaration flag so that we don't look into base classes.
Fixes PR6061.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93862 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
6a0166edea84e6abccce393c15e3dee7b96f7eb6 16-Jan-2010 Douglas Gregor <dgregor@apple.com> Improve the test for unused-expression warnings slightly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93644 91177308-0d34-0410-b5e6-96231b3b80d8
nused.cpp
651f3eec130099fb46e2ce2c8aee9d01531dc3b5 14-Jan-2010 John McCall <rjmccall@apple.com> Improve overload diagnostics some more by calling out qualifier mismatches
for special diagnostics. Unfortunately, the non-overload diagnostics are not
this good.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93420 91177308-0d34-0410-b5e6-96231b3b80d8
verload-member-call.cpp
e81e15ed0c31f828104b339ceb66648d1c815a8b 14-Jan-2010 John McCall <rjmccall@apple.com> Improve the diagnostic for bad conversions in overload resolution to talk
about 'object argument' vs. 'nth argument'.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93395 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
verload-member-call.cpp
cefd3ada97faf5a759dac4705900053d3aa071e9 13-Jan-2010 John McCall <rjmccall@apple.com> Don't report ambiguities in the user-defined conversion if we weren't supposed
to be considering user-defined conversions in the first place.

Doug, please review; I'm not sure what we should be doing if we see a real
ambiguity in selecting a copy constructor when otherwise suppressing
user-defined conversions.

Fixes PR6014.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93365 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
adbb8f8aa44216d30d204e843c4a74abab929dae 13-Jan-2010 John McCall <rjmccall@apple.com> Record some basic information about bad conversion sequences. Use that
information to feed diagnostics instead of regenerating it. Much room for
improvement here, but fixes some unfortunate problems reporting on method calls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93316 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
verload-member-call.cpp
a6c058dd75c5563cced821fc16766a7cc179e00c 13-Jan-2010 Sean Hunt <rideau3@gmail.com> Implement semantic checking for C++ literal operators.
This now rejects literal operators that don't meet the requirements.
Templates are not yet checked for.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93315 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-operators.cpp
fa6ef180c0d3609124217387618fbb51bbdd2e48 13-Jan-2010 Mike Stump <mrs@apple.com> Add an unreachable code checker.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93287 91177308-0d34-0410-b5e6-96231b3b80d8
nreachable-code.cpp
220ccbf2c9ef97034cce80561f9f46c4f1f63bc7 13-Jan-2010 John McCall <rjmccall@apple.com> Improve the reporting of non-viable overload candidates by noting the reason
why the candidate is non-viable. There's a lot we can do to improve this, but
it's a good start. Further improvements should probably be integrated with the
bad-initialization reporting routines.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93277 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
onstructor-initializer.cpp
onverting-constructor.cpp
cl_init_aggr.cpp
irect-initializer.cpp
unctional-cast.cpp
amespace.cpp
ested-name-spec.cpp
verload-call.cpp
verloaded-builtin-operators.cpp
3c80f573dfbc01f29cc292f6c1fc794705823d52 12-Jan-2010 John McCall <rjmccall@apple.com> Reorganize some of the code to note overload candidates. Improves the
fidelity with which we note them as functions/constructors and templates
thereof. Also will be helpful when reporting bad conversions (next).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93224 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
4248491ce435bf6c96dcd79149863f4c7e9cabfa 12-Jan-2010 John McCall <rjmccall@apple.com> Chris thinks these diagnostics are better now. :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93216 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
1d31833450e6d2947a33cb0840d87661d92eec07 12-Jan-2010 John McCall <rjmccall@apple.com> Introduce a specific representation for the ambiguous implicit conversion
sequence. Lots of small relevant changes. Fixes some serious problems with
ambiguous conversions; also possibly improves associated diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93214 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
uiltin-ptrtomember-overload-1.cpp
onditional-expr.cpp
b4a89998b2c8945ccb05d5d1ab7b93e98d695057 11-Jan-2010 Douglas Gregor <dgregor@apple.com> Add test case from PR5763

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93190 91177308-0d34-0410-b5e6-96231b3b80d8
omposite-pointer-type.cpp
9007328043c9c17029e07c99d89d0488fb3da3a7 11-Jan-2010 Douglas Gregor <dgregor@apple.com> When computing surrogates for calls to a value of object type, look
for all visible conversion functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93173 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
e27d87ff27b26e5886cf6472271d3b5e18ec3d87 11-Jan-2010 Sebastian Redl <sebastian.redl@getdesigned.at> Make Clang complain about taking the address of an unqualified member function. Fixes PR5985.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93150 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
9a0e530ba8ea87a6478e166daecc847eec91cecf 08-Jan-2010 John McCall <rjmccall@apple.com> Organize testcase into namespaces.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93015 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
81201626aa08bcc9d05c8b3c6a1d38a7d577c3ce 08-Jan-2010 John McCall <rjmccall@apple.com> Change the printing of OR_Deleted overload results to print all the candidates,
not just the viable ones. This is reasonable because the most common use of
deleted functions is to exclude some implicit conversion during calls; users
therefore will want to figure out why some other options were excluded.

Started sorting overload results. Right now it just sorts by location in the
translation unit (after putting viable functions first), but we can do better than
that.

Changed bool OnlyViable parameter to PrintOverloadCandidates to an enum for better
self-documentation.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92990 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
val-references.cpp
827feec561c8a1f23c099da56c4ac98364ecfc09 08-Jan-2010 Douglas Gregor <dgregor@apple.com> Improve the fix-its for -Wparentheses to ensure that the fix-it
suggestions follow recovery. Additionally, add a note to these
diagnostics which suggests a fix-it for changing the behavior to what
the user probably meant. Examples:

t.cpp:2:9: warning: & has lower precedence than ==; == will be evaluated first
[-Wparentheses]
if (i & j == k) {
^~~~~~~~
( )
t.cpp:2:9: note: place parentheses around the & expression to evaluate it first
if (i & j == k) {
^
( )

t.cpp:14:9: warning: using the result of an assignment as a condition
without
parentheses [-Wparentheses]
if (i = f()) {
~~^~~~~
( )
t.cpp:14:9: note: use '==' to turn this assignment into an equality
comparison
if (i = f()) {
^
==




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92975 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
1eb3e1003d5cda4d47f54321d81d678c26981e7a 07-Jan-2010 John McCall <rjmccall@apple.com> Improve the lead diagnostic for C++ object subscript expressions with
no viable overloads. Use a different message when the class provides
no operator[] overloads at all; use it for operator(), too.

Partially addresses PR 5900.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92894 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
bab497b9f94cd1538c6b3348c2331daf27dd092e 06-Jan-2010 Douglas Gregor <dgregor@apple.com> Add testcase for PR5817, although the bug was already fixed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92858 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
adda84683944e11820b9a03c6b170edd109289c5 06-Jan-2010 Douglas Gregor <dgregor@apple.com> Make sure that the key-function computation produces the correct
result for a nested class whose first non-pure virtual member function
has an inline body. Previously, we were checking for the key function
before we had seen the (delayed) inline body.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92839 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-member-functions-key-function.cpp
b1622a1fd7b7f4ab8d00d0183d17c90ad25c14e3 06-Jan-2010 John McCall <rjmccall@apple.com> Improve the diagnostics used to report implicitly-generated class members
as parts of overload sets. Also, refer to constructors as 'constructors'
rather than functions.

Adjust a lot of tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92832 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
onstructor-initializer.cpp
onversion-function.cpp
onverting-constructor.cpp
opy-initialization.cpp
cl_init_aggr.cpp
ecl-init-ref.cpp
efault2.cpp
irect-initializer.cpp
unctional-cast.cpp
amespace.cpp
ested-name-spec.cpp
verloaded-builtin-operators.cpp
val-references.cpp
159ef1ed9f024f73028aa3c9b27ae0717e43786c 06-Jan-2010 Douglas Gregor <dgregor@apple.com> Make our marking of virtual members functions in a class be
deterministic and work properly with templates. Once a class that
needs a vtable has been defined, we now do one if two things:

- If the class has no key function, we place the class on a list of
classes whose virtual functions will need to be "marked" at the
end of the translation unit. The delay until the end of the
translation unit is needed because we might see template
specializations of these virtual functions.
- If the class has a key function, we do nothing; when the key
function is defined, the class will be placed on the
aforementioned list.

At the end of the translation unit, we "mark" all of the virtual
functions of the classes on the list as used, possibly causing
template instantiation and other classes to be added to the
list. This gets LLVM's lib/Support/CommandLine.cpp compiling again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92821 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-virtual-member-functions.cpp
irtual-member-functions-key-function.cpp
be2e205add4c1f6375bb430e847b712a88581e46 31-Dec-2009 Anders Carlsson <andersca@mac.com> Make sure that an overriding return type is complete before checking if it's covariant. Fixes PR5920.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92365 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
8c3f89032c8822c443fb8a1633d297b60e5ca90c 31-Dec-2009 Chris Lattner <sabre@nondot.org> improve diagnostics for case when a field type is unknown by
not emitting a follow-on error about 'int', which the user
never wrote. PR5924.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92339 91177308-0d34-0410-b5e6-96231b3b80d8
llegal-member-initialization.cpp
e8337dff778f6386f0a2a08f5def71a8dd44f2c8 30-Dec-2009 Chris Lattner <sabre@nondot.org> fix PR5917, L'x' was getting the wrong type in c++ mode. Per
C++2.13.2p2: "A wide-character literal has type wchar_t"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92313 91177308-0d34-0410-b5e6-96231b3b80d8
char_t.cpp
5126fd0dd92c4ec211c837ee78d5ce59c68dcbd5 30-Dec-2009 John McCall <rjmccall@apple.com> Typedefs can be redeclared. That seems like something we should record in
the AST lest we run into some crazy canonicalization bug like PR5874.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92283 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
595e290bcb69af7ea053fe43f87701ee761d68d3 29-Dec-2009 Chandler Carruth <chandlerc@gmail.com> Fix support for const_cast<>s of array types which actual change the
CV-qualifiers. Remove an error expectation from the 'good' set of const-cast
test cases. With this patch, the final non-template test case from PR5542
passes. (It's the same as the one already in const-cast.cpp.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92257 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
28e318cc6008c2bc008f0caee70dc736a03d6289 29-Dec-2009 Chandler Carruth <chandlerc@gmail.com> Correctly refer to element CVR qualifications when determining if a type is
more or less cv-qualified than another during implicit conversion and overload
resolution ([basic.type.qualifier] p5). Factors the logic out of template
deduction and into the ASTContext so it can be shared.

This fixes several aspects of PR5542, but not all of them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92248 91177308-0d34-0410-b5e6-96231b3b80d8
ualification-conversion.cpp
bd64729ac6de8fed320e7a722597cc5444709c63 29-Dec-2009 Chandler Carruth <chandlerc@gmail.com> Handle using declarations in overloaded and template functions during ADL and
address resolution. This fixes PR5751.

Also, while we're here, remove logic from ADL which mistakenly included the
definition namespaces of overloaded and/or templated functions whose name or
address is used as an argument.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92245 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
cb1c77f90d4e747b83a0d0cc125dc01567378f82 24-Dec-2009 Nuno Lopes <nunoplopes@sapo.pt> support the warn_unused_result in C++ class methods

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92095 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
f75b8309e3e40290683e3d34bac3a04e88d9c625 24-Dec-2009 Nuno Lopes <nunoplopes@sapo.pt> allow the noreturn attribute to be used in class methods

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92090 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-noreturn.cpp
765ccba920269eefbf572ec4bcd6ac7b6e9f9f77 23-Dec-2009 Douglas Gregor <dgregor@apple.com> Diagnose the use of incomplete types in C++ typeid expressions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92045 91177308-0d34-0410-b5e6-96231b3b80d8
ypeid.cpp
bc12044215a6d0d77b5c6f09df34e8506a8d80e1 23-Dec-2009 John McCall <rjmccall@apple.com> Test case for PR5134.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91965 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
df370002215a56cbbee139630f1cd8c8299b861f 23-Dec-2009 John McCall <rjmccall@apple.com> Test case from PR5476.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91957 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
44e067bd8f923ba8e7c24b2189e06717d70015c8 23-Dec-2009 John McCall <rjmccall@apple.com> Set a member's access specifier even if it doesn't match the previous specifier.
Prevents an assert on successive redeclarations.

Fixed PR5573.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91956 91177308-0d34-0410-b5e6-96231b3b80d8
ccess.cpp
6e790ab61bf4835944971955e84279112833ef0c 23-Dec-2009 Douglas Gregor <dgregor@apple.com> Allow the first parameter of operator new to be a cv-qualified
size_t. Also, fix an issue with initialization of parameters in calls,
where we weren't removing the cv-qualifiers on the parameter type
itself. Fixes PR5823.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91941 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
90f9382b3e97afa55e6aaaa4ab31c7473a8c7bb9 22-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch Sema::AddCXXDirectInitializerToDecl over to InitializationSequence

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91927 91177308-0d34-0410-b5e6-96231b3b80d8
opy-constructor-error.cpp
efault2.cpp
irect-initializer.cpp
aa0373107968aa7a26bf63f4a2673b8325b800af 22-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch initialization of parameters in a call over to
InitializationSequence (when a FunctionDecl is present). This required
a few small fixes to initialization sequences:

- Make sure to use the adjusted parameter type for initialization of
function parameters.
- Implement transparent union calling semantics in C



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91902 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
laborated-type-specifier.cpp
ember-location.cpp
4a2c19bf2330e31851330423187ec48035cab1a5 22-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Switch default arguments over to InitializationSequence.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91883 91177308-0d34-0410-b5e6-96231b3b80d8
efault1.cpp
a91eb541a6adf81acf872e7315bc6b814c3241eb 22-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Switch file-scope assignment initialization over to InitializationSequence.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91881 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
ggregate-initialization.cpp
cl_init_aggr.cpp
4b52e25f3b05ab0f9d2492276a52323a50a84fb7 22-Dec-2009 Douglas Gregor <dgregor@apple.com> When a template-id refers to a single function template, and the
explicitly-specified template arguments are enough to determine the
instantiation, and either template argument deduction fails or is not
performed in that context, we can resolve the template-id down to a
function template specialization (so sayeth C++0x
[temp.arg.explicit]p3). Fixes PR5811.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91852 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-overloaded-functions.cpp
745880f35066bdb1950d0e870608295221346fc5 20-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch default-initialization of variables of class type (or array thereof) over to InitializationSequence. I could swear that this fixes a PR somewhere, but I couldn't figure out which one

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91796 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-recovery.cpp
efault2.cpp
eleted-function.cpp
irect-initializer.cpp
731ad843b7bf1862f6547ac79539f0f5b4c539bd 19-Dec-2009 John McCall <rjmccall@apple.com> Just push a new scope when parsing an out-of-line variable definition.
Magically fixes all the terrible lookup problems associated with not pushing
a new scope. Resolves an ancient xfail and an LLVM misparse.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91769 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ual-id-test.cpp
cfdc81a83467973b14e4ea5e9e9af1690f135415 19-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Initialization improvements: addition of string initialization and a few
small bug fixes in SemaInit, switch over SemaDecl to use it more often, and
change a bunch of diagnostics which are different with the new initialization
code.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91767 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
ool.cpp
ondition.cpp
onvert-to-bool.cpp
eleted-function.cpp
irect-initializer.cpp
xception-spec.cpp
ember-pointer.cpp
ullptr.cpp
7abfbdbc97ad8e7f340789f751df1e32b10118b4 19-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch more of Sema::CheckInitializerTypes over to
InitializationSequence. Specially, switch initialization of a C++
class type (either copy- or direct-initialization).

Also, make sure that we create an elidable copy-construction when
performing copy initialization of a C++ class variable. Fixes PR5826.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91750 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
onversion-function.cpp
onverting-constructor.cpp
opy-initialization.cpp
cl_init_aggr.cpp
efault1.cpp
ested-name-spec.cpp
1d7c52803e49d651a66cee782e264f62078c1da5 18-Dec-2009 John McCall <rjmccall@apple.com> Pull Sema::isAcceptableLookupResult into SemaLookup. Extract the criteria into
different functions and pick the function at lookup initialization time.
In theory we could actually divide the criteria functions into N different
functions for the N cases, but it's so not worth it.

Among other things, lets us invoke LookupQualifiedName without recomputing
IDNS info every time.

Do some refactoring in SemaDecl to avoid an awkward special case in LQN
that was only necessary for redeclaration testing for anonymous structs/unions ---
which could be done more efficiently with a scoped lookup anyway.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91676 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
18ef5e28a9a2677f8b1dce1fb2638d66e0a1621f 18-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch the initialization required by return statements over to the
new InitializationSequence. This fixes some bugs (e.g., PR5808),
changed some diagnostics, and caused more churn than expected. What's
new:

- InitializationSequence now has a "C conversion sequence" category
and step kind, which falls back to
- Changed the diagnostics for returns to always have the result type
of the function first and the type of the expression second.
CheckSingleAssignmentConstraints to peform checking in C.
- Improved ASTs for initialization of return values. The ASTs now
capture all of the temporaries we need to create, but
intentionally do not bind the tempoary that is actually returned,
so that it won't get destroyed twice.
- Make sure to perform an (elidable!) copy of the class object that
is returned from a class.
- Fix copy elision in CodeGen to properly see through the
subexpressions that occur with elidable copies.
- Give "new" its own entity kind; as with return values and thrown
objects, we don't bind the expression so we don't call a
destructor for it.

Note that, with this patch, I've broken returning move-only types in
C++0x. We'll fix it later, when we tackle NRVO.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91669 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
ecl-init-ref.cpp
ef-init-ambiguous.cpp
val-references-xfail.cpp
val-references.cpp
e129d44aab6324aa2094d68730a7843c41a4e45f 18-Dec-2009 John McCall <rjmccall@apple.com> Patch over yet more problems with friend declarations which were provoking
problems on LLVM-Code-Syntax. This proved remarkably easy to "fix" once
I settled on how I was going to approach it.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91633 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
5f7157ec28f367b97a9f4560fb0fa3d13a9adf87 16-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91566 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
2aaad63ec5d012e6de40f72e114c60df9c205a24 16-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Make sure C-specific enum warning doesn't trigger in C++.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91563 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
ff2d87840df9f269d8a2f9df27518548da3d40f1 16-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Correctly calcluate abstract-ness in the case where an implicitly declared
method overrides a pure virtual method.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91558 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
16006c901315fa12a108b4e571f187f4b676e426 16-Dec-2009 Douglas Gregor <dgregor@apple.com> When value-initializing a class with no user-defined constructors but
with a non-trivial default constructor, zero-initialize the storage
and then call the default constructor. Fixes PR5800.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91548 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
52bb5d2a1474460707e5ca11656b2749a7a33a82 16-Dec-2009 Douglas Gregor <dgregor@apple.com> In Sema::CheckInitializerTypes, replace a use of CheckReferenceInit with an InitializationSequence

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91542 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-init-ref.cpp
578b69b186d9cba0a6ae1dd7f4c04cd6a49f0aac 16-Dec-2009 John McCall <rjmccall@apple.com> Introduce a centralized routine in Sema for diagnosing failed lookups (when
used as expressions). In dependent contexts, try to recover by doing a lookup
in previously-dependent base classes. We get better diagnostics out, but
unfortunately the recovery fails: we need to turn it into a method call
expression, not a bare call expression. Thus this is still a WIP.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91525 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
ecltype-crash.cpp
o-implicit-builtin-decls.cpp
ype-dependent-exprs.cpp
99a2e600f9e2e51d3ce10fb6f27191677ac65b2a 16-Dec-2009 Douglas Gregor <dgregor@apple.com> Switch the C++ new expression over to InitializationSequence, rather
than using its own partial implementation of initialization.

Switched CheckInitializerTypes over to
InitializedEntity/InitializationKind, to help move us closer to
InitializationSequence.

Added InitializedEntity::getName() to retrieve the name of the entity,
for diagnostics that care about such things.

Implemented support for default initialization in
InitializationSequence.

Clean up the determination of the "source expressions" for an
initialization sequence in InitializationSequence::Perform.

Taught CXXConstructExpr to store more location information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91492 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
80737ad5e0a67d6e3dd0a0ba48446344215a5fd5 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang instead of 'clang', and forcibly disable use of '
clang ' or ' clang -cc1 ' or ' clang-cc ' in test lines (by substituting them to
garbage).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91460 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
a5728872c7702ddd09537c95bc3cbd20e1f2fb09 15-Dec-2009 Daniel Dunbar <daniel@zuster.org> Update tests to use %clang_cc1 instead of 'clang-cc' or 'clang -cc1'.
- This is designed to make it obvious that %clang_cc1 is a "test variable"
which is substituted. It is '%clang_cc1' instead of '%clang -cc1' because it
can be useful to redefine what gets run as 'clang -cc1' (for example, to set
a default target).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91446 91177308-0d34-0410-b5e6-96231b3b80d8
R5086-ambig-resolution-enum.cpp
_null.cpp
bstract.cpp
ccess-base-class.cpp
ccess-control-check.cpp
ccess.cpp
ddr-of-overloaded-function.cpp
ddress-of.cpp
ggregate-initialization.cpp
lignof-sizeof-reference.cpp
mbig-user-defined-conversions.cpp
mbiguous-builtin-unary-operator.cpp
nonymous-union.cpp
rray-bound-merge.cpp
rrow-operator.cpp
ttr-after-definition.cpp
ttr-cxx0x.cpp
ttr-deprecated.cpp
ttr-format.cpp
ttr-noreturn.cpp
ttr-sentinel.cpp
ttr-unavailable.cpp
uto-cxx0x.cpp
uto-cxx98.cpp
locks.cpp
ool.cpp
uiltin-ptrtomember-ambig.cpp
uiltin-ptrtomember-overload-1.cpp
uiltin-ptrtomember-overload.cpp
uiltins.cpp
99.cpp
ast-conversion.cpp
ast-explicit-ctor.cpp
lass-base-member-init.cpp
lass-layout.cpp
lass-names.cpp
lass.cpp
ompare.cpp
omplex-overload.cpp
omposite-pointer-type.cpp
ondition.cpp
onditional-expr.cpp
onst-cast.cpp
onstant-expression.cpp
onstructor-initializer.cpp
onstructor-recovery.cpp
onstructor.cpp
onversion-delete-expr.cpp
onversion-function.cpp
onvert-to-bool.cpp
onverting-constructor.cpp
opy-assignment.cpp
opy-constructor-error.cpp
opy-initialization.cpp
style-cast.cpp
xx-member-pointer-op.cpp
cl_ambig_res.cpp
cl_init_aggr.cpp
ecl-expr-ambiguity.cpp
ecl-init-ref.cpp
ecltype-crash.cpp
ecltype-overloaded-functions.cpp
ecltype-pr4444.cpp
ecltype-pr4448.cpp
ecltype-this.cpp
efault-argument-temporaries.cpp
efault-assignment-operator.cpp
efault-constructor-initializers.cpp
efault1.cpp
efault2.cpp
eleted-function.cpp
ependent-types.cpp
erived-to-base-ambig.cpp
estructor.cpp
irect-initializer.cpp
o-while-scope.cpp
ynamic-cast.cpp
laborated-type-specifier.cpp
mpty-class-layout.cpp
num.cpp
xception-spec.cpp
xceptions.cpp
xpressions.cpp
ntype-decl.cpp
ormat-attribute.cpp
riend-class-nodecl.cpp
riend.cpp
unction-overloaded-redecl.cpp
unction-redecl.cpp
unction-type-qual.cpp
unctional-cast.cpp
-c-e-cxx.cpp
llegal-member-initialization.cpp
mplicit-int.cpp
mplicit-member-functions.cpp
mplicit-virtual-member-functions.cpp
ncomplete-call.cpp
nherit.cpp
nline.cpp
nvalid-member-expr.cpp
nvalid-template-specifier.cpp
ibstdcxx_is_pod_hack.cpp
inkage-spec.cpp
iteral-type.cpp
ember-expr-anonymous-union.cpp
ember-expr-static.cpp
ember-expr.cpp
ember-location.cpp
ember-name-lookup.cpp
ember-operator-expr.cpp
ember-pointer-size.cpp
ember-pointer.cpp
ember-pointers-2.cpp
issing-members.cpp
s-exception-spec.cpp
amespace-alias.cpp
amespace.cpp
ested-name-spec.cpp
ew-delete.cpp
o-implicit-builtin-decls.cpp
ullptr.cpp
ffsetof.cpp
verload-call-copycon.cpp
verload-call.cpp
verload-decl.cpp
verload-member-call.cpp
verload-value-dep-arg.cpp
verloaded-builtin-operators.cpp
verloaded-operator-decl.cpp
verloaded-operator.cpp
refetch-enum.cpp
rimary-base.cpp
seudo-destructors.cpp
trtomember-badcall.cpp
trtomember-overload-resolution.cpp
ual-id-test.cpp
ualification-conversion.cpp
ualified-id-lookup.cpp
ualified-names-diag.cpp
ualified-names-print.cpp
ef-init-ambiguous.cpp
eferences.cpp
einterpret-cast.cpp
einterpret-fn-obj-pedantic.cpp
eturn-stack-addr.cpp
eturn.cpp
val-references.cpp
tatements.cpp
tatic-array-member.cpp
tatic-assert.cpp
tatic-cast-complete-type.cpp
tatic-cast.cpp
tatic-initializers.cpp
truct-class-redecl.cpp
witch-0x.cpp
witch.cpp
his.cpp
rivial-constructor.cpp
rivial-destructor.cpp
ype-convert-construct.cpp
ype-definition-in-specifier.cpp
ype-dependent-exprs.cpp
ype-traits-incomplete.cpp
ype-traits.cpp
ypedef-redecl.cpp
ypeid.cpp
ypes_compatible_p.cpp
nknown-type-name.cpp
nreachable-catch-clauses.cpp
nused.cpp
ser-defined-conversions.cpp
sing-decl-1.cpp
sing-decl-pr4441.cpp
sing-decl-pr4450.cpp
sing-decl-templates.cpp
sing-directive.cpp
alue-dependent-exprs.cpp
alue-initialization.cpp
ararg-default-arg.cpp
ararg-non-pod.cpp
ector-casts.cpp
irtual-member-functions-key-function.cpp
irtual-override.cpp
irtuals.cpp
arn-assignment-condition.cpp
arn-char-subscripts.cpp
arn-for-var-in-else.cpp
arn-missing-prototypes.cpp
arn-reorder-ctor-initialization.cpp
char_t.cpp
335b07ae470045dab25739ded6541744ec8fe40b 13-Dec-2009 Douglas Gregor <dgregor@apple.com> Don't assume that all conversions to a void pointer are converting
from a PointerType. Fixes PR5756.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91253 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
156c78e4ef14e5f7ba251554ea8f2dbec573fef3 13-Dec-2009 Anders Carlsson <andersca@mac.com> More improvements to checking allocation and deallocation functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91244 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
06d33699f11277a494c1118a0d25a83dab3bbd4c 12-Dec-2009 Douglas Gregor <dgregor@apple.com> When certain diagnostics involving run-time behavior would be emitted
in a potentially potentially evaluated context, queue those
diagnostics and only emit them if the context ends up being
potentially evaluated. This completes the fix for PR5761.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91213 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
75b699a883ed02e9183cb5f4ad7086f4e3c6adf1 12-Dec-2009 Douglas Gregor <dgregor@apple.com> Suppress warnings and errors about certain uses of non-POD types (in
__builtin_offsetof, passing through an ellipsis) when we're in an
unevaluated context. This is the first part of the fix to PR5761,
which deals with the simple case of an unevaluated context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91210 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
ararg-non-pod.cpp
e7e278bce2301990107cef3f873cbbf7da94469a 11-Dec-2009 John McCall <rjmccall@apple.com> Don't enter a new scope for a namespace-qualified declarator unless we're
in a file context. In well-formed code, only happens with friend functions.
Fixes PR 5760.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91146 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
7e1848ddba7b2a5f73a17387de7078bf8de7a646 11-Dec-2009 Chris Lattner <sabre@nondot.org> Give the "cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime" warning a -W flag (non-pod-varargs) and default it being an error by default. There is no good reason to allow users to get bitten by this sort of thing by default.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91094 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call-copycon.cpp
ararg-non-pod.cpp
0966f358989e2f3900d3a4efaca4c14250f2777b 10-Dec-2009 Douglas Gregor <dgregor@apple.com> Implement C++ DR437, which involves exception-specifications that name
a type currently being defined, from Nicola Gigante!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91052 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
153c33ed957b135a366178c61bbe22b6b1362a2a 10-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR5515: allow "merging" array bounds both forwards and backwards.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91044 91177308-0d34-0410-b5e6-96231b3b80d8
rray-bound-merge.cpp
20093b4bf698f292c664676987541d5103b65b15 10-Dec-2009 Douglas Gregor <dgregor@apple.com> Reimplement reference initialization (C++ [dcl.init.ref]) using the
new notion of an "initialization sequence", which encapsulates the
computation of the initialization sequence along with diagnostic
information and the capability to turn the computed sequence into an
expression. At present, I've only switched one CheckReferenceInit
callers over to this new mechanism; more will follow.

Aside from (hopefully) being much more true to the standard, the
diagnostics provided by this reference-initialization code are a bit
better than before. Some examples:

p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct
Derived'
cannot bind to a value of unrelated type 'struct Base'
Derived &dr2 = b; // expected-error{{non-const lvalue reference to
...
^ ~
p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to
a value of
type 'struct Base const' drops qualifiers
Base &br3 = bc; // expected-error{{drops qualifiers}}
^ ~~

p5-var.cpp:57:15: error: ambiguous conversion from derived class
'struct Diamond' to base class 'struct Base':
struct Diamond -> struct Derived -> struct Base
struct Diamond -> struct Derived2 -> struct Base
Base &br5 = diamond; // expected-error{{ambiguous conversion from
...
^~~~~~~
p5-var.cpp:59:9: error: non-const lvalue reference to type 'long'
cannot bind to
a value of unrelated type 'int'
long &lr = i; // expected-error{{non-const lvalue reference to type
...
^ ~

p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct
Base' cannot
bind to a temporary of type 'struct Base'
Base &br1 = Base(); // expected-error{{non-const lvalue reference to
...
^ ~~~~~~

p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field
'i'
int & ir1 = (ib.i); // expected-error{{non-const reference cannot
...
^ ~~~~~~
p5-var.cpp:98:7: note: bit-field is declared here
int i : 17; // expected-note{{bit-field is declared here}}
^






git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90992 91177308-0d34-0410-b5e6-96231b3b80d8
onvert-to-bool.cpp
ecl-init-ref.cpp
verloaded-operator.cpp
ef-init-ambiguous.cpp
eferences.cpp
val-references.cpp
842aef8d942a880eeb9535d40de31a86838264cb 09-Dec-2009 John McCall <rjmccall@apple.com> First pass at implementing C++ enum semantics: calculate (and store) an
"integer promotion" type associated with an enum decl, and use this type to
determine which type to promote to. This type obeys C++ [conv.prom]p2 and
is therefore generally signed unless the range of the enumerators forces
it to be unsigned.

Kills off a lot of false positives from -Wsign-compare in C++, addressing
rdar://7455616




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90965 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
num.cpp
verload-call.cpp
eac813909b3ca1142ad186f6c6a1b1ae0dbf9378 09-Dec-2009 Anders Carlsson <andersca@mac.com> Look through using declarations when searching for allocation overloads.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90961 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
ca910e84ea026a898c7184d3f3608403005b9bc0 09-Dec-2009 Anders Carlsson <andersca@mac.com> In CXXRecordDecl::forallBases, add the base to the "queue", so we walk more than one heirarchy of classes. John, please review.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90948 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
63fb6737e7488e3af85c822d4d030663e2b4feaf 09-Dec-2009 Anders Carlsson <andersca@mac.com> Don't warn about function templates or function template specializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90943 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-prototypes.cpp
9f89dd783d9abb9539bd7e952e5823301415c076 09-Dec-2009 Anders Carlsson <andersca@mac.com> Move the missing prototypes checking out into a new function. Don't warn about inline functions. Add a test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90938 91177308-0d34-0410-b5e6-96231b3b80d8
arn-missing-prototypes.cpp
b6cc91be4da4f55c7e3dca87ecfdb532b33c83ca 09-Dec-2009 Anders Carlsson <andersca@mac.com> Pass the current SourceLocation to getAssignOperatorMethod, fixing a crash when the assign operator method needs to be instantiated. Doug, please review the updated default-assignment-operator.cpp change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90935 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
43c79c2b07abc7ba6d9f243b84ee6539de4d2652 09-Dec-2009 Douglas Gregor <dgregor@apple.com> Implemented an implicit conversion from "noreturn" function types (and
pointers thereof) to their corresponding non-noreturn function
types. This conversion is considered an exact match for
overload-resolution purposes. Note that we are a little more strict
that GCC is, because we encode noreturn in the type system, but that's
a Good Thing (TM) because it does not allow us to pretend that
potentially-returning function pointers are non-returning function
pointers.

Fxies PR5620.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90913 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-noreturn.cpp
1237259bda343504cc0bd3cfe2198bdeea2b2fdf 08-Dec-2009 Douglas Gregor <dgregor@apple.com> When performing unqualified name lookup in C++, don't look directly
into transparent contexts; instead, we'll look into their nearest
enclosing non-transparent contexts further up the stack. Fixes PR5479.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90859 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
sing-directive.cpp
604e7f14d672af80ca5b9044f30f3dc23d37ddd5 08-Dec-2009 John McCall <rjmccall@apple.com> Correctly implement the C++03 and 0x restrictions on class-member using
declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90843 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
d6a637f8c8a93863509fc1bc555513ff6504957d 07-Dec-2009 Anders Carlsson <andersca@mac.com> Rework how virtual member functions are marked. If a class has no key function, we now wait until the end of the translation unit to mark its virtual member functions as references. This lays the groundwork for fixing PR5557.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90752 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-member-functions-key-function.cpp
46646491834cd8faabb22482dfe93b24ce28a6c1 07-Dec-2009 Chris Lattner <sabre@nondot.org> reapply my patch for PR4451, which improves diagnostics for :: vs : confusion.
This time with a fix to bail out when in a dependent context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90730 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
1ade4ca0aa9331c2388cca9becad1357a154ae34 06-Dec-2009 Chris Lattner <sabre@nondot.org> revert my previous patch, it is breaking something and I don't have time
to fix it ATM.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90717 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
93fc8fbc82c9d083d7e106d0fc7f21f9678cbeb6 06-Dec-2009 Chris Lattner <sabre@nondot.org> this is really about both PR's, 4452 is "don't crash", 4451 is "recover nicely".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90714 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
a564b17dcc7daf298ffa72cde94630343bf9c31a 06-Dec-2009 Chris Lattner <sabre@nondot.org> implement PR4451, improving error recovery for a mistaken : where a :: was
intended. On the first testcase in the bug, we now produce:

cxx-decl.cpp:12:2: error: unexpected ':' in nested name specifier
y:a a2;
^
::

instead of:

t.cc:8:1: error: C++ requires a type specifier for all declarations
x:a a2;
^
t.cc:8:2: error: invalid token after top level declarator
x:a a2;
^
;
t.cc:9:11: error: use of undeclared identifier 'a2'
x::a a3 = a2;
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90713 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ed97649e9574b9d854fa4d6109c9333ae0993554 04-Dec-2009 John McCall <rjmccall@apple.com> Fix "using typename" and the instantiation of non-dependent using declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90614 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
5c478cf2d54157062cd843737324e0d0df03a464 04-Dec-2009 Anders Carlsson <andersca@mac.com> Diagnose declarations of implicit member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90605 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-member-functions.cpp
16c5378c1e3af09a33604e096b3fe20742fc629d 04-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Make sure to call PerformObjectMemberConversion where necessary.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90555 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr-anonymous-union.cpp
ffsetof.cpp
9aef7263d84d9224575e113878cfbb06b8343cbf 04-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR5679: make __builtin_prefetch a bit more flexible in what it accepts
as a constant integer. Also, some minor cleanup and improvements to the
diagnostics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90504 91177308-0d34-0410-b5e6-96231b3b80d8
refetch-enum.cpp
5023437f5a897d513c08ddf64b74d688252a23e5 04-Dec-2009 John McCall <rjmccall@apple.com> When recovering from an invalid forward reference to an enum type in C++,
create the enum type in the same scope as you would a record type.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90500 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
c013118155077cf8bdaef743c5dbce760114eed3 03-Dec-2009 Eli Friedman <eli.friedman@gmail.com> Add recursion guards to ice-checking and evaluation for declrefs, so we
don't infinitely recurse for cases we can't evaluate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90480 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
1ab537be683c31afba3272a61ddd13811967d3be 03-Dec-2009 Douglas Gregor <dgregor@apple.com> Unify the end-of-class code paths used by the parser and template
instantiation, to ensure that we mark class template specilizations as
abstract when we need to and perform checking of abstract classes.

Also, move the checking that determines whether we are creating a
variable of abstract class type *after* we check whether the type is
complete. Otherwise, we won't see when we have an abstract class
template specialization that is implicitly instantiated by this
declaration. This is the "something else" that Sebastian had noted
earlier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90467 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
51f940457ab20f82c62c2093389763bb9f5187eb 03-Dec-2009 Anders Carlsson <andersca@mac.com> When instantiating a class, if a base specifier is not dependent we still need to copy its attributes down to the instantiated class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90463 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
ccf43505dbc47da041c06125f90b3bd3ac7eac97 03-Dec-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Introduce the notion of literal types, as specified in C++0x.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90361 91177308-0d34-0410-b5e6-96231b3b80d8
iteral-type.cpp
336e7743b8e2222d8557e2cf7c100c8f878df630 02-Dec-2009 John McCall <rjmccall@apple.com> Recognize that EnumConstantDecls can be found by lookup and are not instance
members. Fixes PR5667.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90341 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
5ec02ae147760c32ad5b6fb0fec30ab3b3696778 02-Dec-2009 Anders Carlsson <andersca@mac.com> In Sema, whenever we think that a function is going to cause a vtable to be generated, we mark any virtual implicit member functions as referenced.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90327 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-virtual-member-functions.cpp
b1b425648c4968824a3ef706b8c0ca35e88e8846 01-Dec-2009 John McCall <rjmccall@apple.com> Fix IsProvablyNotDerivedFrom to always use record definitions when available.
Gets clang-on-clang passing again.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90270 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
e6342c06356976508525145a6ba433d05f893171 01-Dec-2009 Douglas Gregor <dgregor@apple.com> Funtion templates and function template specializations do not
override virtual functions. Also, eliminate a (now redundant) call to
AddOverriddenMethods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90242 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
4ba3136b3eb9740a07bd61d0ab23ce9a8d894dee 01-Dec-2009 Douglas Gregor <dgregor@apple.com> Move the checking of overridden virtual functions into the code path
common to both parsing and template instantiation, so that we'll find
overridden virtuals for member functions of class templates when they
are instantiated.

Additionally, factor out the checking for pure virtual functions, so
that it will be executed both at parsing time and at template
instantiation time.

These changes fix PR5656 (for real), although one more tweak
w.r.t. member function templates will be coming along shortly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90241 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
9af2f52fbcb993350f54e57d498e7849ba29c75d 01-Dec-2009 Douglas Gregor <dgregor@apple.com> Don't automatically assume that an id-expression refers to a
ValueDecl, because that isn't always the case in ill-formed
code. Diagnose a common mistake (forgetting to provide a template
argument list for a class template, PR5655) and dyn_cast so that we
handle the general problem of referring to a non-value declaration
gracefully.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90239 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
d3a505827fd8775ce479498e5726b484336eedd8 01-Dec-2009 Douglas Gregor <dgregor@apple.com> An inherited virtual (where "virtual" wasn't written explicitly) can
be defined as pure. Fixes PR5656.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90237 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
129e2df52ed7e0434b3f1cf1867fd6a5cb083ff6 30-Nov-2009 John McCall <rjmccall@apple.com> Eliminate the use of OverloadedFunctionDecl in member expressions.
Create a new UnresolvedMemberExpr for these lookups. Assorted hackery
around qualified member expressions; this will all go away when we
implement the correct (i.e. extremely delayed) implicit-member semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90161 91177308-0d34-0410-b5e6-96231b3b80d8
ual-id-test.cpp
37909808416da93703cecc83091e2b9eab0053d6 30-Nov-2009 Anders Carlsson <andersca@mac.com> When we're trying to define an implicit virtual destructor, make sure that we have a valid delete operator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90156 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
a75a92dfffee2b34a43f1d0e9f8d1949feb190ad 29-Nov-2009 Daniel Dunbar <daniel@zuster.org> Remove unnecessary -fms-extensions=0 from tests (this command line syntax is going away).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90066 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-int.cpp
ested-name-spec.cpp
ypedef-redecl.cpp
d85b5b9b8fcf53906d9a61649b3657ca0d902017 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement the rules in C++ [basic.link] and C99 6.2.2 for computing
the linkage of a declaration. Switch the lame (and completely wrong)
NamedDecl::hasLinkage() over to using the new NamedDecl::getLinkage(),
along with the "can this declaration be a template argument?" check
that started all of this.

Fixes -fsyntax-only for PR5597.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89891 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
7725e67639fa2fe74f8775b7ed884a076ffdbffc 25-Nov-2009 Sean Hunt <rideau3@gmail.com> Parse C++ member check attributes - base_check, hiding, and override.
The attributes are currently ignored.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89837 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
99e9b4d172f6877e6ba5ebe75bb8238721f5e01c 25-Nov-2009 Douglas Gregor <dgregor@apple.com> Eliminate CXXConditionDeclExpr with extreme prejudice.

All statements that involve conditions can now hold on to a separate
condition declaration (a VarDecl), and will use a DeclRefExpr
referring to that VarDecl for the condition expression. ForStmts now
have such a VarDecl (I'd missed those in previous commits).

Also, since this change reworks the Action interface for
if/while/switch/for, use FullExprArg for the full expressions in those
expressions, to ensure that we're emitting

Note that we are (still) not generating the right cleanups for
condition variables in for statements. That will be a follow-on
commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89817 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
d1a7846699a82f85ff3ce6b2e383409537c3f5c5 25-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Have the parser tell sema whether a member declaration is a function definition. This allows sema to not emit spurious diagnostics in some invalid code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89816 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
e4d2bdd54c29656f2eba004d6db1e4942f2bfcd9 24-Nov-2009 Anders Carlsson <andersca@mac.com> GNUNullExpr is a valid sentinel even though it isn't of pointer type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89778 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-sentinel.cpp
46408eedfff5aa33662cedb6716a20616f3bad31 24-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make sure redeclaration chains are properly linked, even through invalid decls. This fixes PR5415.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89777 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
5d484e8cf710207010720589d89602233de61d01 23-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Intercept sizeof and alignof references before they get into ASTContext methods. This fixes a crash when writing sizeof(Incomplete&), and lets ASTContext's methods do the right thing for CodeGen, which fixes PR5590.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89668 91177308-0d34-0410-b5e6-96231b3b80d8
lignof-sizeof-reference.cpp
eb0d8c95b43549ebf1acbb78d597901ace6dc8b7 23-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Let using directives refer to namespace aliases. Fixes PR5479.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89657 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
f21bac640870db0569e697a8a14f59f6ca069f80 23-Nov-2009 Douglas Gregor <dgregor@apple.com> Require a class type to be complete before probing its conversion
functions for a switch condition's conversion to integral or
enumeration type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89656 91177308-0d34-0410-b5e6-96231b3b80d8
witch.cpp
84fb9c0be621c9e4ca4e56f67dae2a0bb6e44821 23-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement conversion from a switch condition with class type to an
integral or enumeration type (vi user-defined conversions). Fixes PR5518.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89655 91177308-0d34-0410-b5e6-96231b3b80d8
witch-0x.cpp
witch.cpp
e4fc0d97420e13d13c9664a3c27c17aa7c1e47b9 22-Nov-2009 Anders Carlsson <andersca@mac.com> When laying out bitfields, make sure that the data size is always aligned to a byte. This fixes PR5580.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89611 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
f1cd5e5c85f2ad433874310d826c1860a262909c 22-Nov-2009 Sean Hunt <rideau3@gmail.com> Use intptr_t rather than long so that this test will not fail on LLP64 systems,
where long is only 32-bits and so a reinterpret_cast would be ill-formed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89583 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
b681b61fea36618778b8030360e90e3f4641233b 22-Nov-2009 John McCall <rjmccall@apple.com> If a C++ qualified id is followed by a postfix suffix, it is never the direct
operand of an addressof operator, and so we should not treat it as an abstract
member-pointer expression and therefore suppress the implicit member access.

This is really a well-formedness constraint on expressions: a DeclRefExpr of
a FieldDecl or a non-static CXXMethodDecl (or template thereof, or unresolved
collection thereof) should not be allowed in an arbitrary location in the AST.
Arguably it shouldn't be allowed anywhere and we should have a different expr
node type for this. But unfortunately we don't have a good way of enforcing
this kind of constraint right now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89578 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointers-2.cpp
bbd37c62e34db3f5a95c899723484a76c71d7757 21-Nov-2009 Sean Hunt <rideau3@gmail.com> Added rudimentary C++0x attribute support.
The following attributes are currently supported in C++0x attribute
lists (and in GNU ones as well):
- align() - semantics believed to be conformant to n3000, except for
redeclarations and what entities it may apply to
- final - semantics believed to be conformant to CWG issue 817's proposed
wording, except for redeclarations
- noreturn - semantics believed to be conformant to n3000, except for
redeclarations
- carries_dependency - currently ignored (this is an optimization hint)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89543 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-cxx0x.cpp
eeb7fd0ccfd656ac578806fa78a35023f76eca45 20-Nov-2009 Douglas Gregor <dgregor@apple.com> A previous commit fixed PR5519; here's the test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89494 91177308-0d34-0410-b5e6-96231b3b80d8
onverting-constructor.cpp
f6e6fc801c700c7b8ac202ddbe550d9843a816fc 20-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement C++ [basic.lookup.classref]p3, which states how the type
name 'T' is looked up in the expression

t.~T()

Previously, we weren't looking into the type of "t", and therefore
would fail when T actually referred to an injected-class-name. Fixes
PR5530.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89493 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
275c2b47a1dc200d6b55dd867bdfeb7a91b8d876 19-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Do overload resolution for compound assignment even if only the RHS is overloadable. Compound assignment may be overloaded as a non-member, and anyway the overload resolution is necessary because it triggers implicit (used-defined) conversions. Fixes PR5512, but not really the deeper issues lurking. Those are standard defects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89268 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
6654294ec1074d069c35152ea258f95f97ca7625 19-Nov-2009 John McCall <rjmccall@apple.com> Resolve this FIXME: unelaborated lookups are ambiguous, too.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89266 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
6826314938f8510cd1a6b03b5d032592456ae27b 18-Nov-2009 John McCall <rjmccall@apple.com> Overhaul previous-declaration and overload checking to work on lookup results
rather than NamedDecl*. This is a major step towards eliminating
OverloadedFunctionDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89263 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
19d70731388c4ed84d9270ddc5b1937218dcf572 18-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> ignore parens surounding the type when diagnosing
pointer-to-member cast types used in expressions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89255 91177308-0d34-0410-b5e6-96231b3b80d8
xx-member-pointer-op.cpp
05ebda9490e15f900edb2e5c690e067abcb37b2e 18-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> This patch fixes a bug in misdiagnosing correct
use of pointer to data member.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89251 91177308-0d34-0410-b5e6-96231b3b80d8
xx-member-pointer-op.cpp
a165da09c0313309d2d4dda42d0b2d4096a372a1 18-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Track overriding methods when instantiating a template class. Fixes PR5550.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89248 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
a9efadada0430493a4d68b34b2e76580d0fd8f10 18-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Don't generate superfluous and ambiguous built-in candidates for multi-level array subscript and arithmetic. Fixes PR5546.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89242 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
cc5306ac8a39cdd5e7f83e597cba911e97c4a595 18-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> Improve on diagnosing type mismatches because of
lack of viable convesion functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89216 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
76d69bb7f984c390f90504a06dfc7485387ffdd7 18-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> CastsAwayConstness shouldn't care if member pointers point into different classes. Fixes PR5545.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89215 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
7ba107a1863ddfa1664555854f0d7bdb3c491c92 18-Nov-2009 John McCall <rjmccall@apple.com> Incremental progress on using declarations. Split UnresolvedUsingDecl into
two classes, one for typenames and one for values; this seems to have some
support from Doug if not necessarily from the extremely-vague-on-this-point
standard. Track the location of the 'typename' keyword in a using-typename
decl. Make a new lookup result for unresolved values and deal with it in
most places.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89184 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
f43fb722f6bf048d548659ad326cfb1cfc14420b 18-Nov-2009 Eli Friedman <eli.friedman@gmail.com> PR5520: Make sure to check whether the base type is complete before looking for
operator->.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89180 91177308-0d34-0410-b5e6-96231b3b80d8
rrow-operator.cpp
4a2614e94672c47395abcde60518776fbebec589 17-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Adjust format attribute index for implicit object arguments. Fixes PR5521.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89113 91177308-0d34-0410-b5e6-96231b3b80d8
ormat-attribute.cpp
58beed91d468863b8c85bce43425422703838d27 17-Nov-2009 Anders Carlsson <andersca@mac.com> Fix PR5531.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89106 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
a439e6f8f57eaeb0a02960d8f2d8ad124ba8b3d5 16-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Repair broken FindCompositePointerType. Correct early termination condition. Get CVR qualifiers from canonical types. Traverse collected qualifiers in reverse order on rebuilding the pointer, so that we don't swap inner and outer qualifiers. That last one fixes PR5509.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88960 91177308-0d34-0410-b5e6-96231b3b80d8
omposite-pointer-type.cpp
5e6214b4c7b326a83fbcf55250a95b46bdc0bb8f 16-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Fix test on Linux.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88889 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
50724302e24d44a27e3bc45e7185a710d6eb3c2d 15-Nov-2009 Anders Carlsson <andersca@mac.com> If we find a deallocation function in the class scope, but it is a placement function we should not look for a deallocation function in the global scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88851 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
ab15d0e5af616c11b6cbb478c81d0a8eaa9d450a 15-Nov-2009 Douglas Gregor <dgregor@apple.com> When performing a static downcast as part of a static_cast, make sure
that we're dealing with canonical types like the documentation say
(yay, CanQualType). Alas, this is another instance where using
getQualifiers() on a non-canonical QualType got us in trouble.

Good news: with this fix, Clang can now parse all of its own headers!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88848 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
c07a494b376f75f33759cf09ad188b11ef3fa9d5 15-Nov-2009 Douglas Gregor <dgregor@apple.com> Don't gratuitously mark the default constructors of base or member initializers as used

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88847 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
891fdae811e991d15b26fc165724c4cf6b6737a6 15-Nov-2009 Douglas Gregor <dgregor@apple.com> When adding the underlying declaration of a decl to a lookup-results
set, expand overloaded function declarations. Long-term, this should
actually be done by the name-lookup code rather than here, but this
part of the code (involving using declarations) is getting a makeover
now and the test-case is useful.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88846 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
593564ba94ff854b7a410a4ca17ad34a90c5b761 15-Nov-2009 Douglas Gregor <dgregor@apple.com> When looking for operator() to type-check a call to an object of class
type, use full qualified name lookup rather than the poking the
declaration context directly. This makes sure that we see operator()'s
in superclasses. Also, move the complete-type check before this name
lookup.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88842 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
79cbc7dd2aacd85a28f469b5dc73c4ea296e7072 14-Nov-2009 Anders Carlsson <andersca@mac.com> Add an internal CreateRecordDecl that will create a CXXRecordDecl when compiling C++ and a RecordDecl otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88816 91177308-0d34-0410-b5e6-96231b3b80d8
uiltins.cpp
a8a1e3da7cc741ab36be18041fafbebdc9be826b 14-Nov-2009 Anders Carlsson <andersca@mac.com> Always build a builtin operator expression for the __extension__ unary operator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88811 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
a82e4ae149168be47458f298371035911685370c 14-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> - Have TryStaticImplicitCast set the cast kind to NoOp when binding a reference. CheckReferenceInit already inserts implicit casts to the necessary types. This fixes an assertion in CodeGen for some casts and brings a fix for PR5453 close, if I understand that bug correctly.
- Also, perform calculated implicit cast sequences if they're determined to work. This finally diagnoses static_cast to ambiguous or implicit bases and fixes two long-standing fixmes in the test case. For the C-style cast, this requires propagating the access check suppression pretty deep into other functions.
- Pass the expressions for TryStaticCast and TryStaticImplicitCast by reference. This should lead to a better AST being emitted for such casts, and also fixes a memory leak, because CheckReferenceInit and PerformImplicitConversion wrap the node passed to them. These wrappers were previously lost.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88809 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
3e42ffd3a848236413caa799f1f32a87fd6d702b 14-Nov-2009 Eli Friedman <eli.friedman@gmail.com> PR5462: Don't run off the edge of the argument array for vararg handling
when there are more parameters in the prototype than arguments to the call.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88759 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-default-arg.cpp
19aeac6ea4897c542b21c9f53a0a51762d8ddf83 14-Nov-2009 Douglas Gregor <dgregor@apple.com> When type-checking a static cast (or the static_cast part of a C-style
cast) that is converting to a class type, enumerate its constructors
as in any other direct initialization. This ensures that we get the
proper conversion sequence.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88751 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
ba69b3c1050447db3c91a41ff25ce8cd29d9b021 14-Nov-2009 Daniel Dunbar <daniel@zuster.org> Fix broken tests, exposed by improved -verify.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88749 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-this.cpp
0ba63ea5be2c90ef62d1350ea4a0a0c415a785f1 14-Nov-2009 Anders Carlsson <andersca@mac.com> Diagnose ambiguity of operator delete and operator delete[]. Sebastian, please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88747 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
fd47648b5d351ff6d1a3e886e1c3d10712ba4675 14-Nov-2009 Douglas Gregor <dgregor@apple.com> Revert r88718, which does NOT solve the constructor-template-as-copy-constructor issue. Big thanks to John for finding this

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88724 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-recovery.cpp
opy-constructor-error.cpp
cad84b7c12564ff37feb66d6d004bb609bea8788 14-Nov-2009 Douglas Gregor <dgregor@apple.com> A constructor template cannot be instantiated to a copy
constructor. Make sure that such declarations can never be formed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88718 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-recovery.cpp
opy-constructor-error.cpp
79b680ea869983d62b84a9175eeb6b6efb376326 13-Nov-2009 Douglas Gregor <dgregor@apple.com> When performing copy initialization (= "implicit conversion", here) to
a class type from itself or a derived class thereof, enumerate
constructors and permit user-defined conversions to the arguments of
those constructors. This fixes the wacky implicit conversion sequence
used in std::auto_ptr's lame emulation of move semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88670 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
1f2fcee89677d597f2a10b54d6cefac0e79db504 11-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> Make test more platform independent (per Sebastian's comment).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86888 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
b03bfa55d03ca38922ffedac19225d0832e8d911 11-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> Diagnose illegally typed operator new/new[].



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86755 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
d411b3f746e612294bd5f0843d83e8c215f7fe58 09-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> For array pointee type, get its cvr qualifier from
its element type. Fixes pr5432.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86587 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
80c30dad6c6fca077293125a96f464b6c8857171 09-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Add additional note to mark the cause of synthesized constructors. Mark
declaration invalid if the constructor can't be properly built. Addresses
remaining review comments from Fariborz for r86500.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86579 91177308-0d34-0410-b5e6-96231b3b80d8
efault-constructor-initializers.cpp
alue-initialization.cpp
49c16da71b9c95cc53b4af6de2833a022cb69b6a 09-Nov-2009 Eli Friedman <eli.friedman@gmail.com> Unify the codepaths used to verify base and member initializers for explicitly
and implicitly defined constructors. This has a number of benefits:

1. Less code.

2. Explicit and implicit constructors get the same diagnostics.

3. The AST explicitly contains constructor calls from implicit default
constructors. This allows handing some cases that previously weren't handled
correctly in IRGen without any additional code. Specifically, implicit default
constructors containing calls to constructors with default arguments are now
handled correctly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86500 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
efault-constructor-initializers.cpp
alue-initialization.cpp
9770ef0eea1dbebb9cad93b8a564bff789568e62 08-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> When checking the namespace of a redeclaration or definition, look through linkage specs. Fixes PR5430.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86461 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
4fcfde4d5c8f25e40720972a5543d538a0dcb220 08-Nov-2009 Daniel Dunbar <daniel@zuster.org> Eliminate &&s in tests.
- 'for i in $(find . -type f); do sed -e 's#\(RUN:.*[^ ]\) *&& *$#\1#g' $i | FileUpdate $i; done', for the curious.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86430 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
rrow-operator.cpp
omposite-pointer-type.cpp
riend-class-nodecl.cpp
inkage-spec.cpp
ember-pointer-size.cpp
seudo-destructors.cpp
ararg-non-pod.cpp
6a8b7f3f62119f9d8659965ad36fa58059054c46 07-Nov-2009 Anders Carlsson <andersca@mac.com> Add bug number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86357 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
f7613d53619d11f46fb07ddb0ea90c9fb0cad027 07-Nov-2009 Anders Carlsson <andersca@mac.com> Don't treat variables with non-trivial ctors or dtors as unused. Fixes PR5407.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86352 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
5dbad3d46c43e8051dac0c3775bcbaf8f1a6b8fe 06-Nov-2009 John McCall <rjmccall@apple.com> Improve the -Wsign-compare heuristics:
* If the unsigned type is smaller than the signed type, never warn, because
its value will not change when zero-extended to the larger type.
* If we're testing for (in)equality, and the unsigned value is an integer
constant whose sign bit is not set, never warn, because even though the
signed value might change, it can't affect the result of the equality.

Also make the comparison test cases much more rigorous, and have them expose
the subtle differences between C and C++ here.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86242 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
3f0b5fd3a55baf1e3e768fe981bcc3ad5e209ec1 06-Nov-2009 Douglas Gregor <dgregor@apple.com> Rework the fix-it hint for code like

get_origin->x

where get_origin is actually a function and the user has forgotten the
parentheses. Instead of giving a lame note for the fix-it, give a
full-fledge error, early, then build the call expression to try to
recover.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86238 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
27591ff4fc64600fd67c5d81899e3efe5ef41a80 06-Nov-2009 Douglas Gregor <dgregor@apple.com> Improve recovery when we fail to parse the operand of a C++ named cast. Fixes PR5210

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86234 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
35de813674503b87ec5117b6492cc0a4ef7d8728 06-Nov-2009 Douglas Gregor <dgregor@apple.com> Turn off -Wsign-compare warnings by default

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86233 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
onditional-expr.cpp
b653c52d9176a4faecf923f792758f4454f7f78c 06-Nov-2009 Douglas Gregor <dgregor@apple.com> If we have a C-style cast, functional cast, or a static_cast to a
class type, don't perform the array-to-pointer or function-to-pointer
conversions, because we may end up binding a reference to a function
or array.

With this change, FileCheck now passes -fsyntax-only!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86211 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
b7a86f5c5f9cdea126817247cc1fd3a7441388da 06-Nov-2009 Douglas Gregor <dgregor@apple.com> When we encounter a derived-to-base conversion when performing an
implicit conversion sequence, check the validity of this conversion
and then perform it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86210 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
6e8247556807ecaaac470852222762db998a05b2 05-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Don't allow definitions of array variables without some size information in C++. Fixed PR5401

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86165 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-types.cpp
9c4b838782132ec670fd7e48d1a7a7fd433fed06 05-Nov-2009 Douglas Gregor <dgregor@apple.com> Eliminate some false positives due to a thinko in the "'blah' is
always zero in this context" warning logic. Also, make the diagnostic
itself more precise when referring to pointer values ("NULL" vs. "zero").


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86143 91177308-0d34-0410-b5e6-96231b3b80d8
arn-for-var-in-else.cpp
a65b55142bd8e8c94f371bb056d8f58f11de220f 05-Nov-2009 Sebastian Redl <sebastian.redl@getdesigned.at> When collecting types for built-in candidates, make arrays decay to pointers. Otherwise, subscripting an array leads to no candidates at all. Fixes PR5360.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86140 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
b13c87f0c9705d91d5a3e134be9934c9ad531071 05-Nov-2009 John McCall <rjmccall@apple.com> Implement the conditional-operator part of -Wsign-compare. Turn
DiagnoseSignCompare into Sema::CheckSignCompare and call it from more places.

Add some enumerator tests. These seem to expose some oddities in the
types we're converting C++ enumerators to; in particular, they're converting
to unsigned before int, which seems to contradict 4.5 [conv.prom] p2.

Note to self: stop baiting Doug in my commit messages.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86128 91177308-0d34-0410-b5e6-96231b3b80d8
ompare.cpp
onditional-expr.cpp
644aa9a59c9c5e84c8cc81b64f933ada681c26af 05-Nov-2009 Mike Stump <mrs@apple.com> Fix 80-col violation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86115 91177308-0d34-0410-b5e6-96231b3b80d8
rimary-base.cpp
b1c2ea5dddc9188e2ea30de7f6546f640b85dead 05-Nov-2009 Douglas Gregor <dgregor@apple.com> Make sure to grab CVR qualifiers from the canonical type. ARGH!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86079 91177308-0d34-0410-b5e6-96231b3b80d8
verload-member-call.cpp
b41900410fae8cba4bc02db2e3e44142e7f4c625 05-Nov-2009 John McCall <rjmccall@apple.com> Diagnose using a field to initialize itself. Patch by Brandon Pearcy!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86061 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
ca1bdd7c269a2390d43c040a60511edd017ee130 04-Nov-2009 Douglas Gregor <dgregor@apple.com> Implement support for parsing dependent template-ids that refer to
overloaded operators, e.g.,

p->template operator+<T>()




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85989 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-template-specifier.cpp
6f26920dfa5020202016b18f52ccd120d9c7e518 03-Nov-2009 Fariborz Jahanian <fjahanian@apple.com> Remove previous patch for pr5296 due to further clarification
of value-initialization and trivial constructors.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85935 91177308-0d34-0410-b5e6-96231b3b80d8
alue-initialization.cpp
2d1c21414199a7452f122598189363a3922605b1 03-Nov-2009 Douglas Gregor <dgregor@apple.com> Replace the code that parses member access expressions after "." or
"->" with a use of ParseUnqualifiedId. Collapse
ActOnMemberReferenceExpr, ActOnDestructorReferenceExpr (both of them),
ActOnOverloadedOperatorReferenceExpr,
ActOnConversionOperatorReferenceExpr, and
ActOnMemberTemplateIdReferenceExpr into a single, new action
ActOnMemberAccessExpr that does the same thing more cleanly (and can
keep more source-location information).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85930 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-member-expr.cpp
3f9a0566e6793151b99a65ab936220971cf96c1b 03-Nov-2009 Douglas Gregor <dgregor@apple.com> Introduce a new class, UnqualifiedId, that provides a parsed
representation of a C++ unqualified-id, along with a single parsing
function (Parser::ParseUnqualifiedId) that will parse all of the
various forms of unqualified-id in C++.

Replace the representation of the declarator name in Declarator with
the new UnqualifiedId class, simplifying declarator-id parsing
considerably and providing more source-location information to
Sema. In the future, I hope to migrate all of the other
unqualified-id-parsing code over to this single representation, then
begin to merge actions that are currently only different because we
didn't have a unqualified notion of the name in the parser.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85851 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
5de245058d411b166dc32622f39298716450fa1c 28-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Diagnose use of data pointer member in a function call
expression instead of crashing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85401 91177308-0d34-0410-b5e6-96231b3b80d8
trtomember-badcall.cpp
6c813e1cb719a328f01619c3d44910be4e79e4d5 27-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Generate constructor for value-initialization cases, even if the
implementation technique doesn't call the constructor at that point.
DR302. Fixes pr5296.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85249 91177308-0d34-0410-b5e6-96231b3b80d8
alue-initialization.cpp
838b04871270b37c99a43dda2527f3e96b3331ff 27-Oct-2009 John Thompson <John.Thompson.JTSoftware@gmail.com> Disabling some MS extensions which cause this test to fail

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85242 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
b3eca29e2b1f11d2daa06feb23e006f69be759c7 27-Oct-2009 John Thompson <John.Thompson.JTSoftware@gmail.com> Disabling some MS extensions which cause these tests to fail

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85236 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-int.cpp
ested-name-spec.cpp
8ce35b095e8fca45e04c1bda14ed0548ce7536ad 25-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Remove the Skip parameter from GetTypeForDeclarator and dependents. Take the opportunity to improve an error message and fix PR4498.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@85068 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
644be853b87cae94fcabaf309a5e482a8c291fb9 23-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Apply the special enum restrictions from [over.match.oper]p3b2 in argument-dependent lookup too. This fixes PR5244.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84963 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
54e14c4db764c0636160d26c5bbf491637c83a76 23-Oct-2009 John McCall <rjmccall@apple.com> When building types from declarators, instead of building two types (one for
the DeclaratorInfo, one for semantic analysis), just build a single type whose
canonical type will reflect the semantic analysis (assuming the type is
well-formed, of course).

To make that work, make a few changes to the type system:
* allow the nominal pointee type of a reference type to be a (possibly sugared)
reference type. Also, preserve the original spelling of the reference type.
Both of these can be ignored on canonical reference types.
* Remove ObjCProtocolListType and preserve the associated source information on
the various ObjC TypeLocs. Preserve the spelling of protocol lists except in
the canonical form.
* Preserve some level of source type structure on parameter types, but
canonicalize on the canonical function type. This is still a WIP.

Drops code size, makes strides towards accurate source location representation,
slight (~1.7%) progression on Cocoa.h because of complexity drop.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84907 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
5ed66f709126b60e88631bf86d7e2d59e774686f 22-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Try to instantiate templates before doing hierarchy checks in static_cast. Fixes PR5261.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84860 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
652371ad0427b2310ff01ea22fdc37f02d19abe8 22-Oct-2009 Douglas Gregor <dgregor@apple.com> Don't generate pointer types for void or base classes when finding
conversion types for builtin overloaded operator candidates; I misread
this section in the standard the first time around.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84788 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
4a27d7061ee2fe0e2b71aa470c323e76afb95917 21-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics and template instantiation behavior when calling
an overloaded function call operator.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84745 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
8577c98a679d69fe1254e57c67bb3e1d5eaf92be 20-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Patch implements ranking conversions between member pointers [over.ics.rank]



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84660 91177308-0d34-0410-b5e6-96231b3b80d8
trtomember-overload-resolution.cpp
2782302961b6f57316b1ece494c7135b65e18b30 18-Oct-2009 Anders Carlsson <andersca@mac.com> It's OK for a pure virtual function to override another pure virtual function. Fixes PR5222.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84428 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
8d1c9ae5d27c5190a7793f7ac1224a70cd3df33f 18-Oct-2009 Douglas Gregor <dgregor@apple.com> Fix a crash with qualified member access into a non-type, from Sean Hunt!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84370 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
12356b119032edd64e9c32f9f01920d12c2acc57 17-Oct-2009 Edward O'Callaghan <eocallaghan@auroraux.org> Fix for PR5190, Credit to Zhanyong Wan.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84346 91177308-0d34-0410-b5e6-96231b3b80d8
witch.cpp
e38050d47dc673b7edf1e4b4d2e3c822293a8cba 17-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add a DR437 testcase, but disable it for now, since it fails.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84345 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
866b2744ffe66294c8791cc8407b918f3bb81b2c 17-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to clean up and improve visual display of
builtin function ambiguity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84289 91177308-0d34-0410-b5e6-96231b3b80d8
mbiguous-builtin-unary-operator.cpp
uiltin-ptrtomember-ambig.cpp
04905014fd854979ac12fc31a2b25fca37a93eb4 16-Oct-2009 Anders Carlsson <andersca@mac.com> The result type of logical || and && is bool in C++. Fixes PR5206.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84231 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
a9cca896d5f3e871d92d4448e2fe1668c43230a8 15-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Apply heuristics to cut back on number of candidate
sets of builtin operators. Currently, it is applied
to '++' and '->*' operators. I need to apply it to others
as well. Also, heuristics need be applied to
BuiltinCandidateTypeSet::AddPointerWithMoreQualifiedTypeVariants.
This is WIP.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84187 91177308-0d34-0410-b5e6-96231b3b80d8
mbiguous-builtin-unary-operator.cpp
uiltin-ptrtomember-ambig.cpp
uiltin-ptrtomember-overload.cpp
8d6d90d5499d4248761251811ebed0ae77665ed7 15-Oct-2009 Anders Carlsson <andersca@mac.com> Check the return type when calling pointer to member functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84161 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
491b84c062ead1c69911a8d5f0d57826afacc099 14-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Use partial diagnostics properly in call to RequireCompleteType. Among other things, this means we get a note on the declaration of the incomplete type when it is used in an exception specification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84099 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
c3a3b7b38440384944614ea6e93cf8d238d3d5f2 14-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Do exception spec compatibility tests for member pointers, too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84098 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
d9290cb5ad9eae8d10487cea5392331cf6a47142 14-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Handle ambiguity of reference initialization.
Removes a FIXME.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84068 91177308-0d34-0410-b5e6-96231b3b80d8
ef-init-ambiguous.cpp
a786fdbf6c1d8ff08c3e61c7eb6bf2872895e2b4 14-Oct-2009 Douglas Gregor <dgregor@apple.com> Improve diagnostics when the parser encounters a declarator with an
unknown type name, e.g.,

foo::bar x;

when "bar" does not refer to a type in "foo".

With this change, the parser now calls into the action to perform
diagnostics and can try to recover by substituting in an appropriate
type. For example, this allows us to easily diagnose some missing
"typename" specifiers, which we now do:

test/SemaCXX/unknown-type-name.cpp:29:1: error: missing 'typename'
prior to dependent type name 'A<T>::type'
A<T>::type A<T>::f() { return type(); }
^~~~~~~~~~
typename

Fixes PR3990.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84053 91177308-0d34-0410-b5e6-96231b3b80d8
amespace.cpp
ested-name-spec.cpp
nknown-type-name.cpp
15ea378083ee4d9e4838076e4a310177da3d46c4 14-Oct-2009 Anders Carlsson <andersca@mac.com> Check the return type of binary operators and the arrow operator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84043 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
3a9439f3b55a018a149953074801921fc1df63b7 14-Oct-2009 Anders Carlsson <andersca@mac.com> Check the return type of operator[]() and fix a thinko that lead to a crash in SemaCXX/overloaded-operator.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84041 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
07d68f1f0760110d430c4b849abd49f12777f09c 13-Oct-2009 Anders Carlsson <andersca@mac.com> More return type checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84034 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
26a2a07acfacc06406e6a48c6d22e4b26bcd6382 13-Oct-2009 Anders Carlsson <andersca@mac.com> Diagnose invalid return types for unary operators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84030 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
3f09327b26033d0a9676d52d80cf92c48f581aff 13-Oct-2009 Douglas Gregor <dgregor@apple.com> Unify our diagnostic printing for errors of the form, "we didn't like
what we found when we looked into <blah>", where <blah> is a
DeclContext*. We can now format DeclContext*'s in nice ways, e.g.,
"namespace N", "the global namespace", "'class Foo'".

This is part of PR3990, but we're not quite there yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84028 91177308-0d34-0410-b5e6-96231b3b80d8
issing-members.cpp
ested-name-spec.cpp
cee1b54e11cb4d460634e6ecedbe75c7c2382389 13-Oct-2009 Anders Carlsson <andersca@mac.com> Pass the right SourceLocation to Actions.ActOnOverloadedOperatorReferenceExpr and Actions.ActOnConversionOperatorReferenceExpr. Update incomplete-call.cpp test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84026 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
5a881bb09928b7ade891efc680088aaad276f8d6 12-Oct-2009 John McCall <rjmccall@apple.com> Implement -Wparentheses: warn about using assignments in contexts that require
conditions. Add a fixit to insert the parentheses. Also fix a very minor
possible memory leak in 'for' conditions.

Fixes PR 4876 and rdar://problem/7289172



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83907 91177308-0d34-0410-b5e6-96231b3b80d8
arn-assignment-condition.cpp
2ebe7ebb1d6149a1845dd3169009f99b78e91bc9 12-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Handle built-in unary operators when reporting ambiguities.
wip - To prune excessive reporting.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83889 91177308-0d34-0410-b5e6-96231b3b80d8
mbiguous-builtin-unary-operator.cpp
27687cf7f6fea50e592f653549a33f07bf5c0667 12-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> If built-in operators could not be selected because of ambiguity in
user-defined type conversions, issue list of ambiguites in addition
to the diagnostic. So, clang now issues the following:

b.cpp:19:19: error: left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'struct C1'
int i = c1->*pmf;
~~^
b.cpp:19:19: note: because of ambiguity in conversion of 'struct C1' to 'struct E *'
b.cpp:5:5: note: candidate function
operator E*();
^
b.cpp:11:5: note: candidate function
operator E*();
^


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83862 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin-ptrtomember-overload-1.cpp
ecl-init-ref.cpp
5db4d908308576b0fc574138d4aa410c529785a6 11-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Types appearing more than once in a spec shouldn't matter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83766 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
dced226e37f7c2c31c25d06c514f29b610fe2a54 11-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Test exception spec compatibility on return type and parameters.

Along the way, use RequireCompleteType when testing exception spec types.
Separate all the ugly spec stuff into its own file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83764 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
2c7588f1260c6655cfb73126b695d2f79ae170bb 10-Oct-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement the core checking for compatible exception specifications in assignment and initialization.

The exception specification of the assignee must be the same or a subset of the target. In addition, exception specifications on arguments and return types must be equivalent, but this is not implemented yet.
This currently produces two diagnostics for every invalid assignment/initialization, due to the diagnostic produced outside PerformImplicitConversion, e.g. in CheckSingleInitializer. I don't know how to suppress this; in any case I think it is the wrong place for a diagnostic, since there are other diagnostics produced inside the function. So I'm leaving it as it is for the moment.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83710 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
eed3e699b581ad9e17f8147f26b882d20d65a317 10-Oct-2009 Anders Carlsson <andersca@mac.com> Check that the return type is complete when calling a member function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83694 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
11582f542e183f7a7dfcba82cc4378f42d1527c2 10-Oct-2009 Anders Carlsson <andersca@mac.com> Add another test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83693 91177308-0d34-0410-b5e6-96231b3b80d8
ncomplete-call.cpp
8c8d91917c307dc3ba4f60661377c745f2a6bef2 10-Oct-2009 Anders Carlsson <andersca@mac.com> Add CheckCallReturnType and start using it for regular call expressions. This will improve error messages. For

struct B;

B f();

void g() {
f();
}

We now get

t.cpp:6:3: error: calling 'f' with incomplete return type 'struct B'
f();
^~~
t.cpp:3:3: note: 'f' declared here
B f();
^
t.cpp:1:8: note: forward declaration of 'struct B'
struct B;
^



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83692 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
f36e02d4aff98bf2e52e342e0038d4172fbb5e64 09-Oct-2009 John McCall <rjmccall@apple.com> Refactor the LookupResult API to simplify most common operations. Require users to
pass a LookupResult reference to lookup routines. Call out uses which assume a single
result.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83674 91177308-0d34-0410-b5e6-96231b3b80d8
lass-names.cpp
ad3607da8ad626c408d8e6d804bf1359977b200a 09-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Produce good looking diagnostics on ambiguous built-in operators.
Now we produce things like:
bug1.cpp:21:11: error: use of overloaded operator '->*' is ambiguous
int i = c->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \
~^ ~~~
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int const struct A::*')
bug1.cpp:21:11: note: built-in candidate operator ->* ('struct A volatile *', 'int restrict struct A::*')
...

Still need to look at an issue (indicated as FIXME in the test case).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83650 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin-ptrtomember-ambig.cpp
0c728f1eb2e8e6e5adc2501c6fdcd87105b34d5c 09-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Fix up error reporting when object cannot be constructed
because of missing default constructor of a member.
Fixes pr5154.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83583 91177308-0d34-0410-b5e6-96231b3b80d8
efault-constructor-initializers.cpp
b5352cf949898cd42c8c5bc96a17a831b61ac2e5 08-Oct-2009 Douglas Gregor <dgregor@apple.com> Implement support for -Wunused-variable, from Oscar Bonilla!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83577 91177308-0d34-0410-b5e6-96231b3b80d8
arn-unused-variables.cpp
27d4be5b3f455275ff6b6afe5ce155d6435081d7 08-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Implement [expr.mptr.oper]p6 for '->*' operator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83562 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin-ptrtomember-overload-1.cpp
ember-pointer.cpp
6e8f550439c09f3f044d651354e297518b553712 08-Oct-2009 Anders Carlsson <andersca@mac.com> Handle MemberExprs in ResolveAddressOfOverloadedFunction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83495 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
0351a1e2e17c1edf27f90c23fbf65d8fcad995c4 07-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Fixes problem in finding visible convertion functions of a class
where matching conversion types in base classes were still visible.
Plus refactoring and cleanup.
Added a test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83485 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin-ptrtomember-overload-1.cpp
ca4fb04b5c43f866c095a3bcc14e02a150da2568 07-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> When building candidate set for built-ins; when looking for
convesion functions, look in base classes to.
(Removes a FIXME).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83472 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin-ptrtomember-overload.cpp
4657a992742862639a356352c26b4e88f995b578 07-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to implement C++ [over.built]p11 of overload resolution.
Doug, please review. There is a FIXME in the test case with a question
which is unrelated to this patch (that is, error is issued
before set of builtins are added to the candidate list).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83429 91177308-0d34-0410-b5e6-96231b3b80d8
uiltin-ptrtomember-overload.cpp
56fc0d18caf9c829647a5e3ce35197f0d7e0feee 06-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Refixed pr5086 by letting Expr::isNullPointerConstant
handle checking for a null pointer for a zero-valued
enumerator; moving the test case from CodeGen to Sema.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83350 91177308-0d34-0410-b5e6-96231b3b80d8
R5086-ambig-resolution-enum.cpp
1be8aee8745e8b814ad2f151aa214b0ef07833db 02-Oct-2009 Douglas Gregor <dgregor@apple.com> When the return type of a function is dependent, don't perform any
of the flow-control checks for falling off the end of a function,
since the return type may instantiate to void. Similarly, if a
return statement has an expression and the return type of the function
is void, don't complain if the expression is type-dependent, since
that type could instantiate to void.

Fixes PR5071.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83222 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
249ceade4942a2a5d7888541c547abeda5bb85b4 01-Oct-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to implement static casting which requires one
user-defined type conversion. Fixes PR5040.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83211 91177308-0d34-0410-b5e6-96231b3b80d8
ast-conversion.cpp
3307475eb0dd6e5d88be9392ea8247d0b6b812df 30-Sep-2009 Douglas Gregor <dgregor@apple.com> When overload resolution fails for an overloaded operator, show the
overload candidates (but not the built-in ones). We still rely on the
underlying built-in semantic analysis to produce the initial
diagnostic, then print the candidates following that diagnostic.

One side advantage of this approach is that we can perform more validation
of C++'s operator overloading with built-in candidates vs. the
semantic analysis for those built-in operators: when there are no
viable candidates, we know to expect an error from the built-in
operator handling code. Otherwise, we are not modeling the built-in
semantics properly within operator overloading. This is checked as:

assert(Result.isInvalid() &&
"C++ binary operator overloading is missing
candidates!");
if (Result.isInvalid())
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);

The assert() catches cases where we're wrong in a +Asserts build. The
"if" makes sure that, if this happens in a production clang
(-Asserts), we still build the proper built-in operator and continue
on our merry way. This is effectively what happened before this
change, but we've added the assert() to catch more flies.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83175 91177308-0d34-0410-b5e6-96231b3b80d8
opy-assignment.cpp
amespace.cpp
verloaded-builtin-operators.cpp
verloaded-operator.cpp
893f955321cdf49dd0ceaf4ff821632e9b265000 30-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Issue good diagnostics when initializing a refernce type with
a bad initializer. Fixes pr4274.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83169 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-init-ref.cpp
7a8233a69103a6eeb6602bd4a17fb5d9b7bacaad 30-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Note location of operators caused the circularity.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83153 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
c4e8321deb2bd83f734a09749460050f40ec51d1 30-Sep-2009 John McCall <rjmccall@apple.com> Detect operator-> chains of arbitrary length. Use a terrible data structure
to strike fear into the hearts of CPUs everywhere.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83133 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
4a4e345a8bf749b5462a127ecfb1f90d4a9d6ba7 30-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> self-referecing operator '->' member function was causing
infinit recursion. This patch fixes it. [13.3.1.2]-p2



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83124 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
5d64e5b6bc03462e8b7d0cd804565829afb1b508 30-Sep-2009 Douglas Gregor <dgregor@apple.com> Find operators new/delete in base classes. FIXME -= 2;


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83119 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
1070c9f7acc889336be6f80c70dc1b32622cc83d 29-Sep-2009 Douglas Gregor <dgregor@apple.com> The C++ delete expression strips cv-qualifiers from the pointed-to type. My previous fix eliminated this behavior, so bring it back again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83113 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
7605618e3b0e7c3855ca804dbe0692a89835c71a 29-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> 13.1-p3 Overloadable declarations
Parameter declarations that differ only in the presence or absence of const and/or volatile are equivalent.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83104 91177308-0d34-0410-b5e6-96231b3b80d8
unction-overloaded-redecl.cpp
verloaded-operator.cpp
9091656e423f2354e53b2b3baa95b3eb5510badc 29-Sep-2009 Douglas Gregor <dgregor@apple.com> Handle C++ delete expressions when the overloaded delete operator is a
"usual deallocation function" with two arguments. CodeGen will have to
handle this case specifically, since the value for the second argument
(the size of the allocated object) may have to be computed at run
time.

Fixes the Sema part of PR4782.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83080 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
99d6c445cc968bdf08c53a6bd4e9044bde43bdd1 28-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Multiple conversions to the same type are ambiguous but for the
purpose of overload resolution is to be treated as a uner-defined
conversion.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83004 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
2531c2d2f1e8ce35f2ce8e9539738ddf8dccb7cc 28-Sep-2009 Douglas Gregor <dgregor@apple.com> Teach Sema::isDeclInScope to handle overload sets constructed from
functions that occur in multiple declaration contexts, e.g., because
some were found via using declarations. Now, isDeclInScope will build
a new overload set (when needed) containing only those declarations
that are actually in scope. This eliminates a problem found with
libstdc++'s <iostream>, where the presence of using

In the longer term, I'd like to eliminate Sema::isDeclInScope in favor
of better handling of the RedeclarationOnly flag in the name-lookup
routines. That way, name lookup only returns the entities that matter,
rather than taking the current two-pass approach of producing too many
results and then filtering our the wrong results. It's not efficient,
and I'm sure that we aren't filtering everywhere we should be.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82954 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
dfde681bddd525fd8dcebc98865ff74682d8b833 26-Sep-2009 Anders Carlsson <andersca@mac.com> Start at NextOffset when laying out bases as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82831 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
7e41038723bf77132674f55b12f60e24e5473b33 26-Sep-2009 Anders Carlsson <andersca@mac.com> Use NextOffset when laying out a field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82828 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
0b60d9e0097e2d6a1a5e62396967e207c4a772f2 26-Sep-2009 Douglas Gregor <dgregor@apple.com> Use explicitly-specified template argument lists to help naming
explicit template specializations, when available.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82824 91177308-0d34-0410-b5e6-96231b3b80d8
emplate-specialization.cpp
1eca99b815e531eba63233c0558af0dc971387aa 25-Sep-2009 Anders Carlsson <andersca@mac.com> Even more work on empty classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82770 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
a4c6081abd5582515b110bdcb576b4b85536467b 25-Sep-2009 Anders Carlsson <andersca@mac.com> Who would have thought that empty classes were so tricky? Handle cases where an empty virtual base class needs to be moved aside because it conflicts with the first field.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82746 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
fbbce49c116aa8c8c7c0707cb6048b55f70461a9 25-Sep-2009 Anders Carlsson <andersca@mac.com> Handle array fields that contain empty structs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82744 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
6026504302763f74102592602b392cecd5ced3ae 25-Sep-2009 Anders Carlsson <andersca@mac.com> More work on empty classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82736 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
ffbdefc7a24c01a0f77425423278774796a3aa53 24-Sep-2009 Anders Carlsson <andersca@mac.com> More improvements with laying out empty bases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82682 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
1345bd2b093e78620c32f5148b1279ed290188e8 24-Sep-2009 Anders Carlsson <andersca@mac.com> More work on empty classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82679 91177308-0d34-0410-b5e6-96231b3b80d8
mpty-class-layout.cpp
96be6917e1c4ba1f4435a14c9e7c6c139571d086 24-Sep-2009 Douglas Gregor <dgregor@apple.com> Make C++ temporary-related expressions provide proper source-range information.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82665 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
51bebc83e74001ed0412d82aadae9eb247fee2d4 23-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> This patch addresses a few issues related to 8.5.3 [dcl.init.ref]
It uses a recent API to find inherited conversion functions to do
the initializer to reference lvalue conversion (and removes a FIXME).
It issues the ambiguity diagnostics when multiple conversions are found.
WIP.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82649 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-init-ref.cpp
a441283c601588ebeb8aeb0ac630186a7fd31b72 23-Sep-2009 Gabor Greif <ggreif@gmail.com> fix typo in file name

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82623 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-conversions.cpp
mbig-user-defined-convesions.cpp
b1663d050744ab3a4987df2d3a394f3ae0468435 23-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Produce detailed diagnostics when overload
resolution failed to select a candidate due to
ambiguity in type conversion function selection.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82596 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-convesions.cpp
ac18b2e3af8d0c5304f74e362a1d4207363e4c94 23-Sep-2009 Anders Carlsson <andersca@mac.com> Cast the array size expr to a size_t

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82594 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
455acd9452f5b2a69d7ab8e53f733e46b500473a 22-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Issue good ambiguity diagnostic when convesion fails.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82565 91177308-0d34-0410-b5e6-96231b3b80d8
mbig-user-defined-convesions.cpp
56cfdc183e6012201c7e0a45b04fe74fd1ab51e4 22-Sep-2009 Anders Carlsson <andersca@mac.com> If we already set a primary base, don't set it to the first nearly empty base class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82563 91177308-0d34-0410-b5e6-96231b3b80d8
rimary-base.cpp
f515b2268f829adfbfdb751f54d102b53ed0285c 18-Sep-2009 Daniel Dunbar <daniel@zuster.org> Disable questionable code for handling isNullPointerConstant on value dependent
expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82217 91177308-0d34-0410-b5e6-96231b3b80d8
alue-dependent-exprs.cpp
3f180c618970d1369726b9229c0370617e05c7cb 17-Sep-2009 Daniel Dunbar <daniel@zuster.org> Fix two crashes on value dependent expressions (shift and null-pointer check).
- Doug, please check.

- PR4940.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82129 91177308-0d34-0410-b5e6-96231b3b80d8
alue-dependent-exprs.cpp
b237fd6f36145c023ed12fe83f21727cbe197158 17-Sep-2009 Anders Carlsson <andersca@mac.com> Temporary band-aid for handling empty classes somewhat better.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82124 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
0de51bc6122f6cee0e8081d65dfcc7d500da1c6f 16-Sep-2009 Anders Carlsson <andersca@mac.com> Improve handling of vector casts in C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82072 91177308-0d34-0410-b5e6-96231b3b80d8
ector-casts.cpp
8b915e7048b20b0feb60ec90c365a8eb68360cd4 16-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> 1) don't do overload resolution in selecting conversion
to pointer function for delete expression. 2)
Treat type conversion function and its 'const' version
as identical in building the visible conversion list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81930 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-delete-expr.cpp
irect-initializer.cpp
34acd3e62c4ca3a2904f2515ff2a1a94c7d27b01 15-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Issue good diagnostics when initialization failes due to
ambiguity in type conversion function selection.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81898 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
irect-initializer.cpp
f652793d4d32cc71b5ee2167069cbd363baa75de 15-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Perform overload resolution when selecting a pointer conversion
function for delete of a class expression and issue
good diagnostic when result is ambiguous.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81870 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-delete-expr.cpp
ew-delete.cpp
78cf9a26d27349a7b9ae83a0b7d5451571b9b41e 15-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Issue a good diagnostics when attempt to select
a type convesion function results in ambiguity.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81812 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
1d524c3dde58e4402aab4165e85e9ae6f15f5023 15-Sep-2009 Anders Carlsson <andersca@mac.com> Diagnose taking the address of a bit-field inside a conditional operator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81808 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
60d923125a1f267403f1b62fa9a15d702e557dbf 15-Sep-2009 Douglas Gregor <dgregor@apple.com> Slightly improve the test for partial ordering of overloaded function
templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81806 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
d173b207a032b39d35727877fc794aa2f52dc290 15-Sep-2009 Douglas Gregor <dgregor@apple.com> Test function template partial ordering when resolving the address of
an overloaded function (template).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81804 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
b191e2dda9f4dc033cb21f9625a78fe80d4ac105 14-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Used visible conversion function api to do overload
resolution of type conversion functions in base and
current class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81784 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
d7c3e4e9d72a4080664f10c1a1e6160e0de8be76 14-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Removed couple of FIXME comments from test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81774 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-delete-expr.cpp
76e2b710a92bceb9575a81db181109664946986e 14-Sep-2009 Sam Weinig <sam.weinig@gmail.com> Add support for -Wchar-subscripts. Fixes PR4801.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81747 91177308-0d34-0410-b5e6-96231b3b80d8
arn-char-subscripts.cpp
2c59d3c19715cb318a0a5939c735b8345d14d281 13-Sep-2009 Anders Carlsson <andersca@mac.com> Perform the C++ specific semantic checks of a function declaration after it's been merged with the previous declaration. This ensures that getPreviousDecl() will have the right value when ActOnConversionDeclarator is called.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81720 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
8195bc932d27e21be46b9a1f8ce268ebd419246b 13-Sep-2009 Anders Carlsson <andersca@mac.com> CXXMethodDecl::isVirtual needs to check the canonical declaration. Fixes PR4878.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81715 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
6250921cc5bd3493a0d99fa2c32ec9716767a965 12-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> More work toward having an access method for visible
conversion functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81618 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-delete-expr.cpp
5346278f81930e7fd0545bbbb2fc217c6921b109 11-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to build visible conversion function list lazily and make its
first use in calling the conversion function on delete statements.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81576 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-delete-expr.cpp
6cc1518b9f15ca846b8c35518eeae9557935678d 11-Sep-2009 Douglas Gregor <dgregor@apple.com> Cleanup and test C++ default arguments. Improvements include:

- Diagnose attempts to add default arguments to templates (or member
functions of templates) after the initial declaration (DR217).
- Improve diagnostics when a default argument is redefined. Now, the
note will always point at the place where the default argument was
previously defined, rather than pointing to the most recent
declaration of the function.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81548 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
ed90c4ee8cfed90be92741313e1715d308ed2fe3 11-Sep-2009 Anders Carlsson <andersca@mac.com> Fix PR4878 for real.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81507 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
043cad21b78c6b02597cdc7b6ead32388e27ebc7 11-Sep-2009 Douglas Gregor <dgregor@apple.com> Diagnose VLAs as an error in C++.

Also, treat the GNU __null as an integral constant expression to match
GCC's behavior.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81490 91177308-0d34-0410-b5e6-96231b3b80d8
99.cpp
f299124fe491879fed48f611f6f299382d114dd4 11-Sep-2009 Douglas Gregor <dgregor@apple.com> Eliminate some "default"s in CheckICE.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81477 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
e30572ae31b4b1875d7a6d4375b5c6b3a1caf9e3 11-Sep-2009 Anders Carlsson <andersca@mac.com> Look for overloaded arrow operators in base classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81475 91177308-0d34-0410-b5e6-96231b3b80d8
rrow-operator.cpp
0f728566b9fc1a013be3c0f3ca43a074307dc081 10-Sep-2009 Anders Carlsson <andersca@mac.com> Don't check use of a member function declaration used if the member function is virtual and the member reference expression doesn't explicitly qualify it. Fixes PR4878.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81460 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
59600d80b7e34e819cd25dd67f661aa1f3d9099d 10-Sep-2009 Douglas Gregor <dgregor@apple.com> static_cast, reinterpret_cast, and const_cast can all be used in C++
integral constant expressions (for conversions to integer types,
naturally). I don't *think* that const_casts will ever get to this
point, but I also can't convince myself that they won't... so I've
taken the safe route and allowed the ICE checking code to look at
const_cast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81453 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
e942bbe02b6fb332d1f13d38c6e1980b416cf89a 10-Sep-2009 Douglas Gregor <dgregor@apple.com> When performing unqualified name lookup into a DeclContext, also look into
all of the parent DeclContexts that aren't represented within the
Scope chain. This fixes some name-lookup problems in out-of-line
definitions of members of nested classes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81451 91177308-0d34-0410-b5e6-96231b3b80d8
ember-name-lookup.cpp
9cd9f3f55d22f34f1d69db8bfc2735c4e1e082c3 10-Sep-2009 Douglas Gregor <dgregor@apple.com> For a C++ delete expression where the operand is of class type that
has a single conversion to pointer-to-object type, implicitly convert
to that pointer-to-object type (C++ [expr.delete]p1).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81401 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
39da0b8145eaec7da7004f9b3645c5c9f4f63b1d 10-Sep-2009 Douglas Gregor <dgregor@apple.com> Improve handling of initialization by constructor, by ensuring that
such initializations properly convert constructor arguments and fill
in default arguments where necessary. This also makes the ownership
model more clear.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81394 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
ccess-control-check.cpp
ttr-format.cpp
lass-base-member-init.cpp
onstructor-initializer.cpp
opy-constructor-error.cpp
efault-assignment-operator.cpp
efault-constructor-initializers.cpp
num.cpp
llegal-member-initialization.cpp
nherit.cpp
ember-expr-static.cpp
tatic-initializers.cpp
arn-reorder-ctor-initialization.cpp
3dab34a7cb5e2ad9c2311fc44b3d3b7ebb540992 09-Sep-2009 Douglas Gregor <dgregor@apple.com> Allow a declaration of an array to complete a prior, incomplete
declaration of that array in C++.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81309 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-array-member.cpp
d74d4149f759b8abec15fb8163a4206e8c7068c8 08-Sep-2009 Anders Carlsson <andersca@mac.com> Handle variadic constructors better. Share code between BuildCXXConstructExpr and BuildCXXTemporaryObjectExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81181 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
d851b37a331a7bc0047922ea9244aff85470987e 07-Sep-2009 Anders Carlsson <andersca@mac.com> Check that the destination type of a static_cast expression is a complete type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81151 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast-complete-type.cpp
a78c5c34fbd20fde02261c3f3e21933cd58fcc04 04-Sep-2009 Douglas Gregor <dgregor@apple.com> If a destructor is referenced or a pseudo-destructor expression is
formed without a trailing '(', diagnose the error (these expressions
must be immediately called), emit a fix-it hint, and fix the code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81015 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
a71d819bb8f50c28938db0f2867d3fb6e2ce5910 04-Sep-2009 Douglas Gregor <dgregor@apple.com> Implement AST, semantics, and CodeGen for C++ pseudo-destructor
expressions, e.g.,

p->~T()

when p is a pointer to a scalar type.

We don't currently diagnose errors when pseudo-destructor expressions
are used in any way other than by forming a call.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81009 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
b117a60f7684261ddc8c8f14e8ef8a827e6af814 04-Sep-2009 Douglas Gregor <dgregor@apple.com> Introduce an egregious hack to fix PR4828.

The problem this change addresses is that we treat __is_pod and
__is_empty as keywords in C++, because they are built-in type traits
in GCC >= 4.3. However, GNU libstdc++ 4.2 (and possibly earlier
versions) define implementation-detail struct templates named __is_pod
and __is_empty.

This commit solves the problem by recognizing

struct __is_pod

and

struct __is_empty

as special token sequences. When one of these token sequences is
encountered, the keyword (__is_pod or __is_empty) is implicitly
downgraded to an identifier so that parsing can continue. This is an
egregious hack, but it has the virtue of "just working" whether
someone is using libstdc++ 4.2 or not, without the need for special
flags.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80988 91177308-0d34-0410-b5e6-96231b3b80d8
ibstdcxx_is_pod_hack.cpp
c68afe2cbe7f875a9243c411077602fb5f5dc74b 03-Sep-2009 Douglas Gregor <dgregor@apple.com> Improve template instantiation for member access expressions that
involve qualified names, e.g., x->Base::f. We now maintain enough
information in the AST to compare the results of the name lookup of
"Base" in the scope of the postfix-expression (determined at template
definition time) and in the type of the object expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80953 91177308-0d34-0410-b5e6-96231b3b80d8
ual-id-test.cpp
80545ad0f9b8e52177a8c37bd140bae0ffbd0cc6 03-Sep-2009 Fariborz Jahanian <fjahanian@apple.com> Issue diagnostics in variety of situations involving
reference/const data members when user has declared
the constructor. This necessitated some non-minor
refactoring.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80934 91177308-0d34-0410-b5e6-96231b3b80d8
llegal-member-initialization.cpp
a38c687ef5354678b9d76a7b29354159f2b83736 03-Sep-2009 Douglas Gregor <dgregor@apple.com> Improved handling for dependent, qualified member access expressions, e.g.,

t->Base::f

where t has a dependent type. We save the nested-name-specifier in the
CXXUnresolvedMemberExpr then, during instantiation, substitute into
the nested-name-specifier with the (transformed) object type of t, so
that we get name lookup into the type of the object expression.

Note that we do not yet retain information about name lookup into the
lexical scope of the member access expression, so several regression
tests are still disabled.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80925 91177308-0d34-0410-b5e6-96231b3b80d8
ual-id-test.cpp
2dd078ae50ff7be1fb25ebeedde45e9ab691a4f0 03-Sep-2009 Douglas Gregor <dgregor@apple.com> Rewrite of our handling of name lookup in C++ member access expressions, e.g.,

x->Base::f

We no longer try to "enter" the context of the type that "x" points
to. Instead, we drag that object type through the parser and pass it
into the Sema routines that need to know how to perform lookup within
member access expressions.

We now implement most of the crazy name lookup rules in C++
[basic.lookup.classref] for non-templated code, including performing
lookup both in the context of the type referred to by the member
access and in the scope of the member access itself and then detecting
ambiguities when the two lookups collide (p1 and p4; p3 and p7 are
still TODO). This change also corrects our handling of name lookup
within template arguments of template-ids inside the
nested-name-specifier (p6; we used to look into the scope of the
object expression for them) and fixes PR4703.

I have disabled some tests that involve member access expressions
where the object expression has dependent type, because we don't yet
have the ability to describe dependent nested-name-specifiers starting
with an identifier.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80843 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ual-id-test.cpp
d7eff68dbbbc6b3f8dfd44f6a833c2b320a96e9a 02-Sep-2009 John McCall <rjmccall@apple.com> Ensure that the tag decls of friend decls aren't added to the friending class's
decl list, and remove some workarounds that were due to this. Thanks to Eli for
pointing this out and providing the test case.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80745 91177308-0d34-0410-b5e6-96231b3b80d8
riend-class-nodecl.cpp
c4c65f2b696cf7a29e31f98fad6b00493f724217 01-Sep-2009 Douglas Gregor <dgregor@apple.com> Move C++ test over to CodeGenCXX, since it requires CodeGen to reproduce

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80672 91177308-0d34-0410-b5e6-96231b3b80d8
verload-binop-implicitconvert.cpp
a6f0f9d589a06737707fe914e06bd6d4bfae0997 31-Aug-2009 Douglas Gregor <dgregor@apple.com> Support explicit C++ member operator syntax, from James Porter!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80608 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-member-expr.cpp
ember-operator-expr.cpp
a31d5f70e02d89631d07be162796a2d6bd74e561 30-Aug-2009 Anders Carlsson <andersca@mac.com> More missing member goodness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80491 91177308-0d34-0410-b5e6-96231b3b80d8
issing-members.cpp
639bfc7b1e55e01dd38d2ef399366b5efa55a9a7 30-Aug-2009 Anders Carlsson <andersca@mac.com> Improve missing error messages as suggested by Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80489 91177308-0d34-0410-b5e6-96231b3b80d8
issing-members.cpp
05180afbf4b55c8ee8894df0bb77ac41ea3a41fa 30-Aug-2009 Anders Carlsson <andersca@mac.com> Use DiagnoseMissingMember for UsingDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80470 91177308-0d34-0410-b5e6-96231b3b80d8
issing-members.cpp
f4d84b663ef7dda959cbe45561d90e59760cbb74 30-Aug-2009 Anders Carlsson <andersca@mac.com> Improve diagnostics for missing members. This renames the err_typecheck_no_member to err_typecheck_no_member_deprecated. The idea is that err_typecheck_no_member_deprecated should be phased out and any call sites that reference it should call DiagnoseMissingMember instead.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80469 91177308-0d34-0410-b5e6-96231b3b80d8
issing-members.cpp
eab975dce83fcf6a7fa8fc9379944d4b1aaf1a00 29-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Fix a couple issues with parsing invalid nested-name-specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80421 91177308-0d34-0410-b5e6-96231b3b80d8
nvalid-template-specifier.cpp
598da5b01fa9e205f55db8b3b5cb20abec2d74cf 29-Aug-2009 Anders Carlsson <andersca@mac.com> CreateDeclRefExprs that point to UnresolvedUsingDecls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80413 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
203cb71998a39a9d01a29db135454a9e7f402235 29-Aug-2009 Anders Carlsson <andersca@mac.com> Add another check for UnresolvedUsingDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80412 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
fdc39199c91e6246ac3f4da10eee96a369ce3e1a 29-Aug-2009 Douglas Gregor <dgregor@apple.com> Make sure we actually found a redeclaration before complaining about attributes added to a redeclaration in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80403 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-after-definition.cpp
36ef0787532ef3ecfc8ecd5e9661f5b2f87a280f 28-Aug-2009 Anders Carlsson <andersca@mac.com> Check for UnresolvedUsingDecl when determining if a declaration is a redeclaration or not.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80383 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
faccd72e2448b552f17992eaba6cfe12ec497e58 28-Aug-2009 Anders Carlsson <andersca@mac.com> Fix this for real.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80377 91177308-0d34-0410-b5e6-96231b3b80d8
ast-explicit-ctor.cpp
83b534cb4329a49e265776dba3e87dc7032174be 28-Aug-2009 Anders Carlsson <andersca@mac.com> Allow explicit ctors for casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80374 91177308-0d34-0410-b5e6-96231b3b80d8
ast-explicit-ctor.cpp
bbf306bd1d3e674edf40c692a5693a475e961a57 28-Aug-2009 Anders Carlsson <andersca@mac.com> When doing overload resolution, expressions that are value dependent but not type dependent and of integral type should not be treated as null pointer constants.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80369 91177308-0d34-0410-b5e6-96231b3b80d8
verload-value-dep-arg.cpp
0dde18e5a713bc186062ca1ebc9967500b07faee 28-Aug-2009 Anders Carlsson <andersca@mac.com> Instantiate unresolved using declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80366 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-templates.cpp
8a5ae2401645788144c0ae769a2fb899866801f5 28-Aug-2009 Douglas Gregor <dgregor@apple.com> When looking for overloaded member operators, make sure to instantiate
class template specializations (when possible) and look into base
classes. Thanks to Eli for the test case!

FIXME -=1.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80302 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
e74b32a328b73fbce7944efdb3861c4f09755fcf 27-Aug-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Extend the exception spec test even further. Now I need to implement this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80276 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
a8880ddc02b62410b652afccfb6b9554a089e04f 27-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Don't create a junk file in the source directory.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80274 91177308-0d34-0410-b5e6-96231b3b80d8
verload-binop-implicitconvert.cpp
e7624a75b74633ff9c54d1c60ace2707fe298008 27-Aug-2009 Anders Carlsson <andersca@mac.com> Add a BuildCXXTemporaryObjectExpr and use it so default arguments will be instantiated correctly for temporary object expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80206 91177308-0d34-0410-b5e6-96231b3b80d8
efault-argument-temporaries.cpp
2cf738f1944d1cc724ea7561b84440a3a1059e45 26-Aug-2009 Anders Carlsson <andersca@mac.com> More support for pseudo dtors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80129 91177308-0d34-0410-b5e6-96231b3b80d8
seudo-destructors.cpp
c3384cba391f9140a46db0caa061649b633f65bc 26-Aug-2009 Douglas Gregor <dgregor@apple.com> Fix for overloaded binary operators whose operands need implicit
conversions, from Sylvere Teissier!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80112 91177308-0d34-0410-b5e6-96231b3b80d8
verload-binop-implicitconvert.cpp
4fb77202ceef22a572cf4357f380b08f6bcc5c36 25-Aug-2009 Anders Carlsson <andersca@mac.com> Handle the implicit 'this' parameter for format attributes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79987 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-format.cpp
a24eb4ef63d5860a5a02f7532e56e84283782984 24-Aug-2009 Douglas Gregor <dgregor@apple.com> Skip transparent contexts when performing C++ name lookup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79931 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
20b3e9918cf7d7845c920baabc4fb2f1ac0ee1d2 24-Aug-2009 Douglas Gregor <dgregor@apple.com> Implement support for equality comparisons (!=, ==) of member
pointers, by extending the "composite pointer type" logic to include
member pointer types.

Introduce test cases for member pointer comparisons, including those
that involve the builtin operator candidates implemented earlier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79925 91177308-0d34-0410-b5e6-96231b3b80d8
omposite-pointer-type.cpp
onditional-expr.cpp
ember-pointer.cpp
verloaded-builtin-operators.cpp
a1d71aea847a50b3acbd187d2ae9e5c1ead0f4e2 24-Aug-2009 Douglas Gregor <dgregor@apple.com> Top-level semicolons are allowed in C++0x. Fixes PR4755.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79912 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
onstructor.cpp
1d954f6a0057cb55a3a5d483904a3c57d03c996f 15-Aug-2009 Eli Friedman <eli.friedman@gmail.com> Implement __is_empty. Patch by Sean Hunt.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79143 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
fb7ef75a28af7b6a7f666df2a5db53cf90d957b1 08-Aug-2009 Anders Carlsson <andersca@mac.com> getFunctionLevelDeclContext needs to get the previous DeclContext if EnterDeclaratorContext has been called. Fixes PR4694. (Doug, please review)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78480 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
0f44b5a85e612e1644d688be93151b22f08604a7 08-Aug-2009 Anders Carlsson <andersca@mac.com> Make sure to diagnose use of declarations in the case where we create an implicit CXXThisExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78474 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-deprecated.cpp
52ab92bee00eb14e38dcbefc091d6b9aa5157506 06-Aug-2009 Fariborz Jahanian <fjahanian@apple.com> After reporting ill-formed copy constructor(12.8.p3)
don't recurs and crash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78323 91177308-0d34-0410-b5e6-96231b3b80d8
opy-constructor-error.cpp
fe85cedd58df7daed29201703cfb8806e12876d0 06-Aug-2009 Douglas Gregor <dgregor@apple.com> Support nested-name-specifiers for C++ member access expressions, e.g.,

this->Base::foo

from James Porter!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@78278 91177308-0d34-0410-b5e6-96231b3b80d8
ual-id-test.cpp
4dabe96fc9c5333bbcb6e36114bca95160967e26 01-Aug-2009 Daniel Dunbar <daniel@zuster.org> Ok, ok, I give in. Fix tests for unused result warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77780 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
b7b6c4c6c72f817df4485329221b4de721a62340 29-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Fixed test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77506 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
96e2fa97ea929f69778c66dd42e426330d893e7a 29-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Some refactoring of member access for
performace sake. Also added a test case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77502 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-control-check.cpp
c447aba04527a71d254b151f79f444d1cbe83ce9 29-Jul-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Check for identical types in C++ catch expression. Patch by Erik Verbruggen.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77475 91177308-0d34-0410-b5e6-96231b3b80d8
nreachable-catch-clauses.cpp
ef0cb8e62d090ad88a01ca9fa89e48d7416f0ac7 29-Jul-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make functional-style casts emit correct messages, and fix a crash-on-invalid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77451 91177308-0d34-0410-b5e6-96231b3b80d8
unctional-cast.cpp
227aad58cc46c15dfc3fee2244d4a56d8c003d8f 28-Jul-2009 Anders Carlsson <andersca@mac.com> Add two more tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77330 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
3c38aab8bbcb8dbc80081616e74f64b9a47edd25 27-Jul-2009 Benjamin Kramer <benny.kra@googlemail.com> fix test (broken in r77224)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77241 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
9cc11e70031365972424b43f439021d88096b146 25-Jul-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement C++ semantics for C-style and functional-style casts. This regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators.
Add custom conversions to static_cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77076 91177308-0d34-0410-b5e6-96231b3b80d8
style-cast.cpp
cl_ambig_res.cpp
ecl-expr-ambiguity.cpp
tatic-cast.cpp
8bf0ccd4c7e23a329f150323e2f9b474ff15c66c 25-Jul-2009 Daniel Dunbar <daniel@zuster.org> Make having no RUN line a failure.

Doug, please look at decltype-crash and instantiate-function-1.mm, I'm not sure
if they are actually testing the right thing / anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77070 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-crash.cpp
0eb7cff82f943ebcb14f1c9a2020a83a030a0893 24-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Fixes broken test by accident.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77001 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
7252f5110de3163a465aa50a2114c1fef9e848e8 24-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> More Sema check for constructor's member initializer along
with type conversion to fix ir-gen crash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77000 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
5e03f9ea8174ae588c5e69ec6b5ef4c68f8fd766 24-Jul-2009 Douglas Gregor <dgregor@apple.com> This patch fixes the implementations of the __has_trivial_destructor
and __has_trivial_constructor builtin pseudo-functions and
additionally implements __has_trivial_copy and __has_trivial_assign,
from John McCall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76916 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
87595e46ccd61c9b7c08074c2c64b66b5c0fc694 24-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Diagnose when base classes and members to be intialized
with constructors don't have a matching constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76913 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
d7b27e1c17d40c72a1ccf8868315bf0c5271aa54 23-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Add constructor used to initialize base/member in
CXXBaseOrMemberInitializer AST node. Needed by
its clients to do the initialization.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76826 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
b1682c50d26e0f12130d35b7b9b77d40542c4540 23-Jul-2009 Mike Stump <mrs@apple.com> Add warning for falling off the end of a function that should return a
value. This is on by default, and controlled by -Wreturn-type (-Wmost
-Wall). I believe there should be very few false positives, though
the most interesting case would be:

int() { bar(); }

when bar does:

bar() { while (1) ; }

Here, we assume functions return, unless they are marked with the
noreturn attribute. I can envision a fixit note for functions that
never return normally that don't have a noreturn attribute to add a
noreturn attribute.

If anyone spots other false positives, let me know!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76821 91177308-0d34-0410-b5e6-96231b3b80d8
eturn.cpp
d33133cdc1af466f9c276249b2621be03867888b 22-Jul-2009 Eli Friedman <eli.friedman@gmail.com> Fix the parsing of default arguments for inline member function
definitions.

I'm not very familiar with this code, so please review.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76796 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
d1969d803cfcc65f1c334df4cc89c7fdd33ee4c9 22-Jul-2009 Mike Stump <mrs@apple.com> Prep for new warning.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76709 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
arn-for-var-in-else.cpp
6347f420ee0b097c0e642dc6c51afee5f1b14235 21-Jul-2009 Eli Friedman <eli.friedman@gmail.com> Misc fixes for -Wreorder:

1. Make it work correctly with anonymous unions.
2. Don't compute it if the warning isn't enabled.
3. Optimize the algorithm slightly to make it linear time in the
case where we don't produce any warnings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76630 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reorder-ctor-initialization.cpp
1e054213f8416a48866105216ad4a45f1e7c24de 21-Jul-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Consider nested-names as part of the declarator when resolving an ambiguous statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76583 91177308-0d34-0410-b5e6-96231b3b80d8
cl_ambig_res.cpp
c19f959d7fa5303f2fff5fa7a4968361cb7ef068 21-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Diagnose when a destructor uses a unrelated class type as its name.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76577 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
f37006bc8a9d398d40d6ce329f023ed1a92fe484 21-Jul-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix a crash that occurs in this C++ case:

struct foo {
static bool value;
};
bool (foo::value); // crash because of parens

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76538 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
76ed9cb1d7398bb721cb9df67b3004c14dae8aa8 21-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Improve message for bad destructor decl. Per Doug's comment.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76494 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
d33c868d386ef47c2942e2dbff0d9955a8591fa9 20-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Issue a more descriptive diagnostics when mis-declaring
a destructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76436 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
74cbe226207fd101623638dadfa7fbada04ff2a6 19-Jul-2009 Anders Carlsson <andersca@mac.com> Handle layout of non-virtual base classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76348 91177308-0d34-0410-b5e6-96231b3b80d8
lass-layout.cpp
726212f41bac77dc7f3352bc7047615fa0cd9e58 18-Jul-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Enhance testing of overriding exception specs for inaccessible base exceptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76317 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
5abd1b0d237b42a7d617ac577ab0f4560907d6ef 18-Jul-2009 Chris Lattner <sabre@nondot.org> This takes a long time to crash, just disable it for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76263 91177308-0d34-0410-b5e6-96231b3b80d8
emplate-specialization.cpp
9685aeef5f73c9d00829bd9dcf449500fdea3086 12-Jul-2009 Daniel Dunbar <daniel@zuster.org> Remove excessive use of Carbon.h / Cocoa.h in clang tests.
- These kinds of "shotgun" tests are very slow, and do not belong in the
regression suite. If these kinds of tests are regarded to have value, they
should be added to the LLVM test-suite.

- I would actually like to remove all of these tests, but I left Sema/carbon.c
and SemaObjC/cocoa.m...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75399 91177308-0d34-0410-b5e6-96231b3b80d8
arbon.cpp
3591b1ae0a48e7a5ddc878bf334165ff1aaa56fc 11-Jul-2009 Anders Carlsson <andersca@mac.com> Fix a test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75327 91177308-0d34-0410-b5e6-96231b3b80d8
uto-cxx0x.cpp
4e579922ada4e19618710878c32543322f86c9c8 10-Jul-2009 Anders Carlsson <andersca@mac.com> Fix type of 'this' and add a decltype test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75291 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-this.cpp
40c072f44ff081293f79909ecc518af23938108e 10-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to build list of inherited virtual base classes
in their order of construction for each class and use it
to to check on propery order of base class construction
under -Wreorder option.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75270 91177308-0d34-0410-b5e6-96231b3b80d8
arn-reorder-ctor-initialization.cpp
d5940ce01c5f6235c88a8b92e80b86e5b5abe212 10-Jul-2009 Anders Carlsson <andersca@mac.com> Fix another decltype crash.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75175 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-crash.cpp
eb96e1275206b888eee484aac8b1b693417c6521 09-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Sema check on out of order object initialization of
class object's base and members under -Wreorder flag.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75168 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
arn-reorder-ctor-initialization.cpp
5e09d4c96dc2846cc1fc75f80f5632612247354b 09-Jul-2009 Anders Carlsson <andersca@mac.com> Use getDeclName in DefineImplicitOverloadedAssign as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75152 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
5eda81624ff3b9f617fa377f43d89f36741460a7 09-Jul-2009 Anders Carlsson <andersca@mac.com> Pass the DeclName to the diagnostic builder so that member names will be quoted correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75150 91177308-0d34-0410-b5e6-96231b3b80d8
efault-constructor-initializers.cpp
69be8d60ded8bbfbd30facf0590c97920a074f46 08-Jul-2009 Douglas Gregor <dgregor@apple.com> Improve argument-dependent lookup to find associated classes and
namespaces based on the template arguments of a class template
specialization type.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74993 91177308-0d34-0410-b5e6-96231b3b80d8
asic_lookup_argdep.cpp
23c7d061367dd2fc1631e867cffc3d6aae24e799 07-Jul-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement checking of exception spec compatibility for overriding virtual functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74943 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
3292d5ce510061ea50152f53b7ab462b622176f4 07-Jul-2009 Anders Carlsson <andersca@mac.com> Some (most) type trait expressions require that the argument passed in is a complete type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74937 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits-incomplete.cpp
675431d5a8b6aed1bd7322aa2da5cd8eb0ae76b7 06-Jul-2009 Douglas Gregor <dgregor@apple.com> Parsing fix for out-of-line constructors, from Piotr Rak

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74833 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
a34267595534a72703290153a6f7e3da1adcec59 06-Jul-2009 Eli Friedman <eli.friedman@gmail.com> Fix for PR4502: add calculation of the integer conversion rank for
wchar_t.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74808 91177308-0d34-0410-b5e6-96231b3b80d8
char_t.cpp
4994d2d50ceacdc8908f750c55589c0a20942a0a 04-Jul-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Catch function redeclarations with incompatible exception specifications.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74787 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
bcfad54a43e5570e09daddd976bd4545933e75b1 01-Jul-2009 Fariborz Jahanian <fjahanian@apple.com> Patch to support optional nested-name-specifier in in ctor-initializer
list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74571 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
5ac3dfc24bd2d8c5c0d9955f5de33c97e6aaaadf 30-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> Diagnose multiple initialization of anonymous union
fields in the ctor-initializer list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74554 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
9da7201adeab345fc7da72bcfcf30e11774fb8c4 30-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> More diagnostics related to initialization of direct bases
in ctor-initializer list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74541 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
8d4655d3b966da02fe0588767160448594cddd61 30-Jun-2009 Anders Carlsson <andersca@mac.com> Make an error message more clear.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74481 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
47deacfa43625c6cc1b2008a0396ccb3af725fde 30-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> A more detailed diagnosis of ill-formed ctor-initializer
list.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74480 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
af017e682918f7a1a95ff08d9ab7ae3426436ca3 30-Jun-2009 Anders Carlsson <andersca@mac.com> Improvements to decltype. We now don't crash anymore when the expr is an overloaded function decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74472 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-overloaded-functions.cpp
7881a0565893f1da6faafbd86377f5b50e4376a5 30-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> Diagnose multiple initialzation of data-member/base
in the ctor-initializer list. More to come.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74465 91177308-0d34-0410-b5e6-96231b3b80d8
lass-base-member-init.cpp
0c6139d0c2497c4e8780340e0dc097de041f248e 27-Jun-2009 Anders Carlsson <andersca@mac.com> Make it possible for using decls to point to operators. Fixes PR4441.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74362 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-pr4441.cpp
e89d15944dd3be750a09805ad21222d2fa9321fa 26-Jun-2009 Anders Carlsson <andersca@mac.com> Implement enough of the 'auto' keyword so we can claim to support N2546.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74307 91177308-0d34-0410-b5e6-96231b3b80d8
uto-cxx0x.cpp
uto-cxx98.cpp
b78d833b12f7c4baab138f305f72efd49455a3f9 26-Jun-2009 Chris Lattner <sabre@nondot.org> Improve error recovery in C++: when we hit 'implicit int' cases in C++,
these are usually because the parser was thoroughly confused. In addition
to typing the value being declared as an int and hoping for the best, we
mark the value as invalid so we don't get chains of errors when it is
used downstream. In C, implicit int actually is valid, so typing the thing
as int is good and marking it invalid is bad. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74266 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
c8e27cc402043ec86c1698c09e4ee9e415b16207 26-Jun-2009 Chris Lattner <sabre@nondot.org> fix PR4452, a crash on invalid. The error recovery is still terrible in this case
but at least we don't crash :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74264 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
bc13ab2bc75bd997a2a40e371f50a4c456d8ee69 26-Jun-2009 Anders Carlsson <andersca@mac.com> Fix another assert related to using decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74262 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-1.cpp
8b50d01949c649fbe89ea83f76e5f445170c7d26 26-Jun-2009 Anders Carlsson <andersca@mac.com> When creating LookupResults, see through UsingDecls. Fixes PR4450.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74258 91177308-0d34-0410-b5e6-96231b3b80d8
sing-decl-pr4450.cpp
87471f5b64783c52e01e7accc1b123560b52bf35 26-Jun-2009 Anders Carlsson <andersca@mac.com> Fix PR4448.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74257 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-pr4448.cpp
a1fbe8611694835a647811b97e56ec62d504110a 26-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> Test case for my last patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74216 91177308-0d34-0410-b5e6-96231b3b80d8
efault-assignment-operator.cpp
e53060fa78ad7e98352049f72787bdb7543e2a48 26-Jun-2009 Douglas Gregor <dgregor@apple.com> Improved semantic analysis and AST respresentation for function
templates.

For example, this now type-checks (but does not instantiate the body
of deref<int>):

template<typename T> T& deref(T* t) { return *t; }

void test(int *ip) {
int &ir = deref(ip);
}

Specific changes/additions:
* Template argument deduction from a call to a function template.
* Instantiation of a function template specializations (just the
declarations) from the template arguments deduced from a call.
* FunctionTemplateDecls are stored directly in declaration contexts
and found via name lookup (all forms), rather than finding the
FunctionDecl and then realizing it is a template. This is
responsible for most of the churn, since some of the core
declaration matching and lookup code assumes that all functions are
FunctionDecls.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74213 91177308-0d34-0410-b5e6-96231b3b80d8
emplate-specialization.cpp
a07c33e64e1169e4261f7748c7f9191091a3ad2e 25-Jun-2009 Anders Carlsson <andersca@mac.com> Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74175 91177308-0d34-0410-b5e6-96231b3b80d8
ecltype-pr4444.cpp
44bc2d53ebf1b7ad7439a0f73aba3d00a462d63a 23-Jun-2009 Douglas Gregor <dgregor@apple.com> Make sure that argument-dependent lookup looks into the global scope
when it should.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73992 91177308-0d34-0410-b5e6-96231b3b80d8
asic_lookup_argdep.cpp
c1005ac71f48ac8637ff1193a2ad9d6eb67fcf3d 22-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> Fixed text of a diagnostics.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73885 91177308-0d34-0410-b5e6-96231b3b80d8
efault-constructor-initializers.cpp
3da83eb7bcfa6bd476ab804ecb6cf755b39a6f92 20-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> Made improvements in c++'s object model patch on Doug's review.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73833 91177308-0d34-0410-b5e6-96231b3b80d8
efault-constructor-initializers.cpp
efault-contructor-initializers.cpp
9cfbe48a7a20a217fdb2920b29b67ae7941cb116 20-Jun-2009 Douglas Gregor <dgregor@apple.com> Parsing and AST support for using declarations, from John Thompson!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73812 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
f8dcb866d344aa9355595e14c429852830b63095 19-Jun-2009 Fariborz Jahanian <fjahanian@apple.com> Patch for implementation of C++'s object model. This is
work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73782 91177308-0d34-0410-b5e6-96231b3b80d8
efault-contructor-initializers.cpp
5e300d1a8e37f24e71f8cf204b982f20f85cf91a 12-Jun-2009 Anders Carlsson <andersca@mac.com> It's an error to use a function declared in a class definition as a default argument before the function has been declared.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73234 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
3c94374c4b7a3ce800bf2b991518d61b04b67f21 11-Jun-2009 Eli Friedman <eli.friedman@gmail.com> Move test to be with the other typename tests.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73178 91177308-0d34-0410-b5e6-96231b3b80d8
ypename-expression.cpp
2e0cdb4e5442c2f1976dcf8f304bfa6b5f90f728 11-Jun-2009 Eli Friedman <eli.friedman@gmail.com> PR4364: fix parsing 'typename' in an expression.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73177 91177308-0d34-0410-b5e6-96231b3b80d8
ypename-expression.cpp
949bf69136e07fb7968d84bc21d9272ff343ffdb 10-Jun-2009 Douglas Gregor <dgregor@apple.com> Handle member pointer types with dependent class types (e.g., int
T::*) and implement template instantiation for member pointer types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73151 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
7c94c4bb7b875dc1a2b23f77f1ed8013cf94abdb 03-Jun-2009 Argyrios Kyrtzidis <akyrtzi@gmail.com> Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72747 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
ecl-expr-ambiguity.cpp
ember-expr.cpp
einterpret-cast.cpp
tatic-cast.cpp
fc27d268cb34cbb8d186c6ad7cc043d41581ce71 31-May-2009 Anders Carlsson <andersca@mac.com> Fix an off by one error when trying to perform copy initialization of operator new and operator delete arguments. Sebastian, please review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72670 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
3cc9726a493d90bd8faf094986a59352fd3461cb 31-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Disallow exception specs on typedefs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72664 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
f89bb0fa8b2b806b0a3ad23619c1f5acb4aa952a 30-May-2009 Anders Carlsson <andersca@mac.com> Replace a cast with a dyn_cast as suggested by Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72624 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
d12ef8d142868889867f9dd968b5f3ea02d463c1 30-May-2009 Anders Carlsson <andersca@mac.com> Add a member lookup criteria constructor for searching for overridden virtual member functions. Use this instead of regular name lookup when checking for overriding functions so we will see declarations that would otherwise be hidden. Fixes 6902298.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72601 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
d249e1d1f1498b81314459ceda19d6ff25c278ad 29-May-2009 Douglas Gregor <dgregor@apple.com> Create a new PrintingPolicy class, which we pass down through the AST
printing logic to help customize the output. For now, we use this
rather than a special flag to suppress the "struct" when printing
"struct X" and to print the Boolean type as "bool" in C++ but "_Bool"
in C.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72590 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
onvert-to-bool.cpp
verloaded-operator.cpp
ef65f06e8e440aec541442cfd73a8a836e9bc842 29-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Reject incomplete types in exception specs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72580 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
6a7330c20cabf1cf1cd46f5dfc183ec3a72add66 29-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Disallow exception specifications on multi-level indirections.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72571 91177308-0d34-0410-b5e6-96231b3b80d8
xception-spec.cpp
402abb55fc2e0cdda5fb1ac90009b1f5f6774906 29-May-2009 Douglas Gregor <dgregor@apple.com> When we parse a tag specifier, keep track of whether that tag
specifier resulted in the creation of a new TagDecl node, which
happens either when the tag specifier was a definition or when the tag
specifier was the first declaration of that tag type. This information
has several uses, the first of which is implemented in this commit:

1) In C++, one is not allowed to define tag types within a type
specifier (e.g., static_cast<struct S { int x; } *>(0) is
ill-formed) or within the result or parameter types of a
function. We now diagnose this.

2) We can extend DeclGroups to contain information about any tags
that are declared/defined within the declaration specifiers of a
variable, e.g.,

struct Point { int x, y, z; } p;

This will help improve AST printing and template instantiation,
among other things.

3) For C99, we can keep track of whether a tag type is defined
within the type of a parameter, to properly cope with cases like,
e.g.,

int bar(struct T2 { int x; } y) {
struct T2 z;
}

We can also do similar things wherever there is a type specifier,
e.g., to keep track of where the definition of S occurs in this
legal C99 code:

(struct S { int x, y; } *)0





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72555 91177308-0d34-0410-b5e6-96231b3b80d8
ype-definition-in-specifier.cpp
1590d9c0fec4c710c2962e4bb71f76979b5163d3 27-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add a big test case for I-C-Es in C++, and a fix to make it work. The fix might not be the right way to do it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72490 91177308-0d34-0410-b5e6-96231b3b80d8
onstant-expression.cpp
5e5783180acb42c9d9b1be2838370ea5930a2a8b 26-May-2009 Anders Carlsson <andersca@mac.com> A block that returns a reference is an lvalue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72409 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
8593c7810fba6548679e7c89d8eaccebf4d5ec20 21-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Avoid using the built-in type checker for assignment in C++ when classes are involved. Patch by Vyacheslav Kononenko.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72212 91177308-0d34-0410-b5e6-96231b3b80d8
opy-assignment.cpp
amespace.cpp
verloaded-builtin-operators.cpp
c12a9c5e552825c2b7d2e4352a9f70e061ebb367 20-May-2009 Douglas Gregor <dgregor@apple.com> Ban the use of __builtin_types_compatible_p in C++; g++ doesn't support it,
and it isn't clear exactly what it's supposed to mean. Thanks Eli!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72142 91177308-0d34-0410-b5e6-96231b3b80d8
ypes_compatible_p.cpp
1cca74ef3627a3a0ab14501d23e336548f6611b2 17-May-2009 Anders Carlsson <andersca@mac.com> Use the Itanium ABI for member pointers. Add a missing 'break' statement and a test case

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71972 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer-size.cpp
8ff8c2278cf5ef26e40314dfbb363e32542da032 17-May-2009 Anders Carlsson <andersca@mac.com> Rewrite PureVirtualMethodCollector to use the overridden methods. Fixes <rdar://problem/6854087>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71970 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
bc6c848f3e0ec2dc44f6e3d59ef85e884cc9b7be 17-May-2009 Eli Friedman <eli.friedman@gmail.com> Make the RAII extension warning silencing for __extension__ a bit
narrower, so it doesn't catch expresions that aren't sub-expressions of
__extension__ operator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71967 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
425bfdee21d7ce13799bb7f9d74805a2d5775762 17-May-2009 Anders Carlsson <andersca@mac.com> Fix another case where the extern-ness of extern "C" wasn't being captured.

This makes me think that we should make hasExternalStorage perform this check...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71962 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
196f7d0ce9d928ecf89430e099f6c065d72ef920 16-May-2009 Anders Carlsson <andersca@mac.com> Don't return member pointer types for static member functions. Fixes 6879261.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71961 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr-static.cpp
77b7f1d4fb782c9152f91b76f9f8b1d1af21bd35 15-May-2009 Anders Carlsson <andersca@mac.com> Check that the function being overridden is virtual.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71802 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
b5133c279f86e04f71c9dd5d581ecfedf1f5e7eb 14-May-2009 Anders Carlsson <andersca@mac.com> Fix the same speling error in the test case (Duh).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71793 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
c3a68b25cdd687d4beb59f083fcb22afe173286f 14-May-2009 Anders Carlsson <andersca@mac.com> Better diagnostics for covariance when checking overriding return types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71786 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
9afe1308ed19dffc281dca5cfbe521826754980f 14-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> When there are any member new operators, global versions aren't looked up at all.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71780 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
501c5ce63c2ff54c103fbab8c1c45234d5a82a57 14-May-2009 Douglas Gregor <dgregor@apple.com> In C++, warn when something previously declared as a "struct" is later
declared as a "class", or vice-versa. This warning is under the
control of -Wmismatched-tags, which is off by default.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71773 91177308-0d34-0410-b5e6-96231b3b80d8
truct-class-redecl.cpp
d7ba27dc562e1837703fa8696531c1f21a5fdb36 14-May-2009 Anders Carlsson <andersca@mac.com> Add return type checking for overriding virtual functions. We currently don't check covariance but that's next.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71759 91177308-0d34-0410-b5e6-96231b3b80d8
irtual-override.cpp
3f5b61c394f4f205bcb4d316eb2a7a0a68b8af86 14-May-2009 Douglas Gregor <dgregor@apple.com> Implement explicit instantiations of member classes of class templates, e.g.,

template<typename T>
struct X {
struct Inner;
};

template struct X<int>::Inner;

This change is larger than it looks because it also fixes some
a problem with nested-name-specifiers and tags. We weren't requiring
the DeclContext associated with the scope specifier of a tag to be
complete. Therefore, when looking for something like "struct
X<int>::Inner", we weren't instantiating X<int>.

This, naturally, uncovered a problem with member pointers, where we
were requiring the left-hand side of a member pointer access
expression (e.g., x->*) to be a complete type. However, this is wrong:
the semantics of this expression does not require a complete type (EDG
agrees).

Stuart vouched for me. Blame him.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71756 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
a33d9b4ebf732a5da6d56fd7319ff6c020789b1c 13-May-2009 Anders Carlsson <andersca@mac.com> Disable access control by default. It can be enabled with the -faccess-control option. When we have better support for it, we can enable it by default again.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71706 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
onditional-expr.cpp
0033836b3c4bb578ef999813de4f5f1a24862d18 12-May-2009 Anders Carlsson <andersca@mac.com> Friend declarations are only valid inside class definitions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71489 91177308-0d34-0410-b5e6-96231b3b80d8
riend.cpp
6e8ed16ffef02b82995a90bdcf10ffff7d63839a 10-May-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement C++0x nullptr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71405 91177308-0d34-0410-b5e6-96231b3b80d8
ullptr.cpp
6d507a6d96ea6379bc1df207abe26ad4cbe6563d 07-May-2009 Douglas Gregor <dgregor@apple.com> Big update to the C++ status table to reflect "recent"
development. Still much more to write!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71167 91177308-0d34-0410-b5e6-96231b3b80d8
cl_ambig_res.cpp
868bd0aa9281929ef50d2e9a8c82a036906f53f5 06-May-2009 Daniel Dunbar <daniel@zuster.org> Improve handling of (X86) target features.
- This is a WIP...

- This adds -march= handling to the driver, and fixes the defaulting
of -mcpu on Darwin (which was using the wrong test).

Instead of handling -m{sse, ...} in the driver, pass them to clang-cc as
-target-feature [+-]name

In clang-cc, communicate with the (clang) target to discover the legal
features of a target, and the features which are enabled based on
-mcpu. This is currently hardcoded just enough to not be a feature
regression, we need to get this information from the backend's
TableGen information somehow.

This is used to construct the full list of features which are being
used, which is in turn used to initialize the predefines.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71061 91177308-0d34-0410-b5e6-96231b3b80d8
arbon.cpp
0c6db9417dceeb082296c4e097be5de3ee1c5eb7 04-May-2009 Douglas Gregor <dgregor@apple.com> Implement support for comparing pointers with <, >, <=, >=, ==, and !=
in C++, taking into account conversions to the "composite pointer
type" so that we can compare, e.g., a pointer to a derived class to a
pointer to a base class.

Also, upgrade the "comparing distinct pointer types" from a warning to
an error for C++, since this is clearly an error. Turns out that we
hadn't gone through and audited this code for C++, ever.

Fixes <rdar://problem/6816420>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70829 91177308-0d34-0410-b5e6-96231b3b80d8
omposite-pointer-type.cpp
laborated-type-specifier.cpp
c0d600c83a91b200616616f3982553c0ff42fcf3 03-May-2009 Eli Friedman <eli.friedman@gmail.com> Fix/re-enable test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70800 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
9c2b34728b1a7c9df2df25fb5952dd33411a5a23 03-May-2009 Daniel Dunbar <daniel@zuster.org> Disable this test case, I'm tired of seeing red. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70799 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
ed4ec8f6d183c247a4528ff846669b02f2326185 03-May-2009 Douglas Gregor <dgregor@apple.com> One can use "class" and "struct" interchangeably to refer to a class
in C++. Fixes <rdar://problem/6815995>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70784 91177308-0d34-0410-b5e6-96231b3b80d8
truct-class-redecl.cpp
ypedef-redecl.cpp
5992e4a9cf7e2762a746a6d355dfab4598125012 02-May-2009 Anders Carlsson <andersca@mac.com> Fix a thinko and a test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70637 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
f9b8bc662a84bb89a2d98530592f5d8fb6bee761 02-May-2009 Anders Carlsson <andersca@mac.com> Downgrade the invalid offsetof error to a warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70634 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
6d7f149b0bff12e8f74c372e50b6e9a9ea980425 02-May-2009 Anders Carlsson <andersca@mac.com> It's an error to call offsetof on a non-POD type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70595 91177308-0d34-0410-b5e6-96231b3b80d8
ffsetof.cpp
7786d1c5d752b90ff74093bd1ffda37daf0dbe6e 01-May-2009 Anders Carlsson <andersca@mac.com> C++ destructors can have a single unnamed void parameter. Fixes <rdar://problem/6841210>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70519 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
4649cac75c3cb80d543c6d90269388277228508d 01-May-2009 Anders Carlsson <andersca@mac.com> Rework the way we handle constructor decls to be less hacky and fix PR3948 completely.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70516 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
5a8cb0bda09c91d6530d943b72b1a6ac95862430 30-Apr-2009 Anders Carlsson <andersca@mac.com> Just because a declaration has the same name as its containing class doesn't mean that it's a constructor. Fixes rdar://problem/6815988.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70436 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
72527137c521ad9330ecb81ccd841159719dc8cd 29-Apr-2009 Eli Friedman <eli.friedman@gmail.com> PR4103: improve source location information for members of the current
class. This isn't perfect, but it's a big improvement over not having
any location information.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70390 91177308-0d34-0410-b5e6-96231b3b80d8
ember-location.cpp
852871abbff45f1c1d3787755a27fce08365b166 29-Apr-2009 Eli Friedman <eli.friedman@gmail.com> PR4103: Silence bogus unused expression warning.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70384 91177308-0d34-0410-b5e6-96231b3b80d8
nused.cpp
9895d88c34cb2eab65c622cddeaf721108d1af38 28-Apr-2009 Eli Friedman <eli.friedman@gmail.com> Fix a minor edge case in C89 mode related to the definition of a
"function designator".

(This causes a minor glitch in the
diagnostics for C++ member pointers, but we weren't printing the
right diagnostic there anyway.)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70307 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
2962f4d71d26817780e7441b23e0e91214fceb5e 28-Apr-2009 Eli Friedman <eli.friedman@gmail.com> Emit keyword extension warning in all modes, not just C99 mode.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70283 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
13e8854b186265a601545ca88f8f495fb3fb5654 27-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Track down return statements in the handlers of a function-try-block of constructors. Meh ...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70256 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
fef9f59e80275cc7515676ee6d8cc539ef155b47 27-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Don't allow catch declarations to name an abstract class

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70248 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
972041f45bdf8df7ea447221292d7827466ba94b 27-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Improve validation of C++ exception handling: diagnose throwing incomplete types and jumps into protected try-catch scopes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70242 91177308-0d34-0410-b5e6-96231b3b80d8
xceptions.cpp
ry-catch.cpp
a5cd2cdd11179387aa01f43cb6d6af440e006553 26-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make reference class unification in conditional expressions check for validity of the conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70121 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
6e4750188e836e119f8605cbd34023d0a3b18011 25-Apr-2009 Chris Lattner <sabre@nondot.org> change a couple more c++ sema methods to be based on isinvalid bits.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70022 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
6540180c2fd7a5b4963b22dc81461b73927499a8 25-Apr-2009 Chris Lattner <sabre@nondot.org> various "is invalid" cleanups for C++ ctors/dtors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70021 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
eaaebc7cf10dc1a2016183a262ad3256bc468759 25-Apr-2009 Chris Lattner <sabre@nondot.org> This is a pretty big cleanup for how invalid decl/type are handle.
This gets rid of a bunch of random InvalidDecl bools in sema, changing
us to use the following approach:

1. When analyzing a declspec or declarator, if an error is found, we
set a bit in Declarator saying that it is invalid.
2. Once the Decl is created by sema, we immediately set the isInvalid
bit on it from what is in the declarator. From this point on, sema
consistently looks at and sets the bit on the decl.

This gives a very clear separation of concerns and simplifies a bunch
of code. In addition to this, this patch makes these changes:

1. it renames DeclSpec::getInvalidType() -> isInvalidType().
2. various "merge" functions no longer return bools: they just set the
invalid bit on the dest decl if invalid.
3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator
methods now set invalid on the decl returned instead of returning an
invalid bit byref.
4. In SemaType, refering to a typedef that was invalid now propagates the
bit into the resultant type. Stuff declared with the invalid typedef
will now be marked invalid.
5. Various methods like CheckVariableDeclaration now return void and set the
invalid bit on the decl they check.


There are a few minor changes to tests with this, but the only major bad
result is test/SemaCXX/constructor-recovery.cpp. I'll take a look at this
next.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70020 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-recovery.cpp
estructor.cpp
78eb874222b7653edf7182d0d899d717d5c592c1 19-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Conditional operator C++ checking complete. What issues remain are in more general code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69555 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
9bebfadb807aba0bc272197aff1cb4b2284c00a6 19-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Bring member pointer operands of the conditional operator to a common type. We're getting there ...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69548 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
d1bd7fc4cd88f8790c56620d22560e19717f468a 19-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Another piece of the conditional operator puzzle. We'll want to use FindCompositePointerType in some other places, too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69534 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
76458501a8963fa11b91c9337a487de6871169b4 17-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement lvalue test for conditional expressions.
Add a few commented lines to the test case that point out things that don't work yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69354 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
072abefcddea5fb65e435cea60921b3c21c1279d 17-Apr-2009 Anders Carlsson <andersca@mac.com> Add support for the __has_trivial_destructor type trait.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69345 91177308-0d34-0410-b5e6-96231b3b80d8
rivial-constructor.cpp
rivial-destructor.cpp
3201f6beec688ab9fe8750527e28f52d5420e22d 16-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Fix a crash bug when comparing overload quality of conversion operators with conversion constructors.
Remove an atrocious amount of trailing whitespace in the overloaded operator mangler. Sorry, couldn't help myself.
Change the DeclType parameter of Sema::CheckReferenceInit to be passed by value instead of reference. It wasn't changed anywhere.
Let the parser handle C++'s irregular grammar around assignment-expression and conditional-expression.
And finally, the reason for all this stuff: implement C++ semantics for the conditional operator. The implementation is complete except for determining lvalueness.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69299 91177308-0d34-0410-b5e6-96231b3b80d8
onditional-expr.cpp
onversion-function.cpp
347ba89dec89091868982434154c3508085b727a 16-Apr-2009 Anders Carlsson <andersca@mac.com> Add support for the __has_trivial_constructor type trait.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69245 91177308-0d34-0410-b5e6-96231b3b80d8
rivial-constructor.cpp
f4382f50b7ab9f445c3f5b3ddaa59e6da25ea3bb 15-Apr-2009 Chris Lattner <sabre@nondot.org> Make the implicit-int handling error recovery stuff handle C++
nested name specifiers. Now we emit stuff like:

t.cpp:8:13: error: unknown type name 'X'
static foo::X P;
~~~~ ^

instead of:

t.cpp:8:16: error: invalid token after top level declarator
static foo::X P;
^

This is inspired by a really awful error message I got from
g++ when I misspelt diag::kind as diag::Kind.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69086 91177308-0d34-0410-b5e6-96231b3b80d8
amespace.cpp
ested-name-spec.cpp
841b53c5021152fa930e517d66e02e97ae47c34b 13-Apr-2009 Douglas Gregor <dgregor@apple.com> Make the selection of type declarations in Sema::getTypeName
deterministic when faced with an ambiguity. This eliminates the
annoying test/SemaCXX/using-directive.cpp failure.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68952 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
8129edbb576c297df8631c3db4ac1339f4a9e8ad 13-Apr-2009 Chris Lattner <sabre@nondot.org> Fix some C++ error recovery problems in init declarator parsing
that I noticed working on other things.

Instead of emitting:

t2.cc:1:8: error: use of undeclared identifier 'g'
int x(*g);
^
t2.cc:1:10: error: expected ')'
int x(*g);
^
t2.cc:1:6: note: to match this '('
int x(*g);
^

We now only emit:

t2.cc:1:7: warning: type specifier missing, defaults to 'int'
int x(*g);
^


Note that the example in SemaCXX/nested-name-spec.cpp:f4 is still
not great, we now produce both of:

void f4(undef::C); // expected-error {{use of undeclared identifier 'undef'}} \
expected-error {{variable has incomplete type 'void'}}

The second diagnostic should be silenced by something getting marked invalid.
I don't plan to fix this though.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68919 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
0b5e7fbb94071e83a527e6759154d9512620f0ce 12-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add deleted functions and rvalue references to C++ status.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68903 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
e2b6833d445c7a4ce64f1816c05f176ba1740aca 12-Apr-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Parse deleted member functions. Parsing member declarations goes through a different code path that I forgot previously.
Implement the rvalue reference overload dance for returning local objects. Returning a local object first tries to find a move constructor now.
The error message when no move constructor is defined (or is not applicable) and the copy constructor is deleted is quite ugly, though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68902 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
val-references.cpp
85a5319ea4b5c916d7dd665e84af61e4a8a0b9c2 07-Apr-2009 Eli Friedman <eli.friedman@gmail.com> Diagnose uses of function specifiers on declarations which don't declare
functions. Fixes PR3941.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68541 91177308-0d34-0410-b5e6-96231b3b80d8
nline.cpp
1a31ad817149d57053dafcdcf18326363a8e79f5 07-Apr-2009 Douglas Gregor <dgregor@apple.com> XFAIL a failing test

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68519 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
dd6f4abe816a529cfc8c0487f9a13f3b88f0aae8 02-Apr-2009 Douglas Gregor <dgregor@apple.com> Move the fix-it tests into their own subdirectory

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68325 91177308-0d34-0410-b5e6-96231b3b80d8
ixit.cpp
fe057ac36b9a76cdfa37dfa003f986461fb5fb98 02-Apr-2009 Douglas Gregor <dgregor@apple.com> Update comments in fixit tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68279 91177308-0d34-0410-b5e6-96231b3b80d8
ixit.cpp
558cb56caf8906e0adbe643e3febbef0b7af1b9f 02-Apr-2009 Douglas Gregor <dgregor@apple.com> Introduce a "-fixit" mode to clang-cc that applies code-modification hints.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68268 91177308-0d34-0410-b5e6-96231b3b80d8
ixit.cpp
a3a835149ed4b183e3b009a1f94a6123779d696b 02-Apr-2009 Douglas Gregor <dgregor@apple.com> Add some more code modification hints

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68261 91177308-0d34-0410-b5e6-96231b3b80d8
ixit.cpp
ested-name-spec.cpp
9b3064b55f3c858923734e8b1c9831777fc22554 02-Apr-2009 Douglas Gregor <dgregor@apple.com> Add code modification hints to various parsing-related diagnostics.

Plus, reword a extension warnings to avoid talking about "ISO C" when
the extension might also be available in C++ or C++0x.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68257 91177308-0d34-0410-b5e6-96231b3b80d8
ixit.cpp
31a19b6989bbf326d2de5ae12e712e2a65ca9c34 01-Apr-2009 Douglas Gregor <dgregor@apple.com> Make parsing a semantic analysis a little more robust following Sema
failures that involve malformed types, e.g., "typename X::foo" where
"foo" isn't a type, or "std::vector<void>" that doens't instantiate
properly.

Similarly, be a bit smarter in our handling of ambiguities that occur
in Sema::getTypeName, to eliminate duplicate error messages about
ambiguous name lookup.

This eliminates two XFAILs in test/SemaCXX, one of which was crying
out to us, trying to tell us that we were producing repeated error
messages.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68251 91177308-0d34-0410-b5e6-96231b3b80d8
ember-name-lookup.cpp
sing-directive.cpp
969c689d893a248eca4f049f5b89f747e66e4bff 01-Apr-2009 Douglas Gregor <dgregor@apple.com> Give Type::getDesugaredType a "for-display" mode that can apply more
heuristics to determine when it's useful to desugar a type for display
to the user. Introduce two C++-specific heuristics:

- For a qualified type (like "foo::bar"), only produce a new
desugred type if desugaring the qualified type ("bar", in this
case) produces something interesting. For example, if "foo::bar"
refers to a class named "bar", don't desugar. However, if
"foo::bar" refers to a typedef of something else, desugar to that
something else. This gives some useful desugaring such as
"foo::bar (aka 'int')".
- Don't desugar class template specialization types like
"basic_string<char>" down to their underlying "class
basic_string<char, char_traits<char>, allocator<char>>, etc.";
it's better just to leave such types alone.

Update diagnostics.html with some discussion and examples of type
preservation in C++, showing qualified names and class template
specialization types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68207 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-names-diag.cpp
b73e75cfda58c89e6cb196668409daa3c7e45d7f 31-Mar-2009 Anders Carlsson <andersca@mac.com> Check in test for namespace aliases+using directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68086 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
a98458054d9004ad414a8518057f8ce08f23ae70 29-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Reintroduce r67870 (rval ref overloading), since I can't reproduce any test failures on i386 or x86_64. If this fails for someone, please contact me.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67999 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
81c85c421197a602523781a6ef730639c4c6ea51 29-Mar-2009 Anders Carlsson <andersca@mac.com> More improvements to namespace aliases. We now support everything except aliases in using directives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67966 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
dd729fce03899ed03a212a49d7b03e043ce6ed40 29-Mar-2009 Anders Carlsson <andersca@mac.com> Fix lookup bug

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67964 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
a1a1b306946e5730f7a47f7be920061cfd7e7259 28-Mar-2009 Anders Carlsson <andersca@mac.com> As Eli pointed out, it is possible that a namespace lookup is ambiguous!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67932 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
5721c68299edddd6d6dc32f6ea5441bcfa20dfd8 28-Mar-2009 Anders Carlsson <andersca@mac.com> Check that the alias points to a valid namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67925 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
8d7ba402ba062994e242c97719685d6d66a056dd 28-Mar-2009 Anders Carlsson <andersca@mac.com> Check that the namespace alias doesn't conflict with a previous declaration in this scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67921 91177308-0d34-0410-b5e6-96231b3b80d8
amespace-alias.cpp
14734f7d2a69f9076e8a06954f06d3313063e7f9 28-Mar-2009 Anders Carlsson <andersca@mac.com> Revert Sebastian's rvalue patch (r67870) since it caused test failures in

SemaCXX//overload-member-call.cpp
SemaCXX//overloaded-operator.cpp
SemaTemplate//instantiate-method.cpp



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67912 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
val-references.cpp
e5194ff24c224fa8ee83064dff73f62f745a4469 28-Mar-2009 Anders Carlsson <andersca@mac.com> Implement access checking for protected base classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67887 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
f8738782e3322923501c8c185b152f0553a37463 27-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Better overload resolution for rvalue references.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67870 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
f8080a39e6e576a820dadb7a4e0bcf5e7c8ffa35 27-Mar-2009 Anders Carlsson <andersca@mac.com> It is OK to cast to a private base class if the current member belongs to the class that the private base class is a base of:

class A {};
class B : private A {
void f(B *b) { A* a = b; }
};



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67860 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
c4f1e87138bfe5d3aaccff13c86b383a255bca42 27-Mar-2009 Anders Carlsson <andersca@mac.com> Implement checking for base class access. Right now it's overly conservative but that will change. (Also, protected isn't implemented right now).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67827 91177308-0d34-0410-b5e6-96231b3b80d8
ccess-base-class.cpp
214f31a347d7824eb92e6a3f5dce4d4047fd5ae0 27-Mar-2009 Douglas Gregor <dgregor@apple.com> If the user is trying to apply the -> or . member reference operator
to a function or function pointer, it's probably because the user
forgot to put in parentheses () to call the function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67826 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
332975661d287082f64d260ef6ac5f36499d478f 27-Mar-2009 Douglas Gregor <dgregor@apple.com> Improve recovery when a constructor fails to type-check. Test case from Anders

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67818 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-recovery.cpp
onstructor.cpp
4cbe82c7c82ca0106f60296a60951d41f7d2ec7d 26-Mar-2009 Anders Carlsson <andersca@mac.com> Set the access specifier for templates inside classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67726 91177308-0d34-0410-b5e6-96231b3b80d8
ccess.cpp
50713450f61b85805e1ca97e547a4082b7798bd3 26-Mar-2009 Anders Carlsson <andersca@mac.com> Check that the access specifier of a member redeclaration is the same as the original declaration.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67722 91177308-0d34-0410-b5e6-96231b3b80d8
ccess.cpp
1329c274628cc8c4e8ad472b41d1a78c8123f611 26-Mar-2009 Anders Carlsson <andersca@mac.com> Tighten the setAccess assert. We now allow AS_none if the decl contex is not a C++ record decl.

Also, fix fallout from the change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67717 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
a7b3521ef52d983bd0e7fa562bb9ef1393f14634 25-Mar-2009 Anders Carlsson <andersca@mac.com> Improve handling of base initializers. We now parse initializers in out of line decls, such as:

class C {
C() { }

int a;
};

C::C() : a(10) { }

We also diagnose when initializers are used on declarations that aren't constructors:

t.cpp:1:10: error: only constructors take base initializers
void f() : a(10) { }
^

Doug and/or Sebastian: I'd appreciate a review, especially the nested-name-spec test results (from the looks of it we now match gcc in that test.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67672 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
ested-name-spec.cpp
50de12f5783b57c74fd30ebfa3945181313625ff 24-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Parse deleted function definitions and hook them up to Doug's machinery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67653 91177308-0d34-0410-b5e6-96231b3b80d8
eleted-function.cpp
e7450f5dbd5bed63b8ef9db86350a8fc3db011e8 24-Mar-2009 Douglas Gregor <dgregor@apple.com> Make sure to use RequireCompleteType rather than testing for
incomplete types. RequireCompleteType is needed when the type may be
completed by instantiating a template.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67643 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
ew-delete.cpp
e65a3c8f181adc42786e0a409cd1e827f4ab37ff 24-Mar-2009 Anders Carlsson <andersca@mac.com> Fix the bug that Eli noticed where we wouldn't look at function decls outside the class declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67627 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
d7d5f0223bd30dfd618762349c6209dd1d5ea3e6 24-Mar-2009 Daniel Dunbar <daniel@zuster.org> Rename clang to clang-cc.

Tests and drivers updated, still need to shuffle dirs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67602 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
bstract.cpp
ddr-of-overloaded-function.cpp
ddress-of.cpp
ggregate-initialization.cpp
nonymous-union.cpp
ttr-unavailable.cpp
asic_lookup_argdep.cpp
locks.cpp
ool.cpp
arbon.cpp
lass-names.cpp
lass.cpp
omplex-overload.cpp
ondition.cpp
onst-cast.cpp
onstructor-initializer.cpp
onstructor.cpp
onversion-function.cpp
onvert-to-bool.cpp
onverting-constructor.cpp
opy-initialization.cpp
cl_init_aggr.cpp
ecl-expr-ambiguity.cpp
efault1.cpp
efault2.cpp
ependent-types.cpp
erived-to-base-ambig.cpp
estructor.cpp
irect-initializer.cpp
o-while-scope.cpp
ynamic-cast.cpp
laborated-type-specifier.cpp
num.cpp
xpressions.cpp
ntype-decl.cpp
unction-redecl.cpp
unction-type-qual.cpp
unctional-cast.cpp
-c-e-cxx.cpp
mplicit-int.cpp
nherit.cpp
inkage-spec.cpp
ember-expr.cpp
ember-name-lookup.cpp
ember-pointer.cpp
s-exception-spec.cpp
amespace.cpp
ested-name-spec.cpp
ew-delete.cpp
o-implicit-builtin-decls.cpp
verload-call-copycon.cpp
verload-call.cpp
verload-decl.cpp
verload-member-call.cpp
verloaded-builtin-operators.cpp
verloaded-operator-decl.cpp
verloaded-operator.cpp
ualification-conversion.cpp
ualified-id-lookup.cpp
ualified-names-diag.cpp
ualified-names-print.cpp
eferences.cpp
einterpret-cast.cpp
einterpret-fn-obj-pedantic.cpp
eturn-stack-addr.cpp
val-references.cpp
tatements.cpp
tatic-assert.cpp
tatic-cast.cpp
tatic-initializers.cpp
emplate-specialization.cpp
his.cpp
ry-catch.cpp
ype-convert-construct.cpp
ype-dependent-exprs.cpp
ype-traits.cpp
ypedef-redecl.cpp
ypeid.cpp
ser-defined-conversions.cpp
sing-directive.cpp
ararg-non-pod.cpp
irtuals.cpp
arn-for-var-in-else.cpp
char_t.cpp
5eff73c7679349f39e3602e05fff1ff347a28858 24-Mar-2009 Anders Carlsson <andersca@mac.com> Handle pointers to arrays of abstract types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67598 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
8211effbd3abc5948a5d6924c87e72323016a376 24-Mar-2009 Anders Carlsson <andersca@mac.com> More work on diagnosing abstract classes. We can now handle cases like

class C {
void g(C c);

virtual void f() = 0;
};

In this case, C is not known to be abstract when doing semantic analysis on g. This is done by recursively traversing the abstract class and checking the types of member functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67594 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
2dc0e64e57b2a1786fa53a7dbd1d5c8e255eadb0 24-Mar-2009 Douglas Gregor <dgregor@apple.com> Template instantiation for the declarations of member functions within
a class template. At present, we can only instantiation normal
methods, but not constructors, destructors, or conversion operators.

As ever, this contains a bit of refactoring in Sema's type-checking. In
particular:

- Split ActOnFunctionDeclarator into ActOnFunctionDeclarator
(handling the declarator itself) and CheckFunctionDeclaration
(checking for the the function declaration), the latter of which
is also used by template instantiation.
- We were performing the adjustment of function parameter types in
three places; collect those into a single new routine.
- When the type of a parameter is adjusted, allocate an
OriginalParmVarDecl to keep track of the type as it was written.
- Eliminate a redundant check for out-of-line declarations of member
functions; hide more C++-specific checks on function declarations
behind if(getLangOptions().CPlusPlus).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67575 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
11f21a08cd40caec93e088c404bbf3136917a035 23-Mar-2009 Anders Carlsson <andersca@mac.com> More improvements to abstract type checking. Handle arrays correctly, and make sure to check parameter types before they decay.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67550 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
b9bbe49f513080b3307e88bdee0d383f4b8c1d4e 23-Mar-2009 Anders Carlsson <andersca@mac.com> It's an error to try to allocate an abstract object using new.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67542 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
f2e21e5ad5e816d88e048c89dc775a9d4547c089 23-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Disallow catching exceptions by rvalue reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67492 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
157be839ade8312389b20d02a3d470c0487fd756 22-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement static_cast from lvalue to rvalue reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67487 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
e7c6f7aa7e8ee1f0acacc314dcf59d5dadff1524 22-Mar-2009 Eli Friedman <eli.friedman@gmail.com> Check that the return/argument types of calls are complete.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67485 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
4681ebd429846ed98e7beaf49934fa347ff22152 22-Mar-2009 Anders Carlsson <andersca@mac.com> Disallow abstract types where appropriate.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67476 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
67e4dd2e9936d828d68b20e01922b6442c6ce31b 22-Mar-2009 Anders Carlsson <andersca@mac.com> Keep track of whether a class is abstract or not. This is currently only used for the __is_abstract type trait.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67461 91177308-0d34-0410-b5e6-96231b3b80d8
bstract.cpp
2ff44784d180bb96953c22de4a0b2efb5d50263a 20-Mar-2009 Douglas Gregor <dgregor@apple.com> Some minor tweaks and additional tests for rvalue references

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67397 91177308-0d34-0410-b5e6-96231b3b80d8
val-references.cpp
24c46b3133b03e254877a680f92f035e56058a39 19-Mar-2009 Douglas Gregor <dgregor@apple.com> Print the context of tag types as part of pretty-printing, e.g.,

struct N::M::foo



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67284 91177308-0d34-0410-b5e6-96231b3b80d8
laborated-type-specifier.cpp
num.cpp
ualified-names-diag.cpp
bad351822117eaf280081494e3dbe4a06c0dbfcf 19-Mar-2009 Douglas Gregor <dgregor@apple.com> Generalize printing of nested-name-specifier sequences for use in both
QualifiedNameType and QualifiedDeclRefExpr. We now keep track of the
exact nested-name-specifier spelling for a QualifiedDeclRefExpr, and
use that spelling when printing ASTs. This fixes PR3493.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67283 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-names-print.cpp
e6258936178b4c52b43b3b9dbec13552961cd645 19-Mar-2009 Douglas Gregor <dgregor@apple.com> Extend the use of QualifiedNameType to the creation of class template
specialization names. This way, we keep track of sugared types like

std::vector<Real>

I believe we are now using QualifiedNameTypes everywhere we can. Next
step: QualifiedDeclRefExprs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67268 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-names-diag.cpp
e4e5b054b4917f0ee493bb2fda5b1ec749bfb9a1 19-Mar-2009 Douglas Gregor <dgregor@apple.com> Introduce a representation for types that we referred to via a
qualified name, e.g.,

foo::x

so that we retain the nested-name-specifier as written in the source
code and can reproduce that qualified name when printing the types
back (e.g., in diagnostics). This is PR3493, which won't be complete
until finished the other tasks mentioned near the end of this commit.

The parser's representation of nested-name-specifiers, CXXScopeSpec,
is now a bit fatter, because it needs to contain the scopes that
precede each '::' and keep track of whether the global scoping
operator '::' was at the beginning. For example, we need to keep track
of the leading '::', 'foo', and 'bar' in

::foo::bar::x

The Action's CXXScopeTy * is no longer a DeclContext *. It's now the
opaque version of the new NestedNameSpecifier, which contains a single
component of a nested-name-specifier (either a DeclContext * or a Type
*, bitmangled).

The new sugar type QualifiedNameType composes a sequence of
NestedNameSpecifiers with a representation of the type we're actually
referring to. At present, we only build QualifiedNameType nodes within
Sema::getTypeName. This will be extended to other type-constructing
actions (e.g., ActOnClassTemplateId).

Also on the way: QualifiedDeclRefExprs will also store a sequence of
NestedNameSpecifiers, so that we can print out the property
nested-name-specifier. I expect to also use this for handling
dependent names like Fibonacci<I - 1>::value.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67265 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-names-diag.cpp
7c80bd64032e610c0dbd74fc0ef6ea334447f2fd 17-Mar-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Almost complete implementation of rvalue references. One bug, and a few unclear areas. Maybe Doug can shed some light on some of the fixmes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67059 91177308-0d34-0410-b5e6-96231b3b80d8
onvert-to-bool.cpp
verloaded-operator.cpp
eferences.cpp
val-references.cpp
tatic-cast.cpp
94b15fbc3a10cdfb1639528a8a773b66a1e7cd9e 15-Mar-2009 Anders Carlsson <andersca@mac.com> Handle static_asserts when instantiating structs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67031 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-assert.cpp
c3082413e4207173b32c118e922d63149df6261f 14-Mar-2009 Anders Carlsson <andersca@mac.com> Handle dependent types/exprs in static_assert expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66997 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-assert.cpp
fb311762bb52dc015c02cb257d2913f104b556f8 14-Mar-2009 Anders Carlsson <andersca@mac.com> More static_assert work. Check that the assert expr is valid and show an error if it's false. Create the declaration and add it to the current context.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66995 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-assert.cpp
656de633acefb7ced01a4b573dbd4f70b4300097 12-Mar-2009 Douglas Gregor <dgregor@apple.com> Fix various problems with matching out-of-line definitions of static
class members to the corresponding in-class declaration.

Diagnose the erroneous use of 'static' on out-of-line definitions of
class members.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66740 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
021c3b372c58f5423b4fa2a5be6933d1c7ecc663 12-Mar-2009 Douglas Gregor <dgregor@apple.com> Move most of the checking from ActOnCXXMemberDeclarator to other, more general routines. This is a step toward separating the checking logic from Declarators, which in turn is required for template instantiation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66734 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
irtuals.cpp
3cf538d5c49bbebac1afa6f4a5010e3d877440bb 11-Mar-2009 Douglas Gregor <dgregor@apple.com> Implement basic template instantiation for fields. Reshuffle checking
for FieldDecls so that the parser and the template instantiation make
use of the same semantic checking module.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66685 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
4fdf1faedbca40787fd277a6fbd5061fd69b2708 11-Mar-2009 Douglas Gregor <dgregor@apple.com> Add basic, hackish support for instantiation of typedefs in a class
template. More importantly, start to sort out the issues regarding
complete types and nested-name-specifiers, especially the question of:
when do we instantiate a class template specialization that occurs to
the left of a '::' in a nested-name-specifier?




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66662 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
9fa14a547881e7abbe1edcdb92e6d3084be8d8bc 06-Mar-2009 Douglas Gregor <dgregor@apple.com> Improve recovery from ill-formed scope specifiers. Fixes PR3670.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66286 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
80711a22fa06b734a68d719ac85d4e443a51cb09 06-Mar-2009 Douglas Gregor <dgregor@apple.com> Implement the GNU semantics for forward declarations of enum types in
C and C++. Fixes PR3688.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66282 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
8b963ef99be6235f1e9fe866180fff7dbbe5e85b 06-Mar-2009 Chris Lattner <sabre@nondot.org> refactor C++ bitfield checking a bit (haha)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66213 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
247936605913c718f4141f845aec6cb6e169fb37 05-Mar-2009 Chris Lattner <sabre@nondot.org> fix PR3607 and a fixme, by checking bitfield constraints
more consistently.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66210 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
04495c859f81e440748a9b86baa2913461652bb0 24-Feb-2009 Douglas Gregor <dgregor@apple.com> Improve merging of function declarations. Specifically:

- When we are declaring a function in local scope, we can merge with
a visible declaration from an outer scope if that declaration
refers to an entity with linkage. This behavior now works in C++
and properly ignores entities without linkage.
- Diagnose the use of "static" on a function declaration in local
scope.
- Diagnose the declaration of a static function after a non-static
declaration of the same function.
- Propagate the storage specifier to a function declaration from a
prior declaration (PR3425)
- Don't name-mangle "main"



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65360 91177308-0d34-0410-b5e6-96231b3b80d8
unction-redecl.cpp
d0344a4a6182ad704881cbbaa21cca14913d2296 20-Feb-2009 Chris Lattner <sabre@nondot.org> Fix a long standard problem with clang retaining "too much" sugar
information about types. We often print diagnostics where we say
"foo_t" is bad, but the user doesn't know how foo_t is declared
(because it is a typedef). Fix this by expanding sugar when present
in a diagnostic (and not one of a few special cases, like vectors).

Before:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' and 'typeof(F)')
MAX(P, F);
^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
^

After:
t.m:5:2: error: invalid operands to binary expression ('typeof(P)' (aka 'struct mystruct') and 'typeof(F)' (aka 'float'))
MAX(P, F);
^~~~~~~~~
t.m:1:78: note: instantiated from:
#define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; })
^




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65081 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
onstructor-initializer.cpp
estructor.cpp
nherit.cpp
verloaded-operator-decl.cpp
ypedef-redecl.cpp
611a8c49c6a5848aed17eced8f2f3f7b1b7577a1 19-Feb-2009 Douglas Gregor <dgregor@apple.com> Provide a proper source location when building an implicit dereference. Fixes PR3600

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64993 91177308-0d34-0410-b5e6-96231b3b80d8
opy-initialization.cpp
48f3bb9f780f6e64ab71ba0202ca04b07473805a 18-Feb-2009 Douglas Gregor <dgregor@apple.com> Downgrade complaints about calling unavailable functions to a warning
(as GCC does), except when we've performed overload resolution and
found an unavailable function: in this case, we actually error.

Merge the checking of unavailable functions with the checking for
deprecated functions. This unifies a bit of code, and makes sure that
we're checking for unavailable functions in the right places. Also,
this check can cause an error. We may, eventually, want an option to
make "unavailable" warnings into errors.

Implement much of the logic needed for C++0x deleted functions, which
are effectively the same as "unavailable" functions (but always cause
an error when referenced). However, we don't have the syntax to
specify deleted functions yet :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64955 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
c6666f8e9bbb7f31bf2e52f97137e738c4ca01d0 18-Feb-2009 Douglas Gregor <dgregor@apple.com> Don't allow calls to functions marked "unavailable". There's more work
to do in this area, since there are other places that reference
FunctionDecls.

Don't allow "overloadable" functions (in C) to be declared without a
prototype.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64897 91177308-0d34-0410-b5e6-96231b3b80d8
ttr-unavailable.cpp
4310f4ee260e6c7ceeaf299e240f4d789ecc730d 16-Feb-2009 Douglas Gregor <dgregor@apple.com> Make "implicit int" an error in C++ (unless we're allowing Microsoft
extensions). This caught a couple bugs in our test suite :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64686 91177308-0d34-0410-b5e6-96231b3b80d8
mplicit-int.cpp
19891b082be53204ec91da31aee902966508c6d8 14-Feb-2009 Mike Stump <mrs@apple.com> Add expected note. Surely people test before the check in stuff.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64565 91177308-0d34-0410-b5e6-96231b3b80d8
nherit.cpp
3d658640abc128dcc84a5a5201456395c86c4fa6 14-Feb-2009 Cedric Venet <cedric.venet@laposte.net> Add svn:eol-style=native to some files
Correct two files with inconsistent lines endings.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64564 91177308-0d34-0410-b5e6-96231b3b80d8
lass-names.cpp
o-while-scope.cpp
unction-type-qual.cpp
nherit.cpp
0f4330c708753761313ce24e01223d6f0c130218 14-Feb-2009 Douglas Gregor <dgregor@apple.com> Add test case to insure that implicit builtin declarations for C library functions aren't created in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64513 91177308-0d34-0410-b5e6-96231b3b80d8
o-implicit-builtin-decls.cpp
b7b5d13de34272b31681e7eafa9851e39bde2ef9 12-Feb-2009 Douglas Gregor <dgregor@apple.com> Expand the definition of a complex promotion to include complex ->
complex conversions where the conversion between the real types is an
integral promotion. This is how G++ handles complex promotions for its
complex integer extension.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64344 91177308-0d34-0410-b5e6-96231b3b80d8
omplex-overload.cpp
5cdf82164dd7c2b2320d6735c63ace4331e0716d 12-Feb-2009 Douglas Gregor <dgregor@apple.com> Introduce _Complex conversions into the function overloading
system. Since C99 doesn't have overloading and C++ doesn't have
_Complex, there is no specification for this. Here's what I think
makes sense.

Complex conversions come in several flavors:

- Complex promotions: a complex -> complex conversion where the
underlying real-type conversion is a floating-point promotion. GCC
seems to call this a promotion, EDG does something else. This is
given "promotion" rank for determining the best viable function.
- Complex conversions: a complex -> complex conversion that is
not a complex promotion. This is given "conversion" rank for
determining the best viable function.
- Complex-real conversions: a real -> complex or complex -> real
conversion. This is given "conversion" rank for determining the
best viable function.

These rules are the same for C99 (when using the "overloadable"
attribute) and C++. However, there is one difference in the handling
of floating-point promotions: in C99, float -> long double and double
-> long double are considered promotions (so we give them "promotion"
rank), while C++ considers these conversions ("conversion" rank).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64343 91177308-0d34-0410-b5e6-96231b3b80d8
omplex-overload.cpp
00e68e2cc5ce37cb95beb801cae73c0d1e9dda37 09-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Update new expression to make use of Declarator::getSourceRange().
References are not objects; implement this in Type::isObjectType().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64152 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
00d50747e8442a4d0daf2dfc226aec354fd3441e 08-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Fix redundant errors with missing default arguments in member declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64085 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
ddf7e994b55ed2f161e22dfab8db14997e22c01c 08-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make the test cases failing due to exact diagnostic matching XFAIL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64080 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
ember-name-lookup.cpp
ested-name-spec.cpp
sing-directive.cpp
3cb069213c8502dbb7a67860d40122d869ed8fd6 07-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make one expected-diag directive match exactly one actual diagnostic.
This uncovers some bugs, so several test cases now fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64025 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
cl_init_aggr.cpp
ynamic-cast.cpp
unctional-cast.cpp
amespace.cpp
ew-delete.cpp
verload-member-call.cpp
ry-catch.cpp
4a4251b9e719415f30db0f5170abf31296a62225 07-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make const-initialized const integral variables I-C-Es in C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64015 91177308-0d34-0410-b5e6-96231b3b80d8
-c-e-cxx.cpp
7878ffde0c48a33a8fd3819be1b797d52f7b3849 07-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add negative test cases and fix diagnostics for member pointer dereferencing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63987 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
224605064a4ef87d1c3d35ad1cb363f8b534012b 07-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement dereferencing of pointers-to-member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63983 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
4ce205f94c984ddc4776ba0c3de7e398d251653a 06-Feb-2009 Douglas Gregor <dgregor@apple.com> Diagnose attempts to define a namespace member out-of-line when no
matching member exists. Thanks to Piotr Rak for reporting the problem!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63939 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ualified-id-lookup.cpp
7dda67d8decef1b3621a151488c4b83bd8372d6a 05-Feb-2009 Douglas Gregor <dgregor@apple.com> Improvements and fixes for name lookup with using directives, from Piotr Rak!

Also, put Objective-C protocols into their own identifier
namespace. Otherwise, we find protocols when we don't want to in C++
(but not in C).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63877 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
eeb15d499f032bb89773ddaca2d17475122a37bb 04-Feb-2009 Douglas Gregor <dgregor@apple.com> Implement semantic analysis for the GNU flexible array initialization
extension. The interaction with designated initializers is a
bit... interesting... but we follow GNU's lead and don't permit too
much crazy code in this area.

Also, make the "excess initializers" error message a bit more
informative.

Addresses PR2561: http://llvm.org/bugs/show_bug.cgi?id=2561


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63785 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
33b399a8fdd0910ed86b60e61c6a02ba8258bbe3 04-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement taking address of member functions, including overloaded ones.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63779 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
b696ea3a0693798daeafd896d77f0b8f1fec3cc5 04-Feb-2009 Douglas Gregor <dgregor@apple.com> Diagnose ambiguities in getTypeName. Fixes http://llvm.org/bugs/show_bug.cgi?id=3475

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63737 91177308-0d34-0410-b5e6-96231b3b80d8
ember-name-lookup.cpp
f680a0fe2dcab32b59fe6fdf71145b5313c40950 04-Feb-2009 Douglas Gregor <dgregor@apple.com> Bring operator name lookup (as required for C++ operator overloading)
into the general name-lookup fold. This cleans up some ugly,
not-quite-working code in the handling of operator overloading.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63735 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
17330019f05966762bc952840ef1926b9becb145 04-Feb-2009 Douglas Gregor <dgregor@apple.com> Fix our semantic analysis of

unqualified-id '('

in C++. The unqualified-id might not refer to any declaration in our
current scope, but declarations by that name might be found via
argument-dependent lookup. We now do so properly.

As part of this change, CXXDependentNameExpr, which was previously
designed to express the unqualified-id in the above constructor within
templates, has become UnresolvedFunctionNameExpr, which does
effectively the same thing but will work for both templates and
non-templates.

Additionally, we cope with all unqualified-ids, since ADL also applies
in cases like

operator+(x, y)




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63733 91177308-0d34-0410-b5e6-96231b3b80d8
asic_lookup_argdep.cpp
onversion-function.cpp
ype-dependent-exprs.cpp
fa047648b2a5502d7eef117adb4777eb9a63baa6 04-Feb-2009 Douglas Gregor <dgregor@apple.com> Initial implementation of argument dependent lookup (a.k.a. ADL,
a.k.a. Koenig lookup) in C++. Most of the pieces are in place, but for
two:

- In an unqualified call g(x), even if the name does not refer to
anything in the current scope, we can still find functions named
"g" based on ADL. We don't yet have this ability.
- ADL will need updating for friend functions and templates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63692 91177308-0d34-0410-b5e6-96231b3b80d8
asic_lookup_argdep.cpp
onvert-to-bool.cpp
onverting-constructor.cpp
ecl-expr-ambiguity.cpp
verloaded-operator.cpp
ualification-conversion.cpp
ype-dependent-exprs.cpp
ebc07d57be9e0722b4b9c66625e1fca43dcc2ee0 03-Feb-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Allow taking the address of data members, resulting in a member pointer.
Pointers to functions don't work yet, and pointers to overloaded functions even less. Also, far too much illegal code is accepted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63655 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
c144bfa05a92dcd14e2649f6dcfa1bc6d3f39f1e 03-Feb-2009 Douglas Gregor <dgregor@apple.com> Remove a fixed FIXME

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63648 91177308-0d34-0410-b5e6-96231b3b80d8
sing-directive.cpp
e2c565d488bc74a506d49fe37df4268fa35637b3 03-Feb-2009 Douglas Gregor <dgregor@apple.com> When looking for a tag name via unqualified name lookup, only look in
scopes where the name would be considered a redeclaration if we know
that we're declaring or defining that tag.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63647 91177308-0d34-0410-b5e6-96231b3b80d8
ember-name-lookup.cpp
sing-directive.cpp
2a3009a432bdcec59e6383d7b2b17494d6f91649 03-Feb-2009 Douglas Gregor <dgregor@apple.com> Semantic analysis, ASTs, and unqualified name lookup support for C++
using directives, from Piotr Rak!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63646 91177308-0d34-0410-b5e6-96231b3b80d8
ember-name-lookup.cpp
sing-directive.cpp
2b1e0039a1937e3df59b5c99bcf4746360db3441 02-Feb-2009 Douglas Gregor <dgregor@apple.com> Steve set me straight on this one. GCC was right, EDG was wrong: the
direct-initialization following a user-defined conversion can select
any constructor; it just can't employ any user-defined
conversions. So we ban those conversions and classify the constructor
call based on the relationship between the "from" and "to" types in
the conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63554 91177308-0d34-0410-b5e6-96231b3b80d8
ser-defined-conversions.cpp
87fd703e097c27d63479cb83b687d4000a22bbb1 02-Feb-2009 Douglas Gregor <dgregor@apple.com> Check value-initializations that occur when an initializer list
provides too few elements.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63525 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
734d9869efb5d126df53ba70a6060789887e0d68 31-Jan-2009 Douglas Gregor <dgregor@apple.com> Improve our handling of the second step in a user-defined conversion
sequence. Previously, we weren't permitting the second step to call
copy constructors, which left user-defined conversion sequences
surprisingly broken.

Now, we perform overload resolution among all of the constructors, but
only accept the result if it makes the conversion a standard
conversion. Note that this behavior is different from both GCC and EDG
(which don't agree with each other, either); I've submitted a core
issue on the matter.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63450 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
ser-defined-conversions.cpp
b574e5630d66629ccc8f2432e60b59ae42f1f363 30-Jan-2009 Douglas Gregor <dgregor@apple.com> Upgrade the "excess elements in array initializer" warning to an
error, since both C99 and C++ consider it an error. For reference, GCC
makes this a warning while G++ makes it an error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63435 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
930d8b5ecc074cca01ecd9a522a55f55f3b72396 30-Jan-2009 Douglas Gregor <dgregor@apple.com> Implement and test aggregate initialization in C++. Major changes:

- Support initialization of reference members; complain if any
reference members are left uninitialized.
- Use C++ copy-initialization for initializing each element (falls
back to constraint checking in C)
- Make sure we diagnose when one tries to provide an initializer
list for a non-aggregate.
- Don't complain about empty initializers in C++ (they are permitted)
- Unrelated but necessary: don't bother trying to convert the
decl-specifier-seq to a type when we're dealing with a C++
constructor, destructor, or conversion operator; it results in
spurious warnings.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63431 91177308-0d34-0410-b5e6-96231b3b80d8
cl_init_aggr.cpp
21593acb933324b439bc68b68e7cc7d1c3e3484d 28-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement pointer to member handling in static_cast.
Fix a stupid mistake in UnwrapSimilarPointers that made any two member pointers compatible as long as the pointee was the same.
Make a few style corrections as suggested by Chris.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63215 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
tatic-cast.cpp
66973121788ca645fe3d4a66179b9cfb6f2bce08 28-Jan-2009 Douglas Gregor <dgregor@apple.com> Complete semantic checking for typedef redeclarations in C++. The
rules are slightly different than in C, and now we handle both
dialects properly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63211 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
ypedef-redecl.cpp
db64728e69a45b89870ede13944a934d3c2ed12a 28-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add handling of member pointers to reinterpret_cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63150 91177308-0d34-0410-b5e6-96231b3b80d8
einterpret-cast.cpp
f20269b42843d10c930886ee661ee1dd37a4248b 26-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add support for member pointers to const_cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63055 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
9e5e4aaf8b8835b552819d68d29b6d94115d8a0b 26-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Remove an implemented FIXME and extend test cases. Follow-up on Doug's review.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63032 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
4433aafbc2591b82e4ea2fc39c723b21d2497f4d 25-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Implement implicit conversions for pointers-to-member.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62971 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
ualification-conversion.cpp
8edef7c31d27fc9d5d163660702a8a7730a0d19f 25-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Make tentative parsing of pointer-to-member decls work, and fix other stuff pointed out by Doug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62944 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
f30208ad5b334e93582e846a2a0c92f38a607b8a 24-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add support for declaring pointers to members.
Add serialization support for ReferenceType.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62934 91177308-0d34-0410-b5e6-96231b3b80d8
ember-pointer.cpp
95389dd07343c0b17612329ac1e586776eb13ecf 19-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Add missing test case for operator ! result type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62532 91177308-0d34-0410-b5e6-96231b3b80d8
xpressions.cpp
4ec339f43c0cae2678334850c90926bea10999c7 19-Jan-2009 Douglas Gregor <dgregor@apple.com> Centralize error reporting of improper uses of incomplete types in the
new DiagnoseIncompleteType. It provides additional information about
struct/class/union/enum types when possible, either by pointing to the
forward declaration of that type or by pointing to the definition (if
we're in the process of defining that type).
Fixes <rdar://problem/6500531>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62521 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic-cast.cpp
ew-delete.cpp
ualified-id-lookup.cpp
ry-catch.cpp
0b7a158d120ac8d78c114a823e17eedfec6b6658 17-Jan-2009 Douglas Gregor <dgregor@apple.com> Teach DeclContext how to find the primary declaration for any TagDecl
even when we are still defining the TagDecl. This is required so that
qualified name lookup of a class name within its definition works (see
the new bits in test/SemaCXX/qualified-id-lookup.cpp).

As part of this, move the nested redefinition checking code into
ActOnTag. This gives us diagnostics earlier (when we try to perform
the nested redefinition, rather than when we try to complete the 2nd
definition) and removes some code duplication.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62386 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
66b947fdf9104b53d7e8caa8f71ee0c0e3fe1521 16-Jan-2009 Douglas Gregor <dgregor@apple.com> Fix <rdar://problem/6502934>. We were creating an ImplicitCastExpr
with reference type (it should be an lvalue with non-reference type).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62345 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
ember-name-lookup.cpp
506ae418eb171d072f2fb4f6bc46d258b52cbf97 16-Jan-2009 Douglas Gregor <dgregor@apple.com> Part one of handling C++ functional casts. This handles semantic
analysis and AST-building for the cases where we have N != 1
arguments. For N == 1 arguments, we need to finish the C++
implementation of explicit type casts (C++ [expr.cast]).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62329 91177308-0d34-0410-b5e6-96231b3b80d8
unctional-cast.cpp
01beed0db79b6a1809955e61e7ac2c30c1a161a4 16-Jan-2009 Douglas Gregor <dgregor@apple.com> Add test case for member name lookup

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62324 91177308-0d34-0410-b5e6-96231b3b80d8
ember-name-lookup.cpp
dce5e2cabf07ff25eb4d9e1859c0a21c69f588d2 16-Jan-2009 Anders Carlsson <andersca@mac.com> Use a single function for doing vararg argument promotion. Also, make sure to do the promotion before checking the type - fixes PR3340.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62323 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
76f7d287020a0b4996d6e9d3968d5bd9a39f7d84 16-Jan-2009 Douglas Gregor <dgregor@apple.com> Add test for contextual conversion to bool, and enable some FIXME'd tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62302 91177308-0d34-0410-b5e6-96231b3b80d8
onvert-to-bool.cpp
ember-expr.cpp
eb11cd078ba8682bbb9b082f8f6ead8be5c98581 14-Jan-2009 Douglas Gregor <dgregor@apple.com> Refactor name lookup.

This change refactors and cleans up our handling of name lookup with
LookupDecl. There are several aspects to this refactoring:

- The criteria for name lookup is now encapsulated into the class
LookupCriteria, which replaces the hideous set of boolean values
that LookupDecl currently has.

- The results of name lookup are returned in a new class
LookupResult, which can lazily build OverloadedFunctionDecls for
overloaded function sets (and, eventually, eliminate the need to
allocate member for OverloadedFunctionDecls) and contains a
placeholder for handling ambiguous name lookup (for C++).

- The primary entry points for name lookup are now LookupName (for
unqualified name lookup) and LookupQualifiedName (for qualified
name lookup). There is also a convenience function
LookupParsedName that handles qualified/unqualified name lookup
when given a scope specifier. Together, these routines are meant
to gradually replace the kludgy LookupDecl, but this won't happen
until after we have base class lookup (which forces us to cope
with ambiguities).

- Documented the heck out of name lookup. Experimenting a little
with using Doxygen's member groups to make some sense of the Sema
class. Feedback welcome!

- Fixes some lingering issues with name lookup for
nested-name-specifiers, which now goes through
LookupName/LookupQualifiedName.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62245 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
bf985f1fccd1ff5a686b79e0c6aeb5004eac33f3 14-Jan-2009 Douglas Gregor <dgregor@apple.com> Test explicit constructor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62237 91177308-0d34-0410-b5e6-96231b3b80d8
onverting-constructor.cpp
09f41cf63f4df0bf4e98ee473e44e9a95b68f0ff 14-Jan-2009 Douglas Gregor <dgregor@apple.com> Introduce support for C++0x explicit conversion operators (N2437)

Small cleanup in the handling of user-defined conversions.

Also, implement an optimization when constructing a call. We avoid
recomputing implicit conversion sequences and instead use those
conversion sequences that we computed as part of overload resolution.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62231 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
906fed0fb54a338961aba3aa54802b7d68de94c7 13-Jan-2009 Anders Carlsson <andersca@mac.com> Warn when someone tries to pass a variable with a non-POD type to a varargs function/method/block.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62148 91177308-0d34-0410-b5e6-96231b3b80d8
ararg-non-pod.cpp
518fda1d121dcba3ad7276f5e9a94f733f6e5ecd 13-Jan-2009 Douglas Gregor <dgregor@apple.com> Fix argument-passing bugs in a call to object

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62147 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
ualified-id-lookup.cpp
88b4bf202a6bb67ed241281b8dea973f38df2782 13-Jan-2009 Douglas Gregor <dgregor@apple.com> Add the proper restrictions on the left-hand argument of a built-in
assignment operator candidate (C++ [over.match.oper]p4).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62128 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
e63ef48b76b84e7ffb0a38fbf475ddea5c48adb4 13-Jan-2009 Douglas Gregor <dgregor@apple.com> Make sure we don't name a constructor or destructor with a qualified
type. It leads to very weird errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62124 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
3f20a682baad7f3aa6d2b3a9a3053420e5421e32 13-Jan-2009 Douglas Gregor <dgregor@apple.com> Update C++ status and add a few more tests of overloading for member function calls

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62121 91177308-0d34-0410-b5e6-96231b3b80d8
verload-member-call.cpp
4920f1ffb62b13b88e579476803c093f97f3e17f 12-Jan-2009 Douglas Gregor <dgregor@apple.com> Implement support for anonymous structs and unions in C. Both C and
C++ handle anonymous structs/unions in the same way. Addresses several
bugs:

<rdar://problem/6259534>
<rdar://problem/6481130>
<rdar://problem/6483159>

The test case in PR clang/1750 now passes with -fsyntax-only, but
CodeGen for inline assembler still fails.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62112 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
3218c4bb3b5d7250f12420de6db7ef3e3f805a75 09-Jan-2009 Douglas Gregor <dgregor@apple.com> When we see a reference to a struct, class, or union like "struct X"
that is neither a definition nor a forward declaration and where X has
not yet been declared as a tag, introduce a declaration
into the appropriate scope (which is likely *not* to be the current
scope). The rules for the placement of the declaration differ slightly
in C and C++, so we implement both and test the various corner
cases. This implementation isn't 100% correct due to some lingering
issues with the function prototype scope (for a function parameter
list) not being the same scope as the scope of the function
definition. Testcase is FIXME'd; this probably isn't an important issue.

Addresses <rdar://problem/6484805>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62014 91177308-0d34-0410-b5e6-96231b3b80d8
laborated-type-specifier.cpp
9ba73ad65446f6bc876f40cced866d85dff754da 09-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> Very basic support for pure virtual functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62003 91177308-0d34-0410-b5e6-96231b3b80d8
irtuals.cpp
72de6676bd30f9081ee4166bbe07b4c270258ce6 08-Jan-2009 Douglas Gregor <dgregor@apple.com> Unify the code for defining tags in C and C++, so that we always
introduce a Scope for the body of a tag. This reduces the number of
semantic differences between C and C++ structs and unions, and will
help with other features (e.g., anonymous unions) in C. Some important
points:

- Fields are now in the "member" namespace (IDNS_Member), to keep
them separate from tags and ordinary names in C. See the new test
in Sema/member-reference.c for an example of why this matters. In
C++, ordinary and member name lookup will find members in both the
ordinary and member namespace, so the difference between
IDNS_Member and IDNS_Ordinary is erased by Sema::LookupDecl (but
only in C++!).
- We always introduce a Scope and push a DeclContext when we're
defining a tag, in both C and C++. Previously, we had different
actions and different Scope/CurContext behavior for enums, C
structs/unions, and C++ structs/unions/classes. Now, it's one pair
of actions. (Yay!)

There's still some fuzziness in the handling of struct/union/enum
definitions within other struct/union/enum definitions in C. We'll
need to do some more cleanup to eliminate some reliance on CurContext
before we can solve this issue for real. What we want is for something
like this:

struct X {
struct T { int x; } t;
};

to introduce T into translation unit scope (placing it at the
appropriate point in the IdentifierResolver chain, too), but it should
still have struct X as its lexical declaration
context. PushOnScopeChains isn't smart enough to do that yet, though,
so there's a FIXME test in nested-redef.c



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61940 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
lass.cpp
bc468ba19c0bad9bf4a40ff39d8fad7e471bfbf5 07-Jan-2009 Douglas Gregor <dgregor@apple.com> Fix PR clang/3291

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61886 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
6b3945f4bc757bdadd3e443180cf32c2cccb52a0 07-Jan-2009 Douglas Gregor <dgregor@apple.com> Finished semantic analysis of anonymous unions in C++.

Duplicate-member checking within classes is still a little messy, and
anonymous unions are still completely broken in C. We'll need to unify
the handling of fields in C and C++ to make this code applicable in
both languages.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61878 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
bdae88f629538afd8504496ed28864d61471db69 07-Jan-2009 Douglas Gregor <dgregor@apple.com> Test case for anonymous unions in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61860 91177308-0d34-0410-b5e6-96231b3b80d8
nonymous-union.cpp
17a9b9e3ee75f5dbb4819cc8ebf40eec8015f84a 07-Jan-2009 Douglas Gregor <dgregor@apple.com> When determining whether a variable is a file-scoped variable, check
out its lookup context (to see through linkage
specifications). Addresses <rdar://problem/6477142>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61848 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
1a49af9681c350fef58e677f85ccb9a77e8e9d0a 06-Jan-2009 Douglas Gregor <dgregor@apple.com> Add QualifiedDeclRefExpr, which retains additional source-location
information for declarations that were referenced via a qualified-id,
e.g., N::C::value. We keep track of the location of the start of the
nested-name-specifier. Note that the difference between
QualifiedDeclRefExpr and DeclRefExpr does have an effect on the
semantics of function calls in two ways:
1) The use of a qualified-id instead of an unqualified-id suppresses
argument-dependent lookup
2) If the name refers to a virtual function, the qualified-id
version will call the function determined statically while the
unqualified-id version will call the function determined dynamically
(by looking up the appropriate function in the vtable).

Neither of these features is implemented yet, but we do print out
qualified names for QualifiedDeclRefExprs as part of the AST printing.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61789 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
64b45f7e0d3167f040841ac2920aead7f080730d 05-Jan-2009 Sebastian Redl <sebastian.redl@getdesigned.at> PODness and Type Traits

Make C++ classes track the POD property (C++ [class]p4)
Track the existence of a copy assignment operator.
Implicitly declare the copy assignment operator if none is provided.
Implement most of the parsing job for the G++ type traits extension.
Fully implement the low-hanging fruit of the type traits:
__is_pod: Whether a type is a POD.
__is_class: Whether a type is a (non-union) class.
__is_union: Whether a type is a union.
__is_enum: Whether a type is an enum.
__is_polymorphic: Whether a type is polymorphic (C++ [class.virtual]p1).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61746 91177308-0d34-0410-b5e6-96231b3b80d8
ype-traits.cpp
6c6fce03ea12b7b8e812fa1b24cfe5aa8705ceca 05-Jan-2009 Douglas Gregor <dgregor@apple.com> Add forgotten test case for linkage specifications

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61737 91177308-0d34-0410-b5e6-96231b3b80d8
inkage-spec.cpp
074149e11baf5f7db12f84efd5c34ba6e35d5cdf 05-Jan-2009 Douglas Gregor <dgregor@apple.com> Introduce support for "transparent" DeclContexts, which are
DeclContexts whose members are visible from enclosing DeclContexts up
to (and including) the innermost enclosing non-transparent
DeclContexts. Transparent DeclContexts unify the mechanism to be used
for various language features, including C enumerations, anonymous
unions, C++0x inline namespaces, and C++ linkage
specifications. Please refer to the documentation in the Clang
internals manual for more information.

Only enumerations and linkage specifications currently use transparent
DeclContexts.

Still to do: use transparent DeclContexts to implement anonymous
unions and GCC's anonymous structs extension, and, later, the C++0x
features. We also need to tighten up the DeclContext/ScopedDecl link
to ensure that every ScopedDecl is in a single DeclContext, which
will ensure that we can then enforce ownership and reduce the memory
footprint of DeclContext.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61735 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
83cf05a3b0e655dc8ea1cb4c4e1eef541b770992 05-Jan-2009 Chris Lattner <sabre@nondot.org> Fix a bug where we'd try to look beyond the current cached tokens when
not in backtracking mode. This was just using the wrong predicate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61666 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
a67865c64e2185817703b602ec24163b286abaab 05-Jan-2009 Chris Lattner <sabre@nondot.org> add a testcase


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61660 91177308-0d34-0410-b5e6-96231b3b80d8
ualified-id-lookup.cpp
a4ed0d8d75212dc01b4438829a4b0c846d99458d 28-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Diagnose declarations that don't declare anything, and fix PR3020.
Examples:
int;
typedef int;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61454 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
70316a065bcf11c88143e22c88d530ebd320832f 26-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for out-of-line definitions of conversion functions and member operators

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61442 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
61366e9cd41a6dbde4e66416dac21269c8ac1d94 24-Dec-2008 Douglas Gregor <dgregor@apple.com> Correct the order in which we cope with end-of-class-definition
semantics and improve our handling of default arguments. Specifically,
we follow this order:

- As soon as the see the '}' in the class definition, the class is
complete and we add any implicit declarations (default constructor,
copy constructor, etc.) to the class.
- If there are any default function arguments, parse them
- If there were any inline member function definitions, parse them

As part of this change, we now keep track of the the fact that we've
seen unparsed default function arguments within the AST. See the new
ParmVarDecl::hasUnparsedDefaultArg member. This allows us to properly
cope with calls inside default function arguments to other functions
where we're making use of the default arguments.

Made some C++ error messages regarding failed initializations more
specific.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61406 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
onstructor.cpp
opy-initialization.cpp
efault1.cpp
efault2.cpp
1f5432c227d0ced5f647b8fca9751d6f35008b02 23-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Merge pr-3188.cpp into constructor.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61370 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
r-3188.cpp
494bb06e34bd6aca77bb57257ed4236c22bae702 22-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Guard against the return of PR3188

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61348 91177308-0d34-0410-b5e6-96231b3b80d8
r-3188.cpp
8351da06ca3082dfd49dd8e3c1785a986920f57c 22-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Full AST support and better Sema support for C++ try-catch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61346 91177308-0d34-0410-b5e6-96231b3b80d8
ry-catch.cpp
4b07b2968f87f3cd5a3d8c76145f1cbfd718d42d 22-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Partial AST and Sema support for C++ try-catch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61337 91177308-0d34-0410-b5e6-96231b3b80d8
ry-catch.cpp
88a3514f36de96b19cdf50141c640df1a5f13f6c 22-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for calls to overloaded member functions. Things to note:
- Overloading has to cope with having both static and non-static
member functions in the overload set.
- The call may or may not have an implicit object argument,
depending on the syntax (x.f() vs. f()) and the context (static
vs. non-static member function).
- We now generate MemberExprs for implicit member access expression.
- We now cope with mutable whenever we're building MemberExprs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61329 91177308-0d34-0410-b5e6-96231b3b80d8
verload-member-call.cpp
3f70456b8adb0405ef2a47d51f9fc2d5937ae8ae 21-Dec-2008 Anders Carlsson <andersca@mac.com> Add codegen support for __null

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61314 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
86f194083504938df72135b5b66bf0c5cafd9498 21-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for member references (E1.E2, E1->E2) with C++ semantics,
which can refer to static data members, enumerators, and member
functions as well as to non-static data members.

Implement correct lvalue computation for member references in C++.
Compute the result type of non-static data members of reference type properly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61294 91177308-0d34-0410-b5e6-96231b3b80d8
ember-expr.cpp
e6d5a4a58346441c969d5fcc7aa053e029186f86 20-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implement checks for bool in increment and decrement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61275 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
d6fb7ef028d9aa0b3e8943b7bc049c524437b407 18-Dec-2008 Douglas Gregor <dgregor@apple.com> Ultrasimplistic sketch for the parsing of C++ template-ids. This won't
become useful or correct until we (1) parse template arguments
correctly, (2) have some way to turn template-ids into types,
declarators, etc., and (3) have a real representation of templates.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61208 91177308-0d34-0410-b5e6-96231b3b80d8
emplate-specialization.cpp
e878eb035b343d7d819c092102364ec9849716ae 18-Dec-2008 Chris Lattner <sabre@nondot.org> This is valid in C++.
void foo() { return foo(); }



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61188 91177308-0d34-0410-b5e6-96231b3b80d8
tatements.cpp
9103bb27f4eefa0e0d7935387750e3aca24abc49 17-Dec-2008 Douglas Gregor <dgregor@apple.com> Delay semantic analysis of the C++ names casts when the subexpression is type-dependent or the destination type is dependent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61165 91177308-0d34-0410-b5e6-96231b3b80d8
ype-dependent-exprs.cpp
3eb1c546857087b5e1377d172f37868ade960664 17-Dec-2008 Douglas Gregor <dgregor@apple.com> Removed the warning

warning: statement was disambiguated as declaration

because it is currently firing in cases where the declaration would
not actually parse as a statement. We'd love to bring this warning
back if we can make it more accurate.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61137 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
ecl-expr-ambiguity.cpp
irect-initializer.cpp
eferences.cpp
6fea8d2e42a53a1c03e2e1ced68dda8a36e09153 16-Dec-2008 Nuno Lopes <nunoplopes@sapo.pt> fix PR 3222: allow one to get the address of a global function in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61111 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of.cpp
72b505b7904b3c9320a1312998800ba76e4f5841 16-Dec-2008 Douglas Gregor <dgregor@apple.com> Delay parsing of default arguments of member functions until the class
is completely defined (C++ [class.mem]p2).

Reverse the order in which we process the definitions of member
functions specified inline. This way, we'll get diagnostics in the
order in which the member functions were declared in the class.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61103 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
3dde5a3fa28cae4b8b2fb060abc0bfc2b4425ed8 16-Dec-2008 Douglas Gregor <dgregor@apple.com> Partial fix for qualified name lookup, such that the lookup of N in
N::X only skips those entities specified in C++ [basic.lookup.qual]p1.

Note that both EDG and GCC currently get this wrong. EDG has confirmed
that the bug will be fixed in a future version.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61079 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
0a59acb9ae36077ce46fb2807956c5e84f0f6837 16-Dec-2008 Douglas Gregor <dgregor@apple.com> Make name lookup when we're inside a declarator's scope, such as ClassName::func, work with the new unqualified name lookup code. Test it with default arguments in out-of-line member definitions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61060 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
69497c315fd2bfebc7b7a8180d9125fa8b17b292 16-Dec-2008 Douglas Gregor <dgregor@apple.com> Added a test for default arguments added to out-of-line member
functions. They work except that name lookup within the default
arguments needs to be deferred until the class definition is complete
(see FIXME in the test).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61059 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
584049d49d956add7bce5669e9823491f7d8de78 16-Dec-2008 Douglas Gregor <dgregor@apple.com> Diagnose erroneous uses of out-of-line member definitions and scope
specifiers. Specifically:
* Determine when an out-of-line function definition does not match
any declaration within the class or namespace (including coping
with overloaded functions).
* Complain about typedefs and parameters that have scope specifiers.
* Complain about out-of-line declarations that aren't also
definitions.
* Complain about non-static data members being declared out-of-line.
* Allow cv-qualifiers on out-of-line member function definitions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61058 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
9e7d9de3ef538c1473248238b76a6d7b16f5f684 15-Dec-2008 Douglas Gregor <dgregor@apple.com> Place constructors and destructors into the DeclContext of the class,
just like all other members, and remove the special variables in
CXXRecordDecl to store them. This eliminates a lot of special-case
code for constructors and destructors, including
ActOnConstructor/ActOnDeclarator and special lookup rules in
LookupDecl. The result is far more uniform and manageable.

Diagnose the redeclaration of member functions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61048 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
verload-decl.cpp
9d35097bc0fefb2f77638be513cac72d1c09d840 12-Dec-2008 Douglas Gregor <dgregor@apple.com> Enable out-of-line definitions of C++ constructors and destructors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60947 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
estructor.cpp
93afb0d4f9f2ec322438c3bb7e1114ea6f614510 12-Dec-2008 Douglas Gregor <dgregor@apple.com> Add test of enumerator types

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60940 91177308-0d34-0410-b5e6-96231b3b80d8
num.cpp
c9467cf4cff1bb09f38667b871268c47ed823f97 12-Dec-2008 Douglas Gregor <dgregor@apple.com> In C++, set the type of each of the enumerators in an enumeration to
the type of the enumeration once the enumeration has been defined.

Fix the overloading test-case to properly create enums that promote
the way we want them to.

Implement C++0x promotions from enumeration types to long
long/unsigned long long. We're using these promotions in Carbon.h
(since long long is a common extension).

Fixes PR clang/2954: http://llvm.org/bugs/show_bug.cgi?id=2954


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60917 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
44b4321feab46299d3f5cfd404680884752a0fcf 11-Dec-2008 Douglas Gregor <dgregor@apple.com> Unifies the name-lookup mechanisms used in various parts of the AST
and separates lexical name lookup from qualified name lookup. In
particular:
* Make DeclContext the central data structure for storing and
looking up declarations within existing declarations, e.g., members
of structs/unions/classes, enumerators in C++0x enums, members of
C++ namespaces, and (later) members of Objective-C
interfaces/implementations. DeclContext uses a lazily-constructed
data structure optimized for fast lookup (array for small contexts,
hash table for larger contexts).

* Implement C++ qualified name lookup in terms of lookup into
DeclContext.

* Implement C++ unqualified name lookup in terms of
qualified+unqualified name lookup (since unqualified lookup is not
purely lexical in C++!)

* Limit the use of the chains of declarations stored in
IdentifierInfo to those names declared lexically.

* Eliminate CXXFieldDecl, collapsing its behavior into
FieldDecl. (FieldDecl is now a ScopedDecl).

* Make RecordDecl into a DeclContext and eliminates its
Members/NumMembers fields (since one can just iterate through the
DeclContext to get the fields).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60878 91177308-0d34-0410-b5e6-96231b3b80d8
amespace.cpp
ualified-id-lookup.cpp
caaf29a08761b14fbe42a29080c22dd6961056d1 11-Dec-2008 Douglas Gregor <dgregor@apple.com> Added a warning when referencing an if's condition variable in the
"else" clause, e.g.,

if (int X = foo()) {
} else {
if (X) { // warning: X is always zero in this context
}
}

Fixes rdar://6425550 and lets me think about something other than
DeclContext.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60858 91177308-0d34-0410-b5e6-96231b3b80d8
arn-for-var-in-else.cpp
2988205cb3d00286fa3f32ae242f6738da9060d1 10-Dec-2008 Douglas Gregor <dgregor@apple.com> Fix PR clang/3175: CheckAddressOfOperand does not handle references to class vars

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60849 91177308-0d34-0410-b5e6-96231b3b80d8
ddress-of.cpp
5c37de788529cd9180f22069970737a7208bd625 06-Dec-2008 Douglas Gregor <dgregor@apple.com> Add support for calls to dependent names within templates, e.g.,

template<typename T> void f(T x) {
g(x); // g is a dependent name, so don't even bother to look it up
g(); // error: g is not a dependent name
}

Note that when we see "g(", we build a CXXDependentNameExpr. However,
if none of the call arguments are type-dependent, we will force the
resolution of the name "g" and replace the CXXDependentNameExpr with
its result.

GCC actually produces a nice error message when you make this
mistake, and even offers to compile your code with -fpermissive. I'll
do the former next, but I don't plan to do the latter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60618 91177308-0d34-0410-b5e6-96231b3b80d8
ype-dependent-exprs.cpp
898574e7496ba8fd76290079d3a9d06954992734 06-Dec-2008 Douglas Gregor <dgregor@apple.com> Introduce basic support for dependent types, type-dependent
expressions, and value-dependent expressions. This permits us to parse
some template definitions.

This is not a complete solution; we're missing type- and
value-dependent computations for most of the expression types, and
we're missing checks for dependent types and type-dependent
expressions throughout Sema.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60615 91177308-0d34-0410-b5e6-96231b3b80d8
ependent-types.cpp
ype-dependent-exprs.cpp
ae0ee03fd9d36446ee70e502fdaf5ed5acec269f 05-Dec-2008 Chris Lattner <sabre@nondot.org> instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on. Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60563 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
7f6623914e779e41eb3d85f9a2dc3affea5de1e8 04-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Code cleanup in new handling.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60557 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
636a7c42d42800f69caadcdea433312fd642a4b3 04-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Fix some diagnostics and enhance test cases. Now tests member new and ambiguous overloads.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60542 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
b5a57a69e5fdac6dd9a92be717e279486c4a0128 03-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Overload resolution for the operator new function. Member version is still untested.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60503 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
fb4ccd7152723ac6190eb379250cfe7516cfd1b8 02-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Make the parser handle ::new and ::delete correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60421 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
cee63fbf0e64ac526582312bf8cf33263fc5c16e 02-Dec-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Handle new by passing the Declaration to the Action, not a processed type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60413 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
ec0bf0500c4fd737975a40b781983ee0c4c0eb09 01-Dec-2008 Douglas Gregor <dgregor@apple.com> Fix RUN line

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60372 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
b65f2425e9847d30bae499323a2d5cc29808d0b5 01-Dec-2008 Douglas Gregor <dgregor@apple.com> Test blocks in C++ mode

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60367 91177308-0d34-0410-b5e6-96231b3b80d8
locks.cpp
473e70de24106ffb6f6345f1377988449d32c91e 01-Dec-2008 Douglas Gregor <dgregor@apple.com> Make sure __null test runs in both 32- and 64-bit. Thanks Anders

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60360 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
a4745616ebe36ba7699f18618382e764aa8183a1 01-Dec-2008 Douglas Gregor <dgregor@apple.com> Parse the exception-specification throw(...), a Microsoft extension

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60359 91177308-0d34-0410-b5e6-96231b3b80d8
s-exception-spec.cpp
ac72d40340ce3eb6ffa932ede41631d666084fec 01-Dec-2008 Douglas Gregor <dgregor@apple.com> Add the test for __null

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60357 91177308-0d34-0410-b5e6-96231b3b80d8
_null.cpp
0f669f54f19233b703f38ef2fb3793c26c6caabb 27-Nov-2008 Douglas Gregor <dgregor@apple.com> Test conversion from apointer to incomplete type to void* in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60131 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
c83ed049af2a2ed7ab94b8206fc0fec4da7e26db 25-Nov-2008 Douglas Gregor <dgregor@apple.com> Test another error message, make sure to verify C++ new and delete tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60007 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
d162584991885ab004a02573a73ce06422b921fc 24-Nov-2008 Chris Lattner <sabre@nondot.org> Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first. This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59948 91177308-0d34-0410-b5e6-96231b3b80d8
ynamic-cast.cpp
28eb7e992b9a266abb300da25b6d3c1557cec361 24-Nov-2008 Chris Lattner <sabre@nondot.org> make the 'to match this' diagnostic a note.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59921 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ew-delete.cpp
5f4a6829dc58cab2f76e2b98492859aa3b91e3f2 24-Nov-2008 Chris Lattner <sabre@nondot.org> Make all the 'redefinition' diagnostics more consistent, and make the
"previously defined here" diagnostics all notes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59920 91177308-0d34-0410-b5e6-96231b3b80d8
lass-names.cpp
ondition.cpp
onstructor.cpp
onversion-function.cpp
ecl-expr-ambiguity.cpp
efault1.cpp
estructor.cpp
ntype-decl.cpp
amespace.cpp
verload-decl.cpp
ypedef-redecl.cpp
08631c5fa053867146b5ee8be658c229f6bf127c 23-Nov-2008 Chris Lattner <sabre@nondot.org> Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them. This has a bunch of follow-on
effects and requires tweaking to a whole lot of code. This causes
a regression in two tests (xfailed) by causing it to emit things like:

Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency. This is good, but I was planning to do this
as an independent patch. There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
011bb4edf731d529da1cbf71c7c2696aaf5a054f 23-Nov-2008 Chris Lattner <sabre@nondot.org> add support for inserting a DeclarationName into a diagnostic directly
without calling getAsString(). This implicitly puts quotes around the
name, so diagnostics need to be tweaked to accommodate this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59916 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
9f4d86389f99c5d66664382add340a2ea19ad134 22-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Fix test cases broken by quote normalization in diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59888 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
e4c452c4c7b9124fe94a96f559ff077d59cdf996 22-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implement a %plural modifier for complex plural forms in diagnostics. Use it in the overload diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59871 91177308-0d34-0410-b5e6-96231b3b80d8
opy-initialization.cpp
verloaded-operator.cpp
4c5d320a7581f4b80b151630c91cea5727fa9923 21-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59835 91177308-0d34-0410-b5e6-96231b3b80d8
ew-delete.cpp
bbe2743b0259e6c8b053b601bfd768dd49c8143a 21-Nov-2008 Douglas Gregor <dgregor@apple.com> Allow redeclaration of typedefs in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59822 91177308-0d34-0410-b5e6-96231b3b80d8
ypedef-redecl.cpp
1ca50c3f541dd637063b9d186a7ea193e3440a48 21-Nov-2008 Douglas Gregor <dgregor@apple.com> Fix overloading of non-static member functions that differ in their cv-qualifiers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59819 91177308-0d34-0410-b5e6-96231b3b80d8
verload-decl.cpp
verloaded-operator.cpp
4fcd399a52ae45ed8ebfdd3a25e01cfb76fa366d 21-Nov-2008 Douglas Gregor <dgregor@apple.com> Enable some more operator overloading tests, and don't look into an identifier for functions that might not have one

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59818 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
621b3933e570792810386b891264c78e3bd7b169 21-Nov-2008 Douglas Gregor <dgregor@apple.com> Don't print canonical types in overloading-related diagnostics

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59789 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
verloaded-operator.cpp
8ba10745f525467e91bbaec21044bf4d9017a988 20-Nov-2008 Douglas Gregor <dgregor@apple.com> Add support for overloaded operator-> when used in a member access
expression (smart_ptr->mem).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59732 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
9ebae31a97f862771dc5f6bd4923dd97131fed71 19-Nov-2008 Douglas Gregor <dgregor@apple.com> Beef up the test for function call operators slightly

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59675 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
106c6eb3f1380bfe243a62d8f0f8bce6a7c8d5c6 19-Nov-2008 Douglas Gregor <dgregor@apple.com> Implement the rest of C++ [over.call.object], which permits the object
being called to be converted to a reference-to-function,
pointer-to-function, or reference-to-pointer-to-function. This is done
through "surrogate" candidate functions that model the conversions
from the object to the function (reference/pointer) and the
conversions in the arguments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59674 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
f9eb905197e44ed5634205512074993f6f40470d 19-Nov-2008 Douglas Gregor <dgregor@apple.com> Support for calling overloaded function call operators (operator())
with function call syntax, e.g.,

Functor f;
f(x, y);

This is the easy part of handling calls to objects of class type
(C++ [over.call.object]). The hard part (coping with conversions from
f to function pointer or reference types) will come later. Nobody uses
that stuff anyway, right? :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59663 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
77407b802130b1c44b1f63b855722a5376f57bca 19-Nov-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Take care another assert:

struct A {
struct B;
};

struct A::B {
void m() {} // Assertion failed: getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."
};

Introduce DeclContext::getLexicalParent which may be different from DeclContext::getParent when nested-names are involved, e.g:

namespace A {
struct S;
}
struct A::S {}; // getParent() == namespace 'A'
// getLexicalParent() == translation unit


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59650 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
337c6b9f5d502dc1c5acea628bf7bf9e828efc0e 19-Nov-2008 Douglas Gregor <dgregor@apple.com> Support overloading of the subscript operator[], including support for
built-in operator candidates. Test overloading of '&' and ','.

In C++, a comma expression is an lvalue if its right-hand
subexpression is an lvalue. Update Expr::isLvalue accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59643 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
verloaded-operator.cpp
74253736184c0717a0649922551bf9d8b6815651 19-Nov-2008 Douglas Gregor <dgregor@apple.com> Added operator overloading for unary operators, post-increment, and
post-decrement, including support for generating all of the built-in
operator candidates for these operators.

C++ and C have different rules for the arguments to the builtin unary
'+' and '-'. Implemented both variants in Sema::ActOnUnaryOp.

In C++, pre-increment and pre-decrement return lvalues. Update
Expr::isLvalue accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59638 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
verloaded-operator.cpp
08b2c3743a29a2dddcf72e95f747760e213cdde7 19-Nov-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix this:

With this snippet:
void f(a::b);

An assert is hit:
Assertion failed: CachedTokens[CachedLexPos-1].getLocation() == Tok.getAnnotationEndLoc() && "The annotation should be until the most recent cached token", file ..\..\lib\Lex\PPCaching.cpp, line 98

Introduce Preprocessor::RevertCachedTokens that reverts a specific number of tokens when backtracking is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59636 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
447b69e55e1098d8df46dd99f171bfaace9ff8a0 19-Nov-2008 Douglas Gregor <dgregor@apple.com> Built-in equality and relational operators have return type "bool" in C++,
not "int".

Fix a typo in the promotion of enumeration types that was causing some
integral promotions to look like integral conversions (leading to
extra ambiguities in overload resolution).

Check for "acceptable" overloaded operators based on the types of the
arguments. This is a somewhat odd check that is specified by the
standard, but I can't see why it actually matters: the overload
candidates it suppresses don't seem like they would ever be picked as
the best candidates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59583 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
verloaded-operator.cpp
96176b3575823ea996c6140380dd17d9240c9766 19-Nov-2008 Douglas Gregor <dgregor@apple.com> Partial expansion of C++ operator overloading (for binary operators)
to support operators defined as member functions, e.g.,

struct X {
bool operator==(X&);
};

Overloading with non-member operators is supported, and the special
rules for the implicit object parameter (e.g., the ability for a
non-const *this to bind to an rvalue) are implemented.

This change also refactors and generalizes the code for adding
overload candidates for overloaded operator calls (C++ [over.match.expr]),
both to match the rules more exactly (name lookup of non-member
operators actually ignores member operators) and to make this routine
more reusable for the other overloaded operators.

Testing for the initialization of the implicit object parameter is
very light. More tests will come when we get support for calling
member functions directly (e.g., o.m(a1, a2)).




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59564 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
10c4262aeb5212375e3fa64e76887bd9bcc79924 18-Nov-2008 Douglas Gregor <dgregor@apple.com> As threatened previously: consolidate name lookup and the creation of
DeclRefExprs and BlockDeclRefExprs into a single function
Sema::ActOnDeclarationNameExpr, eliminating a bunch of duplicate
lookup-name-and-check-the-result code.

Note that we still have the three parser entry points for identifiers,
operator-function-ids, and conversion-function-ids, since the parser
doesn't (and shouldn't) know about DeclarationNames. This is a Good
Thing (TM), and there will be more entrypoints coming (e.g., for C++
pseudo-destructor expressions).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59527 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
e94ca9e4371c022329270436b3dd77adc4ddfa8f 18-Nov-2008 Douglas Gregor <dgregor@apple.com> Extend DeclarationName to support C++ overloaded operators, e.g.,
operator+, directly, using the same mechanism as all other special
names.

Removed the "special" identifiers for the overloaded operators from
the identifier table and IdentifierInfo data structure. IdentifierInfo
is back to representing only real identifiers.

Added a new Action, ActOnOperatorFunctionIdExpr, that builds an
expression from an parsed operator-function-id (e.g., "operator
+"). ActOnIdentifierExpr used to do this job, but
operator-function-ids are no longer represented by IdentifierInfo's.

Extended Declarator to store overloaded operator names.
Sema::GetNameForDeclarator now knows how to turn the operator
name into a DeclarationName for the overloaded operator.

Except for (perhaps) consolidating the functionality of
ActOnIdentifier, ActOnOperatorFunctionIdExpr, and
ActOnConversionFunctionExpr into a common routine that builds an
appropriate DeclRefExpr by looking up a DeclarationName, all of the
work on normalizing declaration names should be complete with this
commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59526 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
858bb6f2d6790feeb03b3c2a24f01ef24b54301b 18-Nov-2008 Chris Lattner <sabre@nondot.org> implement a fixme by making warnings for ++/-- on non-modifiable-lvalues better.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59484 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
a11f42f4bca694b9be91350d0a74815f119e3fbf 18-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implement effects of 'mutable', and a few comments from Chris on its parsing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59470 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
10bd36882406cdf4805e35add1ce2f11ab9ae152 17-Nov-2008 Douglas Gregor <dgregor@apple.com> Eliminate all of the placeholder identifiers used for constructors,
destructors, and conversion functions. The placeholders were used to
work around the fact that the parser and some of Sema really wanted
declarators to have simple identifiers; now, the code that deals with
declarators will use DeclarationNames.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59469 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
verloaded-operator-decl.cpp
2def48394f6d48bde0dec2b514193c2b533265b5 17-Nov-2008 Douglas Gregor <dgregor@apple.com> Updated IdentifierResolver to deal with DeclarationNames. The names of
C++ constructors, destructors, and conversion functions now have a
FETokenInfo field that IdentifierResolver can access, so that these
special names are handled just like ordinary identifiers. A few other
Sema routines now use DeclarationNames instead of IdentifierInfo*'s.

To validate this design, this code also implements parsing and
semantic analysis for id-expressions that name conversion functions,
e.g.,

return operator bool();

The new parser action ActOnConversionFunctionExpr takes the result of
parsing "operator type-id" and turning it into an expression, using
the IdentifierResolver with the DeclarationName of the conversion
function. ActOnDeclarator pushes those conversion function names into
scope so that the IdentifierResolver can find them, of course.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59462 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
43c7bad105f742988e7ca40564285c83bea854a5 17-Nov-2008 Douglas Gregor <dgregor@apple.com> Some cleanups for C++ operator overloading

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59443 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
1adbab67751f44147a0d259b684cf52bae142ef3 17-Nov-2008 Douglas Gregor <dgregor@apple.com> Simplify error messages for two-parameter overloaded increment/decrement operators

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59442 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
669d5d74b880a8497b92a3ec159145713f4d6519 15-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implement parsing and semantic checking of the 'mutable' keyword.
Thanks to Doug for the review. Actual effects of mutable to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59331 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
eb8f3063257a392f15aea48d42fb73ec51afc548 12-Nov-2008 Douglas Gregor <dgregor@apple.com> Implement support for operator overloading using candidate operator
functions for built-in operators, e.g., the builtin

bool operator==(int const*, int const*)

can be used for the expression "x1 == x2" given:

struct X {
operator int const*();
} x1, x2;

The scheme for handling these built-in operators is relatively simple:
for each candidate required by the standard, create a special kind of
candidate function for the built-in. If overload resolution picks the
built-in operator, we perform the appropriate conversions on the
arguments and then let the normal built-in operator take care of it.

There may be some optimization opportunity left: if we can reduce the
number of built-in operator overloads we generate, overload resolution
for these cases will go faster. However, one must be careful when
doing this: GCC generates too few operator overloads in our little
test program, and fails to compile it because none of the overloads it
generates match.

Note that we only support operator overload for non-member binary
operators at the moment. The other operators will follow.

As part of this change, ImplicitCastExpr can now be an lvalue.





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59148 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-builtin-operators.cpp
c42e1183846228a7fa5143ad76507d6d60f5c6f3 11-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implement C++ 'typeid' parsing and sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59042 91177308-0d34-0410-b5e6-96231b3b80d8
ypeid.cpp
904eed3f6148758d39a2d3c88f3133274460d645 10-Nov-2008 Douglas Gregor <dgregor@apple.com> Basic support for taking the address of an overloaded function

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59000 91177308-0d34-0410-b5e6-96231b3b80d8
ddr-of-overloaded-function.cpp
3f08d181f620e6bf4971c436fc9878f98a02bbe3 10-Nov-2008 Douglas Gregor <dgregor@apple.com> Improve parser error recovery after a constructor initializer

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58989 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
cb9b977d5989efc1e5bc7684091912ca2915aacb 10-Nov-2008 Douglas Gregor <dgregor@apple.com> Allow user-defined conversions during reference binding

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58988 91177308-0d34-0410-b5e6-96231b3b80d8
ser-defined-conversions.cpp
5239304ff761b8b03eefb772bd5d830a9b9f1aea 10-Nov-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Introduce ScopedDecl::getLexicalDeclContext() which is different from ScopedDecl::getDeclContext() when there are nested-names.
e.g.:
namespace A {
void f(); // SemanticDC (getDeclContext) == LexicalDC (getLexicalDeclContext) == 'namespace A'
}
void A::f(); // SemanticDC == namespace 'A'
// LexicalDC == global namespace


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58948 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
ef6e647b8d3268a765c2c4dd7f8a73cad281a8e6 08-Nov-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement Sema support for C++ nested-name-specifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58916 91177308-0d34-0410-b5e6-96231b3b80d8
ested-name-spec.cpp
e3dc28a32a61960bdef59f79d0da161c72a5c88a 08-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Greatly improve static_cast diagnostics

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58873 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
f1991eab1e777634fb38758eafbbe0d303271d2f 07-Nov-2008 Douglas Gregor <dgregor@apple.com> Initial, partially-baked support for implicit user-defined conversions by conversion functions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58870 91177308-0d34-0410-b5e6-96231b3b80d8
ser-defined-conversions.cpp
c7ed9c60b8ee04b119e23441cae2cfec74536ba9 07-Nov-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Changes in preparation for nested-name-specifiers.

-When parsing declarators, don't depend on "CurScope->isCXXClassScope() == true" for constructors/destructors
-For C++ member declarations, don't depend on "Declarator.getContext() == Declarator::MemberContext"

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58866 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
2f1bc5285ccd40f411af5f5993f013e27e74ab78 07-Nov-2008 Douglas Gregor <dgregor@apple.com> Parsing, ASTs, and semantic analysis for the declaration of conversion
functions in C++, e.g.,

struct X {
operator bool() const;
};

Note that these conversions don't actually do anything, since we don't
yet have the ability to use them for implicit or explicit conversions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58860 91177308-0d34-0410-b5e6-96231b3b80d8
onversion-function.cpp
eaebc75ef6ff21fbc9f25ab4175cba465e4e0e43 07-Nov-2008 Douglas Gregor <dgregor@apple.com> Initial, rudimentary implementation of operator overloading for binary
operators. For example, one can now write "x + y" where x or y is a
class or enumeration type, and Clang will perform overload resolution
for "+" based on the overloaded operators it finds.

The other kinds of overloadable operators in C++ will follow this same
approach.

Three major issues remain:
1) We don't find member operators
2) Since we don't have user-defined conversion operators, we can't
call any of the built-in overloaded operators in C++ [over.built].
3) Once we've done the semantic checks, we drop the overloaded
operator on the floor; it doesn't get into the AST at all.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58821 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator.cpp
1cd1b1e987f5e2f060d7972b13d83239b36d77d6 06-Nov-2008 Douglas Gregor <dgregor@apple.com> Parsing, ASTs, and semantic analysis for the declaration of overloaded
operators in C++. Overloaded operators can be called directly via
their operator-function-ids, e.g., "operator+(foo, bar)", but we don't
yet implement the semantics of operator overloading to handle, e.g.,
"foo + bar".



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58817 91177308-0d34-0410-b5e6-96231b3b80d8
verloaded-operator-decl.cpp
d93f0ddba0965ded252e228134b30ce30e863fb0 06-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Sema-check virtual declarations. Complete dynamic_cast checking.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58804 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
lass.cpp
ynamic-cast.cpp
42a552f8200ba5948661aee0106fce0c04e39818 05-Nov-2008 Douglas Gregor <dgregor@apple.com> Parsing, representation, and preliminary semantic analysis of destructors.

Implicit declaration of destructors (when necessary).

Extended Declarator to store information about parsed constructors
and destructors; this will be extended to deal with declarators that
name overloaded operators (e.g., "operator +") and user-defined
conversion operators (e.g., "operator int").



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58767 91177308-0d34-0410-b5e6-96231b3b80d8
estructor.cpp
4e84935b299f2572601419692f1f2e84def685e7 05-Nov-2008 Sebastian Redl <sebastian.redl@getdesigned.at> A small error message improvement and some comment cleanup for static_cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58762 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-cast.cpp
64bffa9a6f40e5a3d5556f994f09f7bf45eecd4c 05-Nov-2008 Douglas Gregor <dgregor@apple.com> Keep track of whether a C++ class is an aggregate. Don't allow initialization of non-aggregates with initializer lists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58757 91177308-0d34-0410-b5e6-96231b3b80d8
ggregate-initialization.cpp
f03d7c7af2ca8555c513ba7667acffb667445ecd 05-Nov-2008 Douglas Gregor <dgregor@apple.com> Implement C++ copy-initialization for declarations. There is now some
duplication in the handling of copy-initialization by constructor,
which occurs both for initialization of a declaration and for
overloading. The initialization code is due for some refactoring.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58756 91177308-0d34-0410-b5e6-96231b3b80d8
opy-initialization.cpp
irect-initializer.cpp
7ad8390f7992ab7f19b1460c5f0b9d96f165c4e9 05-Nov-2008 Douglas Gregor <dgregor@apple.com> Initial implementation of parsing, semantic analysis, and AST-building
for constructor initializations, e.g.,

class A { };
class B : public A {
int m;
public:
B() : A(), m(17) { };
};





git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58749 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor-initializer.cpp
eb704f22ef00a2b41ff1ccf1b20016d7cd4c5c85 04-Nov-2008 Douglas Gregor <dgregor@apple.com> Now that we have copy initialization support, use it for checking the default arguments

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58692 91177308-0d34-0410-b5e6-96231b3b80d8
efault1.cpp
3996f23ac20de411e0b5931a451bd05142f0b712 04-Nov-2008 Douglas Gregor <dgregor@apple.com> Diagnose use of 'this' in a C++ default argument. Thanks to Eli for correcting my bogus assertion about it already being handled

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58691 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
30c5436856b33e15387ec7a14bcd10c49236e340 03-Nov-2008 Douglas Gregor <dgregor@apple.com> Check that this cannot be used in a default argument. Happily, it was already implemented

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58649 91177308-0d34-0410-b5e6-96231b3b80d8
efault2.cpp
18fe56863be253a27b940022d27a3101778adaf6 03-Nov-2008 Douglas Gregor <dgregor@apple.com> Implicit support for direct initialization of objects of class type, e.g.,

X x(5, 7);




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58641 91177308-0d34-0410-b5e6-96231b3b80d8
irect-initializer.cpp
225c41eb3e960fd2e1d1b547f0f19a278d608bc5 03-Nov-2008 Douglas Gregor <dgregor@apple.com> Standard conversion sequences now have a CopyConstructor field, to
cope with the case where a user-defined conversion is actually a copy
construction, and therefore can be compared against other standard
conversion sequences. While I called this a hack before, now I'm
convinced that it's the right way to go.

Compare overloads based on derived-to-base conversions that invoke
copy constructors.

Suppress user-defined conversions when attempting to call a
user-defined conversion.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58629 91177308-0d34-0410-b5e6-96231b3b80d8
onverting-constructor.cpp
verload-call-copycon.cpp
396b7cd9f6b35d87d17ae03e9448b5c1f2184598 03-Nov-2008 Douglas Gregor <dgregor@apple.com> Add implicitly-declared default and copy constructors to C++ classes,
when appropriate.

Conversions for class types now make use of copy constructors. I've
replaced the egregious hack allowing class-to-class conversions with a
slightly less egregious hack calling these conversions standard
conversions (for overloading reasons).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58622 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call-copycon.cpp
f1f9b4e5c7fd087e78f2e387c01098d49d41e784 03-Nov-2008 Douglas Gregor <dgregor@apple.com> Implement C++ DR 106 and C++ DR 540, both of which deal with
reference-collapsing.

Implement diagnostic for formation of a reference to cv void.

Drop cv-qualifiers added to a reference type when the reference type
comes from a typedef.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58612 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
030ff0cdad79b9e0602e143e0669364d2bad8bd2 31-Oct-2008 Douglas Gregor <dgregor@apple.com> Semantic checking of constructor declarations and classification of default/copy constructors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58538 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
60d62c29d260596454aaf4cb50cbc756ac08875e 31-Oct-2008 Douglas Gregor <dgregor@apple.com> Implement basic support for converting constructors in user-defined
conversions.

Notes:
- Overload resolution for converting constructors need to prohibit
user-defined conversions (hence, the test isn't -verify safe yet).
- We still use hacks for conversions from a class type to itself.
This will be the case until we start implicitly declaring the appropriate
special member functions. (That's next on my list)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58513 91177308-0d34-0410-b5e6-96231b3b80d8
onverting-constructor.cpp
0777972d38a3125efed962b045704c30ae6965cf 31-Oct-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Implement semantic checking of static_cast and dynamic_cast.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58509 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
ynamic-cast.cpp
tatic-cast.cpp
b48fe3812047e84164925c8938ce82be0624c40c 31-Oct-2008 Douglas Gregor <dgregor@apple.com> Add support for parsing and representing C++ constructor declarations.

Notes:
- Constructors are never found by name lookup, so they'll never get
pushed into any scope. Instead, they are stored as an
OverloadedFunctionDecl in CXXRecordDecl for easy overloading.
- There's a new action isCurrentClassName that determines whether an
identifier is the name of the innermost class currently being defined;
we use this to identify the declarator-id grammar rule that refers to
a type-name.
- MinimalAction does *not* support parsing constructors.
- We now handle virtual and explicit function specifiers.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58499 91177308-0d34-0410-b5e6-96231b3b80d8
onstructor.cpp
2a72f7b592d9966fb0cccd989780b6821aaf0368 29-Oct-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Remove workaround for reference. No longer necessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58395 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
6fc17ff5bf73c4d190517ebc5773f2ae557598ab 29-Oct-2008 Douglas Gregor <dgregor@apple.com> Simplify and correct the check for function redefinitions. This does two things:

- Allows definitions of overloaded functions :)
- Eliminates extraneous error messages when we have a definition of a
function that isn't an overload but doesn't have exactly the same type
as the original.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58382 91177308-0d34-0410-b5e6-96231b3b80d8
ntype-decl.cpp
verload-call.cpp
f70bdb9463a6e3ea2c6307b2c7a5f3e2c6b7e489 29-Oct-2008 Douglas Gregor <dgregor@apple.com> Implement overloading rules for reference binding

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58381 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
818ce488beec3935623a25bfa0026d67e182d6d6 29-Oct-2008 Douglas Gregor <dgregor@apple.com> Temporary disable the const-object-declaration-without-initializer check, because it depends on linkage-specifier semantics we don't yet have

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58377 91177308-0d34-0410-b5e6-96231b3b80d8
eferences.cpp
15da57e66cade0c2cab752f925e838b22daadafc 29-Oct-2008 Douglas Gregor <dgregor@apple.com> Tweak Sema::CheckReferenceInit so that it (optionally) computes an
ImplicitConversionSequence and, when doing so, following the specific
rules of [over.best.ics].

The computation of the implicit conversion sequences implements C++
[over.ics.ref], but we do not (yet) have ranking for implicit
conversion sequences that use reference binding.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58357 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
27c8dc06f65d7abcf6a7e7f64a7960c9a150ca01 29-Oct-2008 Douglas Gregor <dgregor@apple.com> Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:

- Try/Perform-ImplicitConversion now handles implicit conversions
that don't involve references.
- Try/Perform-CopyInitialization uses
CheckSingleAssignmentConstraints for C. PerformCopyInitialization
is now used for all argument passing and returning values from a
function.
- Diagnose errors with declaring references and const values without
an initializer. (Uses a new Action callback, ActOnUninitializedDecl).

We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58353 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
eferences.cpp
49badde06e066d058d6c7fcf4e628a72999b65a9 27-Oct-2008 Douglas Gregor <dgregor@apple.com> Refactor the expression class hierarchy for casts. Most importantly:
- CastExpr is the root of all casts
- ImplicitCastExpr is (still) used for all explicit casts
- ExplicitCastExpr is now the root of all *explicit* casts
- ExplicitCCastExpr (new name needed!?) is a C-style cast in C or C++
- CXXFunctionalCastExpr inherits from ExplicitCastExpr
- CXXNamedCastExpr inherits from ExplicitCastExpr and is the root of all
of the C++ named cast expression types (static_cast, dynamic_cast, etc.)
- Added classes CXXStaticCastExpr, CXXDynamicCastExpr,
CXXReinterpretCastExpr, and CXXConstCastExpr to

Also, fixed returned-stack-addr.cpp, which broke once when we fixed
reinterpret_cast to diagnose double->int* conversions and again when
we eliminated implicit conversions to reference types. The fix is in
both testcase and SemaChecking.cpp.

Most of this patch is simply support for the renaming. There's very
little actual change in semantics.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58264 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-stack-addr.cpp
8b3f6b5c522308b709a735a789e41b299d905392 27-Oct-2008 Sebastian Redl <sebastian.redl@getdesigned.at> Fix some invalid casts that are detected by Sema now or soon.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58252 91177308-0d34-0410-b5e6-96231b3b80d8
eturn-stack-addr.cpp
3dda64ec0fad2fa60d882565d135ff598897fa9d 27-Oct-2008 Douglas Gregor <dgregor@apple.com> When destroying a translation unit, deallocate its owned declarations in reverse order, because there may be dependencies among the declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58244 91177308-0d34-0410-b5e6-96231b3b80d8
ntype-decl.cpp
a59620996236d8b09d5bcc3bac6d3226118566b7 25-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Unbreak the test by.. removing a space. (clang protested that -verify only works on single input files).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58123 91177308-0d34-0410-b5e6-96231b3b80d8
unction-type-qual.cpp
971c4fae6092976338b755af1d47dac07c8f16e3 24-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> -Add support for cv-qualifiers after function declarators.
-Add withConst/withVolatile/withRestrict methods to QualType class, that return the QualType plus the respective qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58120 91177308-0d34-0410-b5e6-96231b3b80d8
unction-type-qual.cpp
6cbd3df095ab92e0637265e88fe9c093135cdb03 24-Oct-2008 Douglas Gregor <dgregor@apple.com> PR2942: FunctionDecls by typedef crash the C++ front-end

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58100 91177308-0d34-0410-b5e6-96231b3b80d8
ntype-decl.cpp
2f639b9f3c6b081f076d2ac6d75115ce44bfa249 24-Oct-2008 Douglas Gregor <dgregor@apple.com> Semantic analysis for C++ reinterpret_cast and const_cast. Patch by Sebastian Redl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58094 91177308-0d34-0410-b5e6-96231b3b80d8
onst-cast.cpp
einterpret-cast.cpp
einterpret-fn-obj-pedantic.cpp
94b1dd2368dc9eeedf2794db654deae225fac763 24-Oct-2008 Douglas Gregor <dgregor@apple.com> First non-embarrassing cut at checking for ambiguous derived-to-base
conversions.

Added PerformImplicitConversion, which follows an implicit conversion sequence
computed by TryCopyInitialization and actually performs the implicit
conversions, including the extra check for ambiguity mentioned above.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58071 91177308-0d34-0410-b5e6-96231b3b80d8
erived-to-base-ambig.cpp
bc0805a6ca84e3c38a08c9f47441e138945244d4 23-Oct-2008 Douglas Gregor <dgregor@apple.com> Add support for conversions from a pointer-to-derived to a
pointer-to-base. Also, add overload ranking for pointer conversions
(for both pointer-to-void and derived-to-base pointer conversions).

Note that we do not yet diagnose derived-to-base pointer conversion
errors that stem from ambiguous or inacessible base classes. These
aren't handled during overload resolution; rather, when the conversion
is actually used we go ahead and diagnose the error.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58017 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
f8268ae3196002bbab6adb830302e79b0f368f13 22-Oct-2008 Douglas Gregor <dgregor@apple.com> Add representation of base classes in the AST, and verify that we
don't have duplicated direct base classes.

Seriliazation of base class specifiers is not yet implemented.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57991 91177308-0d34-0410-b5e6-96231b3b80d8
nherit.cpp
57373266011f73418381b736015d8d2bb0381176 22-Oct-2008 Douglas Gregor <dgregor@apple.com> Implement ranking of standard conversion sequences by their qualification
conversions (e.g., comparing int* -> const int* against
int* -> const volatile int*); see C++ 13.3.3.2p3 bullet 3.

Add Sema::UnwrapSimilarPointerTypes to simplify the control flow of
IsQualificationConversion and CompareQualificationConversion (and fix
the handling of the int* -> volatile int* conversion in the former).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57978 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
9b6e2d209cc2931a9bb2ae51e744a8698b54db73 22-Oct-2008 Douglas Gregor <dgregor@apple.com> Fix a thinko in the qualification-conversion check when the qualificaitons are disjoint, and add some overloading-based tests of qualification conversions

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57942 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
98cd599ee8a9b259ed7388ee2921a20d97658864 22-Oct-2008 Douglas Gregor <dgregor@apple.com> Initial step toward supporting qualification conversions (C++ 4.4).

Changes:
- Sema::IsQualificationConversion determines whether we have a qualification
conversion.
- Sema::CheckSingleAssignment constraints now follows the C++ rules in C++,
performing an implicit conversion from the right-hand side to the type of
the left-hand side rather than checking based on the C notion of
"compatibility". We now rely on the implicit-conversion code to
determine whether the conversion can happen or
not. Sema::TryCopyInitialization has an ugly reference-related
hack to cope with the initialization of references, for now.
- When building DeclRefExprs, strip away the reference type, since
there are no expressions whose type is a reference. We'll need to
do this throughout Sema.
- Expr::isLvalue now permits functions to be lvalues in C++ (but not
in C).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57935 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
ualification-conversion.cpp
8e9bebdea69c590dedfbf27374114cb76fe12fbd 21-Oct-2008 Douglas Gregor <dgregor@apple.com> Preliminary support for function overloading

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57909 91177308-0d34-0410-b5e6-96231b3b80d8
verload-call.cpp
verload-decl.cpp
0fe706040795f24ad61c0ca436a0304fdce8fd6f 21-Oct-2008 Gabor Greif <ggreif@gmail.com> Tweak an expected-error to match the output. IMHO it is better to diagnose 'int (void)' because it has the same meaning in C and C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57901 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
259b0d91f2ff90d8daf39221fe133bf1596c5ffb 16-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Issue a warning when there's an ambiguous function declarator (that could be a direct initializer for a variable defition).
Idea originated from here: http://thread.gmane.org/gmane.comp.gcc.devel/101524

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57609 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
d6caa9ef4cc68290b0bf33432934cc11dd5594e6 15-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix this bug:

typedef int f();
struct S {
f *x; // incorrectly assuming this is function decl, leading to failed assertions.
};

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57598 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
de933f025e839bde4b119f3437c320c2137bbe1f 09-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix a bug that crashed clang when parsing this:

class C {
static const int number = 50;
static int arr[number];
};

Here's how it worked:
-GetTypeForDeclarator was called from both Sema::ActOnCXXMemberDeclarator and Sema::ActOnDeclarator.
-VariableArrayTypes are not uniqued so two VariableArrayTypes were created with the same DeclRefExpr.
-On exit they both tried to destroy that one DeclRefExpr.

The fix is not to use GetTypeForDeclarator from the Sema::ActOnCXXMemberDeclarator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57313 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
3f2a8a0de575b02408384f92914729b7518d4e77 07-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> In ParseParenDeclarator match "D.setGroupingParens(true);" with another setGroupingParens call after the ')' is parsed.
Fixes this bug:
int (x)(0); // error, expected function declarator where the '(0)' initializer is

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57241 91177308-0d34-0410-b5e6-96231b3b80d8
irect-initializer.cpp
73a0d889eda0f000a441319e39540509175b8e81 06-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement support for C++ direct initializers in declarations, e.g. "int x(1);".

This is how this kind of initializers appear in the AST:
-The Init expression of the VarDecl is a functional type construction (of the VarDecl's type).
-The new VarDecl::hasCXXDirectInitializer() returns true.

e.g, for "int x(1);":
-VarDecl 'x' has Init with expression "int(1)" (CXXFunctionalCastExpr).
-hasCXXDirectInitializer() of VarDecl 'x' returns true.

A major benefit is that clients that don't particularly care about which exactly form was the initializer can handle both cases without special case code.
Note that codegening works now for "int x(1);" without any changes to CodeGen.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57178 91177308-0d34-0410-b5e6-96231b3b80d8
irect-initializer.cpp
d3dbbb68b1050da2f58d4bea6b23016f451968c9 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add some text from the C++ standard and additional ambiguity resolution tests.
No funcitonality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57136 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
78c8d80f19cb0bccd4f3d590e71a230e727cfab5 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Handle ambiguities between expressions and type-ids that occur inside parentheses, e.g.:

sizeof(int()) -> "int()" is type-id
sizeof(int()+1) -> "int()+1" is expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57131 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
b9f341916e484ff6ba2c2d28c8b2dd5fa12b0015 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Found a subtle bug caused by an implicit enum-to-bool conversion (of the TentativeParsingResult enum).
This was the motivation of the following changes:

-'TentativeParsingResult' enum is replaced by a 'TPResult' class that basically encapsulates the enum.
-TPR_true, TPR_false, TPR_ambiguous, and TPR_error enum constants are replaced by TPResult::True(), TPResult::False(), etc. calls that return a TPResult object.
-Also fixed the subtle bug in Parser::isCXXFunctionDeclarator (caught by the above changes as a compilation error).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57125 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
bbc70c019f7b7f9a256ee29dab5287ecc82c6553 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Disambiguate between a declaration or an expression, in the 'for-init-statement' part of a 'for' statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57112 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
ca35baa788ccba7a213365b9d64d6b2f7bdb9afe 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix Parser::isCXXConditionDeclaration to properly resolve declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57111 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
a8a4598b6f2a07339ab8a1248295a07d771a2b2a 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Disambiguate between a declaration or expression for the 'condition' part of a if/switch/while/for statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57109 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
1ee2c43bc0c281b60b29f1883e1e206cae28aed6 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Consider GNU attributes when doing ambiguity resolution.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57108 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
5404a156be26de1c63ca9916187f970848bb4dbb 05-Oct-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Resolve ambiguous C++ statements (C++ 6.8p1).
'ParseTentative.cpp' implements the functionality needed to resolve ambiguous C++ statements, to either a declaration or an expression, by "tentatively parsing" them.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57084 91177308-0d34-0410-b5e6-96231b3b80d8
ecl-expr-ambiguity.cpp
77a52233f7c0f162672652051bfe78b65ad4f789 12-Sep-2008 Douglas Gregor <dgregor@apple.com> Give string literals const element typesin C++, and cope with the deprecated C++ conversion from a string literal to a pointer-to-non-const-character

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56137 91177308-0d34-0410-b5e6-96231b3b80d8
ype-convert-construct.cpp
6314ff264c345b5babb9faf50dad0bc68d7bd74e 11-Sep-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Do implicit conversion to bool for the condition in a do-while statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56096 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
143db71d8d87bc015fb496f71ef83b268813835a 11-Sep-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Fix do-while scoping in C++.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56095 91177308-0d34-0410-b5e6-96231b3b80d8
o-while-scope.cpp
4c0f56b999f5b079f338ac499513ee8e3af70275 11-Sep-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> In the 'condition.cpp' test case, make sure that condition declarations are local to the statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56077 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
5921093cf1c2e9a8bd1a22b6f612e551bae7476b 10-Sep-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Implement Sema support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56044 91177308-0d34-0410-b5e6-96231b3b80d8
ondition.cpp
4f3cc8189677ceb79293748a159010ac05f481a8 24-Aug-2008 Anders Carlsson <andersca@mac.com> Add carbon.cpp and cocoa.mm tests

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55262 91177308-0d34-0410-b5e6-96231b3b80d8
arbon.cpp
b88d45ea7eb835d36c4a4b3ea84b1260b120dd0a 23-Aug-2008 Anders Carlsson <andersca@mac.com> treat bool literals as constatnt expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55255 91177308-0d34-0410-b5e6-96231b3b80d8
ool.cpp
2fba1217dc4c81064a8bf53e422d0924f141cd4b 23-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add a null pointer test in the type-convert-construct.cpp tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55247 91177308-0d34-0410-b5e6-96231b3b80d8
ype-convert-construct.cpp
4bd8217d94d42e0f1439defe2001292988dc5288 22-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move the rest of the Sema C++ tests into the SemaCXX test directory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55178 91177308-0d34-0410-b5e6-96231b3b80d8
lass-names.cpp
efault1.cpp
efault2.cpp
nherit.cpp
eturn-stack-addr.cpp
987a14bf5883ef6e5d07f1c83eb6d41a8212a78c 22-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Add support for C++'s "type-specifier ( expression-list )" expression:

-The Parser calls a new "ActOnCXXTypeConstructExpr" action.
-Sema, depending on the type and expressions number:
-If the type is a class, it will treat it as a class constructor. [TODO]
-If there's only one expression (i.e. "int(0.5)" ), creates a new "CXXFunctionalCastExpr" Expr node
-If there are no expressions (i.e "int()" ), creates a new "CXXZeroInitValueExpr" Expr node.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55177 91177308-0d34-0410-b5e6-96231b3b80d8
ype-convert-construct.cpp
c5eb7311445bb14b6a26eb2ad667fe7a1ca20887 22-Aug-2008 Anders Carlsson <andersca@mac.com> Initial sema support for C++ static initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55166 91177308-0d34-0410-b5e6-96231b3b80d8
tatic-initializers.cpp
2ff9b4c7c8fed9233a0b8de2e9507368c451aab6 17-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Type::isIntegerType() returns true for types between Bool and LongLong.
Put WChar between them to make it integer type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54882 91177308-0d34-0410-b5e6-96231b3b80d8
char_t.cpp
5e8840c7a6840c9dd67dc3b8ca0ab965db439e32 16-Aug-2008 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move the C++ Sema tests into a separate SemaCXX directory.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54853 91177308-0d34-0410-b5e6-96231b3b80d8
lass.cpp
amespace.cpp
eferences.cpp
his.cpp
char_t.cpp