]> granicus.if.org Git - clang/log
clang
5 years agoMerging r322030: release_60 origin/release_60
Tom Stellard [Thu, 31 May 2018 04:15:13 +0000 (04:15 +0000)]
Merging r322030:

------------------------------------------------------------------------
r322030 | rsmith | 2018-01-08 13:46:42 -0800 (Mon, 08 Jan 2018) | 3 lines

PR35862: Suppress -Wmissing-variable-declarations warning on inline variables,
variable templates, and instantiations thereof.

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

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

5 years agoMerging r333497:
Tom Stellard [Wed, 30 May 2018 18:36:40 +0000 (18:36 +0000)]
Merging r333497:

------------------------------------------------------------------------
r333497 | ctopper | 2018-05-29 20:38:15 -0700 (Tue, 29 May 2018) | 5 lines

[X86] Fix the names of a bunch of icelake intrinsics.

Mostly this fixes the names of all the 128-bit intrinsics to start with _mm_ instead of _mm128_ as is the convention and what the Intel docs say.

This also fixes the name of the bitshuffle intrinsics to say epi64 for 128 and 256 bit versions.
------------------------------------------------------------------------

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

5 years agoMerging r326476:
Tom Stellard [Wed, 30 May 2018 18:19:45 +0000 (18:19 +0000)]
Merging r326476:

------------------------------------------------------------------------
r326476 | mstorsjo | 2018-03-01 12:22:57 -0800 (Thu, 01 Mar 2018) | 7 lines

[RecordLayout] Only assert that fundamental type sizes are power of two on MSVC

Make types with sizes that aren't a power of two an error (that can
be disabled) in structs with ms_struct layout, except on mingw where
the situation is quite likely to occur and GCC handles it silently.

Differential Revision: https://reviews.llvm.org/D43908
------------------------------------------------------------------------

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

5 years agoMerging r326173:
Tom Stellard [Wed, 30 May 2018 18:06:17 +0000 (18:06 +0000)]
Merging r326173:

------------------------------------------------------------------------
r326173 | mstorsjo | 2018-02-26 22:27:06 -0800 (Mon, 26 Feb 2018) | 17 lines

[RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields

When targeting GNU/MinGW for i386, the size of the "long double" data
type is 12 bytes (while it is 8 bytes in MSVC). When building
with -mms-bitfields to have struct layouts match MSVC, data types
are laid out in a struct with alignment according to their size.
However, this doesn't make sense for the long double type, since
it doesn't match MSVC at all, and aligning to a non-power-of-2
size triggers other asserts later.

This matches what GCC does, aligning a long double to 4 bytes
in structs on i386 even when -mms-bitfields is specified.

This fixes asserts when using the max_align_t data type when
building for MinGW/i386 with the -mms-bitfields flag.

Differential Revision: https://reviews.llvm.org/D43734
------------------------------------------------------------------------

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

5 years agoMerging r326235:
Tom Stellard [Wed, 30 May 2018 17:56:03 +0000 (17:56 +0000)]
Merging r326235:

------------------------------------------------------------------------
r326235 | mstorsjo | 2018-02-27 11:42:19 -0800 (Tue, 27 Feb 2018) | 6 lines

[MinGW, CrossWindows] Allow passing -static together with -shared

In these combinations, link a DLL as usual, but pass -Bstatic instead
of -Bdynamic to indicate prefering static libraries.

Differential Revision: https://reviews.llvm.org/D43811
------------------------------------------------------------------------

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

5 years agoMerging r329300:
Tom Stellard [Wed, 30 May 2018 17:33:01 +0000 (17:33 +0000)]
Merging r329300:

------------------------------------------------------------------------
r329300 | manojgupta | 2018-04-05 08:29:52 -0700 (Thu, 05 Apr 2018) | 16 lines

Disable -fmerge-all-constants as default.

Summary:
"-fmerge-all-constants" is a non-conforming optimization and should not
be the default. It is also causing miscompiles when building Linux
Kernel (https://lkml.org/lkml/2018/3/20/872).

Fixes PR18538.

Reviewers: rjmccall, rsmith, chandlerc

Reviewed By: rsmith, chandlerc

Subscribers: srhines, cfe-commits

Differential Revision: https://reviews.llvm.org/D45289
------------------------------------------------------------------------

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

5 years agoMerging r330331:
Tom Stellard [Wed, 30 May 2018 06:02:32 +0000 (06:02 +0000)]
Merging r330331:

------------------------------------------------------------------------
r330331 | erichkeane | 2018-04-19 07:27:05 -0700 (Thu, 19 Apr 2018) | 14 lines

Fix __attribute__((force_align_arg_pointer)) misalignment bug

The force_align_arg_pointer attribute was using a hardcoded 16-byte
alignment value which in combination with -mstack-alignment=32 (or
larger) would produce a misaligned stack which could result in crashes
when accessing stack buffers using aligned AVX load/store instructions.

Fix the issue by using the "stackrealign" function attribute instead
of using a hardcoded 16-byte alignment.

Patch By: Gramner

Differential Revision: https://reviews.llvm.org/D45812

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

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

5 years agoMerging r327863:
Tom Stellard [Wed, 30 May 2018 05:22:21 +0000 (05:22 +0000)]
Merging r327863:

------------------------------------------------------------------------
r327863 | sepavloff | 2018-03-19 09:13:43 -0700 (Mon, 19 Mar 2018) | 12 lines

[Driver] Avoid invalidated iterator in insertTargetAndModeArgs

Doing an .insert() can potentially invalidate iterators by reallocating the
vector's storage. When all the stars align just right, this causes segfaults
or glibc aborts.

Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082.

Patch by Hector Martin!

Differential Revision: https://reviews.llvm.org/D44607

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

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

6 years agoMerging r330927:
Tom Stellard [Thu, 17 May 2018 19:03:52 +0000 (19:03 +0000)]
Merging r330927:

------------------------------------------------------------------------
r330927 | sepavloff | 2018-04-26 01:08:25 -0700 (Thu, 26 Apr 2018) | 2 lines

Make test more platform neutral

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

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

6 years agoMerging r330926:
Tom Stellard [Thu, 17 May 2018 18:55:19 +0000 (18:55 +0000)]
Merging r330926:

------------------------------------------------------------------------
r330926 | sepavloff | 2018-04-25 23:28:47 -0700 (Wed, 25 Apr 2018) | 9 lines

[ConfigFiles] Update argument strings when merging argrument lists

Implementation of `InputArgList` assumes its field `ArgStrings` contains
strings for each argument exactly in the same order. This condition was
broken when arguments from config file and from invocation were merged.

This change fixes https://bugs.llvm.org/show_bug.cgi?id=37196 (Clang
config files can crash argument handling).

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

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

6 years agoMerging r327354:
Tom Stellard [Thu, 17 May 2018 02:36:36 +0000 (02:36 +0000)]
Merging r327354:

------------------------------------------------------------------------
r327354 | dyung | 2018-03-12 17:41:44 -0700 (Mon, 12 Mar 2018) | 2 lines

Add missing "env" so that test added in r327322 passes on Windows bots.

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

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

6 years agoMerging r325446:
Tom Stellard [Thu, 17 May 2018 00:01:10 +0000 (00:01 +0000)]
Merging r325446:

------------------------------------------------------------------------
r325446 | dim | 2018-02-17 13:04:35 -0800 (Sat, 17 Feb 2018) | 28 lines

[X86] Add 'sahf' CPU feature to frontend

Summary:
Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the
`+sahf` feature for the backend, for bug 36028 (Incorrect use of
pushf/popf enables/disables interrupts on amd64 kernels).  This was
originally submitted in bug 36037 by Jonathan Looney
<jonlooney@gmail.com>.

As described there, GCC also uses `-msahf` for this feature, and the
backend already recognizes the `+sahf` feature. All that is needed is to
teach clang to pass this on to the backend.

The mapping of feature support onto CPUs may not be complete; rather, it
was chosen to match LLVM's idea of which CPUs support this feature (see
lib/Target/X86/X86.td).

I also updated the affected test case (CodeGen/attr-target-x86.c) to
match the emitted output.

Reviewers: craig.topper, coby, efriedma, rsmith

Reviewed By: craig.topper

Subscribers: emaste, cfe-commits

Differential Revision: https://reviews.llvm.org/D43394

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

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

6 years agoMerging r327322:
Tom Stellard [Fri, 11 May 2018 18:07:34 +0000 (18:07 +0000)]
Merging r327322:

------------------------------------------------------------------------
r327322 | arphaman | 2018-03-12 12:36:29 -0700 (Mon, 12 Mar 2018) | 7 lines

[Tooling] Clear the PreambleSrcLocCache when preamble is discarded during reparsing

This ensures that diagnostics are not remapped to incorrect preamble locations after
the second reparse with a remapped header file occurs.

rdar://37502480

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

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

6 years agoMerging r325651:
Simon Dardis [Wed, 11 Apr 2018 12:58:50 +0000 (12:58 +0000)]
Merging r325651:

------------------------------------------------------------------------
r325651 | sdardis | 2018-02-21 00:05:05 +0000 (Wed, 21 Feb 2018) | 34 lines

[mips] Spectre variant two mitigation for MIPSR2

This patch provides mitigation for CVE-2017-5715, Spectre variant two,
which affects the P5600 and P6600. It provides the option
-mindirect-jump=hazard, which instructs the LLVM backend to replace
indirect branches with their hazard barrier variants.

This option is accepted when targeting MIPS revision two or later.

The migitation strategy suggested by MIPS for these processors is to
use two hazard barrier instructions. 'jalr.hb' and 'jr.hb' are hazard
barrier variants of the 'jalr' and 'jr' instructions respectively.

These instructions impede the execution of instruction stream until
architecturally defined hazards (changes to the instruction stream,
privileged registers which may affect execution) are cleared. These
instructions in MIPS' designs are not speculated past.

These instructions are used with the option -mindirect-jump=hazard
when branching indirectly and for indirect function calls.

These instructions are defined by the MIPS32R2 ISA, so this mitigation
method is not compatible with processors which implement an earlier
revision of the MIPS ISA.

Implementation note: I've opted to provide this as an
-mindirect-jump={hazard,...} style option in case alternative
mitigation methods are required for other implementations of the MIPS
ISA in future, e.g. retpoline style solutions.

Reviewers: atanasyan

Differential Revision: https://reviews.llvm.org/D43487

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

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

6 years agoMerging r328829:
Tom Stellard [Tue, 10 Apr 2018 04:22:41 +0000 (04:22 +0000)]
Merging r328829:

------------------------------------------------------------------------
r328829 | manojgupta | 2018-03-29 14:11:15 -0700 (Thu, 29 Mar 2018) | 23 lines

[AArch64]: Add support for parsing rN registers.

Summary:
Allow rN registers to be simply parsed as correspoing xN registers.
The "register ... asm("rN")" is an command to the
compiler's register allocator, not an operand to any individual assembly
instruction. GCC documents this syntax as "...the name of the register
that should be used."

This is needed to support the changes in Linux kernel (see
https://lkml.org/lkml/2018/3/1/268 )

Note: This will add support only for the limited use case of
register ... asm("rN"). Any other uses that make rN leak into assembly
are not supported.

Reviewers: kristof.beyls, rengolin, peter.smith, t.p.northover

Reviewed By: peter.smith

Subscribers: javed.absar, eraman, cfe-commits, srhines

Differential Revision: https://reviews.llvm.org/D44815
------------------------------------------------------------------------

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

6 years agoMerging r329052:
Tom Stellard [Mon, 9 Apr 2018 21:30:20 +0000 (21:30 +0000)]
Merging r329052:

------------------------------------------------------------------------
r329052 | hans | 2018-04-03 02:28:21 -0700 (Tue, 03 Apr 2018) | 1 line

UsersManual.rst: update text for /GX- to match r328708
------------------------------------------------------------------------

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

6 years agoMerging r328708:
Tom Stellard [Mon, 9 Apr 2018 21:20:06 +0000 (21:20 +0000)]
Merging r328708:

------------------------------------------------------------------------
r328708 | hans | 2018-03-28 07:57:49 -0700 (Wed, 28 Mar 2018) | 1 line

clang-cl: s/Enable/Disable/ in help text for /GX-
------------------------------------------------------------------------

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

6 years agoMerging r327099:
Tom Stellard [Sat, 7 Apr 2018 03:30:07 +0000 (03:30 +0000)]
Merging r327099:

------------------------------------------------------------------------
r327099 | rsmith | 2018-03-08 18:00:01 -0800 (Thu, 08 Mar 2018) | 3 lines

PR36645: Go looking for an appropriate array bound when constant-evaluating a
name of an array object.

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

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

6 years agoReleaseNotes: move the retpoline bullets higher
Hans Wennborg [Fri, 2 Mar 2018 09:50:00 +0000 (09:50 +0000)]
ReleaseNotes: move the retpoline bullets higher

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

6 years agoAdd some minimal release notes for retpolines.
Chandler Carruth [Fri, 2 Mar 2018 05:49:03 +0000 (05:49 +0000)]
Add some minimal release notes for retpolines.

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

6 years agoFix a typo in the section about C++2a features; it follows C++17, not C++14
Martin Storsjo [Wed, 28 Feb 2018 11:55:11 +0000 (11:55 +0000)]
Fix a typo in the section about C++2a features; it follows C++17, not C++14

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

6 years agoA few release notes updates for C++ support in Clang 6.0.
Richard Smith [Wed, 28 Feb 2018 02:59:20 +0000 (02:59 +0000)]
A few release notes updates for C++ support in Clang 6.0.

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

6 years agoRegenerate docs/AttributeReference.rst
Hans Wennborg [Tue, 27 Feb 2018 13:54:38 +0000 (13:54 +0000)]
Regenerate docs/AttributeReference.rst

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

6 years agoMerging r326195:
Hans Wennborg [Tue, 27 Feb 2018 13:53:37 +0000 (13:53 +0000)]
Merging r326195:
------------------------------------------------------------------------
r326195 | hans | 2018-02-27 14:48:50 +0100 (Tue, 27 Feb 2018) | 1 line

AttrDocs.td: fix some bad code-blocks
------------------------------------------------------------------------

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

6 years agoReleaseNotes: tidy up
Hans Wennborg [Tue, 27 Feb 2018 13:21:07 +0000 (13:21 +0000)]
ReleaseNotes: tidy up

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

6 years agoRegenerate DiagnosticsReference.rst
Hans Wennborg [Fri, 23 Feb 2018 11:19:13 +0000 (11:19 +0000)]
Regenerate DiagnosticsReference.rst

$ bin/clang-tblgen -gen-diag-docs -I../cfe.src/include/clang/Basic \
    ../cfe.src/include/clang/Basic/Diagnostic.td \
    -o ../cfe.src/docs/DiagnosticsReference.rst

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

6 years agoRegenerate ClangCommandLineReference.rst
Hans Wennborg [Thu, 22 Feb 2018 15:16:58 +0000 (15:16 +0000)]
Regenerate ClangCommandLineReference.rst

$ bin/clang-tblgen -gen-opt-docs -I../cfe.src/include \
    -I../cfe.src/include/clang/Driver -I../llvm.src/include \
    ../cfe.src/include/clang/Driver/ClangOptionDocs.td \
    -o ../cfe.src/docs/ClangCommandLineReference.rst

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

6 years agodocs: remove in-progress warnings
Hans Wennborg [Thu, 22 Feb 2018 14:41:44 +0000 (14:41 +0000)]
docs: remove in-progress warnings

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

6 years agoReleaseNotes: mention new -nostdlib++ flag, and clang-cl exposing --version
Hans Wennborg [Thu, 22 Feb 2018 13:39:43 +0000 (13:39 +0000)]
ReleaseNotes: mention new -nostdlib++ flag, and clang-cl exposing --version

By Nico Weber

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

6 years agoReleaseNotes: mention improvements to -Wdelete-non-virtual-dtor and -Wunreachable...
Hans Wennborg [Thu, 22 Feb 2018 13:35:08 +0000 (13:35 +0000)]
ReleaseNotes: mention improvements to -Wdelete-non-virtual-dtor and -Wunreachable-code

By Nico Weber!

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

6 years agoMerging r324308:
Hans Wennborg [Thu, 22 Feb 2018 11:25:29 +0000 (11:25 +0000)]
Merging r324308:
------------------------------------------------------------------------
r324308 | rtrieu | 2018-02-06 03:58:21 +0100 (Tue, 06 Feb 2018) | 4 lines

Fix crash on invalid.

Don't call a method when the pointer is null.

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

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

6 years agoMerging r325655:
Hans Wennborg [Wed, 21 Feb 2018 11:14:24 +0000 (11:14 +0000)]
Merging r325655:
------------------------------------------------------------------------
r325655 | ctopper | 2018-02-21 01:16:50 +0100 (Wed, 21 Feb 2018) | 8 lines

[X86] Disable CLWB in Cannon Lake

Cannon Lake does not support CLWB, therefore it
does not include all features listed under SKX.

Patch by Gabor Buella

Differential Revision: https://reviews.llvm.org/D43459
------------------------------------------------------------------------

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

6 years agoMerging r325576:
Hans Wennborg [Tue, 20 Feb 2018 12:45:43 +0000 (12:45 +0000)]
Merging r325576:
------------------------------------------------------------------------
r325576 | hans | 2018-02-20 13:43:02 +0100 (Tue, 20 Feb 2018) | 13 lines

Revert r325375 "[MS] Make constexpr static data members implicitly inline"

This broke Clang bootstrap on Windows, PR36453.

> This handles them exactly the same way that we handle const integral
> static data members with inline definitions, which is what MSVC does.
>
> As a follow-up, now that we have a way to mark variables inline in the
> AST, we should consider marking them implicitly inline there instead of
> only treating them as inline in CodeGen. Unfortunately, this breaks a
> lot of dllimport test cases, so that is future work for now.
>
> Fixes PR36125.
------------------------------------------------------------------------

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

6 years agoMerging r325375:
Hans Wennborg [Mon, 19 Feb 2018 14:07:28 +0000 (14:07 +0000)]
Merging r325375:
------------------------------------------------------------------------
r325375 | rnk | 2018-02-16 20:44:47 +0100 (Fri, 16 Feb 2018) | 11 lines

[MS] Make constexpr static data members implicitly inline

This handles them exactly the same way that we handle const integral
static data members with inline definitions, which is what MSVC does.

As a follow-up, now that we have a way to mark variables inline in the
AST, we should consider marking them implicitly inline there instead of
only treating them as inline in CodeGen. Unfortunately, this breaks a
lot of dllimport test cases, so that is future work for now.

Fixes PR36125.
------------------------------------------------------------------------

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

6 years agoRevert r319777 for PR36357
Hans Wennborg [Wed, 14 Feb 2018 10:54:05 +0000 (10:54 +0000)]
Revert r319777 for PR36357

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

6 years agoMerging r323998:
Hans Wennborg [Wed, 14 Feb 2018 09:06:43 +0000 (09:06 +0000)]
Merging r323998:
------------------------------------------------------------------------
r323998 | rsmith | 2018-02-01 21:01:49 +0100 (Thu, 01 Feb 2018) | 5 lines

PR36157: When injecting an implicit function declaration in C89, find the right
DeclContext rather than injecting it wherever we happen to be.

This avoids creating functions whose DeclContext is a struct or similar.

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

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

6 years agoMerging r324537:
Hans Wennborg [Fri, 9 Feb 2018 09:04:00 +0000 (09:04 +0000)]
Merging r324537:
------------------------------------------------------------------------
r324537 | rsmith | 2018-02-07 23:25:16 +0100 (Wed, 07 Feb 2018) | 14 lines

PR36055: fix computation of *-dependence in nested initializer lists.

When we synthesize an implicit inner initializer list when analyzing an outer
initializer list, we add it to the outer list immediately, and then fill in the
inner list. This gives the outer list no chance to update its *-dependence bits
with those of the completed inner list. To fix this, re-add the inner list to
the outer list once it's completed.

Note that we do not recompute the *-dependence bits from scratch when we
complete an outer list; this would give the wrong result for the case where a
designated initializer overwrites a dependent initializer with a non-dependent
one. The resulting list in that case should still be dependent, even though all
traces of the dependence were removed from the semantic form.

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

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

6 years agoMerging r324594:
Hans Wennborg [Fri, 9 Feb 2018 09:01:30 +0000 (09:01 +0000)]
Merging r324594:
------------------------------------------------------------------------
r324594 | aivchenk | 2018-02-08 12:15:21 +0100 (Thu, 08 Feb 2018) | 17 lines

Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.

Summary:
This patch is a fix for following issue:
https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end
lowering C calling conventions without taking into account calling conventions
enforced by attribute. In this case win64cc was no correctly lowered on targets
other than Windows.

Reviewed By: rnk (Reid Kleckner)

Differential Revision: https://reviews.llvm.org/D43016

Author: belickim <mateusz.belicki@intel.com>

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

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

6 years agoMerging r324514:
Hans Wennborg [Thu, 8 Feb 2018 13:19:38 +0000 (13:19 +0000)]
Merging r324514:
------------------------------------------------------------------------
r324514 | arphaman | 2018-02-07 21:45:39 +0100 (Wed, 07 Feb 2018) | 10 lines

[PR36008] Avoid -Wsign-compare warning for enum constants in
typeof expressions

This commit looks through typeof type at the original expression when diagnosing
-Wsign-compare to avoid an unfriendly diagnostic.

rdar://36588828

Differential Revision: https://reviews.llvm.org/D42561

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

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

6 years agoMerging r324419:
Hans Wennborg [Thu, 8 Feb 2018 08:17:53 +0000 (08:17 +0000)]
Merging r324419:
------------------------------------------------------------------------
r324419 | vsapsai | 2018-02-06 23:39:25 +0100 (Tue, 06 Feb 2018) | 23 lines

[Lex] Fix handling numerical literals ending with ' and signed exponent.

For input `0'e+1` lexer tokenized as numeric constant only `0'e`. Later
NumericLiteralParser skipped 0 and ' as digits and parsed `e+1` as valid
exponent going past the end of the token. Because it didn't mark numeric
literal as having an error, it continued parsing and tried to expandUCNs
with StringRef of length -2.

The fix is not to parse exponent when we reached the end of token.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=4588

rdar://problem/36076719

Reviewers: rsmith, t.p.northover

Reviewed By: rsmith

Subscribers: cfe-commits, jkorous-apple

Differential Revision: https://reviews.llvm.org/D41834

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

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

6 years agoMerging r324439:
Hans Wennborg [Wed, 7 Feb 2018 08:56:35 +0000 (08:56 +0000)]
Merging r324439:
------------------------------------------------------------------------
r324439 | compnerd | 2018-02-07 02:55:08 +0100 (Wed, 07 Feb 2018) | 5 lines

AST: support SwiftCC on MS ABI

Microsoft has reserved the identifier 'S' as the swift calling
convention.  Decorate the symbols appropriately.  This enables swift on
Windows.
------------------------------------------------------------------------

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

6 years agoMerging r324246:
Hans Wennborg [Tue, 6 Feb 2018 09:53:34 +0000 (09:53 +0000)]
Merging r324246:
------------------------------------------------------------------------
r324246 | mzeren-vmw | 2018-02-05 16:59:00 +0100 (Mon, 05 Feb 2018) | 33 lines

[clang-format] Re-land: Fixup #include guard indents after parseFile()

Summary:
When a preprocessor indent closes after the last line of normal code we do not
correctly fixup include guard indents. For example:

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
  int i;
  #  define A 0
  #endif
  #endif

incorrectly reformats to:

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
  int i;
  #    define A 0
  #  endif
  #endif

To resolve this issue we must fixup levels after parseFile(). Delaying
the fixup introduces a new state, so consolidate include guard search
state into an enum.

Reviewers: krasimir, klimek

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D42035
------------------------------------------------------------------------

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

6 years agoMerging r323904:
Hans Wennborg [Tue, 6 Feb 2018 09:51:45 +0000 (09:51 +0000)]
Merging r323904:
------------------------------------------------------------------------
r323904 | mzeren-vmw | 2018-01-31 21:05:50 +0100 (Wed, 31 Jan 2018) | 34 lines

[clang-format] Align preprocessor comments with #

Summary:
r312125, which introduced preprocessor indentation, shipped with a known
issue where "indentation of comments immediately before indented
preprocessor lines is toggled on each run". For example these two forms
toggle:

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
  // comment
  #   define A 0
  #endif
  #endif

  #ifndef HEADER_H
  #define HEADER_H
  #if 1
     // comment
  #   define A 0
  #endif
  #endif

This happens because we check vertical alignment against the '#' yet
indent to the level of the 'define'. This patch resolves this issue by
aligning against the '#'.

Reviewers: krasimir, klimek, djasper

Reviewed By: krasimir

Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D42408
------------------------------------------------------------------------

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

6 years agoMerging r324059:
Hans Wennborg [Mon, 5 Feb 2018 09:59:14 +0000 (09:59 +0000)]
Merging r324059:
------------------------------------------------------------------------
r324059 | mstorsjo | 2018-02-02 07:22:35 +0100 (Fri, 02 Feb 2018) | 21 lines

[MinGW] Emit typeinfo locally for dllimported classes without key functions

This fixes building Qt as shared libraries with clang in MinGW
mode; previously subclasses of the QObjectData class (in other
DLLs than the base DLL) failed to find the typeinfo symbols
(that neither were emitted in the base DLL nor in the DLL
containing the subclass).

If the virtual destructor in the newly added testcase wouldn't
be pure (or if there'd be another non-pure virtual method),
it'd be a key function and things would work out even before this
change. Make sure to locally emit the typeinfo for these classes
as well.

This matches what GCC does in this specific testcase.

This fixes the root issue that spawned PR35146. (The difference
to GCC that is initially described in that bug still is present
though.)

Differential Revision: https://reviews.llvm.org/D42641
------------------------------------------------------------------------

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

6 years agoMerging r323935:
Hans Wennborg [Mon, 5 Feb 2018 09:29:08 +0000 (09:29 +0000)]
Merging r323935:
------------------------------------------------------------------------
r323935 | rsmith | 2018-02-01 01:28:36 +0100 (Thu, 01 Feb 2018) | 5 lines

PR36181: Teach CodeGen to properly ignore requests to emit dependent entities.

Previously, friend function definitions within class templates slipped through
the gaps and caused the MS mangler to assert.

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

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

6 years agoMerging r324134:
Hans Wennborg [Mon, 5 Feb 2018 08:56:25 +0000 (08:56 +0000)]
Merging r324134:
------------------------------------------------------------------------
r324134 | ericwf | 2018-02-02 21:30:39 +0100 (Fri, 02 Feb 2018) | 14 lines

Make __has_unique_object_representations reject empty union types.

Summary:
Clang incorrectly reports empty unions as having a unique object representation. However, this is not correct since `sizeof(EmptyUnion) == 1` AKA it has 8 bits of padding. Therefore it should be treated the same as an empty struct and report `false`.

@erichkeane also suggested this fix should be merged into the 6.0 release branch, so the initial release of `__has_unique_object_representations` is as bug-free as possible.

Reviewers: erichkeane, rsmith, aaron.ballman, majnemer

Reviewed By: erichkeane

Subscribers: cfe-commits, erichkeane

Differential Revision: https://reviews.llvm.org/D42863
------------------------------------------------------------------------

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

6 years ago[ReleaseNotes] Add note for the new -fexperimental-isel flag.
Hans Wennborg [Mon, 5 Feb 2018 08:46:54 +0000 (08:46 +0000)]
[ReleaseNotes] Add note for the new -fexperimental-isel flag.

Patch by Amara Emerson.

Differential Revision: https://reviews.llvm.org/D42860

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

6 years agoMerging r323155:
Hans Wennborg [Fri, 2 Feb 2018 10:50:16 +0000 (10:50 +0000)]
Merging r323155:
------------------------------------------------------------------------
r323155 | chandlerc | 2018-01-22 23:05:25 +0100 (Mon, 22 Jan 2018) | 133 lines

Introduce the "retpoline" x86 mitigation technique for variant #2 of the speculative execution vulnerabilities disclosed today, specifically identified by CVE-2017-5715, "Branch Target Injection", and is one of the two halves to Spectre..

Summary:
First, we need to explain the core of the vulnerability. Note that this
is a very incomplete description, please see the Project Zero blog post
for details:
https://googleprojectzero.blogspot.com/2018/01/reading-privileged-memory-with-side.html

The basis for branch target injection is to direct speculative execution
of the processor to some "gadget" of executable code by poisoning the
prediction of indirect branches with the address of that gadget. The
gadget in turn contains an operation that provides a side channel for
reading data. Most commonly, this will look like a load of secret data
followed by a branch on the loaded value and then a load of some
predictable cache line. The attacker then uses timing of the processors
cache to determine which direction the branch took *in the speculative
execution*, and in turn what one bit of the loaded value was. Due to the
nature of these timing side channels and the branch predictor on Intel
processors, this allows an attacker to leak data only accessible to
a privileged domain (like the kernel) back into an unprivileged domain.

The goal is simple: avoid generating code which contains an indirect
branch that could have its prediction poisoned by an attacker. In many
cases, the compiler can simply use directed conditional branches and
a small search tree. LLVM already has support for lowering switches in
this way and the first step of this patch is to disable jump-table
lowering of switches and introduce a pass to rewrite explicit indirectbr
sequences into a switch over integers.

However, there is no fully general alternative to indirect calls. We
introduce a new construct we call a "retpoline" to implement indirect
calls in a non-speculatable way. It can be thought of loosely as
a trampoline for indirect calls which uses the RET instruction on x86.
Further, we arrange for a specific call->ret sequence which ensures the
processor predicts the return to go to a controlled, known location. The
retpoline then "smashes" the return address pushed onto the stack by the
call with the desired target of the original indirect call. The result
is a predicted return to the next instruction after a call (which can be
used to trap speculative execution within an infinite loop) and an
actual indirect branch to an arbitrary address.

On 64-bit x86 ABIs, this is especially easily done in the compiler by
using a guaranteed scratch register to pass the target into this device.
For 32-bit ABIs there isn't a guaranteed scratch register and so several
different retpoline variants are introduced to use a scratch register if
one is available in the calling convention and to otherwise use direct
stack push/pop sequences to pass the target address.

This "retpoline" mitigation is fully described in the following blog
post: https://support.google.com/faqs/answer/7625886

We also support a target feature that disables emission of the retpoline
thunk by the compiler to allow for custom thunks if users want them.
These are particularly useful in environments like kernels that
routinely do hot-patching on boot and want to hot-patch their thunk to
different code sequences. They can write this custom thunk and use
`-mretpoline-external-thunk` *in addition* to `-mretpoline`. In this
case, on x86-64 thu thunk names must be:
```
  __llvm_external_retpoline_r11
```
or on 32-bit:
```
  __llvm_external_retpoline_eax
  __llvm_external_retpoline_ecx
  __llvm_external_retpoline_edx
  __llvm_external_retpoline_push
```
And the target of the retpoline is passed in the named register, or in
the case of the `push` suffix on the top of the stack via a `pushl`
instruction.

There is one other important source of indirect branches in x86 ELF
binaries: the PLT. These patches also include support for LLD to
generate PLT entries that perform a retpoline-style indirection.

The only other indirect branches remaining that we are aware of are from
precompiled runtimes (such as crt0.o and similar). The ones we have
found are not really attackable, and so we have not focused on them
here, but eventually these runtimes should also be replicated for
retpoline-ed configurations for completeness.

For kernels or other freestanding or fully static executables, the
compiler switch `-mretpoline` is sufficient to fully mitigate this
particular attack. For dynamic executables, you must compile *all*
libraries with `-mretpoline` and additionally link the dynamic
executable and all shared libraries with LLD and pass `-z retpolineplt`
(or use similar functionality from some other linker). We strongly
recommend also using `-z now` as non-lazy binding allows the
retpoline-mitigated PLT to be substantially smaller.

When manually apply similar transformations to `-mretpoline` to the
Linux kernel we observed very small performance hits to applications
running typical workloads, and relatively minor hits (approximately 2%)
even for extremely syscall-heavy applications. This is largely due to
the small number of indirect branches that occur in performance
sensitive paths of the kernel.

When using these patches on statically linked applications, especially
C++ applications, you should expect to see a much more dramatic
performance hit. For microbenchmarks that are switch, indirect-, or
virtual-call heavy we have seen overheads ranging from 10% to 50%.

However, real-world workloads exhibit substantially lower performance
impact. Notably, techniques such as PGO and ThinLTO dramatically reduce
the impact of hot indirect calls (by speculatively promoting them to
direct calls) and allow optimized search trees to be used to lower
switches. If you need to deploy these techniques in C++ applications, we
*strongly* recommend that you ensure all hot call targets are statically
linked (avoiding PLT indirection) and use both PGO and ThinLTO. Well
tuned servers using all of these techniques saw 5% - 10% overhead from
the use of retpoline.

We will add detailed documentation covering these components in
subsequent patches, but wanted to make the core functionality available
as soon as possible. Happy for more code review, but we'd really like to
get these patches landed and backported ASAP for obvious reasons. We're
planning to backport this to both 6.0 and 5.0 release streams and get
a 5.0 release with just this cherry picked ASAP for distros and vendors.

This patch is the work of a number of people over the past month: Eric, Reid,
Rui, and myself. I'm mailing it out as a single commit due to the time
sensitive nature of landing this and the need to backport it. Huge thanks to
everyone who helped out here, and everyone at Intel who helped out in
discussions about how to craft this. Also, credit goes to Paul Turner (at
Google, but not an LLVM contributor) for much of the underlying retpoline
design.

Reviewers: echristo, rnk, ruiu, craig.topper, DavidKreitzer

Subscribers: sanjoy, emaste, mcrosier, mgorny, mehdi_amini, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D41723
------------------------------------------------------------------------

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

6 years ago[Docs] Added release notes for OpenCL.
Anastasia Stulova [Wed, 31 Jan 2018 14:29:12 +0000 (14:29 +0000)]
[Docs] Added release notes for OpenCL.

Differential Revision: https://reviews.llvm.org/D42307

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

6 years agoMerging r323360:
Hans Wennborg [Tue, 30 Jan 2018 15:16:10 +0000 (15:16 +0000)]
Merging r323360:
------------------------------------------------------------------------
r323360 | kparzysz | 2018-01-24 19:42:19 +0100 (Wed, 24 Jan 2018) | 2 lines

[Hexagon] Accept lowercase b in -hvx-length=64b and -hvx-length=128b

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

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

6 years agoMerging r323485:
Hans Wennborg [Tue, 30 Jan 2018 10:43:43 +0000 (10:43 +0000)]
Merging r323485:
------------------------------------------------------------------------
r323485 | aemerson | 2018-01-26 01:27:22 +0100 (Fri, 26 Jan 2018) | 3 lines

[Driver] Add an -fexperimental-isel driver option to enable/disable GlobalISel.

Differential Revision: https://reviews.llvm.org/D42276
------------------------------------------------------------------------

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

6 years agoMerging r322245:
Hans Wennborg [Tue, 30 Jan 2018 10:15:07 +0000 (10:15 +0000)]
Merging r322245:
------------------------------------------------------------------------
r322245 | ctopper | 2018-01-11 02:37:59 +0100 (Thu, 11 Jan 2018) | 5 lines

[X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it does in the backend.

Similarly, make -mno-fma and -mno-f16c imply -mno-avx512f.

Withou this  "-mno-sse -mavx512f" ends up with avx512f being enabled in the frontend but disabled in the backend.
------------------------------------------------------------------------

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

6 years agoMerging r323008:
Hans Wennborg [Wed, 24 Jan 2018 15:28:43 +0000 (15:28 +0000)]
Merging r323008:
------------------------------------------------------------------------
r323008 | vsapsai | 2018-01-20 00:41:47 +0100 (Sat, 20 Jan 2018) | 32 lines

[Lex] Fix crash on code completion in comment in included file.

This fixes PR32732 by updating CurLexerKind to reflect available lexers.
We were hitting null pointer in Preprocessor::Lex because CurLexerKind
was CLK_Lexer but CurLexer was null. And we set it to null in
Preprocessor::HandleEndOfFile when exiting a file with code completion
point.

To reproduce the crash it is important for a comment to be inside a
class specifier. In this case in Parser::ParseClassSpecifier we improve
error recovery by pushing a semicolon token back into the preprocessor
and later on try to lex a token because we haven't reached the end of
file.

Also clang crashes only on code completion in included file, i.e. when
IncludeMacroStack is not empty. Though we reset CurLexer even if include
stack is empty. The difference is that during pushing back a semicolon
token, preprocessor calls EnterCachingLexMode which decides it is
already in caching mode because various lexers are null and
IncludeMacroStack is not empty. As the result, CurLexerKind remains
CLK_Lexer instead of updating to CLK_CachingLexer.

rdar://problem/34787685

Reviewers: akyrtzi, doug.gregor, arphaman

Reviewed By: arphaman

Subscribers: cfe-commits, kfunk, arphaman, nemanjai, kbarton

Differential Revision: https://reviews.llvm.org/D41688

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

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

6 years ago[ReleaseNotes] Mention OpenMP Tools Interface in runtime library
Jonas Hahnfeld [Tue, 23 Jan 2018 07:50:11 +0000 (07:50 +0000)]
[ReleaseNotes] Mention OpenMP Tools Interface in runtime library

The OpenMP runtime has no dedicated Release Notes, so add it to Clang's
section about OpenMP.

Differential Revision: https://reviews.llvm.org/D42352

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

6 years ago[6.0.0 Release] Release notes for configuration files in clang
Serge Pavlov [Mon, 22 Jan 2018 16:44:29 +0000 (16:44 +0000)]
[6.0.0 Release] Release notes for configuration files in clang

Differential Revision: https://reviews.llvm.org/D42360

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

6 years agoMerging r323123:
Jonas Hahnfeld [Mon, 22 Jan 2018 15:38:26 +0000 (15:38 +0000)]
Merging r323123:
------------------------------------------------------------------------
r323123 | hahnfeld | 2018-01-22 16:27:45 +0100 (Mon, 22 Jan 2018) | 6 lines

[DOCS] Mention OpenMP Tools Interface in runtime library

Also list supported configurations (architectures + operating
systems).

Differential Revision: https://reviews.llvm.org/D42349
------------------------------------------------------------------------

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

6 years agoMerging r322904 and r322905:
Hans Wennborg [Mon, 22 Jan 2018 14:15:37 +0000 (14:15 +0000)]
Merging r322904 and r322905:

------------------------------------------------------------------------
r322904 | rnk | 2018-01-18 23:55:14 +0100 (Thu, 18 Jan 2018) | 3 lines

[CodeView] Sink complex inline functions to .cpp file, NFC

I'm cleaning up this code before I attempt to fix a line table bug.
------------------------------------------------------------------------

------------------------------------------------------------------------
r322905 | rnk | 2018-01-18 23:55:43 +0100 (Thu, 18 Jan 2018) | 5 lines

[CodeView] Add line numbers for inlined call sites

We did this for inline call site line tables, but we hadn't done it for
regular function line tables yet. This patch copies that logic from
encodeInlineLineTable.
------------------------------------------------------------------------

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

6 years agoMerging r322813:
Hans Wennborg [Mon, 22 Jan 2018 12:56:41 +0000 (12:56 +0000)]
Merging r322813:
------------------------------------------------------------------------
r322813 | rtrieu | 2018-01-18 05:28:56 +0100 (Thu, 18 Jan 2018) | 7 lines

Fix Scope::dump()

The dump function for Scope only has 20 out of the 24 flags.  Since it looped
until no flags were left, having an unknown flag lead to an infinite loop.
That loop has been changed to a single pass for each flag, plus an assert to
alert if new flags are added.

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

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

6 years agoMerging r322984:
Hans Wennborg [Mon, 22 Jan 2018 12:54:39 +0000 (12:54 +0000)]
Merging r322984:
------------------------------------------------------------------------
r322984 | rtrieu | 2018-01-19 21:46:19 +0100 (Fri, 19 Jan 2018) | 7 lines

Allow BlockDecl in CXXRecord scope to have no access specifier.

Using a BlockDecl in a default member initializer causes it to be attached to
CXXMethodDecl without its access specifier being set.  This prevents a crash
where getAccess is called on this BlockDecl, since that method expects any
Decl in CXXRecord scope to have an access specifier.

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

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

6 years ago[docs] Fix typo in Release Notes
Jonas Hahnfeld [Sun, 21 Jan 2018 11:43:32 +0000 (11:43 +0000)]
[docs] Fix typo in Release Notes

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

6 years agoMerging r322901:
Hans Wennborg [Fri, 19 Jan 2018 10:09:28 +0000 (10:09 +0000)]
Merging r322901:
------------------------------------------------------------------------
r322901 | nico | 2018-01-18 13:40:27 -0800 (Thu, 18 Jan 2018) | 19 lines

Remove TautologicalInRangeCompare from Extra and TautologicalCompare.

This removes the following (already default-off) warnings from -Wextra:
  -Wtautological-type-limit-compare,
  -Wtautological-unsigned-zero-compare
  -Wtautological-unsigned-enum-zero-compare

On the thread "[cfe-dev] -Wtautological-constant-compare issues", clang
code owners Richard Smith, John McCall, and Reid Kleckner as well as
libc++ code owner Marshall Clow stated that these new warnings are not
yet ready for prime time and shouldn't be part of -Wextra.

Furthermore, Vedant Kumar (Apple), Peter Hosek (Fuchsia), and me (Chromium)
expressed the same concerns (Vedant on that thread, Peter on
https://reviews.llvm.org/D39462, me on https://reviews.llvm.org/D41512).

So remove them from -Wextra, and remove TautologicalInRangeCompare from
TautologicalCompare too until they're usable with real-world code.

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

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

6 years agoMerging r322246:
Hans Wennborg [Wed, 17 Jan 2018 16:26:58 +0000 (16:26 +0000)]
Merging r322246:
------------------------------------------------------------------------
r322246 | ctopper | 2018-01-10 17:38:00 -0800 (Wed, 10 Jan 2018) | 1 line

[X86] Fix vpshrd builtins to require an ICE for their constant argument to match vpshld.
------------------------------------------------------------------------

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

6 years agoMerging r321779:
Hans Wennborg [Wed, 17 Jan 2018 16:15:39 +0000 (16:15 +0000)]
Merging r321779:
------------------------------------------------------------------------
r321779 | rsmith | 2018-01-03 17:24:17 -0800 (Wed, 03 Jan 2018) | 7 lines

PR35045: Convert injected-class-name to its corresponding simple-template-id
during template argument deduction.

We already did this when the injected-class-name was in P, but missed the case
where it was in A. This (probably) can't happen except in implicit deduction
guides.

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

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

6 years agoMerging r321777:
Hans Wennborg [Wed, 17 Jan 2018 16:13:22 +0000 (16:13 +0000)]
Merging r321777:
------------------------------------------------------------------------
r321777 | rsmith | 2018-01-03 17:02:18 -0800 (Wed, 03 Jan 2018) | 2 lines

PR35028: Retain duplicate alignas attributes in template instantiation.

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

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

6 years agoMerging r322390:
Hans Wennborg [Wed, 17 Jan 2018 13:24:15 +0000 (13:24 +0000)]
Merging r322390:
------------------------------------------------------------------------
r322390 | vsapsai | 2018-01-12 10:54:35 -0800 (Fri, 12 Jan 2018) | 20 lines

[Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.

Fix makes the loop in LexAngledStringLiteral more like the loops in
LexStringLiteral, LexCharConstant. When we skip a character after
backslash, we need to check if we reached the end of the file instead of
reading the next character unconditionally.

Discovered by OSS-Fuzz:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3832

rdar://problem/35572754

Reviewers: arphaman, kcc, rsmith, dexonsmith

Reviewed By: rsmith, dexonsmith

Subscribers: cfe-commits, rsmith, dexonsmith

Differential Revision: https://reviews.llvm.org/D41423

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

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

6 years agoMerging r322236:
Hans Wennborg [Wed, 17 Jan 2018 12:56:35 +0000 (12:56 +0000)]
Merging r322236:
------------------------------------------------------------------------
r322236 | rsmith | 2018-01-10 15:08:26 -0800 (Wed, 10 Jan 2018) | 3 lines

In C++17, when instantiating an out-of-line definition of an inline static data
member, don't forget to instantiate the initializer too.

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

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

6 years agoMerging r322350, r322405, r322420, r322593:
Hans Wennborg [Wed, 17 Jan 2018 11:41:51 +0000 (11:41 +0000)]
Merging r322350, r322405, r322420, r322593:

------------------------------------------------------------------------
r322350 | rtrieu | 2018-01-11 20:42:27 -0800 (Thu, 11 Jan 2018) | 6 lines

[ODRHash] Don't hash friend functions.

In certain combinations of templated classes and friend functions, the body
of friend functions does not get propagated along with function signature.
Exclude friend functions for hashing to avoid this case.

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

------------------------------------------------------------------------
r322405 | rtrieu | 2018-01-12 13:49:20 -0800 (Fri, 12 Jan 2018) | 2 lines

Disable test for Windows to fix Windows buildbots.

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

------------------------------------------------------------------------
r322420 | rtrieu | 2018-01-12 15:13:33 -0800 (Fri, 12 Jan 2018) | 2 lines

Try to suppress Windows testing again.

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

------------------------------------------------------------------------
r322593 | rtrieu | 2018-01-16 11:53:06 -0800 (Tue, 16 Jan 2018) | 6 lines

Add context to why test was disabled on Windows

test/Modules/odr_hash-Friend.cpp triggers an assertion in MicrosoftMangle.cpp
This has been reported in PR35939

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

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

6 years agoMerging r322018:
Hans Wennborg [Tue, 16 Jan 2018 15:43:57 +0000 (15:43 +0000)]
Merging r322018:
------------------------------------------------------------------------
r322018 | abataev | 2018-01-08 11:02:51 -0800 (Mon, 08 Jan 2018) | 9 lines

[OPENMP] Current status of OpenMP support.

Summary: Some info about supported features of OpenMP 4.5-5.0.

Reviewers: hfinkel, rsmith

Subscribers: kkwli0, Hahnfeld, cfe-commits

Differential Revision: https://reviews.llvm.org/D39457
------------------------------------------------------------------------

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

6 years agoMerging r321754:
Hans Wennborg [Tue, 16 Jan 2018 14:55:42 +0000 (14:55 +0000)]
Merging r321754:
------------------------------------------------------------------------
r321754 | adrian | 2018-01-03 11:10:21 -0800 (Wed, 03 Jan 2018) | 9 lines

-gmodules: Emit debug info for implicit module imports via #include.

When a type is only used as a template parameter and that type is the
only type imported from another #include'd module, no skeleton CU for
that module is generated, so a consumer doesn't know where to find the
type definition. By emitting an import declaration, we can force a
skeleton CU to be generated for each imported module.

rdar://problem/36266156
------------------------------------------------------------------------

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

6 years agoMerging r321771:
Hans Wennborg [Tue, 16 Jan 2018 14:49:22 +0000 (14:49 +0000)]
Merging r321771:
------------------------------------------------------------------------
r321771 | vedantk | 2018-01-03 15:11:32 -0800 (Wed, 03 Jan 2018) | 21 lines

[CGBuiltin] Handle unsigned mul overflow properly (PR35750)

r320902 fixed the IRGen for some types of checked multiplications. It
did not handle unsigned overflow correctly in the case where the signed
operand is negative (PR35750).

Eli pointed out that on overflow, the result must be equal to the unique
value that is equivalent to the mathematically-correct result modulo two
raised to the k power, where k is the number of bits in the result type.

This patch fixes the specialized IRGen from r320902 accordingly.

Testing: Apart from check-clang, I modified the test harness from
r320902 to validate the results of all multiplications -- not just the
ones which don't overflow:

  https://gist.github.com/vedantk/3eb9c88f82e5c32f2e590555b4af5081

llvm.org/PR35750, rdar://34963321

Differential Revision: https://reviews.llvm.org/D41717
------------------------------------------------------------------------

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

6 years agoMerging r321933:
Hans Wennborg [Tue, 16 Jan 2018 12:58:37 +0000 (12:58 +0000)]
Merging r321933:
------------------------------------------------------------------------
r321933 | xazax | 2018-01-06 02:51:00 -0800 (Sat, 06 Jan 2018) | 4 lines

[analyzer] Fix some check's output plist not containing the check name

Differential Revision: https://reviews.llvm.org/D41538

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

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

6 years agoMerging r322518:
Hans Wennborg [Tue, 16 Jan 2018 09:21:32 +0000 (09:21 +0000)]
Merging r322518:
------------------------------------------------------------------------
r322518 | erichkeane | 2018-01-15 13:16:25 -0800 (Mon, 15 Jan 2018) | 4 lines

Revert 319303: Add _Float128 as alias to __float128 to enable compilations on Fedora27/glibc2

Differential Revision: https://reviews.llvm.org/D40673

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

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

6 years ago[docs] Mention support for Windows/ARM64 in the release notes
Martin Storsjo [Thu, 4 Jan 2018 07:43:41 +0000 (07:43 +0000)]
[docs] Mention support for Windows/ARM64 in the release notes

Differential Revision: https://reviews.llvm.org/D41711

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

6 years agoRegenerate ClangCommandLineReference.rst
Hans Wennborg [Wed, 3 Jan 2018 17:06:59 +0000 (17:06 +0000)]
Regenerate ClangCommandLineReference.rst

$ bin/clang-tblgen -gen-opt-docs -I../cfe.src/include \
    -I../cfe.src/include/clang/Driver -I../llvm.src/include \
    ../cfe.src/include/clang/Driver/ClangOptionDocs.td \
    -o ../cfe.src/docs/ClangCommandLineReference.rst

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

6 years agoGenerate docs/AttributeReference.rst
Hans Wennborg [Wed, 3 Jan 2018 17:05:59 +0000 (17:05 +0000)]
Generate docs/AttributeReference.rst

$ bin/clang-tblgen -gen-attr-docs -I../cfe.src/include \
    ../cfe.src/include/clang/Basic/Attr.td \
    -o ../cfe.src/docs/AttributeReference.rst

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

6 years agoCreating release_60 branch off revision 321711
Hans Wennborg [Wed, 3 Jan 2018 14:54:37 +0000 (14:54 +0000)]
Creating release_60 branch off revision 321711

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

6 years ago[libclang] Fix cursors for functions with trailing return type
Ivan Donchevskii [Wed, 3 Jan 2018 14:35:48 +0000 (14:35 +0000)]
[libclang] Fix cursors for functions with trailing return type

This one was rolled back as follow-up to the failing commit.
Second try.

For the function declaration

auto foo5(Foo) -> Foo;
the parameter tokens were mapped to cursors representing the
FunctionDecl:

Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6
Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6
Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6
Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef
Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6
Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6
Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8
Punctuation: ";" [1:19 - 1:20]

Fix this by ensuring that the trailing return type is not visited as
first.

Patch by Nikolai Kosjar.

Differential Revision: https://reviews.llvm.org/D40561

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

6 years agoRevert r321697 "[libclang] Support querying whether a declaration is invalid" and...
Hans Wennborg [Wed, 3 Jan 2018 14:20:15 +0000 (14:20 +0000)]
Revert r321697 "[libclang] Support querying whether a declaration is invalid" and follow-ups.

This broke test/Index/opencl-types.cl on several buildbots:
http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/3294
http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/6498
http://lab.llvm.org:8011/builders/clang-ppc64le-linux-multistage/builds/5239

> [libclang] Support querying whether a declaration is invalid
>
> This is useful for e.g. highlighting purposes in an IDE.
>
> Patch by Nikolai Kosjar.
>
> Differential Revision: https://reviews.llvm.org/D40072

Also reverting follow-ups that otherwise caused conflicts for the
revert:

r321700 "Fix line endings."
r321701 "Fix more line endings."

r321698 "[libclang] Fix cursors for functions with trailing return type"
> For the function declaration
>
> auto foo5(Foo) -> Foo;
> the parameter tokens were mapped to cursors representing the
> FunctionDecl:
>
> Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6
> Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6
> Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6
> Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef
> Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6
> Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6
> Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8
> Punctuation: ";" [1:19 - 1:20]
>
> Fix this by ensuring that the trailing return type is not visited as
> first.
>
> Patch by Nikolai Kosjar.
>
> Differential Revision: https://reviews.llvm.org/D40561

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

6 years agoUserManual: Update with the latest clang-cl flags
Hans Wennborg [Wed, 3 Jan 2018 13:20:25 +0000 (13:20 +0000)]
UserManual: Update with the latest clang-cl flags

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

6 years agoFix more line endings.
Ivan Donchevskii [Wed, 3 Jan 2018 10:40:11 +0000 (10:40 +0000)]
Fix more line endings.

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

6 years agoFix line endings.
Ivan Donchevskii [Wed, 3 Jan 2018 10:33:21 +0000 (10:33 +0000)]
Fix line endings.

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

6 years ago[libclang] Fix cursors for functions with trailing return type
Ivan Donchevskii [Wed, 3 Jan 2018 10:04:37 +0000 (10:04 +0000)]
[libclang] Fix cursors for functions with trailing return type

For the function declaration

auto foo5(Foo) -> Foo;
the parameter tokens were mapped to cursors representing the
FunctionDecl:

Keyword: "auto" [1:1 - 1:5] FunctionDecl=test5:1:6
Identifier: "test5" [1:6 - 1:11] FunctionDecl=test5:1:6
Punctuation: "(" [1:11 - 1:12] FunctionDecl=test5:1:6
Identifier: "X" [1:12 - 1:13] FunctionDecl=test5:1:6 // Ops, not a TypeRef
Punctuation: ")" [1:13 - 1:14] FunctionDecl=test5:1:6
Punctuation: "->" [1:15 - 1:17] FunctionDecl=test5:1:6
Identifier: "X" [1:18 - 1:19] TypeRef=struct X:7:8
Punctuation: ";" [1:19 - 1:20]

Fix this by ensuring that the trailing return type is not visited as
first.

Patch by Nikolai Kosjar.

Differential Revision: https://reviews.llvm.org/D40561

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

6 years ago[libclang] Support querying whether a declaration is invalid
Ivan Donchevskii [Wed, 3 Jan 2018 09:49:31 +0000 (09:49 +0000)]
[libclang] Support querying whether a declaration is invalid

This is useful for e.g. highlighting purposes in an IDE.

Patch by Nikolai Kosjar.

Differential Revision: https://reviews.llvm.org/D40072

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

6 years ago[libclang] Add clang_getFileContents to libclang.exports
Ivan Donchevskii [Wed, 3 Jan 2018 09:17:08 +0000 (09:17 +0000)]
[libclang] Add clang_getFileContents to libclang.exports

This is the follow up patch for rL319881 which introduced
the function but did not put it into .exports file.

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

6 years agoUpdate clang cc1as for createMCAsmBackend change in r321692
Alex Bradbury [Wed, 3 Jan 2018 08:53:24 +0000 (08:53 +0000)]
Update clang cc1as for createMCAsmBackend change in r321692

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

6 years ago[Sema] -Wtautological-constant-compare is too good. Cripple it.
Roman Lebedev [Wed, 3 Jan 2018 08:45:19 +0000 (08:45 +0000)]
[Sema] -Wtautological-constant-compare is too good. Cripple it.

Summary:
The diagnostic was mostly introduced in D38101 by me, as a reaction to wasting a lot of time, see [[ https://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20171009/206427.html | mail ]].
However, the diagnostic is pretty dumb. While it works with no false-positives,
there are some questionable cases that are diagnosed when one would argue that they should not be.

The common complaint is that it diagnoses the comparisons between an `int` and
`long` when compiling for a 32-bit target as tautological, but not when
compiling for 64-bit targets. The underlying problem is obvious: data model.
In most cases, 64-bit target is `LP64` (`int` is 32-bit, `long` and pointer are
64-bit), and the 32-bit target is `ILP32` (`int`, `long`, and pointer are 32-bit).

I.e. the common pattern is: (pseudocode)
```
#include <limits>
#include <cstdint>
int main() {
  using T1 = long;
  using T2 = int;

  T1 r;
  if (r < std::numeric_limits<T2>::min()) {}
  if (r > std::numeric_limits<T2>::max()) {}
}
```
As an example, D39149 was trying to fix this diagnostic in libc++, and it was not well-received.

This *could* be "fixed", by changing the diagnostics logic to something like
`if the types of the values being compared are different, but are of the same size, then do diagnose`,
and i even attempted to do so in D39462, but as @rjmccall rightfully commented,
that implementation is incomplete to say the least.

So to stop causing trouble, and avoid contaminating upcoming release, lets do this workaround:
* move these three diags (`warn_unsigned_always_true_comparison`, `warn_unsigned_enum_always_true_comparison`, `warn_tautological_constant_compare`) into it's own `-Wtautological-constant-in-range-compare`
* Disable them by default
* Make them part of `-Wextra`
* Additionally, give `warn_tautological_constant_compare` it's own flag `-Wtautological-type-limit-compare`.
  I'm not happy about that name, but i can't come up with anything better.

This way all three of them can be enabled/disabled either altogether, or one-by-one.

Reviewers: aaron.ballman, rsmith, smeenai, rjmccall, rnk, mclow.lists, dim

Reviewed By: aaron.ballman, rsmith, dim

Subscribers: thakis, compnerd, mehdi_amini, dim, hans, cfe-commits, rjmccall

Tags: #clang

Differential Revision: https://reviews.llvm.org/D41512

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

6 years agoPR35697: look at the first declaration when determining whether a function or
Richard Smith [Wed, 3 Jan 2018 02:34:35 +0000 (02:34 +0000)]
PR35697: look at the first declaration when determining whether a function or
variable is extern "C" in linkage calculations.

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

6 years agoFix and simplify handling of return type for (generic) lambda conversion function...
Richard Smith [Tue, 2 Jan 2018 23:52:42 +0000 (23:52 +0000)]
Fix and simplify handling of return type for (generic) lambda conversion function to function pointer.

Previously, we would:
 * compute the type of the conversion function and static invoker as a
   side-effect of template argument deduction for a conversion
 * re-compute the type as part of deduced return type deduction when building
   the conversion function itself

Neither of these turns out to be quite correct. There are other ways to reach a
declaration of the conversion function than in a conversion (such as an
explicit call or friend declaration), and performing auto deduction causes the
function type to be rebuilt in the context of the lambda closure type (which is
different from the context in which it originally appeared, resulting in
spurious substitution failures for constructs that are valid in one context but
not the other, such as the use of an enclosing class's "this" pointer).

This patch switches us to use a different strategy: as before, we use the
declared type of the operator() to form the type of the conversion function and
invoker, but we now populate that type as part of return type deduction for the
conversion function. And the invoker is now treated as simply being an
implementation detail of building the conversion function, and isn't given
special treatment by template argument deduction for the conversion function
any more.

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

6 years ago[analyzer] do not crash with assertion on processing locations of bodyfarmed functions
George Karpenkov [Tue, 2 Jan 2018 23:05:47 +0000 (23:05 +0000)]
[analyzer] do not crash with assertion on processing locations of bodyfarmed functions

This addresses an issue introduced in r183451: since
`removePiecesWithInvalidLocations` is called *after* `adjustCallLocations`,
it is not necessary, and in fact harmful, to have this assertion in
adjustCallLocations.

Addresses rdar://36170689

Differential Revision: https://reviews.llvm.org/D41680

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

6 years ago[WinEH] Allow for multiple terminatepads
Reid Kleckner [Tue, 2 Jan 2018 21:34:16 +0000 (21:34 +0000)]
[WinEH] Allow for multiple terminatepads

Fixes verifier errors with Windows EH and OpenMP, which injects a
terminate scope around parallel blocks.

Fixes PR35778

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

6 years ago[DOXYGEN] Fix doxygen and content issues in smmintrin.h
Douglas Yung [Tue, 2 Jan 2018 20:45:29 +0000 (20:45 +0000)]
[DOXYGEN] Fix doxygen and content issues in smmintrin.h

- Fix formatting issue due to hyphenated terms at line breaks.
- Fix typo

This patch was made by Craig Flores

Differential Revision: https://reviews.llvm.org/D41520

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

6 years ago[DOXYGEN] Fix doxygen and content issues in pmmintrin.h
Douglas Yung [Tue, 2 Jan 2018 20:42:53 +0000 (20:42 +0000)]
[DOXYGEN] Fix doxygen and content issues in pmmintrin.h

- Fix incorrect wording in various intrinsic descriptions. Previously the descriptions used "low-order" and "high-order" when the intended meaning was "even-indexed" and "odd-indexed".

This patch was made by Craig Flores

Differential Revision: https://reviews.llvm.org/D41518

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

6 years ago[DOXYGEN] Fix doxygen and content issues in emmintrin.h
Douglas Yung [Tue, 2 Jan 2018 20:39:29 +0000 (20:39 +0000)]
[DOXYGEN] Fix doxygen and content issues in emmintrin.h

- Fixed innaccurate instruction mappings for various intrinsics.
- Fixed description of NaN handling in comparison intrinsics.
- Unify description of _mm_store_pd1 to match _mm_store1_pd.
- Fix incorrect wording in various intrinsic descriptions. Previously the descriptions used "low-order" and "high-order" when the intended meaning was "even-indexed" and "odd-indexed".
- Fix typos.
- Add missing italics command (\a) for params and fixed some parameter spellings.

This patch was made by Craig Flores

Differential Revision: https://reviews.llvm.org/D41516

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

6 years agoSuppress undefined-template warnings when the pattern is declared in a system header.
Nick Lewycky [Tue, 2 Jan 2018 19:10:12 +0000 (19:10 +0000)]
Suppress undefined-template warnings when the pattern is declared in a system header.

The way to fix an undefined-template warning is to add lines to the header file that defines the template pattern. We should suppress the warnings when the template pattern is in a system header because we don't expect users to edit those.

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

6 years ago[Sema] Don't emit the -Wstrict-prototypes warning for variadic functions.
Volodymyr Sapsai [Tue, 2 Jan 2018 18:02:19 +0000 (18:02 +0000)]
[Sema] Don't emit the -Wstrict-prototypes warning for variadic functions.

rdar://problem/33251668

Reviewers: arphaman, ahatanak

Reviewed By: arphaman

Subscribers: ptitei, cfe-commits

Differential Revision: https://reviews.llvm.org/D41528

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

6 years agoRevert "ASan+operator new[]: Fix operator new[] cookie poisoning"
Filipe Cabecinhas [Tue, 2 Jan 2018 13:46:12 +0000 (13:46 +0000)]
Revert "ASan+operator new[]: Fix operator new[] cookie poisoning"

This reverts r321645.

I missed a compiler-rt test that needs updating.

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

6 years agoASan+operator new[]: Fix operator new[] cookie poisoning
Filipe Cabecinhas [Tue, 2 Jan 2018 13:21:50 +0000 (13:21 +0000)]
ASan+operator new[]: Fix operator new[] cookie poisoning

Summary:
The C++ Itanium ABI says:
No cookie is required if the new operator being used is ::operator new[](size_t, void*).

We should only avoid poisoning the cookie if we're calling this
operator, not others. This is dealt with before the call to
InitializeArrayCookie.

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D41301

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

6 years ago[Driver] Fix unused variables and test-writing-into-workdir after r321621
Sam McCall [Tue, 2 Jan 2018 09:35:10 +0000 (09:35 +0000)]
[Driver] Fix unused variables and test-writing-into-workdir after r321621

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

6 years agoAgain reverting an attempt to convert the DeclSpec enums into scoped enums.
Faisal Vali [Mon, 1 Jan 2018 18:23:28 +0000 (18:23 +0000)]
Again reverting an attempt to convert the DeclSpec enums into scoped enums.
  - reverts r321622, r321625, and r321626.
  - the use of bit-fields is still resulting in warnings - even though we can use static-asserts to harden the code and ensure the bit-fields are wide enough.  The bots still complain of warnings being seen.
  - to silence the warnings requires specifying the bit-fields with the underlying enum type (as opposed to the enum type itself), which then requires lots of unnecessary static casts of each enumerator within DeclSpec to the underlying-type, which even though could be seen as implementation details, it does hamper readability - and given the additional litterings, makes me question the value of the change.

So in short - I give up (for now at least).

Sorry about the noise.

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

6 years ago[Sema] Fix build with GCC
Benjamin Kramer [Mon, 1 Jan 2018 17:07:23 +0000 (17:07 +0000)]
[Sema] Fix build with GCC

tools/clang/lib/Sema/DeclSpec.cpp: In member function 'void clang::DeclSpec::Finish(clang::Sema&, const clang::PrintingPolicy&)':
tools/clang/lib/Sema/DeclSpec.cpp:1116:8: error: could not convert 'clang::DeclSpec::TSW_unspecified' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'
tools/clang/lib/Sema/DeclSpec.cpp:1117:8: error: could not convert 'clang::DeclSpec::TSW_short' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'
tools/clang/lib/Sema/DeclSpec.cpp:1118:8: error: could not convert 'clang::DeclSpec::TSW_longlong' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'
tools/clang/lib/Sema/DeclSpec.cpp:1128:8: error: could not convert 'clang::DeclSpec::TSW_long' from 'const TSW {aka const clang::TypeSpecifierWidth}' to 'int'

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