Add experimental flag for adaptive parameter bin-packing.

This is not activated for any style, might change or go away
completely.

For those that want to play around with it, set
ExperimentalAutoDetectBinPacking to true.

clang-format will then:
Look at whether function calls/declarations/definitions are currently
formatted with one parameter per line (on a case-by-case basis). If so,
clang-format will avoid bin-packing the parameters. If all parameters
are on one line (thus that line is "inconclusive"), clang-format will
make the choice dependent on whether there are other bin-packed
calls/declarations in the same file.

The reason for this change is that bin-packing in some situations can be
really bad and an author might opt to put one parameter on each line. If
the author does that, he might want clang-format not to mess with that.
If the author is unhappy with the one-per-line formatting, clang-format
can easily be convinced to bin-pack by putting any two parameters on the
same line.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186003 91177308-0d34-0410-b5e6-96231b3b80d8
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
Add a hook RecursiveASTVisitor::TraverseLambdaBody, to enable visitors to
use/maintain additional state from the LambdaExpr while visiting the body
of a LambdaExpr.

One use for this arises because Clang's AST currently holds lambda bodies
in a form prior to their adjustment to refer to captured copies of local
variables, and so some clients will need access to the lambda's closure
type in order to query how to map VarDecl*s to the FieldDecls of their
by-copy captures. This hook is sufficient for at least one such client;
to do this without such a hook would require the client to re-implement
the whole of TraverseLambdaExpr, which is non-trivial and would likely be
more brittle.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186024 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Remove bogus assert: in C++11, 'new' can do list-initialization.

Previously, we asserted that whenever 'new' did not include a constructor
call, the type must be a non-record type. In C++11, however, uniform
initialization syntax (braces) allow 'new' to construct records with
list-initialization: "new Point{1, 2}".

Removing this assertion should be perfectly safe; the code here matches
what VisitDeclStmt does for regions allocated on the stack.

<rdar://problem/14403437>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186028 91177308-0d34-0410-b5e6-96231b3b80d8
Use a LexicalScope here since it is one and it will encapsulate
the two sets of debug scope and cleanup scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186030 91177308-0d34-0410-b5e6-96231b3b80d8
ObjC migrator: Improve on hueristics.
migrate to 'copy attribute if Object
class implements NSCopying otherwise 
assume implied 'strong'. Remove 
lifetime qualifier on property as it has
moved to property's attribute. Added TODO
comment for future work by poking into
setter implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186037 91177308-0d34-0410-b5e6-96231b3b80d8
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
Fix documentation:

  #if defined(__has_foo("X")) && __has_foo("X")

is not a correct way to portably use __has_foo, because it is expanded to

  #if 0 && 0("X")

... which is ill-formed.

Also add a missing ')'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186047 91177308-0d34-0410-b5e6-96231b3b80d8
Fix some grammar errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186048 91177308-0d34-0410-b5e6-96231b3b80d8
Simplify atomic load/store IRGen.

Also fixes a couple minor bugs along the way; see testcases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186049 91177308-0d34-0410-b5e6-96231b3b80d8
Make CheckAddressOfOperand a member of Sema so it can be reused by
__builtin_addressof.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186052 91177308-0d34-0410-b5e6-96231b3b80d8
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
Fix build.

Sorry about that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186054 91177308-0d34-0410-b5e6-96231b3b80d8
clang/test/CodeGen/c11atomics.c: Fix testcase for -Asserts since r186054.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186055 91177308-0d34-0410-b5e6-96231b3b80d8
Documentation cleanup for DeclCXX.h:
* Fixing up \brief summaries (adding some, making some briefer);
* Standardizing on \commands, not @commands;
* Update C++0x references to C++11;
* Fix typos and Doxygen warnings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186056 91177308-0d34-0410-b5e6-96231b3b80d8
Documentation fixes - the rest of DeclCXX.h:
* More \brief additions/fixes;
* Fix some misleading comments about C++11's explicit conversion operators;
* Mark up some \code examples;
* Add \file documentation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186059 91177308-0d34-0410-b5e6-96231b3b80d8
PR5066: If a declarator cannot have an identifier, and cannot possibly be
followed by an identifier, then diagnose an identifier as being a bogus part of
the declarator instead of tripping over it. Improves diagnostics for cases like

  std::vector<const int *p> my_vec;


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186061 91177308-0d34-0410-b5e6-96231b3b80d8
Keep trailing annotations close to their argument.

Before:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa GUARDED_BY(
    aaaaaaaaaaaa);

After:
bool aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    GUARDED_BY(aaaaaaaaaaaa);

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186077 91177308-0d34-0410-b5e6-96231b3b80d8
Fix indentation problem for comments in call chains

Before:
SomeObject
    // Calling someFunction on SomeObject
        .someFunction();

After:
SomeObject
    // Calling someFunction on SomeObject
    .someFunction();

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@186085 91177308-0d34-0410-b5e6-96231b3b80d8
Improve detection of trailing return types.

Trailing return types can only occur in declaration contexts.

Before:
  void f() { auto a = b -> c(); }

After:
  void f() { auto a = b->c(); }

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