]> granicus.if.org Git - clang/log
clang
5 years ago[clang-format][NFC] Fix BS_Allman style example in the header docs are generated...
Jan Korous [Wed, 5 Jun 2019 20:59:48 +0000 (20:59 +0000)]
[clang-format][NFC] Fix BS_Allman style example in the header docs are generated from

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

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

5 years ago[cmake] Remove duplicate TestingSupport library for linking
Pengxuan Zheng [Wed, 5 Jun 2019 19:44:08 +0000 (19:44 +0000)]
[cmake] Remove duplicate TestingSupport library for linking

Summary: This patch cleans up a duplicate use of TestingSupport library.

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] PathDiagnosticPopUpPiece: working with CharSourceRange
Csaba Dabis [Wed, 5 Jun 2019 18:55:39 +0000 (18:55 +0000)]
[analyzer] PathDiagnosticPopUpPiece: working with CharSourceRange

Summary: Sometimes we are at character boundaries so past the token-range.

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

5 years agoUse LTO capable linker
Chris Bieneman [Wed, 5 Jun 2019 17:35:38 +0000 (17:35 +0000)]
Use LTO capable linker

Summary:
In DistributionExample.cmake be sure we use a LTO
capable linker, the easiest to choose is lld.

Reviewers: beanz

Reviewed By: beanz

Patch By: winksaville

Subscribers: mgorny, mehdi_amini, inglorion, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[Clang] Fix pretty printing of CUDA address spaces
Anastasia Stulova [Wed, 5 Jun 2019 17:29:00 +0000 (17:29 +0000)]
[Clang] Fix pretty printing of CUDA address spaces

Patch by richardmembarth (Richard Membarth)!

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

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

5 years ago[OpenCL][PR42031] Prevent deducing addr space in type alias.
Anastasia Stulova [Wed, 5 Jun 2019 14:50:01 +0000 (14:50 +0000)]
[OpenCL][PR42031] Prevent deducing addr space in type alias.

Similar to typedefs we shouldn't deduce addr space in
type alias.

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

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

5 years agoAvoid using NoThrow Exception Specifier in non-C++ Modes.
Erich Keane [Wed, 5 Jun 2019 14:10:39 +0000 (14:10 +0000)]
Avoid using NoThrow Exception Specifier in non-C++ Modes.

As reported in https://bugs.llvm.org/show_bug.cgi?id=42113, there are a
number of locations in Clang where it is assumed that exception
specifications are only valid in C++ mode. Since the original
justification for the NoThrow Exception Specifier Type was C++ related,
this patch just makes C mode use the attribute-based nothrow handling.

Additionally, I noticed that the handling of non-prototype functions
regressed the behavior of the nothrow attribute, in part because it is
was listed in the function type macro(which I did in the previous
patch).  In reality, it should only be doing so in a conditional nature,
so this patch removes it there and puts it directly in the switch to be
handled correctly.

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

5 years ago[Sema] Prevent binding incompatible addr space ref to temporaries
Anastasia Stulova [Wed, 5 Jun 2019 14:03:34 +0000 (14:03 +0000)]
[Sema] Prevent binding incompatible addr space ref to temporaries

References to arbitrary address spaces can't always be bound to
temporaries. This change extends the reference binding logic to
check that the address space of a temporary can be implicitly
converted to the address space in a reference when temporary
materialization is performed.

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

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

5 years ago[ARM] Allow "-march=foo+fp" to vary with foo
Sjoerd Meijer [Wed, 5 Jun 2019 13:12:01 +0000 (13:12 +0000)]
[ARM] Allow "-march=foo+fp" to vary with foo

Now, when clang processes an argument of the form "-march=foo+x+y+z",
then instead of calling getArchExtFeature() for each of the extension
names "x", "y", "z" and appending the returned string to its list of
low-level subtarget features, it will call appendArchExtFeatures()
which does the appending itself.

The difference is that appendArchExtFeatures can add _more_ than one
low-level feature name to the output feature list if it has to, and
also, it gets told some information about what base architecture and
CPU the extension is going to go with, which means that "+fp" can now
mean something different for different CPUs. Namely, "+fp" now selects
whatever the _default_ FPU is for the selected CPU and/or
architecture, as defined in the ARM_ARCH or ARM_CPU_NAME macros in
ARMTargetParser.def.

On the clang side, I adjust DecodeARMFeatures to call the new
appendArchExtFeatures function in place of getArchExtFeature. This
means DecodeARMFeatures needs to be passed a CPU name and an ArchKind,
which meant changing its call sites to make those available, and also
sawing getLLVMArchSuffixForARM in half so that you can get an ArchKind
enum value out of it instead of a string.

Also, I add support here for the extension name "+fp.dp", which will
automatically look through the FPU list for something that looks just
like the default FPU except for also supporting double precision.

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

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

5 years agoRevert "Factor out duplicated code building a MemberExpr and marking it" and "Convert...
Benjamin Kramer [Wed, 5 Jun 2019 11:46:57 +0000 (11:46 +0000)]
Revert "Factor out duplicated code building a MemberExpr and marking it" and "Convert MemberExpr creation and serialization to work the same way as"

This reverts commits r362551 and r362563. Crashes during modules selfhost.

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

5 years ago[clang] [test] Add a (xfailing) test for PR41027
Michal Gorny [Wed, 5 Jun 2019 08:21:42 +0000 (08:21 +0000)]
[clang] [test] Add a (xfailing) test for PR41027

Add a test for tracking PR41027 (8.0 regression breaking assembly code
relying on __builtin_constant_p() to identify compile-time constants).
Mark it as expected to fail everywhere.

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

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

5 years ago[CMake][Fuchsia] Use libc++ ABIv2 for the first stage build
Petr Hosek [Wed, 5 Jun 2019 06:58:41 +0000 (06:58 +0000)]
[CMake][Fuchsia] Use libc++ ABIv2 for the first stage build

This also unifies flags between macOS and Linux builds.

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

5 years agoReduce memory consumption of coverage dumps
Serge Guelton [Wed, 5 Jun 2019 06:35:10 +0000 (06:35 +0000)]
Reduce memory consumption of coverage dumps

Avoiding an intermediate join operation removes the need for an
intermediate buffer that may be quite large, as showcased by

        https://bugs.llvm.org/show_bug.cgi?id=41965

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

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

5 years agoAdd __FILE_NAME__ to ReleaseNotes. NFC
Kristina Brooks [Wed, 5 Jun 2019 03:47:02 +0000 (03:47 +0000)]
Add __FILE_NAME__ to ReleaseNotes. NFC

Added it under C language changes as a nonstandard
extension for the time being.

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

5 years ago[Clang] Disable new PM for tests that use optimization level -O1, -O2 and -O3
Petr Hosek [Wed, 5 Jun 2019 03:17:11 +0000 (03:17 +0000)]
[Clang] Disable new PM for tests that use optimization level -O1, -O2 and -O3

Tests that use -O1, -O2 and -O3 would often produce different results
with the new pass manager which makes these tests fail. Disable new PM
explicitly for these tests.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Add the missing license header!
Artem Dergachev [Wed, 5 Jun 2019 02:09:49 +0000 (02:09 +0000)]
[analyzer] exploded-graph-rewriter: Add the missing license header!

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

5 years ago[analyzer] exploded-graph-rewriter: Pick up python from cmake in tests.
Artem Dergachev [Wed, 5 Jun 2019 02:09:29 +0000 (02:09 +0000)]
[analyzer] exploded-graph-rewriter: Pick up python from cmake in tests.

This should fix NetBSD buildbots.

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

5 years agoInitial support for vectorization using MASSV (IBM MASS vector library)
Nemanja Ivanovic [Wed, 5 Jun 2019 01:57:57 +0000 (01:57 +0000)]
Initial support for vectorization using MASSV (IBM MASS vector library)

Part 2 (the Clang portion) of D59881.

This patch (first of two patches) enables the vectorizer to recognize the
IBM MASS vector library routines. This patch specifically adds support for
recognizing the -vector-library=MASSV option, and defines mappings from IEEE
standard scalar math functions to generic PowerPC MASS vector counterparts.
For instance, the generic PowerPC MASS vector entry for double-precision
cbrt function is __cbrtd2_massv.

The second patch will further lower the generic PowerPC vector entries to
PowerPC subtarget-specific entries.
For instance, the PowerPC generic entry cbrtd2_massv is lowered to
cbrtd2_P9 for Power9 subtarget.

The overall support for MASS vector library is presented as such in two patches
for ease of review.

Patch by Jeeva Paudel.

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

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

5 years agoFactor out duplicated code building a MemberExpr and marking it
Richard Smith [Wed, 5 Jun 2019 00:21:47 +0000 (00:21 +0000)]
Factor out duplicated code building a MemberExpr and marking it
referenced.

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

5 years agoPR42111: Use guarded initialization for thread-local variables with
Richard Smith [Wed, 5 Jun 2019 00:04:33 +0000 (00:04 +0000)]
PR42111: Use guarded initialization for thread-local variables with
unordered initialization and internal linkage.

We'll run their initializers once on each reference, so we need a guard
variable even though they only have a single definition.

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

5 years agomsabi: Fix exponential mangling time for even more contrived inputs
Nico Weber [Tue, 4 Jun 2019 23:27:40 +0000 (23:27 +0000)]
msabi: Fix exponential mangling time for even more contrived inputs

This is a follow-up to r362293 which fixed exponential time needed
for mangling certain templates. This fixes the same issue if that
template pattern happens in template arguments > 10: The first
ten template arguments can use back references, and r362293 added
caching for back references. For latter arguments, we have to add
a cache for the mangling itself instead.

Fixes PR42091 even more.

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

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

5 years ago[Analysis] Only build Analysis plugins when CLANG_ENABLE_STATIC_ANALYZER is enabled.
Don Hinton [Tue, 4 Jun 2019 22:07:40 +0000 (22:07 +0000)]
[Analysis] Only build Analysis plugins when CLANG_ENABLE_STATIC_ANALYZER is enabled.

Fixes bug introduced in r362328.

Thanks to Nathan Chancellor for reporting this!

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

5 years agoConvert MemberExpr creation and serialization to work the same way as
Richard Smith [Tue, 4 Jun 2019 21:29:28 +0000 (21:29 +0000)]
Convert MemberExpr creation and serialization to work the same way as
most / all other Expr subclasses.

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

5 years agoIntroduce Value::stripPointerCastsSameRepresentation
Johannes Doerfert [Tue, 4 Jun 2019 20:21:46 +0000 (20:21 +0000)]
Introduce Value::stripPointerCastsSameRepresentation

This patch allows current users of Value::stripPointerCasts() to force
the result of the function to have the same representation as the value
it was called on. This is useful in various cases, e.g., (non-)null
checks.

In this patch only a single call site was adjusted to fix an existing
misuse that would cause nonnull where they may be wrong. Uses in
attribute deduction and other areas, e.g., D60047, are to be expected.

For a discussion on this topic, please see [0].

[0] http://lists.llvm.org/pipermail/llvm-dev/2018-December/128423.html

Reviewers: hfinkel, arsenm, reames

Subscribers: wdng, hiraditya, bollu, llvm-commits

Tags: #llvm

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

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

5 years agoFactor out repeated code to build a DeclRefExpr and mark it referenced.
Richard Smith [Tue, 4 Jun 2019 18:30:46 +0000 (18:30 +0000)]
Factor out repeated code to build a DeclRefExpr and mark it referenced.

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

5 years agoPR42104: Support instantiations of lambdas that implicitly capture
Richard Smith [Tue, 4 Jun 2019 17:17:20 +0000 (17:17 +0000)]
PR42104: Support instantiations of lambdas that implicitly capture
packs.

Two changes:
 * Track odr-use via FunctionParmPackExprs to properly handle dependent
   odr-uses of packs in generic lambdas.
 * Do not instantiate implicit captures; instead, regenerate them by
   instantiating the body of the lambda. This is necessary to
   distinguish between cases where only one element of a pack is
   captured and cases where the entire pack is captured.

This reinstates r362358 (reverted in r362375) with a fix for an
uninitialized variable use in UpdateMarkingForLValueToRValue.

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

5 years ago[Syntax] Do not depend on llvm targets for Syntax tests. NFC
Ilya Biryukov [Tue, 4 Jun 2019 17:15:48 +0000 (17:15 +0000)]
[Syntax] Do not depend on llvm targets for Syntax tests. NFC

They are not required and only slow down the build.

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

5 years ago[CodeGen][ObjC] Convert '[self alloc]' in a class method to a call to
Akira Hatanaka [Tue, 4 Jun 2019 16:29:58 +0000 (16:29 +0000)]
[CodeGen][ObjC] Convert '[self alloc]' in a class method to a call to
'objc_alloc(self)'

Also convert '[[self alloc] init]' in a class method to a call to
'objc_alloc_init(self)'.

rdar://problem/50855121

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

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

5 years ago[CodeComplete] Include more text into typed chunks of pattern completions
Ilya Biryukov [Tue, 4 Jun 2019 09:26:08 +0000 (09:26 +0000)]
[CodeComplete] Include more text into typed chunks of pattern completions

Summary:
To allow filtering on any of the words in the editors.
In particular, the following completions were changed:
    - 'using namespace <#name#>'
      Typed text before: 'using', after: 'using namespace'.
    - 'else if (#<condition#>)'
      Before: 'else', after: 'else if'.
    - 'using typename <#qualifier#>::<#name#>'
      Before: 'using', after: 'using typename'.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAdd a release note entry for the change made in r362034.
Akira Hatanaka [Mon, 3 Jun 2019 23:48:14 +0000 (23:48 +0000)]
Add a release note entry for the change made in r362034.

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

5 years agoFix windows build for commit r362459
Alex Lorenz [Mon, 3 Jun 2019 23:17:21 +0000 (23:17 +0000)]
Fix windows build for commit r362459

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

5 years agoRemove test/CodeGen/builtin-stackaddress.c as it duplicates
Eric Christopher [Mon, 3 Jun 2019 23:16:06 +0000 (23:16 +0000)]
Remove test/CodeGen/builtin-stackaddress.c as it duplicates
test/CodeGen/2004-02-13-BuiltinFrameReturnAddress.c.

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

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

5 years agoAdd clang source minimizer that reduces source to directives
Alex Lorenz [Mon, 3 Jun 2019 22:59:17 +0000 (22:59 +0000)]
Add clang source minimizer that reduces source to directives
that might affect the dependency list for a compilation

This commit introduces a dependency directives source minimizer to clang
that minimizes header and source files to the minimum necessary preprocessor
directives for evaluating includes. It reduces the source down to #define, #include,

The source minimizer works by lexing the input with a custom fast lexer that recognizes
the preprocessor directives it cares about, and emitting those directives in the minimized source.
It ignores source code, comments, and normalizes whitespace. It gives up and fails if seems
any directives that it doesn't recognize as valid (e.g. #define 0).

In addition to the source minimizer this patch adds a
-print-dependency-directives-minimized-source CC1 option that allows you to invoke the minimizer
from clang directly.

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

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

5 years agoFix test failure from r362435
Erich Keane [Mon, 3 Jun 2019 19:57:52 +0000 (19:57 +0000)]
Fix test failure from r362435

Apparently I forgot to do an open brace in a namespace, so we get an
error about an extra closing brace.

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

5 years agoMake NoThrow FunctionLike, make FunctionLike include references, fix
Erich Keane [Mon, 3 Jun 2019 18:36:33 +0000 (18:36 +0000)]
Make NoThrow FunctionLike, make FunctionLike include references, fix
prettyprint

__declspec(nothrow) should work on function pointers as well as function
references, so this changes it to FunctionLike.  Additionally,
FunctionLike needed to be modified to permit function references.

Finally, the TypePrinter didn't properly print the NoThrow exception
specifier, so make sure we get that right as well.

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

5 years agoPermit Exception Spec mismatch with NoThrow on inherited Virtual
Erich Keane [Mon, 3 Jun 2019 18:36:26 +0000 (18:36 +0000)]
Permit Exception Spec mismatch with NoThrow on inherited Virtual

As reported here: https://bugs.llvm.org/show_bug.cgi?id=42100

This fairly common pattern ends up being an error in MinGW, so relax it
in all cases to a warning.

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

5 years agoRe-check in clang support gun asm goto after fixing tests.
Jennifer Yu [Mon, 3 Jun 2019 15:57:25 +0000 (15:57 +0000)]
Re-check in clang support gun asm goto after fixing tests.

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

5 years ago[PR41567][Sema] Fixed cast kind in addr space conversions
Anastasia Stulova [Mon, 3 Jun 2019 15:42:36 +0000 (15:42 +0000)]
[PR41567][Sema] Fixed cast kind in addr space conversions

This change sets missing cast kind correctly in the address
space conversion case.

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

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

5 years ago[OpenCL] Undefine cl_intel_planar_yuv extension
Andrew Savonichev [Mon, 3 Jun 2019 13:02:43 +0000 (13:02 +0000)]
[OpenCL] Undefine cl_intel_planar_yuv extension

Summary:

Remove unnecessary definition (otherwise the extension will be defined
where it's not supposed to be defined).

Consider the code:

  #pragma OPENCL EXTENSION cl_intel_planar_yuv : begin
  // some declarations
  #pragma OPENCL EXTENSION cl_intel_planar_yuv : end

is enough for extension to become known for clang.

Patch by: Dmitry Sidorov <dmitry.sidorov@intel.com>

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Tags: #clang

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

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

5 years ago[OpenCL] Use long instead of long long in x86 builtins
Andrew Savonichev [Mon, 3 Jun 2019 12:34:59 +0000 (12:34 +0000)]
[OpenCL] Use long instead of long long in x86 builtins

Summary: According to C99 standard long long is at least 64 bits in
size. However, OpenCL C defines long long as 128 bit signed
integer. This prevents one to use x86 builtins when compiling OpenCL C
code for x86 targets. The patch changes long long to long for OpenCL
only.

Patch by: Alexander Batashev <alexander.batashev@intel.com>

Reviewers: craig.topper, Ka-Ka, eandrews, erichkeane, Anastasia

Reviewed By: Ka-Ka, erichkeane, Anastasia

Subscribers: a.elovikov, yaxunl, Anastasia, cfe-commits, ivankara, etyurin, asavonic

Tags: #clang

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

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

5 years ago[ARM] Fix recent breakage of -mfpu=none.
Simon Tatham [Mon, 3 Jun 2019 11:02:53 +0000 (11:02 +0000)]
[ARM] Fix recent breakage of -mfpu=none.

The recent change D60691 introduced a bug in clang when handling
option combinations such as `-mcpu=cortex-m4 -mfpu=none`. Those
options together should select Cortex-M4 but disable all use of
hardware FP, but in fact, now hardware FP instructions can still be
generated in that mode.

The reason is because the handling of FPUVersion::NONE disables all
the same feature names it used to, of which the base one is `vfp2`.
But now there are further features below that, like `vfp2d16fp` and
(following D60694) `fpregs`, which also need to be turned off to
disable hardware FP completely.

Added a tiny test which double-checks that compiling a simple FP
function doesn't access the FP registers.

Reviewers: SjoerdMeijer, dmgreen

Reviewed By: dmgreen

Subscribers: lebedev.ri, javed.absar, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoFix compilation warning about unused variable [NFC]
Mikael Holmen [Mon, 3 Jun 2019 10:50:41 +0000 (10:50 +0000)]
Fix compilation warning about unused variable [NFC]

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

5 years agoRevert rL362358 : PR42104: Support instantiations of lambdas that implicitly capture...
Simon Pilgrim [Mon, 3 Jun 2019 09:56:09 +0000 (09:56 +0000)]
Revert rL362358 : PR42104: Support instantiations of lambdas that implicitly capture packs.

Two changes:
 * Track odr-use via FunctionParmPackExprs to properly handle dependent
   odr-uses of packs in generic lambdas.
 * Do not instantiate implicit captures; instead, regenerate them by
   instantiating the body of the lambda. This is necessary to
   distinguish between cases where only one element of a pack is
   captured and cases where the entire pack is captured.
........
Fixes http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win buildbot failures

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

5 years ago[OpenCL] Declare builtin functions using TableGen
Sven van Haastregt [Mon, 3 Jun 2019 09:39:11 +0000 (09:39 +0000)]
[OpenCL] Declare builtin functions using TableGen

This patch adds a `-fdeclare-opencl-builtins` command line option to
the clang frontend.  This enables clang to verify OpenCL C builtin
function declarations using a fast StringMatcher lookup, instead of
including the opencl-c.h file with the `-finclude-default-header`
option.  This avoids the large parse time penalty of the header file.

This commit only adds the basic infrastructure and some of the OpenCL
builtins.  It does not cover all builtins defined by the various OpenCL
specifications.  As such, it is not a replacement for
`-finclude-default-header` yet.

RFC: http://lists.llvm.org/pipermail/cfe-dev/2018-November/060041.html

Co-authored-by: Pierre Gondois
Co-authored-by: Joey Gouly
Co-authored-by: Sven van Haastregt
Differential Revision: https://reviews.llvm.org/D60763

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

5 years ago[CodeComplete] Add a bit more whitespace to completed patterns
Ilya Biryukov [Mon, 3 Jun 2019 08:34:25 +0000 (08:34 +0000)]
[CodeComplete] Add a bit more whitespace to completed patterns

Summary:
E.g. we now turn `while(<#cond#>){` into `while (<#cond#>) {`

This slightly improves the final output. Should not affect clients that
format the result on their own.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years agoPR42104: Support instantiations of lambdas that implicitly capture
Richard Smith [Mon, 3 Jun 2019 06:02:10 +0000 (06:02 +0000)]
PR42104: Support instantiations of lambdas that implicitly capture
packs.

Two changes:
 * Track odr-use via FunctionParmPackExprs to properly handle dependent
   odr-uses of packs in generic lambdas.
 * Do not instantiate implicit captures; instead, regenerate them by
   instantiating the body of the lambda. This is necessary to
   distinguish between cases where only one element of a pack is
   captured and cases where the entire pack is captured.

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

5 years ago[coroutines][PR41909] Don't build dependent coroutine statements for generic lambda
Brian Gesiak [Mon, 3 Jun 2019 00:47:32 +0000 (00:47 +0000)]
[coroutines][PR41909] Don't build dependent coroutine statements for generic lambda

Summary:
https://bugs.llvm.org/show_bug.cgi?id=41909 describes an issue in which
a generic lambda that takes a dependent argument `auto set` causes the
template instantiation machinery for coroutine body statements to crash
with an ICE. The issue is two-fold:

1. The paths taken by the template instantiator contain several asserts
   that the coroutine promise must not have a dependent type.
2. The template instantiator unconditionally builds corotuine statements
   that depend on the promise type, which cannot be dependent.

To work around the issue, prevent the template instantiator from building
dependent coroutine statements if the coroutine promise type is dependent.
Since we only expect this to occur in the case of a generic lambda, limit
the workaround behavior to just that case.

Reviewers: GorNishanov, EricWF, lewissbaker, tks2103

Reviewed By: GorNishanov

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRevert "[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots."
Artem Dergachev [Mon, 3 Jun 2019 00:21:00 +0000 (00:21 +0000)]
Revert "[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots."

This reverts commit r362343.

Instead, disable tests on Windows for now.

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

5 years ago[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots.
Artem Dergachev [Sun, 2 Jun 2019 23:17:56 +0000 (23:17 +0000)]
[analyzer] exploded-graph-rewriter: An attempt to fix Windows buildbots.

Breakage caused by r362340.

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

5 years ago[analyzer] exploded-graph-rewriter: Initial commit.
Artem Dergachev [Sun, 2 Jun 2019 21:40:53 +0000 (21:40 +0000)]
[analyzer] exploded-graph-rewriter: Initial commit.

This is a utility to improve readability and generally manipulate
GraphViz dumps of the analysis graph. Such dumps are often huge and
not only hard to read, but also often hang the viewer apps with their
mere size. Such script should significantly improve debugging experience.

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

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

5 years agoTransform lambda expression captures when transforming an expression to
Richard Smith [Sun, 2 Jun 2019 18:53:44 +0000 (18:53 +0000)]
Transform lambda expression captures when transforming an expression to
potentially-evaluated.

This ensures that every potentially-evaluated expression is built in a
potentially-evaluated context. No functionality change intended.

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

5 years agoFix bug in r362328 -- append to dependency list instead of overwrite it.
Don Hinton [Sun, 2 Jun 2019 17:56:26 +0000 (17:56 +0000)]
Fix bug in r362328 -- append to dependency list instead of overwrite it.

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

5 years agoAdd mangling test coverage for non-volatile const member pointers
Nico Weber [Sun, 2 Jun 2019 17:23:53 +0000 (17:23 +0000)]
Add mangling test coverage for non-volatile const member pointers

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

5 years agoAdd test coverage for __pascal mangling
Nico Weber [Sun, 2 Jun 2019 16:47:07 +0000 (16:47 +0000)]
Add test coverage for __pascal mangling

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

5 years ago[test] Fix plugin tests
Don Hinton [Sun, 2 Jun 2019 15:53:43 +0000 (15:53 +0000)]
[test] Fix plugin tests

Recommit of r361790 that was temporarily reverted in r361793 due to bot breakage.

Summary:
The following changes were required to fix these tests:

1) Change LLVM_ENABLE_PLUGINS to an option and move it to
   llvm/CMakeLists.txt with an appropriate default -- which matches
   the original default behavior.

2) Move the plugins directory from clang/test/Analysis
   clang/lib/Analysis.  It's not enough to add an exclude to the
   lit.local.cfg file because add_lit_testsuites recurses the tree and
   automatically adds the appropriate `check-` targets, which don't
   make sense for the plugins because they aren't tests and don't
   have `RUN` statements.

   Here's a list of the `clang-check-anlysis*` targets with this
   change:

```
  $ ninja -t targets all| sed -n "s/.*\/\(check[^:]*\):.*/\1/p" | sort -u | grep clang-analysis
  check-clang-analysis
  check-clang-analysis-checkers
  check-clang-analysis-copypaste
  check-clang-analysis-diagnostics
  check-clang-analysis-engine
  check-clang-analysis-exploration_order
  check-clang-analysis-html_diagnostics
  check-clang-analysis-html_diagnostics-relevant_lines
  check-clang-analysis-inlining
  check-clang-analysis-objc
  check-clang-analysis-unified-sources
  check-clang-analysis-z3
```

3) Simplify the logic and only include the subdirectories under
   clang/lib/Analysis/plugins if LLVM_ENABLE_PLUGINS is set.

Reviewed By: NoQ

Tags: #clang, #llvm

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

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

5 years agoFactor out commonality between variable capture initialization and
Richard Smith [Sun, 2 Jun 2019 04:00:43 +0000 (04:00 +0000)]
Factor out commonality between variable capture initialization and
'this' capture initialization.

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

5 years agoAdd script to update OpenMP -ast-dump test expectations, and use it to
Richard Smith [Sun, 2 Jun 2019 04:00:38 +0000 (04:00 +0000)]
Add script to update OpenMP -ast-dump test expectations, and use it to
regenerate the test expectations.

(Only two tests change, as a result of no longer matching the 0x in a
pointer; the other tests were already excluding that.)

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

5 years agomsabi: Fix exponential mangling time for certain pathological inputs
Nico Weber [Sat, 1 Jun 2019 10:12:07 +0000 (10:12 +0000)]
msabi: Fix exponential mangling time for certain pathological inputs

Template back references used to be recursively recomputed, add a
memoization cache to cut down on this.

Since there are now two different types of argument maps, rename the
existing TypeBackReferences to FunArgBackReferences, and rename
mangleArgumentType() to mangleFunctionArgumentType().

Fixes PR42091, the input there now takes 50ms instead of 7s to compile.

No intended behavior change.

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

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

5 years agoClarify when fix-it hints on warnings are appropriate
Aaron Puchert [Fri, 31 May 2019 21:27:39 +0000 (21:27 +0000)]
Clarify when fix-it hints on warnings are appropriate

Summary:
This is not a change in the rules, it's meant as a clarification about
warnings. Since the recovery from warnings is a no-op, the fix-it hints
on warnings shouldn't change anything. Anything that doesn't just
suppress the warning and changes the meaning of the code (even if it's
for the better) should be on an additional note.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits, thakis

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: ExplodedNode revision
Csaba Dabis [Fri, 31 May 2019 17:54:12 +0000 (17:54 +0000)]
[analyzer] print() JSONify: ExplodedNode revision

Summary: Revert node-ID removal.

Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp,
             cfe-commits

Tags: #clang

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

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

5 years agoReplace 'default' in an enum-over-a-switch with the missing list.
Erich Keane [Fri, 31 May 2019 17:00:48 +0000 (17:00 +0000)]
Replace 'default' in an enum-over-a-switch with the missing list.

This suppressed the Wswitch warning causing me to miss it and write an
assertion failure.

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

5 years agoSuppress nothrow/Exception spec conflict warning when we dont know the ES.
Erich Keane [Fri, 31 May 2019 16:46:38 +0000 (16:46 +0000)]
Suppress nothrow/Exception spec conflict warning when we dont know the ES.

In any situation where the Exception Spec isn't clear, suppress the
warning to avoid false positives.

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

5 years agoSuppress nothrow/exception spec conflict warning when ES is parsed.
Erich Keane [Fri, 31 May 2019 15:56:27 +0000 (15:56 +0000)]
Suppress nothrow/exception spec conflict warning when ES is parsed.

The previously added warning ended up causing false positives when
nothrow was used on member functions, where the exception specification
wasn't yet parsed.  So, throw() and noexcept(true) both were incorrectly
warning.  There doesn't seem to be a good way to force these to be parsed
to identify which they are (and likely should not be), so suppress the warning.

For now, unevaluated/uninstantiated are left as warnings as I am not
creative enough to find a reproducer that causes a false positive for
either.

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

5 years agoRevise test case due to the change from CUDA 10+.
Michael Liao [Fri, 31 May 2019 15:29:55 +0000 (15:29 +0000)]
Revise test case due to the change from CUDA 10+.

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

5 years agoFix for PR42089, regression from r362119
Erich Keane [Fri, 31 May 2019 14:26:19 +0000 (14:26 +0000)]
Fix for PR42089, regression from r362119

The implementation of the NoThrow ExceptionSpecificationType missed a
switch statement for forming the diagnostic when an out-of-line member
redeclaration misses the exception specification.  This patch adds the
correct case statement.

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

5 years ago[X86] Add VP2INTERSECT instructions
Pengfei Wang [Fri, 31 May 2019 06:09:35 +0000 (06:09 +0000)]
[X86] Add VP2INTERSECT instructions

Support intel AVX512 VP2INTERSECT instructions in clang

Patch by Xiang Zhang (xiangzhangllvm)

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

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

5 years agore-commit r361928: [PowerPC] [Clang] Port SSE intrinsics to PowerPC
Zi Xuan Wu [Fri, 31 May 2019 04:42:13 +0000 (04:42 +0000)]
re-commit r361928: [PowerPC] [Clang] Port SSE intrinsics to PowerPC

Port xmmintrin.h which include Intel SSE intrinsics implementation to PowerPC platform (using Altivec).

The new headers containing those implemenations are located into a directory named ppc_wrappers
which has higher priority when the platform is PowerPC on Linux. They are mainly developed by Steven Munroe,
with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu.

Patched by: Qiu Chaofan <qiucf@cn.ibm.com>
Reviewed By: Jinsong Ji

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

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

5 years agoRedirect test output to /dev/null
Richard Trieu [Fri, 31 May 2019 02:23:33 +0000 (02:23 +0000)]
Redirect test output to /dev/null

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

5 years agoRevert "[X86] Fix i386 struct and union parameter alignment"
Pengfei Wang [Fri, 31 May 2019 01:50:07 +0000 (01:50 +0000)]
Revert "[X86] Fix i386 struct and union parameter alignment"

This reverts commit d61cb749f4ac2c90244906d756e80a5c4a7ffa89 (SVN:
361934).

According to James suggestion, revert this change. Please ref:
https://reviews.llvm.org/D60748

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

5 years ago[CMake] Provide an option to use relative paths in debug info
Petr Hosek [Fri, 31 May 2019 01:34:51 +0000 (01:34 +0000)]
[CMake] Provide an option to use relative paths in debug info

CMake always uses absolute file paths in the generated compiler
invocation which results in absolute file paths being embedded in debug
info. This is undesirable when building a toolchain e.g. on bots as the
debug info may embed the bot source checkout path which is meaningless
anywhere else.

This change introduces the LLVM_USE_RELATIVE_PATHS_IN_DEBUG_INFO which uses
-fdebug-prefix-map (where supported) options to rewrite paths embedded
into debug info with relative ones. Additionally, LLVM_SOURCE_PREFIX can
be used to override the path to source directory with a different one.

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

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

5 years agoPR39728: When completing a class, complete the destructor first.
Richard Smith [Fri, 31 May 2019 01:25:16 +0000 (01:25 +0000)]
PR39728: When completing a class, complete the destructor first.

We need to know whether the destructor is trivial in order to tell
whether other parts of the class are valid (in particular, this affects
whether the type is a literal type, which affects whether defaulted
special members can be declared constexpr or are implicitly constexpr).

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

5 years agoFix the predefined exponent limit macros for the 16-bit IEEE format.
John McCall [Fri, 31 May 2019 01:21:36 +0000 (01:21 +0000)]
Fix the predefined exponent limit macros for the 16-bit IEEE format.

The magnitude range of normalized _Float16 is 2^-14 (~6e-5) to
(2-2^-10)*2^15 (65504).  You might think, then, that the code is
correct to defne FLT16_MIN_EXP and FLT16_MAX_EXP to be -14 and 15
respectively.  However, for some reason the C specification actually
specifies a bias for these macros:

C11 5.2.4.2.2:

  - minimum negative integer such that FLT_RADIX raised to one less than
    that power is a normalized floating-point number, e_min:
      FLT_MIN_EXP
      DBL_MIN_EXP
      LDBL_MIN_EXP

  - maximum integer such that FLT_RADIX raised to one less than that
    power is a representable finite floating-point number, e_max:
      FLT_MAX_EXP
      DBL_MAX_EXP
      LDBL_MAX_EXP

FLT16_MIN_EXP and FLT16_MAX_EXP should clearly be biased the same way,
and other compilers do in fact do so, as do our OpenCL headers for `half`.

Additionally, FLT16_MIN_10_EXP is just wrong.

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

5 years agoDefer building 'this' captures until we have left the capturing region
Richard Smith [Fri, 31 May 2019 01:17:04 +0000 (01:17 +0000)]
Defer building 'this' captures until we have left the capturing region
and returned to the context in which 'this' should be captured.

This means we now always mark 'this' referenced from the context in
which it's actually referenced, rather than potentially from some
context nested within that.

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

5 years ago[CMake][Fuchsia] Use libc++ ABI v2 on Darwin as well
Petr Hosek [Fri, 31 May 2019 01:16:43 +0000 (01:16 +0000)]
[CMake][Fuchsia] Use libc++ ABI v2 on Darwin as well

Since we share headers between host and target builds, we need to use
the same version for both.

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

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

5 years agoFix -DBUILD_SHARED_LIBS=ON build after rL362160
Sam Clegg [Fri, 31 May 2019 01:04:00 +0000 (01:04 +0000)]
Fix -DBUILD_SHARED_LIBS=ON build after rL362160

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

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

5 years agoDefer capture initialization for captured regions until after we've left
Richard Smith [Fri, 31 May 2019 00:45:10 +0000 (00:45 +0000)]
Defer capture initialization for captured regions until after we've left
the captured region scope.

This removes a case where we would build expressions (and mark
declarations odr-used) in the wrong scope.

Remove the now-unused 'capture initializer' field on sema::Capture
(except for 'this' captures, which still need to be cleaned up).

No functionality change intended (except that we now very slightly more
precisely determine whether we need to use a capture or not when another
captured region encloses an OpenMP captured region).

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

5 years agoDefer capture initialization for blocks until after we've left the
Richard Smith [Fri, 31 May 2019 00:45:09 +0000 (00:45 +0000)]
Defer capture initialization for blocks until after we've left the
function scope.

This removes one of the last few cases where we build expressions in the
wrong function scope context. No functionality change intended.

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

5 years agoRefactor OpenMP stack management.
Richard Smith [Thu, 30 May 2019 23:21:14 +0000 (23:21 +0000)]
Refactor OpenMP stack management.

Instead of duplicating access to the directive stack throughout
SemaOpenMP.cpp, consolidate it to a few methods and call those
everywhere else. In passing, simplify adjacent code where possible.

No functionality change intended.

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

5 years agoFix "fallthrough annotation in unreachable code" warning.
Richard Smith [Thu, 30 May 2019 23:21:13 +0000 (23:21 +0000)]
Fix "fallthrough annotation in unreachable code" warning.

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

5 years agoAdd enums as global variables in the IR metadata.
Amy Huang [Thu, 30 May 2019 22:04:11 +0000 (22:04 +0000)]
Add enums as global variables in the IR metadata.

Summary:
Keeps track of the enums that were used by saving them as DIGlobalVariables,
since CodeView emits debug info for global constants.

Reviewers: rnk

Subscribers: aprantl, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[Remarks][NFC] Move the serialization to lib/Remarks
Francis Visoiu Mistrih [Thu, 30 May 2019 21:45:59 +0000 (21:45 +0000)]
[Remarks][NFC] Move the serialization to lib/Remarks

Separate the remark serialization to YAML from the LLVM Diagnostics.

This adds a new serialization abstraction: remarks::Serializer. It's
completely independent from lib/IR and it provides an easy way to
replace YAML by providing a new remarks::Serializer.

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

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

5 years agoFix constexpr __builtin_*_overflow issue when unsigned->signed operand.
Erich Keane [Thu, 30 May 2019 21:35:32 +0000 (21:35 +0000)]
Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.

As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was
possible to get the constexpr version of __builtin_*_overflow to give
the wrong answer.

This was because when extending the operands to fit the largest type (so
that the math could be done), the decision on whether to sign/zero
extend the operands was based on the result signedness, not on the
operands signedness.

In the reported case, (unsigned char)255 - (int)100 needed
to have each extended to the int in order to do the math.  However, when
extending the first operand to 'int', we incorrectly sign extended it
instead of zero extending.  Thus, the result didnt fit back into the
unsigned char.

The fix for this was simply to choose zero/sign extension based on the
sign of the operand itself.

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

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

5 years ago[c++2a] Fix assertion failure if we would walk over more than one level
Richard Smith [Thu, 30 May 2019 20:45:12 +0000 (20:45 +0000)]
[c++2a] Fix assertion failure if we would walk over more than one level
of derived-to-base conversion path when implicitly starting union
subobject lifetimes in constant evaluation.

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

5 years agoMark test as requiring an ARM target.
Douglas Yung [Thu, 30 May 2019 20:02:51 +0000 (20:02 +0000)]
Mark test as requiring an ARM target.

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

5 years ago[GWP-ASan] Mutex implementation [2].
Mitch Phillips [Thu, 30 May 2019 19:45:32 +0000 (19:45 +0000)]
[GWP-ASan] Mutex implementation [2].

Summary:
See D60593 for further information.
This patch pulls out the mutex implementation and the required definitions file.

We implement our own mutex for GWP-ASan currently, because:

1. We must be compatible with the sum of the most restrictive elements of the supporting allocator's build system. Current targets for GWP-ASan include Scudo (on Linux and Fuchsia), and bionic (on Android).
2. Scudo specifies `-nostdlib++ -nonodefaultlibs`, meaning we can't use `std::mutex` or `mtx_t`.
3. We can't use `sanitizer_common`'s mutex, as the supporting allocators cannot afford the extra maintenance (Android, Fuchsia) and code size (Fuchsia) overheads that this would incur.

In future, we would like to implement a shared base mutex for GWP-ASan, Scudo and sanitizer_common. This will likely happen when both GWP-ASan and Scudo standalone are not in the development phase, at which point they will have stable requirements.

Reviewers: vlad.tsyrklevich, morehouse, jfb

Reviewed By: morehouse

Subscribers: dexonsmith, srhines, cfe-commits, kubamracek, mgorny, cryptoad, jfb, #sanitizers, llvm-commits, vitalybuka, eugenis

Tags: #sanitizers, #llvm, #clang

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

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

5 years agoReapply: LLVM IR: update Clang tests for byval being a typed attribute.
Tim Northover [Thu, 30 May 2019 18:49:19 +0000 (18:49 +0000)]
Reapply: LLVM IR: update Clang tests for byval being a typed attribute.

Since byval is now a typed attribute it gets sorted slightly differently by
LLVM when the order of attributes is being canonicalized. This updates the few
Clang tests that depend on the old order.

Clang patch is unchanged.

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

5 years agoAdd Attribute NoThrow as an Exception Specifier Type
Erich Keane [Thu, 30 May 2019 17:31:54 +0000 (17:31 +0000)]
Add Attribute NoThrow as an Exception Specifier Type

In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became
clear that the current mechanism of hacking through checks for the
exception specification of a function gets confused really quickly when
there are alternate exception specifiers.

This patch introcues EST_NoThrow, which is the equivilent of
EST_noexcept when caused by EST_noThrow. The existing implementation is
left in place to cover functions with no FunctionProtoType.

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

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

5 years ago[Docs] Modernize references to macOS
J. Ryan Stinnett [Thu, 30 May 2019 16:46:22 +0000 (16:46 +0000)]
[Docs] Modernize references to macOS

Summary:
This updates all places in documentation that refer to "Mac OS X", "OS X", etc.
to instead use the modern name "macOS" when no specific version number is
mentioned.

If a specific version is mentioned, this attempts to use the OS name at the time
of that version:

* Mac OS X for 10.0 - 10.7
* OS X for 10.8 - 10.11
* macOS for 10.12 - present

Reviewers: JDevlieghere

Subscribers: mgorny, christof, arphaman, cfe-commits, lldb-commits, libcxx-commits, llvm-commits

Tags: #clang, #lldb, #libc, #llvm

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

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

5 years agoRevert "clang support gnu asm goto."
Erich Keane [Thu, 30 May 2019 15:38:02 +0000 (15:38 +0000)]
Revert "clang support gnu asm goto."

This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a.

Reverting due to test failures as requested by Jennifer Yu.

Conflicts:
clang/test/CodeGen/asm-goto.c

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

5 years ago[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.
Anastasia Stulova [Thu, 30 May 2019 15:18:07 +0000 (15:18 +0000)]
[OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.

C++ is derived from OpenCL v2.0 therefore set the versions
identically.

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

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

5 years ago[analyzer] print() JSONify chain: Fix possible build-bot breaks
Csaba Dabis [Thu, 30 May 2019 15:15:57 +0000 (15:15 +0000)]
[analyzer] print() JSONify chain: Fix possible build-bot breaks

Summary:
Printing constructing_objects could be non-deterministic as it is a map.

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

5 years agoFollow up of r362096
Sjoerd Meijer [Thu, 30 May 2019 15:04:06 +0000 (15:04 +0000)]
Follow up of r362096

The new tests were failing, because I missed dependent patch D60697.
I have removed the failing cases for now, which I will restore once
D60697 is in.

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

5 years ago[analyzer] print() JSONify chain: Fix build-bot breaks
Csaba Dabis [Thu, 30 May 2019 14:48:43 +0000 (14:48 +0000)]
[analyzer] print() JSONify chain: Fix build-bot breaks

Summary:
Printing out a map structure different in different environments so that
this patch generalize the test-case to check for the 'no stmt'-case
anywhere in the Store.

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

5 years ago[ARM] Add CLI support for Armv8.1-M and MVE
Sjoerd Meijer [Thu, 30 May 2019 14:22:26 +0000 (14:22 +0000)]
[ARM] Add CLI support for Armv8.1-M and MVE

Given the existing infrastructure in LLVM side for +fp and +fp.dp,
this is more or less trivial, needing only one tiny source change and
a couple of tests.

Patch by Simon Tatham.

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

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

5 years ago[OpenCL] Support logical vector operators in C++ mode
Sven van Haastregt [Thu, 30 May 2019 12:35:19 +0000 (12:35 +0000)]
[OpenCL] Support logical vector operators in C++ mode

Support logical operators on vectors in C++ for OpenCL mode, to
preserve backwards compatibility with OpenCL C.

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

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

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Thu, 30 May 2019 10:44:36 +0000 (10:44 +0000)]
Fix Wdocumentation warning. NFCI.

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

5 years agoRevert "asm goto: fix out-of-bounds read of Constraints after rC362045"
Fangrui Song [Thu, 30 May 2019 10:05:52 +0000 (10:05 +0000)]
Revert "asm goto: fix out-of-bounds read of Constraints after rC362045"

It was fixed by rC362062.

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

5 years agoFix MSVC "not all control paths return a value" warning.
Simon Pilgrim [Thu, 30 May 2019 09:39:45 +0000 (09:39 +0000)]
Fix MSVC "not all control paths return a value" warning.

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

5 years agoasm goto: fix out-of-bounds read of Constraints after rC362045
Fangrui Song [Thu, 30 May 2019 08:03:02 +0000 (08:03 +0000)]
asm goto: fix out-of-bounds read of Constraints after rC362045

When parsing goto labels, Names and Exprs are expanded but Constraints
is not, this may cause a out-of-bounds read later in:

// GCCAsmStmt::GCCAsmStmt
// `constraints` has only `NumExprs - NumLabels` elements
  Constraints = new (C) StringLiteral*[NumExprs];
  std::copy(constraints, constraints + NumExprs, Constraints);

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

5 years ago[AST] asm goto labels don't have constraints, don't try to copy them.
Benjamin Kramer [Thu, 30 May 2019 07:21:08 +0000 (07:21 +0000)]
[AST] asm goto labels don't have constraints, don't try to copy them.

Found by asan.

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