]> granicus.if.org Git - clang/log
clang
6 years agoNow that C++17 is official (https://www.iso.org/standard/68564.html), start changing...
Aaron Ballman [Mon, 4 Dec 2017 20:27:34 +0000 (20:27 +0000)]
Now that C++17 is official (https://www.iso.org/standard/68564.html), start changing the C++1z terminology over to C++17. NFC intended, these are all mechanical changes.

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

6 years agodesign document for a hardware-assisted memory safety (HWAMS) tool, similar to Addres...
Kostya Serebryany [Mon, 4 Dec 2017 20:01:38 +0000 (20:01 +0000)]
design document for a hardware-assisted memory safety (HWAMS) tool, similar to AddressSanitizer

Summary:
preliminary design document for a hardware-assisted memory safety (HWAMS) tool, similar to AddressSanitizer
The name TaggedAddressSanitizer and the rest of the document, are early draft, suggestions are welcome.

The code will follow shortly.

Reviewers: eugenis, alekseyshl

Reviewed By: eugenis

Subscribers: davidxl, cryptoad, fedor.sergeev, cfe-commits, llvm-commits

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

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

6 years agoChanging mixed CRLFs back to LFs; NFC.
Aaron Ballman [Mon, 4 Dec 2017 18:36:34 +0000 (18:36 +0000)]
Changing mixed CRLFs back to LFs; NFC.

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

6 years ago[OPENMP] Codegen for `distribute simd` directive.
Alexey Bataev [Mon, 4 Dec 2017 15:38:33 +0000 (15:38 +0000)]
[OPENMP] Codegen for `distribute simd` directive.

Initial codegen support for `distribute simd` directive.

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

6 years ago[OpenCL] Define __IMAGE_SUPPORT__ macro for SPIR
Sven van Haastregt [Mon, 4 Dec 2017 15:01:08 +0000 (15:01 +0000)]
[OpenCL] Define __IMAGE_SUPPORT__ macro for SPIR

Add #define __IMAGE_SUPPORT__ 1 for SPIR targets to indicate that SPIR
supports images.

Patch by Dmitry Borisenkov.

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

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

6 years agoFix bug where we wouldn't break columns over the limit.
Manuel Klimek [Mon, 4 Dec 2017 08:53:16 +0000 (08:53 +0000)]
Fix bug where we wouldn't break columns over the limit.

Before, we would not break:
  int a = foo(/* trailing */);
when the end of /* trailing */ was exactly the column limit; the reason
is that block comments can have an unbreakable tail length - in this case
2, for the trailing ");"; we would unconditionally account that when
calculating the column state at the end of the token, but not correctly
add it into the remaining column length before, as we do for string
literals.
The fix is to correctly account the trailing unbreakable sequence length
into our formatting decisions for block comments. Line comments cannot
have a trailing unbreakable sequence, so no change is needed for them.

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

6 years ago[analyzer] Don't treat lambda-captures float constexprs as undefined
Devin Coughlin [Mon, 4 Dec 2017 04:46:47 +0000 (04:46 +0000)]
[analyzer] Don't treat lambda-captures float constexprs as undefined

RegionStore has special logic to evaluate captured constexpr variables.
However, if the constexpr initializer cannot be evaluated as an integer, the
value is treated as undefined. This leads to false positives when, for example,
a constexpr float is captured by a lambda.

To fix this, treat a constexpr capture that cannot be evaluated as unknown
rather than undefined.

rdar://problem/35784662

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

6 years ago[ASTImporter] Add unit tests for UsingDecl and UsingShadowDecl
Aleksei Sidorin [Sun, 3 Dec 2017 16:04:07 +0000 (16:04 +0000)]
[ASTImporter] Add unit tests for UsingDecl and UsingShadowDecl

Patch by Kareem Khazem!

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

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

6 years agoRevert "[CodeGen] Add initial support for union members in TBAA"
Hal Finkel [Sun, 3 Dec 2017 03:10:13 +0000 (03:10 +0000)]
Revert "[CodeGen] Add initial support for union members in TBAA"

This reverts commit r319413. See PR35503.

We can't use "union member" as the access type here like this.

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

6 years ago[WebAssembly] Pass through --undefined to Wasm LLD
Sam Clegg [Sat, 2 Dec 2017 23:11:13 +0000 (23:11 +0000)]
[WebAssembly] Pass through --undefined to Wasm LLD

This is a follow-on to D40724 (Wasm entrypoint changes #1,
add `--undefined` argument to LLD).

Patch by Nicholas Wilson

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

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

6 years agoFix assume-filename handling in clang-format.el
Philipp Stephani [Sat, 2 Dec 2017 21:18:14 +0000 (21:18 +0000)]
Fix assume-filename handling in clang-format.el

Summary:
When 'buffer-file-name' is nil 'call-process-region' returned a segmentation fault error.

This was a problem when using clang-format-buffer on an orgmode source code editing buffer.

I fixed this problem by excluding the '-assume-filename' argument when 'buffer-file-name' is nil.

To make it a bit more flexible I also added an optional argument, 'assume-file-name', to specify an assume-filename that overrides 'buffer-file-name'.

Reviewers: klimek, djasper, phst, phi

Reviewed By: phst, phi

Subscribers: phi, jholewinski, mgorny, javed.absar, eraman, cfe-commits

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

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

6 years ago[CodeGen] fix mapping from fmod calls to frem instruction
Sanjay Patel [Sat, 2 Dec 2017 17:52:00 +0000 (17:52 +0000)]
[CodeGen] fix mapping from fmod calls to frem instruction

Similar to D40044 and discussed in D40594.

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

6 years ago[CodeGen] remove stale comment; NFC
Sanjay Patel [Sat, 2 Dec 2017 16:29:34 +0000 (16:29 +0000)]
[CodeGen] remove stale comment; NFC

The libm functions with LLVM intrinsic twins were moved above this blob with:
https://reviews.llvm.org/rL319593

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

6 years agoPR35456: Track definedness of variable template specializations separately from
Richard Smith [Sat, 2 Dec 2017 02:48:42 +0000 (02:48 +0000)]
PR35456: Track definedness of variable template specializations separately from
whether they have an initializer.

We cannot distinguish between a declaration of a variable template
specialization and a definition of one that lacks an initializer without this,
and would previously mistake the latter for the former.

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

6 years agoMove comment back to being next to the code it's a comment for.
Richard Smith [Sat, 2 Dec 2017 00:55:48 +0000 (00:55 +0000)]
Move comment back to being next to the code it's a comment for.

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

6 years ago[AST] Try to fix build bot with modules broken r319589. However real fix may belong...
Eugene Zelenko [Fri, 1 Dec 2017 23:23:28 +0000 (23:23 +0000)]
[AST] Try to fix build bot with modules broken r319589. However real fix may belong to other place.

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

6 years ago[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
Sanjay Patel [Fri, 1 Dec 2017 23:15:52 +0000 (23:15 +0000)]
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics

There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics

We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.

This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.

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

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Fri, 1 Dec 2017 22:04:49 +0000 (22:04 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[OPENMP] Emit `__tgt_target_teams` for all teams directives.
Alexey Bataev [Fri, 1 Dec 2017 21:31:08 +0000 (21:31 +0000)]
[OPENMP] Emit `__tgt_target_teams` for all teams directives.

Previously we emitted `__tgt_target_teams` only for standalone teams
directives. This patch allows emit this function for all teams-based
directives.

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

6 years ago[c++17] When deducing the type of a non-type template parameter from the type
Richard Smith [Fri, 1 Dec 2017 21:24:36 +0000 (21:24 +0000)]
[c++17] When deducing the type of a non-type template parameter from the type
of its argument, perform function-to-pointer and array-to-pointer decay on the
parameter type first.

Otherwise deduction will fail, as the type of the argument will be decayed.

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

6 years agoFix the second part of the broken comment from r306079
Adam Nemet [Fri, 1 Dec 2017 19:59:45 +0000 (19:59 +0000)]
Fix the second part of the broken comment from r306079

The driver-based test is still not identical to the front-end line, remove the
hotness threshold from there and add a new front-end based test with
threshold.

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

6 years agoFix opt-remark with hotness testcase for sample-based PGO
Adam Nemet [Fri, 1 Dec 2017 19:59:42 +0000 (19:59 +0000)]
Fix opt-remark with hotness testcase for sample-based PGO

1. Require hotness on all remark lines with -verify.

3. Fix the samplePGO file to actually produce hotness on each line.

The second remark has hotness 60 rather 30 which I don't quite understand but
testing this is strictly better than before.  It also unblocks the commit of
D40678.

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

6 years agoPartially fix comment in test broken in r306079 and r306948
Adam Nemet [Fri, 1 Dec 2017 19:59:37 +0000 (19:59 +0000)]
Partially fix comment in test broken in r306079 and r306948

A RUN line was referring to the previous RUN line but a new test was added in
between them.  Just reorder the lines.

Note this still does not completely fix this the brokenness of the comment as
the driver-based test gained a new hotness-threshold argument in r306948 but
I'll fix that is a separate commit.

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

6 years ago[OPENMP] Do not allow variables to be first|last-privates in
Alexey Bataev [Fri, 1 Dec 2017 17:40:15 +0000 (17:40 +0000)]
[OPENMP] Do not allow variables to be first|last-privates in
distribute directives.

OpenMP standard does not allow to mark the variables as firstprivate and lastprivate at the same time in distribute-based directives. Patch fixes this problem.

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

6 years agoDisallow a cleanup attribute from appertaining to a parameter (the attribute only...
Aaron Ballman [Fri, 1 Dec 2017 16:53:49 +0000 (16:53 +0000)]
Disallow a cleanup attribute from appertaining to a parameter (the attribute only appertains to local variables and is silently a noop on parameters). This repurposes the unused (and syntactically incorrect) NormalVar attribute subject.

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

6 years agoRemove duplicate, nonsense information from an attribute diagnostic. The NonParmVar...
Aaron Ballman [Fri, 1 Dec 2017 15:54:29 +0000 (15:54 +0000)]
Remove duplicate, nonsense information from an attribute diagnostic. The NonParmVar subject does not need to mention functions, and the resulting diagnostic definitely does not need to mention functions twice.

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

6 years agoBetter trade-off for excess characters vs. staying within the column limits.
Manuel Klimek [Fri, 1 Dec 2017 13:28:08 +0000 (13:28 +0000)]
Better trade-off for excess characters vs. staying within the column limits.

When we break a long line like:
Column limit: 21
                      |
  // foo foo foo foo foo foo foo foo foo foo foo foo

The local decision when to allow protruding vs. breaking can lead to this
outcome (2 excess characters, 2 breaks):
  // foo foo foo foo foo
  // foo foo foo foo foo
  // foo foo

While strictly staying within the column limit leads to this strictly better
outcome (fully below the column limit, 2 breaks):
  // foo foo foo foo
  // foo foo foo foo
  // foo foo foo foo

To get an optimal solution, we would need to consider all combinations of excess
characters vs. breaking for all lines, but that would lead to a significant
increase in the search space of the algorithm for little gain.

Instead, we blindly try both approches and·select the one that leads to the
overall lower penalty.

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

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

6 years ago[c++2a] P0515R3: Support for overloaded operator<=>.
Richard Smith [Fri, 1 Dec 2017 02:13:10 +0000 (02:13 +0000)]
[c++2a] P0515R3: Support for overloaded operator<=>.

No CodeGen support for MSABI yet, we don't know how to mangle this there.

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

6 years ago[c++2a] P0515R3: lexer support for new <=> token.
Richard Smith [Fri, 1 Dec 2017 01:07:10 +0000 (01:07 +0000)]
[c++2a] P0515R3: lexer support for new <=> token.

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

6 years agoMark all library options as hidden.
Zachary Turner [Fri, 1 Dec 2017 00:53:10 +0000 (00:53 +0000)]
Mark all library options as hidden.

These command line options are not intended for public use, and often
don't even make sense in the context of a particular tool anyway. About
90% of them are already hidden, but when people add new options they
forget to hide them, so if you were to make a brand new tool today, link
against one of LLVM's libraries, and run tool -help you would get a
bunch of junk that doesn't make sense for the tool you're writing.

This patch hides these options. The real solution is to not have
libraries defining command line options, but that's a much larger effort
and not something I'm prepared to take on.

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

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

6 years agoUpdate website to mention that you still need -frelaxed-template-template-args to...
Richard Smith [Thu, 30 Nov 2017 23:07:29 +0000 (23:07 +0000)]
Update website to mention that you still need -frelaxed-template-template-args to enable the corresponding C++17 feature in Clang 5.

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

6 years ago[clang] Use add_llvm_install_targets
Shoaib Meenai [Thu, 30 Nov 2017 22:35:02 +0000 (22:35 +0000)]
[clang] Use add_llvm_install_targets

Use this function to create the install targets rather than doing so
manually, which gains us the `-stripped` install targets to perform
stripped installations.

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

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Thu, 30 Nov 2017 22:33:48 +0000 (22:33 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[CUDA] Tweak CUDA wrappers to make cuda-9 work with libc++
Artem Belevich [Thu, 30 Nov 2017 22:22:21 +0000 (22:22 +0000)]
[CUDA] Tweak CUDA wrappers to make cuda-9 work with libc++

CUDA-9 headers check for specific libc++ version and ifdef out
some of the definitions we need if LIBCPP_VERSION >= 3800.

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

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

6 years ago[OpenMP] Diagnose undeclared variables on declare target clause
Kelvin Li [Thu, 30 Nov 2017 18:52:06 +0000 (18:52 +0000)]
[OpenMP] Diagnose undeclared variables on declare target clause

Clang asserts on undeclared variables on the to or link clause in the declare
target directive. The patch is to properly diagnose the error.

// foo1 and foo2 are not declared
#pragma omp declare target to(foo1)
#pragma omp declare target link(foo2)

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

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

6 years ago[OPENMP] Fix possible assert for target regions with incorrect inner
Alexey Bataev [Thu, 30 Nov 2017 18:01:54 +0000 (18:01 +0000)]
[OPENMP] Fix possible assert for target regions with incorrect inner
teams region.

If the inner teams region is not correct, it may cause an assertion when
processing outer target region. Patch fixes this problem.

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

6 years agoFix __has_unique_object_representations implementation
Erich Keane [Thu, 30 Nov 2017 16:37:02 +0000 (16:37 +0000)]
Fix __has_unique_object_representations implementation

As rsmith pointed out, the original implementation of this intrinsic
missed a number of important situations.  This patch fixe a bunch of
shortcomings and implementation details to make it work correctly.

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

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

6 years agoRevert [ARM] disable FPU features when using soft floating point.
Keith Walker [Thu, 30 Nov 2017 12:05:18 +0000 (12:05 +0000)]
Revert [ARM] disable FPU features when using soft floating point.

This reverts r319420
It is failing the test Driver/arm-mfpu.c so reverting while I investigate the failure.

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

6 years ago[ARM] disable FPU features when using soft floating point.
Keith Walker [Thu, 30 Nov 2017 11:38:56 +0000 (11:38 +0000)]
[ARM] disable FPU features when using soft floating point.

To be compatible with GCC if soft floating point is in effect any FPU
specified is effectively ignored, eg,

  -mfloat-abi=soft -fpu=neon

If any floating point features which require FPU hardware are enabled
they must be disable.

There was some support for doing this for NEON, but it did not handle
VFP, nor did it prevent the backend from emitting the build attribute
Tag_FP_arch describing the generated code as using the floating point
hardware if a FPU was specified (even though soft float does not use
the FPU).

Disabling the hardware floating point features for targets which are
compiling for soft float has meant that some tests which were incorrectly
checking for hardware support also needed to be updated. In such cases,
where appropriate the tests have been updated to check compiling for
soft float and a non-soft float variant (usually softfp). This was
usually because the target specified in the test defaulted to soft float.

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

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

6 years agoclang-format: [JS] do not wrap after async/await.
Martin Probst [Thu, 30 Nov 2017 10:25:17 +0000 (10:25 +0000)]
clang-format: [JS] do not wrap after async/await.

Summary:
Otherwise automatic semicolon insertion can trigger, i.e. wrapping
produces invalid syntax.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[CodeGen] Add initial support for union members in TBAA
Ivan A. Kosarev [Thu, 30 Nov 2017 09:26:39 +0000 (09:26 +0000)]
[CodeGen] Add initial support for union members in TBAA

The basic idea behind this patch is that since in strict aliasing
mode all accesses to union members require their outermost
enclosing union objects to be specified explicitly, then for a
couple given accesses to union members of the form

p->a.b.c...
q->x.y.z...

it is known they can only alias if both p and q point to the same
union type and offset ranges of members a.b.c... and x.y.z...
overlap. Note that the actual types of the members do not matter.

Specifically, in this patch we do the following:

* Make unions to be valid TBAA base access types. This enables
  generation of TBAA type descriptors for unions.

* Encode union types as structures with a single member of a
  special "union member" type. Currently we do not encode
  information about sizes of types, but conceptually such union
  members are considered to be of the size of the whole union.

* Encode accesses to direct and indirect union members, including
  member arrays, as accesses to these special members. All
  accesses to members of a union thus get the same offset, which
  is the offset of the union they are part of. This means the
  existing LLVM TBAA machinery is able to handle such accesses
  with no changes.

While this is already an improvement comparing to the current
situation, that is, representing all union accesses as may-alias
ones, there are further changes planned to complete the support
for unions. One of them is storing information about access sizes
so we can distinct accesses to non-overlapping union members,
including accesses to different elements of member arrays.
Another change is encoding type sizes in order to make it
possible to compute offsets within constant-indexed array
elements. These enhancements will be addressed with separate
patches.

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

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

6 years ago[analyzer] Fix false negative on post-increment of uninitialized variable.
Roman Lebedev [Thu, 30 Nov 2017 09:18:35 +0000 (09:18 +0000)]
[analyzer] Fix false negative on post-increment of uninitialized variable.

Summary:
Currently clang static analyzer does warn on:
```
int x;
x+=1;
x-=1;
x=x+1;
x=x-1;
```
But does warn on:
```
int x;
x++;
x--;
--x;
++x;
```

This differential should fix that.
Fixes https://bugs.llvm.org/show_bug.cgi?id=35419

Reviewers: dcoughlin, NoQ

Reviewed By: dcoughlin

Subscribers: NoQ, xazax.hun, szepet, cfe-commits, a.sidorin

Tags: #clang

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

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

6 years agoPreserve the "last diagnostic was suppressed" flag across SFINAE checks.
Richard Smith [Thu, 30 Nov 2017 08:18:21 +0000 (08:18 +0000)]
Preserve the "last diagnostic was suppressed" flag across SFINAE checks.

Sometimes we check the validity of some construct between producing a
diagnostic and producing its notes. Ideally, we wouldn't do that, but in
practice running code that "cannot possibly produce a diagnostic" in such a
situation should be safe, and reasonable factoring of some code requires it
with our current diagnostics infrastruture. If this does happen, a diagnostic
that's suppressed due to SFINAE should not cause notes connected to the prior
diagnostic to be suppressed.

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

6 years ago[XRay][clang] Introduce -fxray-always-emit-customevents
Dean Michael Berris [Thu, 30 Nov 2017 00:04:54 +0000 (00:04 +0000)]
[XRay][clang] Introduce -fxray-always-emit-customevents

Summary:
The -fxray-always-emit-customevents flag instructs clang to always emit
the LLVM IR for calls to the `__xray_customevent(...)` built-in
function. The default behaviour currently respects whether the function
has an `[[clang::xray_never_instrument]]` attribute, and thus not lower
the appropriate IR code for the custom event built-in.

This change allows users calling through to the
`__xray_customevent(...)` built-in to always see those calls lowered to
the corresponding LLVM IR to lay down instrumentation points for these
custom event calls.

Using this flag enables us to emit even just the user-provided custom
events even while never instrumenting the start/end of the function
where they appear. This is useful in cases where "phase markers" using
__xray_customevent(...) can have very few instructions, must never be
instrumented when entered/exited.

Reviewers: rnk, dblaikie, kpw

Subscribers: cfe-commits

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

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

6 years agoMS ABI: Treat explicit instantiation definitions of dllimport function templates...
Hans Wennborg [Wed, 29 Nov 2017 23:44:11 +0000 (23:44 +0000)]
MS ABI: Treat explicit instantiation definitions of dllimport function templates as explicit instantiation decls (PR35435)

This matches MSVC's behaviour, and we already do it for class templates
since r270897.

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

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 29 Nov 2017 23:27:36 +0000 (23:27 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoPerform a bounds check on a function's argument list before accessing any index value...
Aaron Ballman [Wed, 29 Nov 2017 23:10:14 +0000 (23:10 +0000)]
Perform a bounds check on a function's argument list before accessing any index value specified by an 'argument_with_type_tag' attribute. Fixes PR28520.

Patch by Matt Davis.

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

6 years ago[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Wed, 29 Nov 2017 22:39:22 +0000 (22:39 +0000)]
[AST] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[Coverage] Emit gap areas in braces-optional statements (PR35387)
Vedant Kumar [Wed, 29 Nov 2017 22:25:14 +0000 (22:25 +0000)]
[Coverage] Emit gap areas in braces-optional statements (PR35387)

Emit a gap area starting after the r-paren location and ending at the
start of the body for the braces-optional statements (for, for-each,
while, etc). The count for the gap area equal to the body's count. This
extends the fix in r317758.

Fixes PR35387, rdar://35570345

Testing: stage2 coverage-enabled build of clang, check-clang

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

6 years agoReformat switch statement added in r319297, NFC
Reid Kleckner [Wed, 29 Nov 2017 21:36:00 +0000 (21:36 +0000)]
Reformat switch statement added in r319297, NFC

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

6 years ago[EH] Use __CxxFrameHandler3 for C++ EH in MS environments
Reid Kleckner [Wed, 29 Nov 2017 21:35:34 +0000 (21:35 +0000)]
[EH] Use __CxxFrameHandler3 for C++ EH in MS environments

Fixes regression introduced by r319297. MSVC environments still use SEH
unwind opcodes but they should use the Microsoft C++ EH personality, not
the mingw one.

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

6 years ago[OPENMP] Allow only loop control variables in distribute simd
Alexey Bataev [Wed, 29 Nov 2017 21:31:48 +0000 (21:31 +0000)]
[OPENMP] Allow only loop control variables in distribute simd
directives.

According to the OpenMP standard, only loop control variables can be
used in linear clauses of distribute-based simd directives.

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

6 years agoAdd the hasDefinition() AST matcher to match class declarations that also have a...
Aaron Ballman [Wed, 29 Nov 2017 21:21:51 +0000 (21:21 +0000)]
Add the hasDefinition() AST matcher to match class declarations that also have a definition.

Patch by Julie Hockett.

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

6 years ago[SourceLocations] Use stronger sort predicate to remove non-deterministic ordering
Mandeep Singh Grang [Wed, 29 Nov 2017 20:55:13 +0000 (20:55 +0000)]
[SourceLocations] Use stronger sort predicate to remove non-deterministic ordering

Summary:
This fixes the following failure uncovered by D39245:
  Clang :: Index/getcursor-preamble.m

Reviewers: gbenyei, akyrtzi, bkramer, arphaman

Reviewed By: arphaman

Subscribers: arphaman, cfe-commits

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

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

6 years ago[clang-cl] Alias /wd4018 to -Wno-sign-compare
Reid Kleckner [Wed, 29 Nov 2017 18:45:03 +0000 (18:45 +0000)]
[clang-cl] Alias /wd4018 to -Wno-sign-compare

This warning is known to be noisy and projects frequently disable it. In
particular, this should make building isl as bundled in polly with
clang-cl a lot quieter.

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

6 years ago[analyzer] Fix unreachable creating PathDiagnosticLocation with widen-loops=true
Devin Coughlin [Wed, 29 Nov 2017 18:25:37 +0000 (18:25 +0000)]
[analyzer] Fix unreachable creating PathDiagnosticLocation with widen-loops=true

In the original design of the analyzer, it was assumed that a BlockEntrance
doesn't create a new binding on the Store, but this assumption isn't true when
'widen-loops' is set to true. Fix this by finding an appropriate location
BlockEntrace program points.

Patch by Henry Wong!

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

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

6 years ago[OPENMP] Do not allow `linear` clauses on non-simd distribute
Alexey Bataev [Wed, 29 Nov 2017 18:20:04 +0000 (18:20 +0000)]
[OPENMP] Do not allow `linear` clauses on non-simd distribute
directives.

`linear` clause is not allowed on non-simd distribute-based directives.

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

6 years ago[Driver] Turns out the GNU assembler does support falkor/saphira.
Chad Rosier [Wed, 29 Nov 2017 16:42:44 +0000 (16:42 +0000)]
[Driver] Turns out the GNU assembler does support falkor/saphira.

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

6 years agoFix function call to fix build
Ismail Donmez [Wed, 29 Nov 2017 15:18:02 +0000 (15:18 +0000)]
Fix function call to fix build

../tools/clang/lib/Driver/ToolChains/Cuda.cpp:80:18: error: reference to non-static member function must be called; did you mean to call it with no arguments?
    if (Distro(D.getVFS).IsDebian())
               ~~^~~~~~
                       ()

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

6 years ago[OPENMP] General improvement of handling of `teams distribute`
Alexey Bataev [Wed, 29 Nov 2017 15:14:16 +0000 (15:14 +0000)]
[OPENMP] General improvement of handling of `teams distribute`
directive, NFC.

Some general improvements in support of `teams distribute` directive.

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

6 years agoFollow up of r319317, add the missing header file
Sylvestre Ledru [Wed, 29 Nov 2017 15:11:53 +0000 (15:11 +0000)]
Follow up of r319317, add the missing header file

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

6 years agoFix 'control reaches end of non-void' warning by using llvm_unreachable.
Manuel Klimek [Wed, 29 Nov 2017 15:09:12 +0000 (15:09 +0000)]
Fix 'control reaches end of non-void' warning by using llvm_unreachable.

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

6 years agoAdd the nvidia-cuda-toolkit Debian package path to search path
Sylvestre Ledru [Wed, 29 Nov 2017 15:03:28 +0000 (15:03 +0000)]
Add the nvidia-cuda-toolkit  Debian package path to search path

Summary:
Reported here:
http://bugs.debian.org/882505

Patch by Andreas Beckmann

Reviewers: Hahnfeld, tra

Reviewed By: tra

Subscribers: jlebar, cfe-commits

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

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

6 years agoRestructure how we break tokens.
Manuel Klimek [Wed, 29 Nov 2017 14:29:43 +0000 (14:29 +0000)]
Restructure how we break tokens.

This fixes some bugs in the reflowing logic and splits out the concerns
of reflowing from BreakableToken.

Things to do after this patch:
- Refactor the breakProtrudingToken function possibly into a class, so we
  can split it up into methods that operate on the common state.
- Optimize whitespace compression when reflowing by using the next possible
  split point instead of the latest possible split point.
- Retry different strategies for reflowing (strictly staying below the
  column limit vs. allowing excess characters if possible).

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

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

6 years agoToolchain: Normalize dwarf, sjlj and seh eh
Martell Malone [Wed, 29 Nov 2017 07:25:12 +0000 (07:25 +0000)]
Toolchain: Normalize dwarf, sjlj and seh eh

This is a re-apply of r319294.

adds -fseh-exceptions and -fdwarf-exceptions flags

clang will check if the user has specified an exception model flag,
in the absense of specifying the exception model clang will then check
the driver default and append the model flag for that target to cc1

-fno-exceptions has a higher priority then specifying the model

move __SEH__ macro definitions out of Targets into InitPreprocessor
behind the -fseh-exceptions flag

move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into
InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check

remove unused USESEHExceptions from the MinGW Driver

fold USESjLjExceptions into a new GetExceptionModel function that
gives the toolchain classes more flexibility with eh models

Reviewers: rnk, mstorsjo

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

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

6 years agoRevert "Toolchain: Normalize dwarf, sjlj and seh eh"
Martell Malone [Wed, 29 Nov 2017 06:51:27 +0000 (06:51 +0000)]
Revert "Toolchain: Normalize dwarf, sjlj and seh eh"

This reverts rL319294.
The windows sanitizer does not like seh on x86.
Will re apply with None type for x86

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

6 years agoToolchain: Normalize dwarf, sjlj and seh eh
Martell Malone [Wed, 29 Nov 2017 06:25:13 +0000 (06:25 +0000)]
Toolchain: Normalize dwarf, sjlj and seh eh

adds -fseh-exceptions and -fdwarf-exceptions flags

clang will check if the user has specified an exception model flag,
in the absense of specifying the exception model clang will then check
the driver default and append the model flag for that target to cc1

clang cc1 assumes dwarf is the default if none is passed
and -fno-exceptions has a higher priority then specifying the model

move __SEH__ macro definitions out of Targets into InitPreprocessor
behind the -fseh-exceptions flag

move __ARM_DWARF_EH__ macrodefinitions out of verious targets and into
InitPreprocessor behind the -fdwarf-exceptions flag and arm|thumb check

remove unused USESEHExceptions from the MinGW Driver

fold USESjLjExceptions into a new GetExceptionModel function that
gives the toolchain classes more flexibility with eh models

Reviewers: rnk, mstorsjo

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

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

6 years agoUse static function instead of anonymous namespace
Serge Pavlov [Wed, 29 Nov 2017 05:10:11 +0000 (05:10 +0000)]
Use static function instead of anonymous namespace

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

6 years agoReland "Fix vtable not receiving hidden visibility when using push(visibility)"
Jake Ehrlich [Wed, 29 Nov 2017 00:54:20 +0000 (00:54 +0000)]
Reland "Fix vtable not receiving hidden visibility when using push(visibility)"

I had to reland this change in order to make the test work on windows

This change should resolve https://bugs.llvm.org/show_bug.cgi?id=35022

https://reviews.llvm.org/D39627

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

6 years ago[CMake] Support side-by-side checkouts in multi-stage build
Petr Hosek [Wed, 29 Nov 2017 00:34:46 +0000 (00:34 +0000)]
[CMake] Support side-by-side checkouts in multi-stage build

Passthrough LLVM_ENABLE_{PROJECTS,RUNTIMES} to followup stages to
support the side-by-side checkouts (aka monorepo layout).

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

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

6 years ago[CMake] Use LIST_SEPARATOR rather than escaping in ExternalProject_Add
Petr Hosek [Wed, 29 Nov 2017 00:23:10 +0000 (00:23 +0000)]
[CMake] Use LIST_SEPARATOR rather than escaping in ExternalProject_Add

Escaping ; in list arguments passed to ExternalProject_Add doesn't seem
to be working in newer versions of CMake (see
https://public.kitware.com/Bug/view.php?id=16137 for more details). Use
a custom LIST_SEPARATOR instead which is the officially supported way.

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

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

6 years ago[OPENMP] Generalize capturing of clauses expressions.
Alexey Bataev [Tue, 28 Nov 2017 21:11:44 +0000 (21:11 +0000)]
[OPENMP] Generalize capturing of clauses expressions.

The handling and capturing of the non-constant expressions of some of
the capturable clauses in combined directives is generalized.

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

6 years ago[OpenMP] Stable sort Privates to remove non-deterministic ordering
Mandeep Singh Grang [Tue, 28 Nov 2017 20:41:13 +0000 (20:41 +0000)]
[OpenMP] Stable sort Privates to remove non-deterministic ordering

Summary:
This fixes the following failures uncovered by D39245:
    Clang :: OpenMP/task_firstprivate_codegen.cpp
    Clang :: OpenMP/task_private_codegen.cpp
    Clang :: OpenMP/taskloop_firstprivate_codegen.cpp
    Clang :: OpenMP/taskloop_lastprivate_codegen.cpp
    Clang :: OpenMP/taskloop_private_codegen.cpp
    Clang :: OpenMP/taskloop_simd_firstprivate_codegen.cpp
    Clang :: OpenMP/taskloop_simd_lastprivate_codegen.cpp
    Clang :: OpenMP/taskloop_simd_private_codegen.cpp

Reviewers: rjmccall, ABataev, AndreyChurbanov

Reviewed By: rjmccall, ABataev

Subscribers: cfe-commits

Tags: #clang

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

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

6 years ago[CUDA] Report "unsupported VLA" errors only on device side.
Artem Belevich [Tue, 28 Nov 2017 18:51:42 +0000 (18:51 +0000)]
[CUDA] Report "unsupported VLA" errors only on device side.

This fixes erroneously reported CUDA compilation errors
in host-side code during device-side compilation.

I've also restricted OpenMP-specific checks to trigger only
if we're compiling with OpenMP enabled.

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

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

6 years ago[Target] Make a copy of TargetOptions feature list before sorting during CodeGen
Craig Topper [Tue, 28 Nov 2017 18:00:32 +0000 (18:00 +0000)]
[Target] Make a copy of TargetOptions feature list before sorting during CodeGen

Currently CodeGen is calling std::sort on the features vector in TargetOptions for every function, but I don't think CodeGen should be modifying TargetOptions.

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

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

6 years agoRefactor functions PrintTemplateArgumentList
Serge Pavlov [Tue, 28 Nov 2017 16:14:14 +0000 (16:14 +0000)]
Refactor functions PrintTemplateArgumentList

These functions were defined as static members of TemplateSpecializationType.
Now they are moved to namespace level. Previously there were different
implementations for lists containing TemplateArgument and TemplateArgumentLoc,
now these implementations share the same code.

This change is a result of refactoring patch D40508. NFC.

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

6 years ago[test] Fix a typo in a test comment. NFC.
Martin Storsjo [Tue, 28 Nov 2017 05:47:24 +0000 (05:47 +0000)]
[test] Fix a typo in a test comment. NFC.

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

6 years ago[WebAssembly] Add options for using the nontrapping-fptoint feature.
Dan Gohman [Tue, 28 Nov 2017 01:13:45 +0000 (01:13 +0000)]
[WebAssembly] Add options for using the nontrapping-fptoint feature.

This adds ways to control use of WebAssembly's new nontrapping-fptoint
feature.

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

6 years ago[clang-cl] Alias /Wall to -Weverything
Reid Kleckner [Mon, 27 Nov 2017 23:42:20 +0000 (23:42 +0000)]
[clang-cl] Alias /Wall to -Weverything

cl interprets this option to mean enable every supported warning, which
is what Clang's -Weverything flag does.

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

6 years ago[WebAssemby] Enable "-mthread-model single" by default, for now.
Dan Gohman [Mon, 27 Nov 2017 21:39:16 +0000 (21:39 +0000)]
[WebAssemby] Enable "-mthread-model single" by default, for now.

The WebAssembly standard does not yet have threads, and while it's in the
process of being standardized, it'll take some time for it to make it
through and be available in all popular implementations. With increasing
numbers of people using the LLVM wasm backend through LLVM directly rather
than through Emscripten, it's increasingly important to have friendly
defaults.

See also https://bugs.llvm.org/show_bug.cgi?id=35411

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

6 years ago[CMake][Fuchsia] Disable terminfo database in Fuchsia toolchain
Petr Hosek [Mon, 27 Nov 2017 20:29:13 +0000 (20:29 +0000)]
[CMake][Fuchsia] Disable terminfo database in Fuchsia toolchain

It's used to determine whether terminal supports colors, but within LLVM
it's only used in handful of places and in Clang it's only used in AST
dumper, otherwise Clang relies on the -fcolor-diagnostics flag which we
pass explicitly from our build system anyway. This eliminates one of the
shared libraries dependencies making the toolchain less reliant on the
host environment.

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

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

6 years ago[OPENMP] Codegen for `distribute parallel for simd` directive.
Alexey Bataev [Mon, 27 Nov 2017 19:38:58 +0000 (19:38 +0000)]
[OPENMP] Codegen for `distribute parallel for simd` directive.

Initial codegen for `#pragma omp distribute parallel for simd` directive
and its clauses.

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

6 years ago[OPENMP] Codegen for `distribute parallel for simd` directive.
Alexey Bataev [Mon, 27 Nov 2017 19:38:52 +0000 (19:38 +0000)]
[OPENMP] Codegen for `distribute parallel for simd` directive.

Added proper codegen for `distribute parallel for simd` directive.

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

6 years agoSwitch CPU names not recognized by GNU assembler
Pirama Arumuga Nainar [Mon, 27 Nov 2017 19:18:39 +0000 (19:18 +0000)]
Switch CPU names not recognized by GNU assembler

Summary:
Switch CPU names not recognized by GNU assembler to a close CPU that it
does recognize.  In this patch, kryo, falkor and saphira all get
replaced by cortex-a57 when invoking the assembler.  In addition, krait
was already being replaced by cortex-a15.

Reviewers: weimingz

Subscribers: srhines, cfe-commits

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

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

6 years ago[analyzer] pr34766: Fix a crash on explicit std::initializer_list constructor.
Artem Dergachev [Mon, 27 Nov 2017 17:37:09 +0000 (17:37 +0000)]
[analyzer] pr34766: Fix a crash on explicit std::initializer_list constructor.

We didn't support the following syntax:

  (std::initializer_list<int>){12}

which suddenly produces CompoundLiteralExpr that contains
CXXStdInitializerListExpr.

Lift the assertion and instead pass the value through CompoundLiteralExpr
transparently, as it doesn't add much.

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

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

6 years ago[analyzer] pr34404: Fix a crash on modeling pointers to indirect members.
Artem Dergachev [Mon, 27 Nov 2017 17:31:16 +0000 (17:31 +0000)]
[analyzer] pr34404: Fix a crash on modeling pointers to indirect members.

We were crashing whenever a C++ pointer-to-member was taken, that was pointing
to a member of an anonymous structure field within a class, eg.

  struct A {
    struct {
     int x;
    };
  };
  // ...
  &A::x;

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

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

6 years ago[clang] Set up .arcconfig to point to new Diffusion C repository
Ben Hamilton [Mon, 27 Nov 2017 17:21:24 +0000 (17:21 +0000)]
[clang] Set up .arcconfig to point to new Diffusion C repository

Summary:
We want to automatically copy cfe-commits@ on review requests
to the clang repository.

Similar to D40179, I set up a new Diffusion repository with callsign
"C" for clang:

https://reviews.llvm.org/source/clang/

This explicitly updates clang's .arcconfig to point to the new C
repository in Diffusion, which will let us use Herald rule H268.

Reviewers: klimek, sammccall

Reviewed By: klimek

Subscribers: dlj, bkramer

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

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

6 years ago[OPENMP] Improve handling of cancel directives in target-based
Alexey Bataev [Mon, 27 Nov 2017 16:54:08 +0000 (16:54 +0000)]
[OPENMP] Improve handling of cancel directives in target-based
constructs, NFC.

Improved handling of cancel|cancellation point directives inside
target-based for directives.

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

6 years agoConstify. NFC.
Vassil Vassilev [Mon, 27 Nov 2017 15:32:00 +0000 (15:32 +0000)]
Constify. NFC.

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

6 years ago[lit] Set shlibpath_var on Solaris
Fedor Sergeev [Mon, 27 Nov 2017 13:33:19 +0000 (13:33 +0000)]
[lit] Set shlibpath_var on Solaris

Summary:
During make check-all on Solaris, lit complains

llvm-lit: /vol/gcc/src/llvm/llvm/dist/tools/clang/test/Unit/lit.cfg.py:57: warning: unable to inject shared library path on 'SunOS'

The following patch avoids this: Solaris uses LD_LIBRARY_PATH like several other targets.

In theory, one could also handle LD_LIBRARY_PATH_{32,64} which take precedence over
LD_LIBRARY_PATH if set, but let's cross that bridge when we get there.

Patch by Rainer Orth.

Reviewers: rsmith, lichray
Reviewed By: lichray

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

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

6 years ago[clang-format] Add option to group multiple #include blocks when sorting includes
Krasimir Georgiev [Mon, 27 Nov 2017 13:23:45 +0000 (13:23 +0000)]
[clang-format] Add option to group multiple #include blocks when sorting includes

Summary:
This patch allows grouping multiple #include blocks together and sort all includes as one big block.
Additionally, sorted includes can be regrouped after sorting based on configured categories.

Contributed by @KrzysztofKapusta!

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits, klimek

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

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

6 years ago[ASTImporter] Support importing CXXPseudoDestructorExpr
Aleksei Sidorin [Mon, 27 Nov 2017 10:30:00 +0000 (10:30 +0000)]
[ASTImporter] Support importing CXXPseudoDestructorExpr

Patch by Peter Szecsi!

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

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

6 years ago[CodeGen] Collect information about sizes of accesses and access types for TBAA
Ivan A. Kosarev [Mon, 27 Nov 2017 09:39:29 +0000 (09:39 +0000)]
[CodeGen] Collect information about sizes of accesses and access types for TBAA

The information about access and type sizes is necessary for
producing TBAA metadata in the new size-aware format. With this
patch, D39955 and D39956 in place we should be able to change
CodeGenTBAA::createScalarTypeNode() and
CodeGenTBAA::getBaseTypeInfo() to generate metadata in the new
format under the -new-struct-path-tbaa command-line option. For
now, this new information remains unused.

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

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

6 years ago[OpenCL] Add extensions cl_intel_subgroups and cl_intel_subgroups_short
Alexey Sotkin [Mon, 27 Nov 2017 09:14:17 +0000 (09:14 +0000)]
[OpenCL] Add extensions cl_intel_subgroups and cl_intel_subgroups_short

Reviewers: yaxunl, Anastasia, bader

Reviewed By: Anastasia, bader

Subscribers: cfe-commits

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

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

6 years agoEnable additonal features in NetBSD
Kamil Rytarowski [Sun, 26 Nov 2017 22:24:22 +0000 (22:24 +0000)]
Enable additonal features in NetBSD

Summary:
Enable for x86_64:

 - ESan,
 - KASan,
 - MSan.

Enable for x86_64 and i386:

 - Scudo.

These features are under active development and in various level of completeness.

Sponsored by <The NetBSD Foundation>

Reviewers: dvyukov, joerg, vitalybuka, eugenis

Reviewed By: eugenis

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

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

6 years agoDetermine the attribute subject for diagnostics based on declarative information...
Aaron Ballman [Sun, 26 Nov 2017 20:01:12 +0000 (20:01 +0000)]
Determine the attribute subject for diagnostics based on declarative information in DeclNodes.td. This greatly reduces the number of enumerated values used for more complex diagnostics; these are now only required when the "attribute only applies to" diagnostic needs to be generated manually as part of semantic processing.

This also clarifies some terminology used by the diagnostic (methods -> Objective-C methods, fields -> non-static data members, etc).

Many of the tests needed to be updated in multiple places for the diagnostic wording tweaks. The first instance of the diagnostic for that attribute is fully specified and subsequent instances cut off the complete list (to make it easier if additional subjects are added in the future for the attribute).

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

6 years ago[ASTImporter] Support TypeTraitExpr
Aleksei Sidorin [Sun, 26 Nov 2017 17:04:06 +0000 (17:04 +0000)]
[ASTImporter] Support TypeTraitExpr

Patch by Takafumi Kubota!

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

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

6 years agoControl-Flow Enforcement Technology - Shadow Stack and Indirect Branch Tracking suppo...
Oren Ben Simhon [Sun, 26 Nov 2017 12:34:54 +0000 (12:34 +0000)]
Control-Flow Enforcement Technology - Shadow Stack and Indirect Branch Tracking support (Clang side)

Shadow stack solution introduces a new stack for return addresses only.
The stack has a Shadow Stack Pointer (SSP) that points to the last address to which we expect to return.
If we return to a different address an exception is triggered.
This patch includes shadow stack intrinsics as well as the corresponding CET header.
It includes CET clang flags for shadow stack and Indirect Branch Tracking.

For more information, please see the following:
https://software.intel.com/sites/default/files/managed/4d/2a/control-flow-enforcement-technology-preview.pdf

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

Change-Id: I79ad0925a028bbc94c8ecad75f6daa2f214171f1

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

6 years ago[X86] Use separate builtins for fma4 scalar intrinsics. Use negations to remove some...
Craig Topper [Sat, 25 Nov 2017 19:32:12 +0000 (19:32 +0000)]
[X86] Use separate builtins for fma4 scalar intrinsics. Use negations to remove some of the scalar fma3 builtins.

fma4 instructions zero the upper bits of the xmm register. fma3 instructions leave the bits unmodified. This requires separate builtins for the different semantics.

While we're cleaning up the scalar builtins this also removes the fma3 fmsub/fnmadd/fnmsub builtins by using negates in the header file.

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

6 years ago[analyzer] Teach RetainCountChecker about CoreMedia APIs
Devin Coughlin [Sat, 25 Nov 2017 14:57:42 +0000 (14:57 +0000)]
[analyzer] Teach RetainCountChecker about CoreMedia APIs

Teach the retain-count checker that CoreMedia reference types use
CoreFoundation-style reference counting. This enables the checker
to catch leaks and over releases of those types.

rdar://problem/33599757

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