native_client/pnacl-clang.git
4 weeks agoMerge latest changes from branch 'master' into branch merge_36. master merge_36
Jan Voung [Fri, 27 Feb 2015 18:44:31 +0000 (10:44 -0800)]
Merge latest changes from branch 'master' into branch merge_36.

4 weeks agoRevert "Use seperate usr/lib and usr/include directories for i686-nacl"
Jan Voung [Fri, 27 Feb 2015 18:42:56 +0000 (10:42 -0800)]
Revert "Use seperate usr/lib and usr/include directories for i686-nacl"

This reverts commit 16ff1a6d2e820f1f686440c436d2bc610413879a.

This also changed the non-usr/include path, and the lit test
needs to be updated as well.

BUG=none

Review URL: https://codereview.chromium.org/959333003

4 weeks agoUse seperate usr/lib and usr/include directories for i686-nacl
Sam Clegg [Thu, 26 Feb 2015 23:42:33 +0000 (15:42 -0800)]
Use seperate usr/lib and usr/include directories for i686-nacl

This is what the naclports build system is expecting,
and I think its preferable anyway (for example, its
not a good idea to share include paths between
architectures in general).

In the long run I'd like to see lib32 move too, but
that is a bigger change.  This is just enough to make
naclports happy.

BUG= https://code.google.com/p/nativeclient/issues/detail?id=4108
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/946063002

8 weeks agoMerge latest changes from branch 'master' into merge_36.
Jan Voung [Fri, 30 Jan 2015 06:23:46 +0000 (22:23 -0800)]
Merge latest changes from branch 'master' into merge_36.

2 months agoDo not pass -dynamic flag to linker
Derek Schuff [Thu, 22 Jan 2015 23:45:23 +0000 (15:45 -0800)]
Do not pass -dynamic flag to linker

Dynamic (link against shared libraries) is the default behavior of the linker,
and -dynamic is not an option

R=noelallen@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3981

Review URL: https://codereview.chromium.org/869773003

2 months agonacl-clang: put <arch>/usr/include before <arch>/include in the header search path
Sam Clegg [Thu, 22 Jan 2015 17:53:58 +0000 (09:53 -0800)]
nacl-clang: put <arch>/usr/include before <arch>/include in the header search path

This matches the behavior of the pnacl-clang python driver
and allows naclports to override system headers by putting
things in usr/include.

TEST=local testing with "x86_64-nacl-clang -v"
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/798323007

2 months agoMerge latest changes branch 'master' into merge_36.
Jan Voung [Thu, 22 Jan 2015 01:02:24 +0000 (17:02 -0800)]
Merge latest changes branch 'master' into merge_36.

2 months agoMerge upstream LLVM to 223108.
Jan Voung [Thu, 22 Jan 2015 00:41:44 +0000 (16:41 -0800)]
Merge upstream LLVM to 223108.

2 months agoInject gnueabihf environment into the effective clang triple for NaCl
Derek Schuff [Wed, 21 Jan 2015 19:01:42 +0000 (11:01 -0800)]
Inject gnueabihf environment into the effective clang triple for NaCl

The effective clang triple is what the clang driver passes as the
-target flag for its cc1 jobs. Setting gnueabihf as the default environment
for nacl means that the the triple with that environment will end up as the
module's triple (instead of just "armv7-nacl") and the clang LLVM sides will
always agree on the defaults. This mostly doesn't matter except for things
like calls to runtime functions such as those in compiler-rt or libcxxabi,
where a mismatch was observed.

With this change the modules have the environment in the module's triple
and the calling convention is not explicitly overriden on every function
define and callsite as it was before.

R=jfb@chromium.org, jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4018

Review URL: https://codereview.chromium.org/838933004

2 months agoRevert "Refactor PNaCl target in Clang"
Derek Schuff [Wed, 21 Jan 2015 02:12:42 +0000 (18:12 -0800)]
Revert "Refactor PNaCl target in Clang"

This reverts commit 8b3d0d8063a732fdfec6329c5464fbd60b6a5154.

It broke the ATOMIC_*_LOCK_FREE tests in synchronization_cpp11libc++_test

TBR=jfb@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3941

Review URL: https://codereview.chromium.org/861953003

2 months agoRefactor PNaCl target in Clang
JF Bastien [Thu, 15 Jan 2015 22:39:13 +0000 (14:39 -0800)]
Refactor PNaCl target in Clang

A bug fix:
 - Atomic width was missing which caused it to be zero, leading Clang to try to emit library calls instead.

A few refactorings:
 - `this->` everywhere? Gone.
 - Some of the initializations weren't in the canonical order.
 - We were missing a description string.
 - The macro definitions weren't quite standard.

I also updated the test. The PNaCl target is now similar to other targets, especially the le64 target. Note that the test was made hermetic upstream, so I'm leaving it as-is for now (no need to cherrypick that part).

I can upstream this patch once we agree on it, and we could do the same for the NaCl targets.

See the related test patch:
  https://codereview.chromium.org/853823002/

BUG= https://code.google.com/p/nativeclient/issues/detail?id=3941
TEST= ninja check-all
TEST= ./scons run_synchronization_sync_test bitcode=1
R=dschuff@chromium.org

Review URL: https://codereview.chromium.org/850763009

2 months agoMerge latest changes from branch 'master' into merge_36.
Jan Voung [Wed, 14 Jan 2015 22:40:55 +0000 (14:40 -0800)]
Merge latest changes from branch 'master' into merge_36.

3 months agoInject the NaCl ARM assembly macro file into ARM assembler jobs
Derek Schuff [Tue, 16 Dec 2014 18:41:58 +0000 (10:41 -0800)]
Inject the NaCl ARM assembly macro file into ARM assembler jobs

ARM assembly can be written with a set of helper macros for the various
SFI requirements like register masking. Because it can be used by inline
assembly it needs to always be available. So inject it into all assembly
jobs for the ARM toolchain. This also matches nacl-gcc's behavior.

R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4018

Review URL: https://codereview.chromium.org/800393005

3 months agoDefault to aapcs-linux and hard-float ABIs for NaCl
Derek Schuff [Fri, 12 Dec 2014 22:30:45 +0000 (14:30 -0800)]
Default to aapcs-linux and hard-float ABIs for NaCl

Ensure that we get the right ABIs even without setting the "gnueabi"
environment in the triple.
Also test that the -triple architecture is armv7 and not armv4t

R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=4018

Review URL: https://codereview.chromium.org/797283004

3 months agoMerge upstream Clang.
Jan Voung [Fri, 12 Dec 2014 17:36:59 +0000 (09:36 -0800)]
Merge upstream Clang.

3 months agoRemove explicit -lnacl from linker command
Derek Schuff [Tue, 9 Dec 2014 01:32:09 +0000 (17:32 -0800)]
Remove explicit -lnacl from linker command

libc.a is now a linker script that includes libnacl itself.

R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3946

Review URL: https://codereview.chromium.org/742783009

3 months agoMove NaCl MCStreamer initialization to after section init
Derek Schuff [Fri, 5 Dec 2014 20:55:28 +0000 (12:55 -0800)]
Move NaCl MCStreamer initialization to after section init

initializeNaClMCStreamer now requires that a section has been switched to,
so move its call to after InitSections

R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3968

Review URL: https://codereview.chromium.org/783723002

3 months agoAdd <arch>/usr/lib and <arch>/usr/include to search paths for nacl-clang
Derek Schuff [Fri, 5 Dec 2014 00:31:07 +0000 (16:31 -0800)]
Add <arch>/usr/lib and <arch>/usr/include to search paths for nacl-clang

This adds the arch usr paths used by the SDK/naclports to the default
compiler search paths.

R=jvoung@chromium.org, sbc@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3946

Review URL: https://codereview.chromium.org/762393004

3 months agoDriver: Claim all -pthread/-pthreads flags when linking
Derek Schuff [Thu, 4 Dec 2014 18:23:15 +0000 (10:23 -0800)]
Driver: Claim all -pthread/-pthreads flags when linking

We unconditionally link with -lpthread. Also claim the relevant flags so
that an "unused argument" warning is not issued if they are passed on the
command line.

Also pass the -u flag through to the linker, to match the Linux behavior.

R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3946

Review URL: https://codereview.chromium.org/773253005

3 months agoDerive NaCl ToolChain from Generic_ELF instead of Linux
Derek Schuff [Tue, 2 Dec 2014 19:19:08 +0000 (11:19 -0800)]
Derive NaCl ToolChain from Generic_ELF instead of Linux

This prevents the GCC installation detector from injecting unwanted paths
(because it never runs), simplifies the NaCl-specific code, and fixes the
problem of host-dependent linker behavior which was caused by the Linux
constructor injecting different ExtraOps based on the distro.

Also updates the test to check for the --build-id flag and to check
the C++ header path.

R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3975

Review URL: https://codereview.chromium.org/775463002

3 months agoRe-apply "Revert r166370 and r166540 now that Xcode 4.6 has been available for a...
Bob Wilson [Tue, 2 Dec 2014 05:17:21 +0000 (05:17 +0000)]
Re-apply "Revert r166370 and r166540 now that Xcode 4.6 has been available for a while."

This reverts commit r176892.

I had reverted this a while back to give Chromium more time to update, and
Nico says it should be OK now.

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

3 months agoclang/test/Modules/malformed.cpp REQUIRES shell due to "cd".
NAKAMURA Takumi [Tue, 2 Dec 2014 03:55:16 +0000 (03:55 +0000)]
clang/test/Modules/malformed.cpp REQUIRES shell due to "cd".

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

3 months agoCMake: make the regexes used for setting HOST_LINK_VERSION more forgiving (PR21268)
Hans Wennborg [Tue, 2 Dec 2014 03:08:38 +0000 (03:08 +0000)]
CMake: make the regexes used for setting HOST_LINK_VERSION more forgiving (PR21268)

If the output of 'ld -v' didn't match the regexes, CMake would previously error
with a message like:

  CMake Error at tools/clang/CMakeLists.txt:269 (string):
    string sub-command REGEX, mode REPLACE regex "[^0-9]*([0-9.]*).*" matched
    an empty string.

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

3 months agoTry to fix the MSVC build.
Hans Wennborg [Tue, 2 Dec 2014 02:13:09 +0000 (02:13 +0000)]
Try to fix the MSVC build.

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

3 months agoRely on fewer features of the 'env' command. Darwin only supports '-i'.
Chandler Carruth [Tue, 2 Dec 2014 01:24:52 +0000 (01:24 +0000)]
Rely on fewer features of the 'env' command. Darwin only supports '-i'.
I'm explicitly setting LC_ALL=C somewhat for documentation, but
hopefully this also removes some host variation from the test results.

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

3 months agoAdd a test that ensures the Clang driver behaves itself when the PATH
Chandler Carruth [Tue, 2 Dec 2014 00:53:20 +0000 (00:53 +0000)]
Add a test that ensures the Clang driver behaves itself when the PATH
environment variable is changed to strange things out from under it.
Prior to r223099 in LLVM, these test cases would crash in various ways
(assert fails, stack exhaustion, etc.).

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

3 months agoUse gas (non-integrated assembler) by default for nacl-clang
Derek Schuff [Tue, 2 Dec 2014 00:31:43 +0000 (16:31 -0800)]
Use gas (non-integrated assembler) by default for nacl-clang

R=jvoung@chromium.org
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3966

Review URL: https://codereview.chromium.org/749083003

3 months agoRemove special case for aarch64 static vs. PIC code in iOS kernel code.
Bob Wilson [Tue, 2 Dec 2014 00:27:35 +0000 (00:27 +0000)]
Remove special case for aarch64 static vs. PIC code in iOS kernel code.

I added this check a while back but then made a note to myself that it
should be completely unnecessary since iOS always uses PIC code-gen for
aarch64. Since I could never come up with any reason why it would be
necessary, I'm just going to remove it and we'll see if anything breaks.
rdar://problem/13627985

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

3 months ago[modules] Track how 'header' directives were written in module map files,
Richard Smith [Tue, 2 Dec 2014 00:08:08 +0000 (00:08 +0000)]
[modules] Track how 'header' directives were written in module map files,
rather than trying to extract this information from the FileEntry after the
fact.

This has a number of beneficial effects. For instance, diagnostic messages for
failed module builds give a path relative to the "module root" rather than an
absolute file path, and the contents of the module includes file is no longer
dependent on what files the including TU happened to inspect prior to
triggering the module build.

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

3 months agoPerform correct lookup when '__super' is used in class with dependent base.
Nikola Smiljanic [Mon, 1 Dec 2014 23:15:01 +0000 (23:15 +0000)]
Perform correct lookup when '__super' is used in class with dependent base.

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

3 months agoMake -fuse-ld=lld work properly on Windows.
Zachary Turner [Mon, 1 Dec 2014 23:06:47 +0000 (23:06 +0000)]
Make -fuse-ld=lld work properly on Windows.

Using lld on Windows requires calling link-lld.exe instead of
lld.exe.  This patch puts this knowledge into clang so that when
using the GCC style clang driver, it can properly delegate to
lld.

Differential Revision: http://reviews.llvm.org/D6428
Reviewed by: Reid Kleckner, Rui Ueyama

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

3 months agoUse nullptr to silence -Wsentinel when self-hosting on Windows
Reid Kleckner [Mon, 1 Dec 2014 22:02:27 +0000 (22:02 +0000)]
Use nullptr to silence -Wsentinel when self-hosting on Windows

Richard rejected my Sema change to interpret an integer literal zero in
a varargs context as a null pointer, so -Wsentinel sees an integer
literal zero and fires off a warning. Only CodeGen currently knows that
it promotes integer literal zeroes in this context to pointer size on
Windows.  I didn't want to teach -Wsentinel about that compatibility
hack. Therefore, I'm migrating to C++11 nullptr.

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

3 months agoAdd missing 'break's, found by inspection. No functionality change; the
Richard Smith [Mon, 1 Dec 2014 18:59:10 +0000 (18:59 +0000)]
Add missing 'break's, found by inspection. No functionality change; the
fallthrough happened to do the right thing in both cases.

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

3 months agoAdd a test for devirtualization of virtual operator calls.
Nico Weber [Mon, 1 Dec 2014 17:48:04 +0000 (17:48 +0000)]
Add a test for devirtualization of virtual operator calls.

There was no test coverage for this before: Modifiying
EmitCXXOperatorMemberCallee() to not call CanDevirtualizeMemberFunctionCall()
didn't make any test fail.

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

3 months agoUpdate R600 address space map to include generic
Matt Arsenault [Mon, 1 Dec 2014 16:46:03 +0000 (16:46 +0000)]
Update R600 address space map to include generic

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

3 months agoMake the function pointer a template argument instead of a runtime value.
Samuel Benzaquen [Mon, 1 Dec 2014 14:46:14 +0000 (14:46 +0000)]
Make the function pointer a template argument instead of a runtime value.

Summary:
Speed up the variadic matchers by removing one indirect call.
Making the function pointer a template arguments allows the compiler to
inline the call instead of doing an runtime call by pointer.
Also, optimize the allOf() case to avoid redundant kind checks.
This speeds up our clang-tidy benchmark by ~2%

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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

3 months ago[OPENMP] Formating and code improvement for codegen of 'omp critical' directive.
Alexey Bataev [Mon, 1 Dec 2014 11:32:38 +0000 (11:32 +0000)]
[OPENMP] Formating and code improvement for codegen of 'omp critical' directive.
No functional changes, only code improvements.

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

3 months agoRevert "Remove threshold for lifetime marker insertion of named temporaries"
Arnaud A. de Grandmaison [Mon, 1 Dec 2014 09:30:16 +0000 (09:30 +0000)]
Revert "Remove threshold for lifetime marker insertion of named temporaries"

Revert r222993 while I investigate some MemorySanitizer failures.

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

3 months agoRemove threshold for lifetime marker insertion of named temporaries
Arnaud A. de Grandmaison [Mon, 1 Dec 2014 09:13:54 +0000 (09:13 +0000)]
Remove threshold for lifetime marker insertion of named temporaries

Now that TailRecursionElimination has been fixed with r222354, the
threshold on size for lifetime marker insertion can be removed. This
only affects named temporary though, as the patch for unnamed temporaries
is still in progress.

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

3 months agoclang/test/CodeGenOpenCL/opencl_types.cl: Appease i686-msvc.
NAKAMURA Takumi [Sun, 30 Nov 2014 00:32:02 +0000 (00:32 +0000)]
clang/test/CodeGenOpenCL/opencl_types.cl: Appease i686-msvc.

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

3 months agoFix typo.
Nico Weber [Sat, 29 Nov 2014 23:57:35 +0000 (23:57 +0000)]
Fix typo.

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

3 months agoFix grammar error in err_bad_reinterpret_cast_reference error message.
Nathan Sidwell [Sat, 29 Nov 2014 22:51:47 +0000 (22:51 +0000)]
Fix grammar error in err_bad_reinterpret_cast_reference error message.

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

3 months agoTweak clang/test/CodeGenOpenCL/opencl_types.cl to appease msvc since r222941.
NAKAMURA Takumi [Sat, 29 Nov 2014 17:27:07 +0000 (17:27 +0000)]
Tweak clang/test/CodeGenOpenCL/opencl_types.cl to appease msvc since r222941.

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

3 months agoAST: Consider pseudo-struct builtin types as substitutable
David Majnemer [Fri, 28 Nov 2014 22:22:46 +0000 (22:22 +0000)]
AST: Consider pseudo-struct builtin types as substitutable

We didn't consider types like ObjCSel as a substitution candidate.

This fixes PR21688.

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

3 months agoAdd additional arguments for -mfpu options
Richard Barton [Fri, 28 Nov 2014 20:39:59 +0000 (20:39 +0000)]
Add additional arguments for -mfpu options

Add neon-vfpv3 to allow specifying both at the same time. This is not an
option that GCC supports, but follows the same track and should be
non-controversial.

Change-Id: Id9ec157c835937d7d11ad0f49dbe5171fac17658

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

3 months agoAdd -mfpu=neon-vfpv4
Richard Barton [Fri, 28 Nov 2014 20:39:54 +0000 (20:39 +0000)]
Add -mfpu=neon-vfpv4

This enables user to architecturally specify ARMv7A + VFPv4 + NEON.

Change-Id: I779b01fef5c47e5e4ac702ae24ed2f76a0e4c63f

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

3 months ago[OPENMP] Additional processing of 'omp atomic write' directive.
Alexey Bataev [Fri, 28 Nov 2014 07:21:40 +0000 (07:21 +0000)]
[OPENMP] Additional processing of 'omp atomic write' directive.
According to OpenMP standard, Section 2.12.6, atomic Construct, '#pragma omp atomic write' is allowed to be used only for expression statements of form 'x = expr;', where x is a lvalue expression and expr is an expression with scalar type. Patch adds checks for it.

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

3 months agoCreate a new 'flag_enum' attribute.
Sean Hunt [Fri, 28 Nov 2014 00:53:20 +0000 (00:53 +0000)]
Create a new 'flag_enum' attribute.

This attribute serves as a hint to improve warnings about the ranges of
enumerators used as flag types. It currently has no working C++ implementation
due to different semantics for enums in C++. For more explanation, see the docs
and testcases.

Reviewed by Aaron Ballman.

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

3 months agoAArch64: simplify PCS mapping.
Tim Northover [Thu, 27 Nov 2014 21:02:49 +0000 (21:02 +0000)]
AArch64: simplify PCS mapping.

Now that LLVM can count the registers needed to implement AAPCS rules, we don't
need to duplicate that logic here. This means we can drop the explicit padding
and also use more natural types in many cases (e.g. "struct { float arr[3]; }"
used to end up as "[2 x double]" to avoid holes on the stack.

The one wrinkle is that AAPCS va_arg was also using the register counting
machinery. But the local replacement isn't too bad.

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

3 months agoSphinx does not have a lexer for OpenCL, so falling back to C for the language on...
Aaron Ballman [Thu, 27 Nov 2014 15:45:59 +0000 (15:45 +0000)]
Sphinx does not have a lexer for OpenCL, so falling back to C for the language on the code block. Also fixing an indentation warning. NFC to the content of the documentation itself.

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

3 months agoclang-format: [JS] Contract fewer functions to a single line.
Daniel Jasper [Thu, 27 Nov 2014 15:37:42 +0000 (15:37 +0000)]
clang-format: [JS] Contract fewer functions to a single line.

Before:
  var someVariable =
      function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); };

After:
  var someVariable = function(x) {
    return x.zIsTooLongForOneLineWithTheDeclarationLine();
  };

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

3 months agoclang-format: [JS] Try not to break in container literals.
Daniel Jasper [Thu, 27 Nov 2014 15:24:48 +0000 (15:24 +0000)]
clang-format: [JS] Try not to break in container literals.

Before:
  var obj = {
    fooooooooo:
        function(x) { return x.zIsTooLongForOneLineWithTheDeclarationLine(); }
  };

After:
  var obj = {
    fooooooooo: function(x) {
      return x.zIsTooLongForOneLineWithTheDeclarationLine();
    }
  };

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

3 months agoclang-format: [JS] new and delete are valid function names.
Daniel Jasper [Thu, 27 Nov 2014 14:55:17 +0000 (14:55 +0000)]
clang-format: [JS] new and delete are valid function names.

Before:
  someObject.new ();
  someObject.delete ();

After:
  someObject.new();
  someObject.delete();

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

3 months agoclang-format: [JS] Make Closure module detection more narrow.
Daniel Jasper [Thu, 27 Nov 2014 14:46:03 +0000 (14:46 +0000)]
clang-format: [JS] Make Closure module detection more narrow.

Before:
  var MyLongClassName = goog.module.get('my.long.module.name.followedBy.MyLongClassName');

After:
  var MyLongClassName =
      goog.module.get('my.long.module.name.followedBy.MyLongClassName');

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

3 months agoclang-format: Don't use column layout with AlignAfterOpenBrackets.
Daniel Jasper [Thu, 27 Nov 2014 14:40:48 +0000 (14:40 +0000)]
clang-format: Don't use column layout with AlignAfterOpenBrackets.

This fixes llvm.org/PR21676.

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

3 months ago[c++1z] Remove terse range-based for loops; they've been removed from
Richard Smith [Thu, 27 Nov 2014 01:54:27 +0000 (01:54 +0000)]
[c++1z] Remove terse range-based for loops; they've been removed from
consideration for C++17 for now. Update C++ status page to match.

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

3 months agoWhen checking for uninitialized values, do not confuse "std::move" with every
Richard Trieu [Thu, 27 Nov 2014 01:29:32 +0000 (01:29 +0000)]
When checking for uninitialized values, do not confuse "std::move" with every
other function named "move".

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

3 months agoOpenCL: fix test for lack of names in release builds
Tim Northover [Wed, 26 Nov 2014 22:33:04 +0000 (22:33 +0000)]
OpenCL: fix test for lack of names in release builds

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

3 months ago[analyzer] Indented code within the DisplayHelp sub.
Anton Yartsev [Wed, 26 Nov 2014 21:53:39 +0000 (21:53 +0000)]
[analyzer] Indented code within the DisplayHelp sub.

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

3 months agoFix buildbot failure on LLP64 platforms like MSVC x86_64.
Richard Smith [Wed, 26 Nov 2014 19:37:39 +0000 (19:37 +0000)]
Fix buildbot failure on LLP64 platforms like MSVC x86_64.

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

3 months agoclang-format: [Java] Don't line-wrap package declarations.
Daniel Jasper [Wed, 26 Nov 2014 18:03:42 +0000 (18:03 +0000)]
clang-format: [Java] Don't line-wrap package declarations.

This fixes llvm.org/PR21677.

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

3 months agoclang-format: Tweak -style=Chromium for Java files.
Nico Weber [Wed, 26 Nov 2014 16:43:18 +0000 (16:43 +0000)]
clang-format: Tweak -style=Chromium for Java files.

For Java, don't do any of the deviations from Google Style that Chromium style
does for C++.

Chromium's Java follows Android Java style [1], which is roughly Google Java
style with an indent of 4 and a continuation indent of 8.

1: https://source.android.com/source/code-style.html

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

3 months agoAdding an explicit triple to this test to get it to pass all build bots.
Aaron Ballman [Wed, 26 Nov 2014 16:17:20 +0000 (16:17 +0000)]
Adding an explicit triple to this test to get it to pass all build bots.

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

3 months ago[OpenCL] Implemented restrictions for pointer conversions specified in OpenCL v2.0.
Anastasia Stulova [Wed, 26 Nov 2014 15:36:41 +0000 (15:36 +0000)]
[OpenCL] Implemented restrictions for pointer conversions specified in OpenCL v2.0.

OpenCL v2.0 s6.5.5 restricts conversion of pointers to different address spaces:
- the named address spaces (__global, __local, and __private) => __generic - implicitly converted;
- __generic => named - with an explicit cast;
- named <=> named - disallowed;
- __constant <=> any other - disallowed.

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

3 months ago[OpenCL] Generic address space parsing and diagnostics test (forgotten previously)
Anastasia Stulova [Wed, 26 Nov 2014 14:14:05 +0000 (14:14 +0000)]
[OpenCL] Generic address space parsing and diagnostics test (forgotten previously)

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

3 months ago[OpenCL] Generic address space has been added in OpenCL v2.0.
Anastasia Stulova [Wed, 26 Nov 2014 14:10:06 +0000 (14:10 +0000)]
[OpenCL] Generic address space has been added in OpenCL v2.0.

To support it in the frontend, the following has been added:
- generic address space type attribute;
- documentation for the OpenCL address space attributes;
- parsing of __generic(generic) keyword;
- test code for the parser and diagnostics.

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

3 months agoclang-format: [Java] Improve formatting of throws declarations.
Daniel Jasper [Wed, 26 Nov 2014 12:31:19 +0000 (12:31 +0000)]
clang-format: [Java] Improve formatting of throws declarations.

Before:
  public void doSoooooooooo() throws LoooooooooongException,
      LooooooooooongException {}

After:
  public void doSoooooooooo()
      throws LoooooooooongException, LooooooooooongException {}

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

3 months agoclang-format: [Java] Improve cast detection.
Daniel Jasper [Wed, 26 Nov 2014 12:23:10 +0000 (12:23 +0000)]
clang-format: [Java] Improve cast detection.

Before:
  a[b >> 1] = (byte)(c() << 4);

After:
  a[b >> 1] = (byte) (c() << 4);

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

3 months agoclang-format: [Java] Fix breaking after annotations.
Daniel Jasper [Wed, 26 Nov 2014 11:20:43 +0000 (11:20 +0000)]
clang-format: [Java] Fix breaking after annotations.

Before:
  @Annotation1 // comment
  @Annotation2 class C {}

After:
  @Annotation1 // comment
  @Annotation2
  class C {}

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

3 months agoclang-format: Add SFS_Empty to only empty functions on a single line.
Daniel Jasper [Wed, 26 Nov 2014 10:43:58 +0000 (10:43 +0000)]
clang-format: Add SFS_Empty to only empty functions on a single line.

Activated for and tested by Google's Java style.

This fixes llvm.org/PR21667.

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

3 months agoclang-format: [Java] Support Foo.class;
Daniel Jasper [Wed, 26 Nov 2014 08:17:08 +0000 (08:17 +0000)]
clang-format: [Java] Support Foo.class;

Before:
  SomeClass.
  class.getName();

After:
  SomeClass.class.getName();

This fixes llvm.org/PR21665.

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

4 months ago[c++1z] Most of N4268 (allow constant evaluation for non-type template arguments).
Richard Smith [Wed, 26 Nov 2014 03:26:53 +0000 (03:26 +0000)]
[c++1z] Most of N4268 (allow constant evaluation for non-type template arguments).

We don't yet support pointer-to-member template arguments that have undergone
pointer-to-member conversions, mostly because we don't have a mangling for them yet.

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

4 months agoUpdate clang localmods to use LLVM C++11 virtual/override style
Derek Schuff [Wed, 26 Nov 2014 01:21:45 +0000 (17:21 -0800)]
Update clang localmods to use LLVM C++11 virtual/override style

R=jvoung@chromium.org
BUG=None

Review URL: https://codereview.chromium.org/754363007

4 months agoCodeGen: Fix emission of __atomic_compare_exchange
David Majnemer [Tue, 25 Nov 2014 23:44:32 +0000 (23:44 +0000)]
CodeGen: Fix emission of __atomic_compare_exchange

We (wrongly) discarded the return value of the call.

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

4 months agoEnsure that any TypoExprs in the arguments to bultins with custom type
Kaelyn Takata [Tue, 25 Nov 2014 23:04:09 +0000 (23:04 +0000)]
Ensure that any TypoExprs in the arguments to bultins with custom type
checking are handled before the custom type checking is performed.

Fixes PR21669.

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

4 months agoTry to fix a ppc64 bot. What is this 'signext' stuff anyway?
Paul Robinson [Tue, 25 Nov 2014 17:28:54 +0000 (17:28 +0000)]
Try to fix a ppc64 bot.  What is this 'signext' stuff anyway?
No wonder most people use specific triples.

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

4 months agoRe-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: typedefDecl, isInMa...
Manuel Klimek [Tue, 25 Nov 2014 17:01:06 +0000 (17:01 +0000)]
Re-apply r222646 (was reverted in r222667). Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName

Change to original: ifndef out tests in Windows due to /-separated
paths.

Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

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

4 months agoUpdate Clang tests that run the LLVM optimizer to reflect the changed
Chandler Carruth [Tue, 25 Nov 2014 10:10:37 +0000 (10:10 +0000)]
Update Clang tests that run the LLVM optimizer to reflect the changed
canonicalization in r222748. No interesting functionality changed here.

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

4 months agoclang-format: Refactoring.
Daniel Jasper [Tue, 25 Nov 2014 10:05:17 +0000 (10:05 +0000)]
clang-format: Refactoring.

Re-apply r222638 and r222641 without variadic templates.

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

4 months agoAdd flag -f(no-)modules-implicit-maps.
Daniel Jasper [Tue, 25 Nov 2014 09:45:48 +0000 (09:45 +0000)]
Add flag -f(no-)modules-implicit-maps.

This suppresses the implicit search for files called 'module.modulemap' and
similar.

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

4 months agoAdd a missing override, caught by clang's inconsistent override warning.
Chandler Carruth [Tue, 25 Nov 2014 08:59:34 +0000 (08:59 +0000)]
Add a missing override, caught by clang's inconsistent override warning.

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

4 months ago[ARM] Define __ARM_FEATURE_DSP macro for CPUs that have DSP instructions
Sergey Dmitrouk [Tue, 25 Nov 2014 08:57:36 +0000 (08:57 +0000)]
[ARM] Define __ARM_FEATURE_DSP macro for CPUs that have DSP instructions

Summary:
This resolves [[ http://llvm.org/bugs/show_bug.cgi?id=17391 | PR17391 ]].

GCC's sources were used as a guide (couldn't find much information in ARM documentation).

Reviewers: doug.gregor, asl

Reviewed By: asl

Subscribers: asl, aemerson, cfe-commits

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

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

4 months agoMS ABI: Add CodeGen support for rethrowing MS C++ exceptions
David Majnemer [Tue, 25 Nov 2014 07:20:20 +0000 (07:20 +0000)]
MS ABI: Add CodeGen support for rethrowing MS C++ exceptions

Rethrowing exceptions in the MS model is very simple: just call
_CxxThrowException with nullptr for both arguments.

N.B.  They chose stdcall as the calling convention for x86 but cdecl for
all other platforms.

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

4 months agodocs: Update the MSVCCompatibility doc for changes to debug info
David Majnemer [Tue, 25 Nov 2014 06:59:35 +0000 (06:59 +0000)]
docs: Update the MSVCCompatibility doc for changes to debug info

The document should reflect that we now support emission for DWARF.

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

4 months agoCodeGen: further simplify assertion
Saleem Abdulrasool [Tue, 25 Nov 2014 03:49:50 +0000 (03:49 +0000)]
CodeGen: further simplify assertion

Use more of algorithm to simplify the assertion.  Pointed out by David Blakie!

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

4 months agoSee if this fixes Mips bot; ignore contents of parameter lists.
Paul Robinson [Mon, 24 Nov 2014 23:30:12 +0000 (23:30 +0000)]
See if this fixes Mips bot; ignore contents of parameter lists.

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

4 months agoRemove unnecessary environment switch
Reid Kleckner [Mon, 24 Nov 2014 22:05:42 +0000 (22:05 +0000)]
Remove unnecessary environment switch

All supported environments on x86 Windows return structs in EAX:EDX.
This removes code added in r204978 that had to get updated in r222680.
We should now have the same behavior we had before r204978.

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

4 months agoForce the correction of delayed typos in casts in non-C++ code.
Kaelyn Takata [Mon, 24 Nov 2014 21:46:59 +0000 (21:46 +0000)]
Force the correction of delayed typos in casts in non-C++ code.

Fixes PR21656, which is fallout from r222551 caused by an untested/missed
code path.

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

4 months agoFilter the toplevel matchers by kind.
Samuel Benzaquen [Mon, 24 Nov 2014 21:21:09 +0000 (21:21 +0000)]
Filter the toplevel matchers by kind.

Summary:
Filter the toplevel matchers by kind.
Decl and Stmt matchers are tied to a specific node kind and trying to
match incompatible nodes is a waste.
Precalculate a filtered list of matchers that have a chance of matching
the node and ignore the rest.
Speeds up our clang-tidy benchmark by ~10%

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

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

4 months agotesting: make test use FileCheck
Tim Northover [Mon, 24 Nov 2014 21:03:34 +0000 (21:03 +0000)]
testing: make test use FileCheck

The "grep internal | count" was fragile when your source or remote paths could
contain the word "internal".

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

4 months agoCorrectly remove OptimizeForSize from functions marked OptimizeNone.
Paul Robinson [Mon, 24 Nov 2014 20:51:42 +0000 (20:51 +0000)]
Correctly remove OptimizeForSize from functions marked OptimizeNone.
This allows using __attribute__((optnone)) and the -Os/-Oz options.
Fixes PR21604.

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

4 months agoCodeGen: make i686-windows-itanium more similar to msvc
Saleem Abdulrasool [Mon, 24 Nov 2014 20:14:29 +0000 (20:14 +0000)]
CodeGen: make i686-windows-itanium more similar to msvc

The itanium environment follows the system calling convention for structures.
Pass small aggregates via registers.

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

4 months agoCodeGen: use a range-based for loop
Saleem Abdulrasool [Mon, 24 Nov 2014 20:14:26 +0000 (20:14 +0000)]
CodeGen: use a range-based for loop

Convert a debug assertion into a range-based loop form.  NFC.

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

4 months agoReverting r222646; the tests do not pass on Windows. Also reverts r222664, which...
Aaron Ballman [Mon, 24 Nov 2014 17:39:44 +0000 (17:39 +0000)]
Reverting r222646; the tests do not pass on Windows. Also reverts r222664, which was required for r222646 to compile with Visual Studio 2012.

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

4 months agoFix line endings
Nico Rieck [Mon, 24 Nov 2014 17:29:52 +0000 (17:29 +0000)]
Fix line endings

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

4 months agoFix crash when using __if_exists in C mode
Nico Rieck [Mon, 24 Nov 2014 17:29:35 +0000 (17:29 +0000)]
Fix crash when using __if_exists in C mode

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

4 months agoUnbreaking the MSVC 2012 build; however, these tests still fail on Windows.
Aaron Ballman [Mon, 24 Nov 2014 17:22:32 +0000 (17:22 +0000)]
Unbreaking the MSVC 2012 build; however, these tests still fail on Windows.

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

4 months agoReverting r222638; it broke the MSVC build bots because Visual Studio 2012 does not...
Aaron Ballman [Mon, 24 Nov 2014 15:42:34 +0000 (15:42 +0000)]
Reverting r222638; it broke the MSVC build bots because Visual Studio 2012 does not support variadic templates. Also reverting r222641 because it was relying on 222638.

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

4 months agoAdding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName
Manuel Klimek [Mon, 24 Nov 2014 09:10:56 +0000 (09:10 +0000)]
Adding 4 ASTMatchers: typedefDecl, isInMainFile, isInSystemFile, isInFileMatchingName

Summary:
Often one is only interested in matches within the main-file or matches
that are not within a system-header, for which this patch adds
isInMainFile and isInSystemFile. They take no arguments and narrow down
the matches.

The isInFileMatchingName is mainly thought for interactive
clang-query-sessions, to make a matcher more specific without restarting
the session with the files you are interested in for that moment. It
takes a string that will be used as regular-expression to match the
filename of where the matched node is expanded.

Patch by Hendrik von Prince.

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

4 months agoclang-format: Make short case labels work with #ifs
Daniel Jasper [Sun, 23 Nov 2014 21:45:03 +0000 (21:45 +0000)]
clang-format: Make short case labels work with #ifs

Before:
  switch (a) {
  #if FOO
  case 0: return 0; #endif
  }

After:
  switch (a) {
  #if FOO
  case 0: return 0;
  #endif
  }

This fixed llvm.org/PR21544.

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