]> granicus.if.org Git - clang/log
clang
6 years ago[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective
Julie Hockett [Wed, 9 May 2018 18:27:33 +0000 (18:27 +0000)]
[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective

Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are system
headers.

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

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

6 years ago[OPENMP] Generate unique names for offloading regions id.
Alexey Bataev [Wed, 9 May 2018 18:02:37 +0000 (18:02 +0000)]
[OPENMP] Generate unique names for offloading regions id.

It is required to emit unique names for offloading regions ids. Required
to support compilation and linking of several compilation units.

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

6 years ago[OpenCL] Fix typos in emitted enqueue kernel function names
Yaxun Liu [Wed, 9 May 2018 17:07:06 +0000 (17:07 +0000)]
[OpenCL] Fix typos in emitted enqueue kernel function names

Two typos:
vaarg => vararg
get_kernel_preferred_work_group_multiple => get_kernel_preferred_work_group_size_multiple

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

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

6 years ago[X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.
Craig Topper [Wed, 9 May 2018 16:57:48 +0000 (16:57 +0000)]
[X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.

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

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

6 years ago[OPENMP] Mark global tors/dtors as used.
Alexey Bataev [Wed, 9 May 2018 14:15:18 +0000 (14:15 +0000)]
[OPENMP] Mark global tors/dtors as used.

If the global variables are marked as declare target and they need
ctors/dtors, these ctors/dtors are emitted and then invoked by the
offloading runtime library. They are not explicitly used in the emitted
code and thus can be optimized out. Patch marks these functions as used,
so the optimizer cannot remove these function during the optimization
phase.

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

6 years ago[OpenCL] Add constant address space to __func__ in AST.
Anastasia Stulova [Wed, 9 May 2018 13:23:26 +0000 (13:23 +0000)]
[OpenCL] Add constant address space to __func__ in AST.

Added string literal helper function to obtain the type
attributed by a constant address space.

Also fixed predefind __func__ expr to use the helper
to constract the string literal correctly.

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

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

6 years ago[OpenCL] Restrict various keywords in OpenCL C++ mode
Sven van Haastregt [Wed, 9 May 2018 13:16:17 +0000 (13:16 +0000)]
[OpenCL] Restrict various keywords in OpenCL C++ mode

Restrict the following keywords in the OpenCL C++ language mode,
according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification.

 - dynamic_cast
 - typeid
 - register (already restricted in OpenCL C, update the diagnostic)
 - thread_local
 - exceptions (try/catch/throw)
 - access qualifiers read_only, write_only, read_write

Support the `__global`, `__local`, `__constant`, `__private`, and
`__generic` keywords in OpenCL C++.  Leave the unprefixed address
space qualifiers such as global available, i.e., do not mark them as
reserved keywords in OpenCL C++.  libclcxx provides explicit address
space pointer classes such as `global_ptr` and `global<T>` that are
implemented using the `__`-prefixed qualifiers.

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

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

6 years agoRemove unused lit setting, see https://reviews.llvm.org/D46619
Nico Weber [Wed, 9 May 2018 12:38:51 +0000 (12:38 +0000)]
Remove unused lit setting, see https://reviews.llvm.org/D46619

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

6 years agoFixes issue introduced by r331556.
Alexander Kornienko [Wed, 9 May 2018 12:27:21 +0000 (12:27 +0000)]
Fixes issue introduced by r331556.

Closes bug: https://bugs.llvm.org/show_bug.cgi?id=37357

Patch by Rafael Stahl!

Differential revision: https://reviews.llvm.org/D46633

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

6 years agoRevert r331843 "[DebugInfo] Generate debug information for labels."
Hans Wennborg [Wed, 9 May 2018 09:29:58 +0000 (09:29 +0000)]
Revert r331843 "[DebugInfo] Generate debug information for labels."

It broke the Chromium build (see reply on the review).

> Generate DILabel metadata and call llvm.dbg.label after label
> statement to associate the metadata with the label.
>
> Differential Revision: https://reviews.llvm.org/D45045
>
> Patch by Hsiangkai Wang.

This doesn't revert the change to backend-unsupported-error.ll
that seems to correspond to an llvm-side change.

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

6 years agoRevert "[Driver] Use -fuse-line-directives by default in MSVC mode"
Martin Storsjo [Wed, 9 May 2018 09:11:01 +0000 (09:11 +0000)]
Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"

This reverts commit SVN r331666.

It was afterwards pointed out in https://reviews.llvm.org/D46520
that #line directives lose information about what parts come from a
system header. That means the result of -E usually won't compile,
since Windows headers are typically full of warnings and
default-error warnings.

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

6 years ago[clang-format] Respect BreakBeforeClosingBrace while calculating length
Krasimir Georgiev [Wed, 9 May 2018 09:02:11 +0000 (09:02 +0000)]
[clang-format] Respect BreakBeforeClosingBrace while calculating length

Summary:
This patch makes `getLengthToMatchingParen` respect the `BreakBeforeClosingBrace`
ParenState for matching scope closers. In order to distinguish between paren states
introduced by real vs. fake parens, I've added the token opening the ParensState
to that struct.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[driver] Add mips_Features_Group to Options to improve documentation sorting
Simon Atanasyan [Wed, 9 May 2018 08:42:30 +0000 (08:42 +0000)]
[driver] Add mips_Features_Group to Options to improve documentation sorting

Move all of the MIPS-only options into a new m_mips_Features_Group.
Nearly all other targets have most target-specific options grouped,
but MIPS does not.

The primary benefits are that the options will be listed together (and
thus identifiable as MIPS-specific even if they have no help string) in
the ClangCommandLineReference, and that Options.td is a bit more organized.

A secondary benefit is that a custom version of clang can more easily
hide/disable groups of options for unsupported targets.

Patch by Vince Del Vecchio

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

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

6 years ago_Atomic of empty struct shouldn't assert
JF Bastien [Wed, 9 May 2018 03:51:12 +0000 (03:51 +0000)]
_Atomic of empty struct shouldn't assert

Summary:

An _Atomic of an empty struct is pretty silly. In general we just widen empty
structs to hold a byte's worth of storage, and we represent size and alignment
as 0 internally and let LLVM figure out what to do. For _Atomic it's a bit
different: the memory model mandates concrete effects occur when atomic
operations occur, so in most cases actual instructions need to get emitted. It's
really not worth trying to optimize empty struct atomics by figuring out e.g.
that a fence would do, even though sane compilers should do optimize atomics.
Further, wg21.link/p0528 will fix C++20 atomics with padding bits so that
cmpxchg on them works, which means that we'll likely need to do the zero-init
song and dance for empty atomic structs anyways (and I think we shouldn't
special-case this behavior to C++20 because prior standards are just broken).

This patch therefore makes a minor change to r176658 "Promote atomic type sizes
up to a power of two": if the width of the atomic's value type is 0, just use 1
byte for width and leave alignment as-is (since it should never be zero, and
over-aligned zero-width structs are weird but fine).

This fixes an assertion:
   (NumBits >= MIN_INT_BITS && "bitwidth too small"), function get, file ../lib/IR/Type.cpp, line 241.

It seems like this has run into other assertions before (namely the unreachable
Kind check in ImpCastExprToType), but I haven't reproduced that issue with
tip-of-tree.

<rdar://problem/39678063>

Reviewers: arphaman, rjmccall

Subscribers: aheejin, cfe-commits

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

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

6 years ago[DebugInfo] Generate debug information for labels.
Shiva Chen [Wed, 9 May 2018 02:41:56 +0000 (02:41 +0000)]
[DebugInfo] Generate debug information for labels.

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

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

Patch by Hsiangkai Wang.

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

6 years agoRemove \brief commands from doxygen comments.
Adrian Prantl [Wed, 9 May 2018 01:00:01 +0000 (01:00 +0000)]
Remove \brief commands from doxygen comments.

This is similar to the LLVM change https://reviews.llvm.org/D46290.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

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

6 years agoSet CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes
Petr Hosek [Wed, 9 May 2018 00:58:12 +0000 (00:58 +0000)]
Set CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes

This doesn't make any difference since we don't use RPATH/RUNPATH
on Fuchsia but it avoids the CMake error when re-linking libraries
while building with Ninja.

Differntial Revision: https://reviews.llvm.org/D46610

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

6 years ago[CMake] Include llvm-strip in Fuchsia toolchain distribution
Petr Hosek [Wed, 9 May 2018 00:05:28 +0000 (00:05 +0000)]
[CMake] Include llvm-strip in Fuchsia toolchain distribution

Now that llvm-strip is available, include it in the Fuchsia toolchain.

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

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

6 years ago[X86] Mark builtins 'const' where possible
Craig Topper [Tue, 8 May 2018 22:01:43 +0000 (22:01 +0000)]
[X86] Mark builtins 'const' where possible

I attempted to go through all the builtins and marked them const if they didn't touch memory or other hidden state.

I don't know how to test this or if it really matters.

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

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

6 years agoFix float->int conversion warnings when near barriers.
Erich Keane [Tue, 8 May 2018 21:26:21 +0000 (21:26 +0000)]
Fix float->int conversion warnings when near barriers.

As Eli brought up here: https://reviews.llvm.org/D46535
I'd previously messed up this fix by missing conversions
that are just slightly outside the range.  This patch fixes
this by no longer ignoring the return value of
convertToInteger.  Additionally, one of the error messages
wasn't very sensical (mentioning out of range value, when it
really was not), so it was cleaned up as well.

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

6 years ago[HIP] Add hip offload kind
Yaxun Liu [Tue, 8 May 2018 21:02:12 +0000 (21:02 +0000)]
[HIP] Add hip offload kind

There are quite differences in HIP action builder and action job creation,
which justifies to define a separate offload kind.

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

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

6 years agoAdd a mno-outline flag to disable the MachineOutliner
Jessica Paquette [Tue, 8 May 2018 20:58:32 +0000 (20:58 +0000)]
Add a mno-outline flag to disable the MachineOutliner

Since we're working on turning the MachineOutliner by default under -Oz for
AArch64, it makes sense to have an -mno-outline flag available. This currently
doesn't do much (it basically just undoes -moutline).

When the MachineOutliner is on by default under AArch64, this flag should
set -mllvm -enable-machine-outliner=never.

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

6 years ago[Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets
Martin Storsjo [Tue, 8 May 2018 20:55:23 +0000 (20:55 +0000)]
[Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets

-dwarf-column-info is omitted if -gcodeview is specified for msvc
targets at the moment, but since -gcodeview is an option that can be
specified for any target, there's little reason to restrict this
handling to msvc targets.

This allows getting proper codeview debug info by passing -gcodeview
for e.g. MinGW targets as well.

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

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

6 years agoChange -foutline to -moutline
Jessica Paquette [Tue, 8 May 2018 20:53:19 +0000 (20:53 +0000)]
Change -foutline to -moutline

Nitpicky, but the MachineOutliner is a machine-level pass, and so we should
reflect that by using "m" instead of "n".

Figured we should get this in before people get used to the letter f. :)

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

6 years agoAdd missing newlines to cl::extrahelp uses
Stephane Sezer [Tue, 8 May 2018 19:46:29 +0000 (19:46 +0000)]
Add missing newlines to cl::extrahelp uses

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

6 years ago[lit] Fix running tests that require 'examples'.
Zachary Turner [Tue, 8 May 2018 18:20:10 +0000 (18:20 +0000)]
[lit] Fix running tests that require 'examples'.

Differential Revision: https://reviews.llvm.org/D46514
Patch by Nikolai Kosjar.

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

6 years ago[OPENMP, NVPTX] Fix linkage of the global entries.
Alexey Bataev [Tue, 8 May 2018 14:16:57 +0000 (14:16 +0000)]
[OPENMP, NVPTX] Fix linkage of the global entries.

The linkage of the global entries must be weak to enable support of
redefinition of the same target regions in multiple compilation units.

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

6 years ago[OpenCL] Factor out language version printing
Sven van Haastregt [Tue, 8 May 2018 13:47:43 +0000 (13:47 +0000)]
[OpenCL] Factor out language version printing

Generate a printable OpenCL language version number in a single place
and select between the OpenCL C or OpenCL C++ version accordingly.

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

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

6 years ago[ASTImporter] Properly import SourceLocations of Attrs
Aleksei Sidorin [Tue, 8 May 2018 12:45:21 +0000 (12:45 +0000)]
[ASTImporter] Properly import SourceLocations of Attrs

Patch by Rafael Stahl!

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

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

6 years ago[ASTMatchers] Overload isConstexpr for ifStmts
Gabor Horvath [Tue, 8 May 2018 11:53:32 +0000 (11:53 +0000)]
[ASTMatchers] Overload isConstexpr for ifStmts

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

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

6 years agoFix 'not all control paths return a value' MSVC warnings. NFCI.
Simon Pilgrim [Tue, 8 May 2018 09:40:32 +0000 (09:40 +0000)]
Fix 'not all control paths return a value' MSVC warnings. NFCI.

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

6 years ago[clang-format] Add raw string formatting to release notes
Krasimir Georgiev [Tue, 8 May 2018 09:25:12 +0000 (09:25 +0000)]
[clang-format] Add raw string formatting to release notes

Reviewers: hans

Reviewed By: hans

Subscribers: cfe-commits

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

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

6 years ago[C++2a] Implement operator<=>: Fix another bug in the code gen tests.
Eric Fiselier [Tue, 8 May 2018 07:56:05 +0000 (07:56 +0000)]
[C++2a] Implement operator<=>: Fix another bug in the code gen tests.

Sorry for the failures. I'm quite new at writing code gen tests, and
I'm not sure the best way to make them portable.

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

6 years ago[x86] Introduce the encl[u|s|v] intrinsics
Gabor Buella [Tue, 8 May 2018 07:12:34 +0000 (07:12 +0000)]
[x86] Introduce the encl[u|s|v] intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years ago[x86] Introduce the pconfig intrinsic
Gabor Buella [Tue, 8 May 2018 06:49:41 +0000 (06:49 +0000)]
[x86] Introduce the pconfig intrinsic

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years ago[CMake] Pass additional CMake flags in Fuchsia cache files
Petr Hosek [Tue, 8 May 2018 02:47:13 +0000 (02:47 +0000)]
[CMake] Pass additional CMake flags in Fuchsia cache files

This allows passing additional CMake flags to builtins and runtimes
build through Fuchsia cache files.

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

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

6 years ago[C++2a] operator<=>: Fix incorrect use of Twine.
Eric Fiselier [Tue, 8 May 2018 02:28:47 +0000 (02:28 +0000)]
[C++2a] operator<=>: Fix incorrect use of Twine.

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

6 years ago[C++2a] Implement operator<=>: Address bugs and post-commit review comments after...
Eric Fiselier [Tue, 8 May 2018 00:52:19 +0000 (00:52 +0000)]
[C++2a] Implement operator<=>: Address bugs and post-commit review comments after r331677.

This patch addresses some mostly trivial post-commit review comments received
on r331677.

Additionally, this patch fixes an assertion in `getNarrowingKind` caused by
the use of an uninitialized value from `checkThreeWayNarrowingConversion`.

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

6 years agoMove test input file into same directory as test. NFC
Richard Trieu [Tue, 8 May 2018 00:29:21 +0000 (00:29 +0000)]
Move test input file into same directory as test.  NFC

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

6 years agoFix failing codegen test on non-x86_64 platforms
Eric Fiselier [Mon, 7 May 2018 23:15:34 +0000 (23:15 +0000)]
Fix failing codegen test on non-x86_64 platforms

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

6 years agoPR37352: mangle numbering for decomposition declarations.
Richard Smith [Mon, 7 May 2018 22:23:38 +0000 (22:23 +0000)]
PR37352: mangle numbering for decomposition declarations.

In order to match our mangling scheme, use a different set of numbers for
decomposition declarations, and consider all binding names when forming the
numbering. This does not yet affect any mangled names we produce, because
local decomposition declarations can't yet have linkage, but a C++ standard
proposal to change that is currently being processed.

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

6 years ago[NFC] Move 2 variable initialization from Ctor to member initializers.
Erich Keane [Mon, 7 May 2018 22:01:06 +0000 (22:01 +0000)]
[NFC] Move 2 variable initialization from Ctor to member initializers.

In response to dblaikie's suggestion on r331536, replace the two enum
typed variable initializers in the constructor with member initializers.

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

6 years ago[X86] Use target feature defines in tests instead of defining our own flag on the...
Craig Topper [Mon, 7 May 2018 21:47:13 +0000 (21:47 +0000)]
[X86] Use target feature defines in tests instead of defining our own flag on the command line. NFCI

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

6 years ago[X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.
Craig Topper [Mon, 7 May 2018 21:47:11 +0000 (21:47 +0000)]
[X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.

Without this we throw an error on the header file instead of the user code when the right features aren't enabled in clang.

Rename the other DEFAULT_FN_ATTRS defines to _Z for 512-bit since I used _Y for this case.

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

6 years agoRelax a FileCheck pattern to make it pass on Windows.
Peter Collingbourne [Mon, 7 May 2018 21:40:53 +0000 (21:40 +0000)]
Relax a FileCheck pattern to make it pass on Windows.

Should fix Windows bot failure:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/16956

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

6 years ago[C++2a] Implement operator<=> CodeGen and ExprConstant
Eric Fiselier [Mon, 7 May 2018 21:07:10 +0000 (21:07 +0000)]
[C++2a] Implement operator<=> CodeGen and ExprConstant

Summary:
This patch tackles long hanging fruit for the builtin operator<=> expressions. It is currently needs some cleanup before landing, but I want to get some initial feedback.

The main changes are:

* Lookup, build, and store the required standard library types and expressions in `ASTContext`. By storing them in ASTContext we don't need to store (and duplicate) the required expressions in the BinaryOperator AST nodes.

* Implement [expr.spaceship] checking, including diagnosing narrowing conversions.

* Implement `ExprConstant` for builtin spaceship operators.

* Implement builitin operator<=> support in `CodeGenAgg`. Initially I emitted the required comparisons using `ScalarExprEmitter::VisitBinaryOperator`, but this caused the operand expressions to be emitted once for every required cmp.

* Implement [builtin.over] with modifications to support the intent of P0946R0. See the note on `BuiltinOperatorOverloadBuilder::addThreeWayArithmeticOverloads` for more information about the workaround.

Reviewers: rsmith, aaron.ballman, majnemer, rnk, compnerd, rjmccall

Reviewed By: rjmccall

Subscribers: rjmccall, rsmith, aaron.ballman, junbuml, mgorny, cfe-commits

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

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

6 years ago[CFI] Force LLVM to die if the implicit blacklist files cannot be found.
Peter Collingbourne [Mon, 7 May 2018 20:54:05 +0000 (20:54 +0000)]
[CFI] Force LLVM to die if the implicit blacklist files cannot be found.

Currently LLVM CFI tries to use an implicit blacklist file, currently
in /usr/lib64/clang/<version>/share. If the file is not there, LLVM
happily continues, which causes CFI to add checks to files/functions
that are known to fail, generating binaries that fail. This CL causes
LLVM to die (I hope) if it can't find these implicit blacklist files.

Patch by Caroline Tice!

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

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

6 years agoCorrect warning on Float->Integer conversions.
Erich Keane [Mon, 7 May 2018 20:52:56 +0000 (20:52 +0000)]
Correct warning on Float->Integer conversions.

As identified and briefly discussed here:
https://bugs.llvm.org/show_bug.cgi?id=37305

Converting a floating point number to an integer type when
the integral part is out of the range of the integer type is
undefined behavior in C. Additionally, CodeGen emits an undef
in this situation.

HOWEVER, we've been giving a warning that says that the value is
changed. This patch corrects the warning to list that it is actually
undefined behavior.

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

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

6 years ago[Driver] Use -fuse-line-directives by default in MSVC mode
Martin Storsjo [Mon, 7 May 2018 20:26:09 +0000 (20:26 +0000)]
[Driver] Use -fuse-line-directives by default in MSVC mode

Don't use the GNU extension form of line markers in MSVC mode.

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

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

6 years ago[OPENMP, NVPTX] Small test fix, NFC.
Alexey Bataev [Mon, 7 May 2018 17:38:13 +0000 (17:38 +0000)]
[OPENMP, NVPTX] Small test fix, NFC.

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

6 years ago[OPENMP, NVPTX] Codegen for critical construct.
Alexey Bataev [Mon, 7 May 2018 17:23:05 +0000 (17:23 +0000)]
[OPENMP, NVPTX] Codegen for critical construct.

Added correct codegen for the critical construct on NVPTX devices.

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

6 years agoFix explicit template parameter reporting for narrowing conversions
Erich Keane [Mon, 7 May 2018 17:05:20 +0000 (17:05 +0000)]
Fix explicit template parameter reporting for narrowing conversions

I found that explicit template parameters that caused a
narrowing integer conversion resulted in the incorrect parameter
being mentioned in the note (see test attached). This is because
the argument checking code doesn't check to see if it caused
SFINAE errors when checking the arguments, so instead of giving
up on the first error, it continues through the list. This
makes the error reporting pick up the last template param every time.

This patch checks these parameters on each argument and gives up
if there is an error. The result is that only the required amount
of arguments are checked, and that the 'Converted' array contains
only the successful arguments before the first failure, as the
calls seem to all expect.

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

6 years ago[docs] Fix typos in the Clang User's Manual.
Joel Galenson [Mon, 7 May 2018 16:23:46 +0000 (16:23 +0000)]
[docs] Fix typos in the Clang User's Manual.

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

6 years ago[OPENMP, NVPTX] Added support for L2 parallelism.
Alexey Bataev [Mon, 7 May 2018 14:50:05 +0000 (14:50 +0000)]
[OPENMP, NVPTX] Added support for L2 parallelism.

Added initial codegen for level 2, 3 etc. parallelism. Currently, all
the second, the third etc. parallel regions will run sequentially.

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

6 years ago[mips] Improve handling of -fno-[pic/PIC] option
Aleksandar Beserminji [Mon, 7 May 2018 14:30:49 +0000 (14:30 +0000)]
[mips] Improve handling of -fno-[pic/PIC] option

In order to disable PIC and to match GCC behaviour, -mno-abicalls
option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls,
warning is reported. An error is reported when -fno-pic or -fno-PIC is
used in combination with -mabicalls.

In this commit, test case is added.

Depends on D44381.

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

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

6 years agoRevert "[mips] Improve handling of -fno-[pic/PIC] option"
Aleksandar Beserminji [Mon, 7 May 2018 14:28:42 +0000 (14:28 +0000)]
Revert "[mips] Improve handling of -fno-[pic/PIC] option"

This reverts commit r331636. Forgot to add the test case.

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

6 years ago[mips] Improve handling of -fno-[pic/PIC] option
Aleksandar Beserminji [Mon, 7 May 2018 14:19:54 +0000 (14:19 +0000)]
[mips] Improve handling of -fno-[pic/PIC] option

In order to disable PIC and to match GCC behaviour, -mno-abicalls
option is neccessary. When -fno-[pic/PIC] is used witout -mno-abicalls,
warning is reported. An error is reported when -fno-pic or -fno-PIC is
used in combination with -mabicalls.

Depends on D44381.

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

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

6 years ago[ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, DependentSco...
Peter Szecsi [Mon, 7 May 2018 12:08:27 +0000 (12:08 +0000)]
[ASTImporter] Support importing UnresolvedMemberExpr, DependentNameType, DependentScopeDeclRefExpr

The visit callback implementations for the 3 C++ AST Node added to the ASTImporter.

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

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

6 years agoRemove now-unnecessary check for non-zero nvsize in addition to
Richard Smith [Mon, 7 May 2018 06:43:31 +0000 (06:43 +0000)]
Remove now-unnecessary check for non-zero nvsize in addition to
emptyness in MS record layout.

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

6 years agoNon-zero-length bit-fields make a class non-empty.
Richard Smith [Mon, 7 May 2018 06:43:30 +0000 (06:43 +0000)]
Non-zero-length bit-fields make a class non-empty.

This implements the rule intended by the standard (see LWG 2358)
and the rule intended by the Itanium C++ ABI (see
https://github.com/itanium-cxx-abi/cxx-abi/pull/51), and makes
Clang match the behavior of GCC, ICC, and MSVC.

A pedantic reading of both the standard and the ABI indicate that Clang
is currently technically correct, but that's not worth much when it's
clear that the wording is wrong in both those places.

This is an ABI break for classes that derive from a class that is empty
other than one or more unnamed non-zero-length bit-fields. Such cases
are expected to be rare, but -fclang-abi-compat=6 restores the old
behavior just in case.

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

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

6 years agoDisallow pointers to const in __sync_fetch_and_xxx.
Aaron Ballman [Sat, 5 May 2018 17:38:42 +0000 (17:38 +0000)]
Disallow pointers to const in __sync_fetch_and_xxx.

Diagnoses code like:

void f(const int *ptr) {
  __sync_fetch_and_add(ptr, 1);
}

which matches the behavior of GCC and ICC.

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

6 years agoAdd -target to address errors in test from r331592
Teresa Johnson [Sat, 5 May 2018 16:37:31 +0000 (16:37 +0000)]
Add -target to address errors in test from r331592

The error turns out to be:
Assertion failed: (Target.isCompatibleDataLayout(getDataLayout()) && "Can't create a MachineFunction using a Module with a " "Target-incompatible DataLayout attached\n"), function init, file /Users/buildslave/jenkins/workspace/clang-stage1-cmake-RA-incremental/llvm/lib/CodeGen/MachineFunction.cpp, line 180.

Add -target to address this. Also re-enable the test I had temporarily
commented, and move it further down in case there is still a failure
(since it pipes stderr to FileCheck).

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

6 years agoSkip part of test added in r331592 to help debug bot failures
Teresa Johnson [Sat, 5 May 2018 15:54:57 +0000 (15:54 +0000)]
Skip part of test added in r331592 to help debug bot failures

Trying to debug why/where a few bots getting exit code 256 e.g.
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/48471/testReport/Clang/CodeGen/thinlto_diagnostic_handler_remarks_with_hotness_ll/

and a few windows bots getting no output from that RUN line e.g.
http://lab.llvm.org:8011/builders/clang-x86-windows-msvc2015/builds/11865/steps/ninja%20check%201/logs/FAIL%3A%20Clang%3A%3Athinlto-diagnostic-handler-remarks-with-hotness.ll

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

6 years agoAdd required target to address bot failures from r331592
Teresa Johnson [Sat, 5 May 2018 15:15:04 +0000 (15:15 +0000)]
Add required target to address bot failures from r331592

Failing on non-x86 bots, needs x86 target for code gen.

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

6 years ago[ThinLTO] Support opt remarks options with distributed ThinLTO backends
Teresa Johnson [Sat, 5 May 2018 14:37:29 +0000 (14:37 +0000)]
[ThinLTO] Support opt remarks options with distributed ThinLTO backends

Summary:
Passes down the necessary code ge options to the LTO Config to enable
-fdiagnostics-show-hotness and -fsave-optimization-record in the ThinLTO
backend for a distributed build.

Also, remove warning about not having PGO when the input is IR.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

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

6 years agoFix a couple places that immediately called operator-> on the result of dyn_cast.
Craig Topper [Sat, 5 May 2018 01:58:26 +0000 (01:58 +0000)]
Fix a couple places that immediately called operator-> on the result of dyn_cast.

It looks like it safe to just use cast for both cases.

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

6 years agoAdd warning flag -Wordered-compare-function-pointers.
Eli Friedman [Sat, 5 May 2018 00:09:51 +0000 (00:09 +0000)]
Add warning flag -Wordered-compare-function-pointers.

The C standard doesn't allow comparisons like "f1 < f2" (where f1 and f2
are function pointers), but we allow them as an extension.  Add a
warning flag to control this warning.

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

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

6 years ago[analyzer] Remove untested code in evalLoad.
Artem Dergachev [Fri, 4 May 2018 23:01:10 +0000 (23:01 +0000)]
[analyzer] Remove untested code in evalLoad.

No functional change intended.

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

6 years ago[analyzer] Invalidate union regions properly. Don't hesitate to load later.
Artem Dergachev [Fri, 4 May 2018 22:19:32 +0000 (22:19 +0000)]
[analyzer] Invalidate union regions properly. Don't hesitate to load later.

We weren't invalidating our unions correctly. The previous behavior in
invalidateRegionsWorker::VisitCluster() was to direct-bind an UnknownVal
to the union (at offset 0).

For that reason we were never actually loading default bindings from our unions,
because there never was any default binding to load, and the value
that is presumed when there's no default binding to load
is usually completely incorrect (eg. UndefinedVal for stack unions).

The new behavior is to default-bind a conjured symbol (of irrelevant type)
to the union that's being invalidated, similarly to what we do for structures
and classes. Then it becomes safe to load the value properly.

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

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

6 years ago[analyzer] pr36458: Fix retrieved value cast for symbolic void pointers.
Artem Dergachev [Fri, 4 May 2018 22:11:12 +0000 (22:11 +0000)]
[analyzer] pr36458: Fix retrieved value cast for symbolic void pointers.

C allows us to write any bytes into any memory region. When loading weird bytes
from memory regions of known types, the analyzer is required to make sure that
the loaded value makes sense by casting it to an appropriate type.

Fix such cast for loading values that represent void pointers from non-void
pointer type places.

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

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

6 years ago[analyzer] pr18953: Split C++ zero-initialization from default initialization.
Artem Dergachev [Fri, 4 May 2018 21:56:51 +0000 (21:56 +0000)]
[analyzer] pr18953: Split C++ zero-initialization from default initialization.

The bindDefault() API of the ProgramState allows setting a default value
for reads from memory regions that were not preceded by writes.

It was used for implementing C++ zeroing constructors (i.e. default constructors
that boil down to setting all fields of the object to 0).

Because differences between zeroing consturctors and other forms of default
initialization have been piling up (in particular, zeroing constructors can be
called multiple times over the same object, probably even at the same offset,
requiring a careful and potentially slow cleanup of previous bindings in the
RegionStore), we split the API in two: bindDefaultInitial() for modeling
initial values and bindDefaultZero() for modeling zeroing constructors.

This fixes a few assertion failures from which the investigation originated.

The imperfect protection from both inability of the RegionStore to support
binding extents and lack of information in ASTRecordLayout has been loosened
because it's, well, imperfect, and it is unclear if it fixing more than it
was breaking.

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

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

6 years ago[X86] Correct the attributes on the incssp and rdssp builtins to only have 'nothrow'
Craig Topper [Fri, 4 May 2018 21:56:43 +0000 (21:56 +0000)]
[X86] Correct the attributes on the incssp and rdssp builtins to only have 'nothrow'

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

6 years ago[X86] Fix some inconsistent formatting in the first line of our intrinsics headers.
Craig Topper [Fri, 4 May 2018 21:45:25 +0000 (21:45 +0000)]
[X86] Fix some inconsistent formatting in the first line of our intrinsics headers.

Some were too long and some were too short.

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

6 years ago[analyzer] pr37209: Fix casts of glvalues to references.
Artem Dergachev [Fri, 4 May 2018 21:39:25 +0000 (21:39 +0000)]
[analyzer] pr37209: Fix casts of glvalues to references.

Many glvalue expressions aren't of their respective reference type -
they are simply glvalues of their value type.

This was causing problems when we were trying to obtain type of the original
expression while evaluating certain glvalue bit-casts.

Fixed by artificially forging a reference type to provide to the casting
procedure.

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

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

6 years ago[analyzer] Treat more const variables and fields as known contants.
Artem Dergachev [Fri, 4 May 2018 20:52:39 +0000 (20:52 +0000)]
[analyzer] Treat more const variables and fields as known contants.

When loading from a variable or a field that is declared as constant,
the analyzer will try to inspect its initializer and constant-fold it.
Upon success, the analyzer would skip normal load and return the respective
constant.

The new behavior also applies to fields/elements of brace-initialized structures
and arrays.

Patch by Rafael Stahl!

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

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

6 years agoAllow modifying the PrintingPolicy for fully qualified names.
Sterling Augustine [Fri, 4 May 2018 20:12:39 +0000 (20:12 +0000)]
Allow modifying the PrintingPolicy for fully qualified names.

Author: mikhail.ramalho@gmail.com

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

6 years ago[clang-format] Refactor #include insertion/deletion functionality into a class.
Eric Liu [Fri, 4 May 2018 17:55:13 +0000 (17:55 +0000)]
[clang-format] Refactor #include insertion/deletion functionality into a class.

Summary:
The class will be moved into libToolingCore as followup.

The new behaviors in this patch:
- New #include is inserted in the right position in a #include block to
preserver sorted #includes. This is best effort - only works when the
block is already sorted.
- When inserting multiple #includes to the end of a file which doesn't
end with a "\n" character, a "\n" will be prepended to each #include.
This is a special and rare case that was previously handled. This is now
relaxed to avoid complexity as it's rare in practice.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, cfe-commits, djasper

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

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

6 years ago[NFC]Convert Class to use member initialization instead of inline.
Erich Keane [Fri, 4 May 2018 16:19:53 +0000 (16:19 +0000)]
[NFC]Convert Class to use member initialization instead of inline.

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

6 years ago[clang-cl] Print /showIncludes to stderr, if used in combination with /E, /EP or /P
Erich Keane [Fri, 4 May 2018 15:58:31 +0000 (15:58 +0000)]
[clang-cl] Print /showIncludes to stderr, if used in combination with /E, /EP or /P

This replicates 'cl.exe' behavior and allows for both preprocessor output and
dependency information to be extraced with a single compiler invocation.

This is especially useful for compiler caching with tools like Mozilla's sccache.

See: https://github.com/mozilla/sccache/issues/246

Patch By: fxb

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

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

6 years agoRemove explicit cfg-temporary-dtors=true
Alexander Kornienko [Fri, 4 May 2018 14:13:14 +0000 (14:13 +0000)]
Remove explicit cfg-temporary-dtors=true

Summary:
Remove explicit -analyzer-config cfg-temporary-dtors=true in analyzer tests,
since this option defaults to true since r326461.

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: cfe-commits

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

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

6 years ago[Coroutines] Catch exceptions in await_resume
Brian Gesiak [Fri, 4 May 2018 14:02:37 +0000 (14:02 +0000)]
[Coroutines] Catch exceptions in await_resume

Summary:
http://wg21.link/P0664r2 section "Evolution/Core Issues 24" describes a
proposed change to Coroutines TS that would have any exceptions thrown
after the initial suspend point of a coroutine be caught by the handler
specified by the promise type's 'unhandled_exception' member function.
This commit provides a sample implementation of the specified behavior.

Test Plan: `check-clang`

Reviewers: GorNishanov, EricWF

Reviewed By: GorNishanov

Subscribers: cfe-commits, lewissbaker, eric_niebler

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

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

6 years ago[Driver] Don't warn about unused inputs in config files
Martin Storsjo [Fri, 4 May 2018 06:05:58 +0000 (06:05 +0000)]
[Driver] Don't warn about unused inputs in config files

This avoids warnings about unused linker parameters, just like
other flags are ignored if they're from config files.

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

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

6 years ago[analyzer] NFC: Remove unused parameteer of StoreManager::CastRetrievedVal().
Artem Dergachev [Fri, 4 May 2018 00:53:41 +0000 (00:53 +0000)]
[analyzer] NFC: Remove unused parameteer of StoreManager::CastRetrievedVal().

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

6 years ago[X86] Make __builtin_ia32_directstore_u32 and __builtin_ia32_movdir64b 'nothrow'
Craig Topper [Thu, 3 May 2018 21:01:35 +0000 (21:01 +0000)]
[X86] Make __builtin_ia32_directstore_u32 and __builtin_ia32_movdir64b 'nothrow'

These builtins snuck in while I was in the middle of adding nothrow to the other builtins in my local clone and I guess I missed them.

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

6 years ago[CodeGenFunction] Use the StringRef::split function that takes a char separator inste...
Craig Topper [Thu, 3 May 2018 21:01:33 +0000 (21:01 +0000)]
[CodeGenFunction] Use the StringRef::split function that takes a char separator instead of StringRef separator. NFC

The char separator version should be a little better optimized.

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

6 years ago[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG
Joel E. Denny [Thu, 3 May 2018 17:22:04 +0000 (17:22 +0000)]
[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG

Reviewed by: ABataev

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

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

6 years agoRevert r331466: [OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG"
Joel E. Denny [Thu, 3 May 2018 17:22:01 +0000 (17:22 +0000)]
Revert r331466: [OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG"

Sorry, forgot to add commit log attributes.

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

6 years ago[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG
Joel E. Denny [Thu, 3 May 2018 17:15:44 +0000 (17:15 +0000)]
[OPENMP] Fix test typos: CHECK-DAG-N -> CHECK-N-DAG

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

6 years agoAllow writing calling convention attributes on function types.
Aaron Ballman [Thu, 3 May 2018 15:33:50 +0000 (15:33 +0000)]
Allow writing calling convention attributes on function types.

Calling convention attributes notionally appertain to the function type -- they modify the mangling of the function, change the behavior of assignment operations, etc. This commit allows the calling convention attributes to be written in the type position as well as the declaration position.

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

6 years agoRename invariant.group.barrier to launder.invariant.group
Piotr Padlewski [Thu, 3 May 2018 11:03:01 +0000 (11:03 +0000)]
Rename invariant.group.barrier to launder.invariant.group

Summary:
This is one of the initial commit of "RFC: Devirtualization v2" proposal:
https://docs.google.com/document/d/16GVtCpzK8sIHNc2qZz6RN8amICNBtvjWUod2SujZVEo/edit?usp=sharing

Reviewers: rsmith, amharc, kuhar, sanjoy

Subscribers: arsenm, nhaehnle, javed.absar, hiraditya, llvm-commits

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

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

6 years agoEnable -fsanitize=function on FreeBSD.
Fangrui Song [Thu, 3 May 2018 06:37:47 +0000 (06:37 +0000)]
Enable -fsanitize=function on FreeBSD.

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

6 years agoFix -Wunused-variable warning in Clang.cpp
Karl-Johan Karlsson [Thu, 3 May 2018 05:53:29 +0000 (05:53 +0000)]
Fix -Wunused-variable warning in Clang.cpp

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

6 years agoTrack the result of evaluating a computed noexcept specification on the
Richard Smith [Thu, 3 May 2018 03:58:32 +0000 (03:58 +0000)]
Track the result of evaluating a computed noexcept specification on the
FunctionProtoType.

We previously re-evaluated the expression each time we wanted to know whether
the type is noexcept or not. We now evaluate the expression exactly once.

This is not quite "no functional change": it fixes a crasher bug during AST
deserialization where we would try to evaluate the noexcept specification in a
situation where we have not deserialized sufficient portions of the AST to
permit such evaluation.

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

6 years ago[CMake][Cache] Stop pretending that Fuchsia is UNIX
Petr Hosek [Thu, 3 May 2018 01:44:03 +0000 (01:44 +0000)]
[CMake][Cache] Stop pretending that Fuchsia is UNIX

This changes some aspects of the build that are not relevant or useful
for Fuchsia like setting the RPATH/RUNPATH.

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

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

6 years ago[Sema] Do not match function type with const T in template argument deduction
Lei Liu [Thu, 3 May 2018 01:43:23 +0000 (01:43 +0000)]
[Sema] Do not match function type with const T in template argument deduction

From http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1584,
function type should not match cv-qualified type in template argument
deduction. This also matches what GCC and EDG do in template argument
deduction.

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

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

6 years ago[ObjC] Supress the 'implementing unavailable method' warning when
Alex Lorenz [Thu, 3 May 2018 01:12:06 +0000 (01:12 +0000)]
[ObjC] Supress the 'implementing unavailable method' warning when
the method declaration is unavailable for an app extension platform

Rationale:
Classes are often shared between an app extension code and
non-app extension code. There's no way to remove the implementation
using preprocessor when building the app extension, so we should not warn here.

rdar://38150617

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

6 years ago[gcov] Make the CLang side coverage test work with the new
Chandler Carruth [Wed, 2 May 2018 22:57:20 +0000 (22:57 +0000)]
[gcov] Make the CLang side coverage test work with the new
instrumentation codegeneration strategy of using a data structure and
a loop. Required some finesse to get the critical things being tested to
surface in a nice way for FileCheck but I think this preserves the
original intent of the test.

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

6 years ago[ObjC] The absence of ownership qualifiers on an ambiguous property leads
Alex Lorenz [Wed, 2 May 2018 22:40:19 +0000 (22:40 +0000)]
[ObjC] The absence of ownership qualifiers on an ambiguous property leads
to synthesis of a valid property even when the selected protocol property
has ownership qualifiers

rdar://39024725

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

6 years ago[analyzer] Revert r331096 "CStringChecker: Add support for BSD strlcpy()...".
Artem Dergachev [Wed, 2 May 2018 20:33:17 +0000 (20:33 +0000)]
[analyzer] Revert r331096 "CStringChecker: Add support for BSD strlcpy()...".

The return values of the newly supported functions were not handled correctly:
strlcpy()/strlcat() return string sizes rather than pointers.

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

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

6 years ago[X86] Mark all x86 specific builtins as nothrow.
Craig Topper [Wed, 2 May 2018 20:18:57 +0000 (20:18 +0000)]
[X86] Mark all x86 specific builtins as nothrow.

I believe all of the x86 builtins should be considered nothrow.

I've left the incssp builtins alone because I think its current attributes are wrong and I'm following up with the contributor for that.

I plan to start adding const as well, but that requires more careful auditing.

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

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