Improve identification of c-style casts.

A ")" before any of "=", "{" or ";" won't be a cast. This fixes issues
with the formatting of unnamed parameters.

Before: void f(int *){}
After:  void f(int *) {}

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172349 91177308-0d34-0410-b5e6-96231b3b80d8
Don't put spaces around hyphens in include paths.

Before: #include <a - a>
After:  #include <a-a>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172350 91177308-0d34-0410-b5e6-96231b3b80d8
Always put a space after ",".

I am not aware of a case where that would be wrong. The specific case I
am fixing are function parameters wrapped in parenthesis (e.g. in
macros).

Before: function(a,(b));
After:  function(a, (b));

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172351 91177308-0d34-0410-b5e6-96231b3b80d8
CGBuiltin.cpp: Fix abuse of ArrayRef in EmitOverflowIntrinsic().

In ArrayRef<T>(X), X should not be temporary value. It could be rewritten more redundantly;

  llvm::Type *XTy = X->getType();
  ArrayRef<llvm::Type *> Ty(XTy);
  llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, Ty);

Since it is safe if both XTy and Ty are temporary value in one statement, it could be shorten;

  llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, ArrayRef<llvm::Type*>(X->getType()));

ArrayRef<T> has an implicit constructor to create uni-entry of T;

  llvm::Value *Callee = CGF.CGM.getIntrinsic(IntrinsicID, X->getType());

MSVC-generated clang.exe crashed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172352 91177308-0d34-0410-b5e6-96231b3b80d8
Refactor the x86 CPU name logic in the driver and pass -march and -mcpu
flag information down from the Clang driver into the Gold linker plugin
for LTO. This allows specifying -march on the linker commandline and
should hopefully have it pass all the way through to the LTO optimizer.

Fixes PR14697.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172354 91177308-0d34-0410-b5e6-96231b3b80d8
Format unions like structs and classes.

Note that I don't know whether we should put {} on a single line in this
case, but it is probably a theoretical issue as in practice such
structs, classes or unions won't be empty.

Before: union A {}
        a;
After:  union A {} a;

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172357 91177308-0d34-0410-b5e6-96231b3b80d8
Stronger respect the input codes line breaks wrt. comments.

clang-format should not change whether or not there is a line break
before a line comment as this strongly influences the percieved binding.

User input: void f(int a,
                   // b is awesome
		   int b);
            void g(int a, // a is awesome
		   int b);
Before:     void f(int a, // b is awesome
                   int b);
            void g(int a, // a is awesome
		   int b);
After:      <unchanged from input>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172361 91177308-0d34-0410-b5e6-96231b3b80d8
Document behavior of -Wformat-nonliteral, it is different from GCC


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172362 91177308-0d34-0410-b5e6-96231b3b80d8
ArrayRef'ize Sema APIs related to format string checking


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172367 91177308-0d34-0410-b5e6-96231b3b80d8
Remove an unneeded const_cast


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172370 91177308-0d34-0410-b5e6-96231b3b80d8
Constify argument of Preprocessor::getMacroInfoHistory and propagate to
callers, removing unneeded const_cast


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172372 91177308-0d34-0410-b5e6-96231b3b80d8
libclang: remove a few const_casts


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172373 91177308-0d34-0410-b5e6-96231b3b80d8
*this is const in a trailing-return-type for a constexpr member function.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172375 91177308-0d34-0410-b5e6-96231b3b80d8
PR12008: defer adding the implicit 'const' to a constexpr member function until
we know whether it is static.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172376 91177308-0d34-0410-b5e6-96231b3b80d8
Formatter: Add a test for bitfields.

They work fine, but this fifth use of colons (after labels, in ?:,
in initalizer lists in constructors, in objc method expressions, and in
bitfields) wasn't covered by tests yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172377 91177308-0d34-0410-b5e6-96231b3b80d8
Accept [[gnu::*]] for all __attribute__((*))s which are:
 1) Supported by Clang, and
 2) Supported by GCC, and
 3) Documented in GCC's manual.

g++ allows its C++11-style attributes to appertain only to the entity being
declared, and never to a type (even for a type attribute), so we do the same.


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