clang/test/CXX/drs/dr5xx.cpp: Fix up assumption of thiscall. It affects not x64 but x86.

Note, i686-cygwin doesn't use thiscall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217234 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: [JS] Fix indentation in dict literals.

Before:
  return {
    'finish':
        //
        a
        };

After:
  return {
    'finish':
        //
        a
  };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217235 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: [JS] Better support for empty function literals.

Before:
  SomeFunction(function(){});

After:
  SomeFunction(function() {});

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217236 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: [JS] JavaScript does not have the */&/&& madness.

Before:
  e&& e.SomeFunction();

After:
  e && e.SomeFunction();

Yeah, this might be useful for C++, too, but it is not such a frequent
pattern there (plus the fix is much harder).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217237 91177308-0d34-0410-b5e6-96231b3b80d8
clang-format: [JS] Format embedded function literals more efficently.

Before:
  return {
    a: a,
    link:
        function() {
          f();  //
        },
    link:
        function() {
          f();  //
        }
  };

After:
  return {
    a: a,
    link: function() {
      f();  //
    },
    link: function() {
      f();  //
    }
  };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217238 91177308-0d34-0410-b5e6-96231b3b80d8
Mark ms-inline-asm as xfail on ARM

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217241 91177308-0d34-0410-b5e6-96231b3b80d8
[ARMv8] Add support for 32-bit MIN/MAXNM and directed rounding.

This patch adds support for the 32bit numeric max/min and directed round-to-integral NEON intrinsics that were added as part of v8, along with unit tests.

Patch by Graham Hunter!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217242 91177308-0d34-0410-b5e6-96231b3b80d8
[analyzer] Don't crash if malloc() has an unexpected function prototype.

Patch by Daniel Fahlgren!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217258 91177308-0d34-0410-b5e6-96231b3b80d8
-frewrite-includes: Normalize line endings to match the main source file

It is very common to include headers with DOS-style line endings, such
as windows.h, from source files with Unix-style line endings.
Previously, we would end up with mixed line endings and #endifs that
appeared to be on the same line:

  #if 0 /* expanded by -frewrite-includes */
  #include <windows.h>^M#endif /* expanded by -frewrite-includes */

Clang treats either of \r or \n as a line ending character, so this is
purely a cosmetic issue.

This has no automated test because most Unix tools on Windows will
implictly convert CRLF to LF when reading files, making it very hard to
detect line ending mismatches. FileCheck doesn't understand {{\r}}
either.

Fixes PR20552.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217259 91177308-0d34-0410-b5e6-96231b3b80d8
Require an x86 target for ms-inline-asm-return.cpp instead of XFAIL

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217272 91177308-0d34-0410-b5e6-96231b3b80d8
Separate the matchers by type and statically dispatch to the right list.

Summary:
Separate the matchers by type and statically dispatch to the right list.
For any node type that we support, it reduces the number of matchers we
run it through.
For node types we do not support, it makes match() a noop.
This change improves our clang-tidy related benchmark by ~30%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5197

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217274 91177308-0d34-0410-b5e6-96231b3b80d8
Move the initialization of VAListTagName after InitializeSema()

This innocuous statement to get the identifier info for __va_list_tag
was causing an assertion failure:
  NextIsPrevious() && "decl became non-canonical unexpectedly"
if the __va_list_tag identifier was found in a PCH in some
circumstances, because it was looked up before the ASTReader had a Sema
object to use to find existing decls to merge with.

We could possibly move getting the identifier info even later, or make
it lazy if we wanted to, but this seemed like the minimal change.

Now why a PCH would have this identifier in the first place is a bit
mysterious. This seems to be related to the global module index in some
way, because when the test case is built without the global module index
it will not emit an identifier for __va_list_tag into the PCH, but with
the global module index it does.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217275 91177308-0d34-0410-b5e6-96231b3b80d8
Fix r217275 to work without the need for standard headers being included

It seems (I guess) in ObjC that va_list is provided without the need for
inclusions. I verified that with this change the test still crashes in
the absence of the fix committed in r217275.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217290 91177308-0d34-0410-b5e6-96231b3b80d8
Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term
"protected scope" is very unhelpful here and actively confuses users. Instead,
simply state the nature of the problem in the diagnostic: we cannot jump from
here to there. The notes explain nicely why not.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217293 91177308-0d34-0410-b5e6-96231b3b80d8
Add -Wunused-local-typedef, a warning that finds unused local typedefs.

The warning warns on TypedefNameDecls -- typedefs and C++11 using aliases --
that are !isReferenced(). Since the isReferenced() bit on TypedefNameDecls
wasn't used for anything before this warning it wasn't always set correctly,
so this patch also adds a few missing MarkAnyDeclReferenced() calls in
various places for TypedefNameDecls.

This is made a bit complicated due to local typedefs possibly being used only
after their local scope has closed. Consider:

    template <class T>
    void template_fun(T t) {
      typename T::Foo s3foo;  // YYY
      (void)s3foo;
    }
    void template_fun_user() {
      struct Local {
        typedef int Foo;  // XXX
      } p;
      template_fun(p);
    }

Here the typedef in XXX is only used at end-of-translation unit, when YYY in
template_fun() gets instantiated. To handle this, typedefs that are unused when
their scope exits are added to a set of potentially unused typedefs, and that
set gets checked at end-of-TU. Typedefs that are still unused at that point then
get warned on. There's also serialization code for this set, so that the
warning works with precompiled headers and modules. For modules, the warning
is emitted when the module is built, for precompiled headers each time the
header gets used.

Finally, consider a function using C++14 auto return types to return a local
type defined in a header:

    auto f() {
      struct S { typedef int a; };
      return S();
    }

Here, the typedef escapes its local scope and could be used by only some
translation units including the header. To not warn on this, add a
RecursiveASTVisitor that marks all delcs on local types returned from auto
functions as referenced. (Except if it's a function with internal linkage, or
the decls are private and the local type has no friends -- in these cases, it
_is_ safe to warn.)

Several of the included testcases (most of the interesting ones) were provided
by Richard Smith.

(gcc's spelling -Wunused-local-typedefs is supported as an alias for this
warning.)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217298 91177308-0d34-0410-b5e6-96231b3b80d8
Add error, recovery and fixit for "~A::A() {...}".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217302 91177308-0d34-0410-b5e6-96231b3b80d8
[x86] Clean up the x86 builtin specs to reflect r217310 in LLVM which
made the 8-bit masks actually 8-bit arguments to these intrinsics.

These builtins are a mess. Many were missing the I qualifier which
I added where obviously correct. Most aren't tested, but I've updated
the relevant tests. I've tried to catch all the things that should
become 'c' in this round.

It's also frustrating because the set of these is really ad-hoc and
doesn't really map that cleanly to the set supported by either GCC or
LLVM. Oh well...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217311 91177308-0d34-0410-b5e6-96231b3b80d8
Attempt to fix ARM bot. (The test references a typedef from x86 asm.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217313 91177308-0d34-0410-b5e6-96231b3b80d8
Move x86-specific bits of warn-unused-local-typedef.cpp into their own file.

That way, most of the test can run everywhere. Also give the new file an x86
triple in addition to a REQUIRES line.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217314 91177308-0d34-0410-b5e6-96231b3b80d8
MS format strings: parse the 'Z' printf conversion specifier (PR20808)

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