]> granicus.if.org Git - clang/log
clang
5 years ago[RISCV][NFC] Add missing test files for D54091
Lewis Revill [Tue, 11 Jun 2019 12:49:15 +0000 (12:49 +0000)]
[RISCV][NFC] Add missing test files for D54091

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

5 years ago[RISCV] Add inline asm constraints I, J & K for RISC-V
Lewis Revill [Tue, 11 Jun 2019 12:44:01 +0000 (12:44 +0000)]
[RISCV] Add inline asm constraints I, J & K for RISC-V

This allows the constraints I, J & K to be used in inline asm for
RISC-V, with the following semantics (equivalent to GCC):

I: Any 12-bit signed immediate.
J: Integer zero only.
K: Any 5-bit unsigned immediate.

See the GCC definitions here:
https://gcc.gnu.org/onlinedocs/gccint/Machine-Constraints.html

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

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

5 years agoMake sure a test from r363036 does not write into a working directory
Ilya Biryukov [Tue, 11 Jun 2019 12:05:03 +0000 (12:05 +0000)]
Make sure a test from r363036 does not write into a working directory

It breaks if build directory is not writable. This change is required
to fix our integrate.

Also add a flush() call, otherwise time trace option does not produce
the full output.

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

5 years ago[Frontend] Avoid creating auxilary files during a unit test. NFC
Ilya Biryukov [Tue, 11 Jun 2019 09:52:30 +0000 (09:52 +0000)]
[Frontend] Avoid creating auxilary files during a unit test. NFC

A test added in r363009 logs diagnostics into a file inside current
working directory. This breaks when the directory is not writable.

This looks like a debugging output in the first place, the test passes
without it anyway.

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

5 years ago[Support][Test] Time profiler: add regression test
Anton Afanasyev [Tue, 11 Jun 2019 08:25:54 +0000 (08:25 +0000)]
[Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

This is recommit of r362821

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

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

5 years ago[X86] Enable intrinsics that convert float and bf16 data to each other
Pengfei Wang [Tue, 11 Jun 2019 01:17:28 +0000 (01:17 +0000)]
[X86] Enable intrinsics that convert float and bf16 data to each other

Scalar version :
_mm_cvtsbh_ss , _mm_cvtness_sbh

Vector version:
_mm512_cvtpbh_ps , _mm256_cvtpbh_ps
_mm512_maskz_cvtpbh_ps , _mm256_maskz_cvtpbh_ps
_mm512_mask_cvtpbh_ps , _mm256_mask_cvtpbh_ps

Patch by Shengchen Kan (skan)

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

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

5 years ago[Frontend] SetUpDiagnosticLog should handle unowned diagnostic consumer
Alex Lorenz [Mon, 10 Jun 2019 23:32:42 +0000 (23:32 +0000)]
[Frontend] SetUpDiagnosticLog should handle unowned diagnostic consumer
in the compiler

The function SetUpDiagnosticLog that was called from createDiagnostics didn't
handle the case where the diagnostics engine didn't own the diagnostics consumer.
This is a potential problem for a clang tool, in particular some of the follow-up
patches for clang-scan-deps will need this fix.

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

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

5 years agoRevert r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"
Reid Kleckner [Mon, 10 Jun 2019 23:25:43 +0000 (23:25 +0000)]
Revert r362994 & co "[analyzer][tests] Add normalize_plist to replace diff_plist"

Reverts r362998, r362996, and r362994 because the tests do not pass on
Windows due to CRLF changes. Adding back `-w` to diff is not enough, the
new grep substitution doesn't work on Windows, and fixing it is
non-trivial.

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

5 years agoRequire stdcall etc parameters to be complete on ODR use
Reid Kleckner [Mon, 10 Jun 2019 22:53:12 +0000 (22:53 +0000)]
Require stdcall etc parameters to be complete on ODR use

Functions using stdcall, fastcall, or vectorcall with C linkage mangle
in the size of the parameter pack. Calculating the size of the pack
requires the parameter types to complete, which may require template
instantiation.

Previously, we would crash during IRgen when requesting the size of
incomplete or uninstantiated types, as in this reduced example:
  struct Foo;
  void __fastcall bar(struct Foo o);
  void (__fastcall *fp)(struct Foo) = &bar;

Reported in Chromium here: https://crbug.com/971245

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

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

5 years ago[analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)
Hubert Tong [Mon, 10 Jun 2019 22:40:35 +0000 (22:40 +0000)]
[analyzer][tests] Use normalize_plist in place of diff_plist (`tail` cases)

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `tail`. `%diff_plist` is then, being unused, removed.

The changes were applied via a script.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)
Hubert Tong [Mon, 10 Jun 2019 22:37:31 +0000 (22:37 +0000)]
[analyzer][tests] Use normalize_plist in place of diff_plist (`cat` cases)

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html
mechanically to the cases where the output file is piped to
`%diff_plist` via `cat`.

The changes were applied via a script, except that
`clang/test/Analysis/NewDelete-path-notes.cpp` and
`clang/test/Analysis/plist-macros-with-expansion.cpp` were each adjusted
for the line-continuation on the relevant `RUN` step.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer][tests] Add normalize_plist to replace diff_plist
Hubert Tong [Mon, 10 Jun 2019 22:33:34 +0000 (22:33 +0000)]
[analyzer][tests] Add normalize_plist to replace diff_plist

Summary:
The `%diff_plist` lit substitution invokes `diff` with a non-portable
`-I` option. The intended effect can be achieved by normalizing the
inputs to `diff` beforehand. Such normalization can be done with
`grep -Ev`, which is also used by other tests.

This patch applies the change (adjusted for review comments) described
in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html to the
specific case shown in the list message. Mechanical changes to the other
affected files will follow in later patches.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, jsji, cfe-commits

Tags: #clang

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

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

5 years ago[PlistSupport] Produce a newline to end plist output files
Hubert Tong [Mon, 10 Jun 2019 22:30:57 +0000 (22:30 +0000)]
[PlistSupport] Produce a newline to end plist output files

Summary:
As suggested in the review of D62949, this patch updates the plist
output to have a newline at the end of the file. This makes it so that
the plist output file qualifies as a POSIX text file, which increases
the consumability of the generated plist file in relation to various
tools.

Reviewers: NoQ, sfertile, xingxue, jasonliu, daltenty

Reviewed By: NoQ, xingxue

Subscribers: jsji, cfe-commits

Tags: #clang

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

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

5 years ago[CUDA] Fix grep pattern in cuda-types.cu
Hubert Tong [Mon, 10 Jun 2019 22:28:20 +0000 (22:28 +0000)]
[CUDA] Fix grep pattern in cuda-types.cu

Summary:
vertical-line is not a BRE special character.

POSIX.1-2017 XBD Section 9.3.2 indicates that the interpretation of `\|`
is undefined. This patch uses EREs instead.

Additionally, the pattern is further fixed so that `SIZEOF` and `WIDTH`
macros are checked.

Reviewers: jlebar, daltenty, xingxue, jasonliu, tra

Reviewed By: tra

Subscribers: jfb, jsji, cfe-commits

Tags: #clang

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

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

5 years ago[X86] Attempt to make the Intel core CPU inheritance a little more readable and maint...
Craig Topper [Mon, 10 Jun 2019 16:59:28 +0000 (16:59 +0000)]
[X86] Attempt to make the Intel core CPU inheritance a little more readable and maintainable

The recently added cooperlake CPU has made our already ugly switch statement even worse. There's a CPU exclusion list around the bf16 feature in the cooper lake block. I worry that we'll have to keep adding new CPUs to that until bf16 intercepts a client space CPU. We have several other exclusion lists in other parts of the switch due to skylakeserver, cascadelake, and cooperlake not having sgx. Another for cannonlake not having clwb but having all other features from skx.

This removes all these special ifs at the cost of some duplication of features and a goto. I've copied all of the skx features into either cannonlake or icelakeclient(for clwb). And pulled sklyakeserver, cascadelake, and cooperlake out of the main inheritance chain into their own chain. At the end of skylakeserver we merge back into the main chain at skylakeclient but below sgx. I think this is at least easier to follow.

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

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

5 years ago[WebAssembly] Cleanup toolchain test files. NFC.
Sam Clegg [Mon, 10 Jun 2019 16:18:04 +0000 (16:18 +0000)]
[WebAssembly] Cleanup toolchain test files. NFC.

Summary: Split up long lines to improve test readability.

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, jfb, cfe-commits

Tags: #clang

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

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

5 years agoRe-land "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified...
Sam McCall [Mon, 10 Jun 2019 15:17:52 +0000 (15:17 +0000)]
Re-land "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."

ShadowMapEntry is now really, truly a normal class.

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

5 years agoRevert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified...
Sam McCall [Mon, 10 Jun 2019 14:55:57 +0000 (14:55 +0000)]
Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."

This reverts commit r362924, which causes a double-free of ShadowMapEntry.

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

5 years agoRevert "Revert "[CodeComplete] Improve overload handling for C++ qualified and ref...
Sam McCall [Mon, 10 Jun 2019 09:52:09 +0000 (09:52 +0000)]
Revert "Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.""

This reverts commit r362830, and relands r362785 with the leak fixed.

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

5 years ago[analyzer][NFC] Add dividers to BugReporterVisitors.cpp
Kristof Umann [Sat, 8 Jun 2019 20:25:39 +0000 (20:25 +0000)]
[analyzer][NFC] Add dividers to BugReporterVisitors.cpp

Some minor formatting to make the file more readable.
Added //===----------===// around the implementation of class methods
and divided anonymous namespaces as per
https://llvm.org/docs/CodingStandards.html#anonymous-namespaces

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

5 years ago[analyzer][NFC][tests] Pre-normalize expected-plists
Hubert Tong [Sat, 8 Jun 2019 13:51:37 +0000 (13:51 +0000)]
[analyzer][NFC][tests] Pre-normalize expected-plists

As suggested in the review for D62949, this patch pre-normalizes the
reference expected output plist files by removing lines containing
fields for which we expect differences that should be ignored.

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

5 years ago[analyzer][NFC][tests] Remove unused expected-plist files
Hubert Tong [Sat, 8 Jun 2019 13:48:25 +0000 (13:48 +0000)]
[analyzer][NFC][tests] Remove unused expected-plist files

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

5 years agoDebugInfo: Add support for 'nodebug' attribute on typedefs and alias templates
David Blaikie [Sat, 8 Jun 2019 00:01:21 +0000 (00:01 +0000)]
DebugInfo: Add support for 'nodebug' attribute on typedefs and alias templates

Seems like a logical extension to me - and of interest because it might
help reduce the debug info size of libc++ by applying this attribute to
type traits that have a disproportionate debug info cost compared to the
benefit (& possibly harm/confusion) they cause users.

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

5 years ago[analyzer] Add werror flag for analyzer warnings
Keno Fischer [Fri, 7 Jun 2019 23:34:00 +0000 (23:34 +0000)]
[analyzer] Add werror flag for analyzer warnings

Summary:
We're using the clang static analyzer together with a number of
custom analyses in our CI system to ensure that certain invariants
are statiesfied for by the code every commit. Unfortunately, there
currently doesn't seem to be a good way to determine whether any
analyzer warnings were emitted, other than parsing clang's output
(or using scan-build, which then in turn parses clang's output).
As a simpler mechanism, simply add a `-analyzer-werror` flag to CC1
that causes the analyzer to emit its warnings as errors instead.
I briefly tried to have this be `Werror=analyzer` and make it go
through that machinery instead, but that seemed more trouble than
it was worth in terms of conflicting with options to the actual build
and special cases that would be required to circumvent the analyzers
usual attempts to quiet non-analyzer warnings. This is simple and it
works well.

Reviewed-By: NoQ, Szelethusw
Differential Revision: https://reviews.llvm.org/D62885

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

5 years agoRelax test so that the clang binary doesn't need to be named "clang".
Peter Collingbourne [Fri, 7 Jun 2019 20:26:47 +0000 (20:26 +0000)]
Relax test so that the clang binary doesn't need to be named "clang".

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

5 years agoRevert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified...
Vlad Tsyrklevich [Fri, 7 Jun 2019 19:18:30 +0000 (19:18 +0000)]
Revert "[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods."

This reverts commit f1f6e0fc2468e9c120b22b939507c527d08b8ee8, it was
causing LSan failures on the sanitizer bots:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/32809

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

5 years agoDriver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.
Peter Collingbourne [Fri, 7 Jun 2019 19:10:08 +0000 (19:10 +0000)]
Driver, IRGen: Set partitions on GlobalValues according to -fsymbol-partition flag.

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

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

5 years agoRevert "[Support][Test] Time profiler: add regression test"
Anton Afanasyev [Fri, 7 Jun 2019 18:35:58 +0000 (18:35 +0000)]
Revert "[Support][Test] Time profiler: add regression test"

This reverts commit 44282a60c90fdded249d57d91b12c6c0907102ec.
This breaks buildbot.

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

5 years ago[Support][Test] Time profiler: add regression test
Anton Afanasyev [Fri, 7 Jun 2019 18:13:48 +0000 (18:13 +0000)]
[Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

llvm-svn: 362792

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

5 years agoRevert rL362792 : [Support][Test] Time profiler: add regression test
Simon Pilgrim [Fri, 7 Jun 2019 17:37:04 +0000 (17:37 +0000)]
Revert rL362792 : [Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D61914
........
Breaks buildbots - @anton-afanasyev please can you take a look?

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

5 years ago[ARM] Add ACLE feature macros for MVE.
David Green [Fri, 7 Jun 2019 17:28:12 +0000 (17:28 +0000)]
[ARM] Add ACLE feature macros for MVE.

Fixup uninitialised variable.

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

5 years agoAST Matchers tutorial requests to enable clang-tools-extra. NFC
Ilya Biryukov [Fri, 7 Jun 2019 16:31:06 +0000 (16:31 +0000)]
AST Matchers tutorial requests to enable clang-tools-extra. NFC

Otherwise the examples do not build.

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

5 years agoBuild with _XOPEN_SOURCE defined on AIX
David Tenty [Fri, 7 Jun 2019 15:45:25 +0000 (15:45 +0000)]
Build with _XOPEN_SOURCE defined on AIX

Summary:
It is useful to build with _XOPEN_SOURCE defined on AIX, enabling X/Open
and POSIX compatibility mode, to work around stray macros and other
bugs in the headers provided by the system and build compiler.

This patch adds the config to cmake to build with _XOPEN_SOURCE defined
on AIX with a few exceptions. Google Test internals require access to
platform specific thread info constructs on AIX so in that case we build
with _ALL_SOURCE defined instead. Libclang also uses header which needs
_ALL_SOURCE on AIX so we leave that as is as well.

We also add building on AIX with the large file API and doing CMake
header checks with X/OPEN definitions so the results are consistent with
the environment that will be present in the build.

Reviewers: hubert.reinterpretcast, xingxue, andusy

Reviewed By: hubert.reinterpretcast

Subscribers: mgorny, jsji, cfe-commits, llvm-commits

Tags: #llvm, #clang

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

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

5 years ago[ARM] Add ACLE feature macros for MVE
Sjoerd Meijer [Fri, 7 Jun 2019 15:20:56 +0000 (15:20 +0000)]
[ARM] Add ACLE feature macros for MVE

If MVE is present at all, then the macro __ARM_FEATURE_MVE is defined
to a value which has bit 0 set for integer MVE, and bit 1 set for
floating-point MVE.

(Floating-point MVE implies integer MVE, so if this macro is defined
at all then it will be set to 1 or 3, never 2.)

Patch mostly by Simon Tatham

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

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

5 years ago[Support][Test] Time profiler: add regression test
Anton Afanasyev [Fri, 7 Jun 2019 12:59:32 +0000 (12:59 +0000)]
[Support][Test] Time profiler: add regression test

Summary:
Add output to `llvm::errs()` when `-ftime-trace` option is enabled,
add regression test checking this option works as expected.

Reviewers: thakis, aganea

Subscribers: cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[ARM] Fix bugs introduced by the fp64/d32 rework.
Simon Tatham [Fri, 7 Jun 2019 12:42:54 +0000 (12:42 +0000)]
[ARM] Fix bugs introduced by the fp64/d32 rework.

Change D60691 caused some knock-on failures that weren't caught by the
existing tests. Firstly, selecting a CPU that should have had a
restricted FPU (e.g. `-mcpu=cortex-m4`, which should have 16 d-regs
and no double precision) could give the unrestricted version, because
`ARM::getFPUFeatures` returned a list of features including subtracted
ones (here `-fp64`,`-d32`), but `ARMTargetInfo::initFeatureMap` threw
away all the ones that didn't start with `+`. Secondly, the
preprocessor macros didn't reliably match the actual compilation
settings: for example, `-mfpu=softvfp` could still set `__ARM_FP` as
if hardware FP was available, because the list of features on the cc1
command line would include things like `+vfp4`,`-vfp4d16` and clang
didn't realise that one of those cancelled out the other.

I've fixed both of these issues by rewriting `ARM::getFPUFeatures` so
that it returns a list that enables every FP-related feature
compatible with the selected FPU and disables every feature not
compatible, which is more verbose but means clang doesn't have to
understand the dependency relationships between the backend features.
Meanwhile, `ARMTargetInfo::handleTargetFeatures` is testing for all
the various forms of the FP feature names, so that it won't miss cases
where it should have set `HW_FP` to feed into feature test macros.

That in turn caused an ordering problem when handling `-mcpu=foo+bar`
together with `-mfpu=something_that_turns_off_bar`. To fix that, I've
arranged that the `+bar` suffixes on the end of `-mcpu` and `-march`
cause feature names to be put into a separate vector which is
concatenated after the output of `getFPUFeatures`.

Another side effect of all this is to fix a bug where `clang -target
armv8-eabi` by itself would fail to set `__ARM_FEATURE_FMA`, even
though `armv8` (aka Arm v8-A) implies FP-Armv8 which has FMA. That was
because `HW_FP` was being set to a value including only the `FPARMV8`
bit, but that feature test macro was testing only the `VFP4FPU` bit.
Now `HW_FP` ends up with all the bits set, so it gives the right
answer.

Changes to tests included in this patch:

* `arm-target-features.c`: I had to change basically all the expected
  results. (The Cortex-M4 test in there should function as a
  regression test for the accidental double-precision bug.)
* `arm-mfpu.c`, `armv8.1m.main.c`: switched to using `CHECK-DAG`
  everywhere so that those tests are no longer sensitive to the order
  of cc1 feature options on the command line.
* `arm-acle-6.5.c`: been updated to expect the right answer to that
  FMA test.
* `Preprocessor/arm-target-features.c`: added a regression test for
  the `mfpu=softvfp` issue.

Reviewers: SjoerdMeijer, dmgreen, ostannard, samparker, JamesNagurne

Reviewed By: ostannard

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

Tags: #clang, #llvm

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

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

5 years ago[X86][test] Add test cases using immediates to builtins-x86.c
Russell Gallop [Fri, 7 Jun 2019 09:51:44 +0000 (09:51 +0000)]
[X86][test] Add test cases using immediates to builtins-x86.c

These builtins should work with immediate or variable shift operand for
gcc compatibility.

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

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

5 years ago[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.
Sam McCall [Fri, 7 Jun 2019 09:45:17 +0000 (09:45 +0000)]
[CodeComplete] Improve overload handling for C++ qualified and ref-qualified methods.

Summary:
- when a method is not available because of the target value kind (e.g. an &&
  method on a Foo& variable), then don't offer it.
- when a method is effectively shadowed by another method from the same class
  with a) an identical argument list and b) superior qualifiers, then don't
  offer it.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[X86] -march=cooperlake (clang)
Pengfei Wang [Fri, 7 Jun 2019 08:53:37 +0000 (08:53 +0000)]
[X86] -march=cooperlake (clang)

Support intel -march=cooperlake in clang

Patch by Shengchen Kan (skan)

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

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

5 years agoFactor out duplicated code building a MemberExpr and marking it
Richard Smith [Thu, 6 Jun 2019 23:24:18 +0000 (23:24 +0000)]
Factor out duplicated code building a MemberExpr and marking it
referenced.

This reinstates r362563, reverted in r362597.

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

5 years agoConvert MemberExpr creation and serialization to work the same way as
Richard Smith [Thu, 6 Jun 2019 23:24:15 +0000 (23:24 +0000)]
Convert MemberExpr creation and serialization to work the same way as
most / all other Expr subclasses.

This reinstates r362551, reverted in r362597, with a fix to a bug that
caused MemberExprs to sometimes have a null FoundDecl after a round-trip
through an AST file.

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

5 years agoclang-format: better handle namespace macros
Francois Ferrand [Thu, 6 Jun 2019 20:06:23 +0000 (20:06 +0000)]
clang-format: better handle namespace macros

Summary:
Other macros are used to declare namespaces, and should thus be handled
similarly. This is the case for crpcut's TESTSUITE macro, or for
unittest-cpp's SUITE macro:

      TESTSUITE(Foo) {
      TEST(MyFirstTest) {
        assert(0);
      }
      } // TESTSUITE(Foo)

This patch deals with this cases by introducing a new option to specify
lists of namespace macros. Internally, it re-uses the system already in
place for foreach and statement macros, to ensure there is no impact on
performance.

Reviewers: krasimir, djasper, klimek

Reviewed By: klimek

Subscribers: acoomans, cfe-commits, klimek

Tags: #clang

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

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

5 years ago[clang][HeaderSearch] Consider all path separators equal
Kadir Cetinkaya [Thu, 6 Jun 2019 18:49:16 +0000 (18:49 +0000)]
[clang][HeaderSearch] Consider all path separators equal

Reviewers: ilya-biryukov, sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[LibTooling] Add insert/remove convenience functions for creating `ASTEdit`s.
Yitzhak Mandelbaum [Thu, 6 Jun 2019 14:20:29 +0000 (14:20 +0000)]
[LibTooling] Add insert/remove convenience functions for creating `ASTEdit`s.

Summary: `change()` is an all purpose function; the revision adds simple shortcuts for the specific operations of inserting (before/after) or removing source.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[X86] Add ENQCMD instructions
Pengfei Wang [Thu, 6 Jun 2019 08:28:42 +0000 (08:28 +0000)]
[X86] Add ENQCMD instructions

For more details about these instructions, please refer to the latest
ISE document:
https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference.

Patch by Tianqing Wang (tianqing)

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

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

5 years agoUpdate AST matchers tutorial to use monorepo layout
Ilya Biryukov [Thu, 6 Jun 2019 08:06:25 +0000 (08:06 +0000)]
Update AST matchers tutorial to use monorepo layout

The docs were inconsistent: requesting the user to clone the monorepo,
and then continuing with the `llvm/tools/clang` layout.

Follow-up to a question on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2019-June/062518.html

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

5 years ago[WebAssembly] Support Leak Sanitizer on Emscripten
Thomas Lively [Thu, 6 Jun 2019 01:38:12 +0000 (01:38 +0000)]
[WebAssembly] Support Leak Sanitizer on Emscripten

Summary:
LSan is currently being ported to Emscripten and mostly works.

Enabling the support in upstream would simplify testing.

Patch by Guanzhong Chen.

Reviewers: tlively, aheejin

Reviewed By: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

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

5 years agoLLVM IR: Generate new-style byval-with-Type from Clang
Tim Northover [Wed, 5 Jun 2019 21:12:14 +0000 (21:12 +0000)]
LLVM IR: Generate new-style byval-with-Type from Clang

LLVM IR recently added a Type parameter to the byval Attribute, so that
when pointers become opaque and no longer have an element type the
information will still be present in IR.

For now the Type parameter is optional (which is why Clang didn't need
this change at the time), but it will become mandatory soon.

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

5 years agoFix FileCheck prefixes in test case.
Akira Hatanaka [Wed, 5 Jun 2019 21:11:06 +0000 (21:11 +0000)]
Fix FileCheck prefixes in test case.

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

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