]> granicus.if.org Git - clang/log
clang
6 years agoCompound literals, enums, et al require const expr
Bill Wendling [Fri, 9 Nov 2018 00:41:36 +0000 (00:41 +0000)]
Compound literals, enums, et al require const expr

Summary:
Compound literals,  enums, file-scoped arrays, etc. require their
initializers and size specifiers to be constant. Wrap the initializer
expressions in a ConstantExpr so that we can easily check for this later
on.

Reviewers: rsmith, shafik

Reviewed By: rsmith

Subscribers: cfe-commits, jyknight, nickdesaulniers

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

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

6 years agoFix a use-after-free introduced by r344915.
Adrian Prantl [Fri, 9 Nov 2018 00:26:15 +0000 (00:26 +0000)]
Fix a use-after-free introduced by r344915.

r344915 added a call to ApplyDebugLocation to the sanitizer check
function emitter. Some of the sanitizers are emitted in the function
epilogue though and the LexicalScopeStack is emptied out before. By
detecting this situation and early-exiting from ApplyDebugLocation the
fallback location is used, which is equivalent to the return location.

rdar://problem/45859802

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

6 years ago[Frontend/Modules] Show diagnostics on prebuilt module configuration mismatch too
David Blaikie [Thu, 8 Nov 2018 20:47:30 +0000 (20:47 +0000)]
[Frontend/Modules] Show diagnostics on prebuilt module configuration mismatch too

The current version only emits  the below error for a module (attempted to be loaded) from the `prebuilt-module-path`:

```
error: module file blabla.pcm cannot be loaded due to a configuration mismatch with the current compilation [-Wmodule-file-config-mismatch]
```

With this change, if the prebuilt module is used, we allow the proper diagnostic behind the configuration mismatch to be shown.

```
error: POSIX thread support was disabled in PCH file but is currently enabled
error: module file blabla.pcm cannot be loaded due to a configuration mismatch with the current compilation [-Wmodule-file-config-mismatch]
```

(A few lines later an error is emitted anyways, so there is no reason not to complain for configuration mismatches if a config mismatch is found and kills the build.)

Reviewed By: dblaikie

Tags: #clang

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

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

6 years ago[Tooling] Produce diagnostics for missing input files.
Sam McCall [Thu, 8 Nov 2018 16:57:01 +0000 (16:57 +0000)]
[Tooling] Produce diagnostics for missing input files.

Summary:
This was disabled way back in 2011, in the dark times before Driver was VFS-aware.

Also, make driver more VFS-aware :-)

This breaks one ClangTidy test (we improved the error message), will fix when
submitting.

Reviewers: ioeric

Subscribers: cfe-commits, alexfh

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

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

6 years agoFix bitcast to address space cast for coerced load/stores
Yaxun Liu [Thu, 8 Nov 2018 16:55:46 +0000 (16:55 +0000)]
Fix bitcast to address space cast for coerced load/stores

Coerced load/stores through memory do not take into account potential
address space differences when it creates its bitcasts.

Patch by David Salinas.

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

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

6 years ago[OPENMP]Make lambda mapping follow reqs for PTR_AND_OBJ mapping.
Alexey Bataev [Thu, 8 Nov 2018 15:47:39 +0000 (15:47 +0000)]
[OPENMP]Make lambda mapping follow reqs for PTR_AND_OBJ mapping.

The base pointer for the lambda mapping must point to the lambda capture
placement and pointer must point to the captured variable itself. Patch
fixes this problem.

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

6 years agoclang-cl: Add "/clang:" pass-through arg support.
Hans Wennborg [Thu, 8 Nov 2018 11:27:04 +0000 (11:27 +0000)]
clang-cl: Add "/clang:" pass-through arg support.

The clang-cl driver disables access to command line options outside of the
"Core" and "CLOption" sets of command line arguments. This filtering makes it
impossible to pass arguments that are interpreted by the clang driver and not
by either 'cc1' (the frontend) or one of the other tools invoked by the driver.

An example driver-level flag is the '-fno-slp-vectorize' flag, which is
processed by the driver in Clang::ConstructJob and used to set the cc1 flag
"-vectorize-slp". There is no negative cc1 flag or -mllvm flag, so it is not
currently possible to disable the SLP vectorizer from the clang-cl driver.

This change introduces the "/clang:" argument that is available when the
driver mode is set to CL compatibility. This option works similarly to the
"-Xclang" option, except that the option values are processed by the clang
driver rather than by 'cc1'. An example usage is:

  clang-cl /clang:-fno-slp-vectorize /O2 test.c

Another example shows how "/clang:" can be used to pass a flag where there is
a conflict between a clang-cl compat option and an overlapping clang driver
option:

  clang-cl /MD /clang:-MD /clang:-MF /clang:test_dep_file.dep test.c

In the previous example, the unprefixed /MD selects the DLL version of the msvc
CRT, while the prefixed -MD flag and the -MF flags are used to create a make
dependency file for included headers.

One note about flag ordering: the /clang: flags are concatenated to the end of
the argument list, so in cases where the last flag wins, the /clang: flags
will be chosen regardless of their order relative to other flags on the driver
command line.

Patch by Neeraj K. Singh!

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

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

6 years ago[OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
Andrew Savonichev [Thu, 8 Nov 2018 11:25:41 +0000 (11:25 +0000)]
[OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension

Summary:
Documentation can be found at https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_device_side_avc_motion_estimation.txt

Patch by Kristina Bessonova

Reviewers: Anastasia, yaxunl, shafik

Reviewed By: Anastasia

Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits

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

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

6 years ago[clang] Set CMP0075 to new
Shoaib Meenai [Thu, 8 Nov 2018 00:29:33 +0000 (00:29 +0000)]
[clang] Set CMP0075 to new

Make the check_include_file* macros honor CMAKE_REQUIRED_LIBRARIES. This
shouldn't cause any of the configuration checks to give different
results, and I verified that a clean configure before and after this
change resulted in identical CMake caches on my machine. The same change
was done for LLVM in r346377.

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

6 years ago[OPENMP]Fix handling of the globals during compilation for the device.
Alexey Bataev [Wed, 7 Nov 2018 19:11:14 +0000 (19:11 +0000)]
[OPENMP]Fix handling of the globals during compilation for the device.

Fixed lookup for the target regions in unused virtual functions + fixed
processing of the global variables not marked as declare target but
emitted during debug info emission.

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

6 years agoRevert r346326 [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation
Andrew Savonichev [Wed, 7 Nov 2018 18:34:19 +0000 (18:34 +0000)]
Revert r346326 [OpenCL] Add support of cl_intel_device_side_avc_motion_estimation

This patch breaks Index/opencl-types.cl LIT test:

Script:
--
: 'RUN: at line 1';   stage1/bin/c-index-test -test-print-type llvm/tools/clang/test/Index/opencl-types.cl -cl-std=CL2.0 | stage1/bin/FileCheck llvm/tools/clang/test/Index/opencl-types.cl
--
Command Output (stderr):
--
llvm/tools/clang/test/Index/opencl-types.cl:3:26: warning: unsupported OpenCL extension 'cl_khr_fp16' - ignoring [-Wignored-pragmas]
llvm/tools/clang/test/Index/opencl-types.cl:4:26: warning: unsupported OpenCL extension 'cl_khr_fp64' - ignoring [-Wignored-pragmas]
llvm/tools/clang/test/Index/opencl-types.cl:8:9: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:11:8: error: declaring variable of type 'half' is not allowed
llvm/tools/clang/test/Index/opencl-types.cl:15:3: error: use of type 'double' requires cl_khr_fp64 extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:16:3: error: use of type 'double4' (vector of 4 'double' values) requires cl_khr_fp64 extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:26:26: warning: unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring [-Wignored-pragmas]
llvm/tools/clang/test/Index/opencl-types.cl:35:44: error: use of type '__read_only image2d_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:36:49: error: use of type '__read_only image2d_array_msaa_t' requires cl_khr_gl_msaa_sharing extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:37:49: error: use of type '__read_only image2d_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled
llvm/tools/clang/test/Index/opencl-types.cl:38:54: error: use of type '__read_only image2d_array_msaa_depth_t' requires cl_khr_gl_msaa_sharing extension to be enabled

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

6 years ago[OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension
Andrew Savonichev [Wed, 7 Nov 2018 15:44:01 +0000 (15:44 +0000)]
[OpenCL] Add support of cl_intel_device_side_avc_motion_estimation extension

Summary:
Documentation can be found at https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_device_side_avc_motion_estimation.txt

Patch by Kristina Bessonova

Reviewers: Anastasia, yaxunl, shafik

Reviewed By: Anastasia

Subscribers: arphaman, sidorovd, AlexeySotkin, krisb, bader, asavonic, cfe-commits

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

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

6 years ago[OpenCL] Fix diagnostic message about overload candidates
Andrew Savonichev [Wed, 7 Nov 2018 13:07:18 +0000 (13:07 +0000)]
[OpenCL] Fix diagnostic message about overload candidates

Summary:
I wonder if there are some extension which need to be disabled to get
overloadable candidate available.

Reviewers: asavonic, Anastasia

Reviewed By: Anastasia

Subscribers: yaxunl, sidorovd, cfe-commits

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

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

6 years ago[NFC][Clang][Aarch64] Add missing test file
Diogo N. Sampaio [Wed, 7 Nov 2018 11:42:02 +0000 (11:42 +0000)]
[NFC][Clang][Aarch64] Add missing test file

The commit rL345273 by @LukeCheeseman has a missing test file,
see https://reviews.llvm.org/D51429
This patch adds the missing test file.

Patch by Luke Cheeseman

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

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

6 years ago[mips][msa] Fix msa_[st/ld] offset check
Aleksandar Beserminji [Wed, 7 Nov 2018 11:37:05 +0000 (11:37 +0000)]
[mips][msa] Fix msa_[st/ld] offset check

This patch fixes a minimum divider for offset in intrinsics
msa_[st/ld]_[b/h/w/d], when value is known in compile time.

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

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

6 years ago[CodeComplete] Do not complete self-initializations
Ilya Biryukov [Wed, 7 Nov 2018 10:02:31 +0000 (10:02 +0000)]
[CodeComplete] Do not complete self-initializations

Summary:
Removes references to initialized variable from the following completions:

    int x = ^;

Handles only the trivial cases where the variable name is completed
immediately at the start of initializer or assignment, more complicated
cases aren't covered, e.g. these completions still contain 'x':

    // More complicated expressions.
    int x = foo(^);
    int x = 10 + ^;
    // Other kinds of initialization.
    int x{^};
    int x(^);
    // Constructor initializers.
    struct Foo {
      Foo() : x(^) {}
      int x;
    };

We should address those in the future, but they are outside of the scope of
this initial change.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: arphaman, cfe-commits

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

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

6 years ago[Darwin] Export new weak external symbols when compiling with coverage
Vedant Kumar [Tue, 6 Nov 2018 22:25:00 +0000 (22:25 +0000)]
[Darwin] Export new weak external symbols when compiling with coverage

Some weak external symbols were added to the profile runtime in D49953,
and on Darwin, these need to be exported for tapi verification purposes.

I've tightened the test so that future breakages can be caught earlier.

rdar://45831054

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

6 years agoDon't use std::next() on an input iterator; NFC.
Aaron Ballman [Tue, 6 Nov 2018 21:12:44 +0000 (21:12 +0000)]
Don't use std::next() on an input iterator; NFC.

Instead, advance the old-fashioned way, as std::next() cannot be used on an input iterator until C++17.

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

6 years ago[MS] Zero out ECX in __cpuid in intrin.h
Reid Kleckner [Tue, 6 Nov 2018 20:45:26 +0000 (20:45 +0000)]
[MS] Zero out ECX in __cpuid in intrin.h

Summary:
Some CPUID leafs depend on the value of ECX as well as EAX, but we left
it uninitialized.

Originally reported as https://crbug.com/901547

Reviewers: craig.topper, hans

Subscribers: cfe-commits

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

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

6 years agoT was unused on assertion disabled builds.
Kadir Cetinkaya [Tue, 6 Nov 2018 08:59:25 +0000 (08:59 +0000)]
T was unused on assertion disabled builds.

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

6 years agoCast to uint64_t instead of to unsigned.
Akira Hatanaka [Tue, 6 Nov 2018 07:12:28 +0000 (07:12 +0000)]
Cast to uint64_t instead of to unsigned.

This is a follow-up to r346211.

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

6 years agoos_log: Allow specifying mask type in format string.
Akira Hatanaka [Tue, 6 Nov 2018 07:05:14 +0000 (07:05 +0000)]
os_log: Allow specifying mask type in format string.

A mask type is a 1 to 8-byte string that follows the "mask." annotation
in the format string. This enables obfuscating data in the event the
provided privacy level isn't enabled.

rdar://problem/36756282

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

6 years agoos_log: Add a new privacy annotation "sensitive".
Akira Hatanaka [Tue, 6 Nov 2018 06:26:17 +0000 (06:26 +0000)]
os_log: Add a new privacy annotation "sensitive".

This is a stricter privacy annotation than "private", which will be used
for data that shouldn’t be logged to disk. For backward compatibility,
the "private" bit is set too.

rdar://problem/36755912

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

6 years agoos_log: Minor code cleanups. NFC.
Akira Hatanaka [Tue, 6 Nov 2018 05:41:33 +0000 (05:41 +0000)]
os_log: Minor code cleanups. NFC.

Also, add a new test case and fix an incorrect comment.

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

6 years ago[COFF, ARM64] Implement InterlockedDecrement*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 05:07:43 +0000 (05:07 +0000)]
[COFF, ARM64] Implement InterlockedDecrement*_* builtins

This is eight in a series of patches to move intrinsic definitions out of intrin.h.

Differential: https://reviews.llvm.org/D54068

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

6 years ago[COFF, ARM64] Implement InterlockedIncrement*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 05:05:32 +0000 (05:05 +0000)]
[COFF, ARM64] Implement InterlockedIncrement*_* builtins

This is seventh in a series of patches to move intrinsic definitions out of intrin.h.

Differential: https://reviews.llvm.org/D54067

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

6 years ago[COFF, ARM64] Implement InterlockedAnd*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 05:03:13 +0000 (05:03 +0000)]
[COFF, ARM64] Implement InterlockedAnd*_* builtins

This is sixth in a series of patches to move intrinsic definitions out of intrin.h.

Differential: https://reviews.llvm.org/D54066

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

6 years ago[COFF, ARM64] Implement InterlockedXor*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 04:55:20 +0000 (04:55 +0000)]
[COFF, ARM64] Implement InterlockedXor*_* builtins

This is fifth in a series of patches to move intrinsic definitions out of intrin.h.

Note: This was reviewed and approved in D54065 but somehow that diff was messed
up. Committing this again with the proper diff.

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

6 years ago[CodeGenCXX] XFAIL test for ASAN on Darwin.
Volodymyr Sapsai [Tue, 6 Nov 2018 02:16:28 +0000 (02:16 +0000)]
[CodeGenCXX] XFAIL test for ASAN on Darwin.

The test hits stack overflow trying to instantiate recursive templates.
It is observed with ASAN and not with a regular build because ASAN
increases stack frame size.

rdar://problem/45009892

Reviewers: george.karpenkov, lebedev.ri

Reviewed By: george.karpenkov

Subscribers: dexonsmith, rjmccall, cfe-commits

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

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

6 years agoRevert "[COFF, ARM64] Implement InterlockedXor*_* builtins"
Mandeep Singh Grang [Tue, 6 Nov 2018 01:14:24 +0000 (01:14 +0000)]
Revert "[COFF, ARM64] Implement InterlockedXor*_* builtins"

This reverts commit cc3d3cd0fbeb88412d332354c261ff139c4ede6b.

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

6 years ago[COFF, ARM64] Implement InterlockedXor*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 01:12:29 +0000 (01:12 +0000)]
[COFF, ARM64] Implement InterlockedXor*_* builtins

Summary: This is fifth in a series of patches to move intrinsic definitions out of intrin.h.

Reviewers: rnk, efriedma, mstorsjo, TomTan

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

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

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

6 years ago[COFF, ARM64] Implement InterlockedOr*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 01:11:25 +0000 (01:11 +0000)]
[COFF, ARM64] Implement InterlockedOr*_* builtins

This is fourth in a series of patches to move intrinsic definitions out of intrin.h.

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

6 years ago[COFF, ARM64] Implement InterlockedCompareExchange*_* builtins
Mandeep Singh Grang [Tue, 6 Nov 2018 00:36:48 +0000 (00:36 +0000)]
[COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

Summary: This is third in a series of patches to move intrinsic definitions out of intrin.h.

Reviewers: rnk, efriedma, mstorsjo, TomTan

Reviewed By: efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

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

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

6 years agoAMDGPU: Add sram-ecc feature options
Konstantin Zhuravlyov [Mon, 5 Nov 2018 22:44:59 +0000 (22:44 +0000)]
AMDGPU: Add sram-ecc feature options

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

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

6 years ago[Driver] Reland again again: Default Android toolchains to libc++.
Dan Albert [Mon, 5 Nov 2018 20:57:46 +0000 (20:57 +0000)]
[Driver] Reland again again: Default Android toolchains to libc++.

Landed more fixes to the compiler-rt Android tests.

Original review was https://reviews.llvm.org/D53109.

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

6 years ago[AST] Get aliased type info from an aliased TemplateSpecialization.
Matt Davis [Mon, 5 Nov 2018 17:25:26 +0000 (17:25 +0000)]
[AST] Get aliased type info from an aliased TemplateSpecialization.

Summary:
Previously the TemplateSpecialization instance for 'template_alias', in the example below, returned the type info of the  canonical type (int).  This ignored the type alias if the template type happen to be aliased.

Before this patch, the assert would trigger with an  alignment of 4:
```
typedef int __attribute__(( aligned( 16 ) )) aligned_int;
template < typename >
using template_alias = aligned_int;
static_assert( alignof( template_alias<void>) == 16, "" );
```

This patch checks if the TemplateSpecialization type has an alias, and if so will return the type information for the aliased type, else the canonical type's info is returned (original behavior).  I believe that this is the desired behavior.

Reviewers: aaron.ballman, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

6 years ago[Format] Add debugging to ObjC language guesser
Ben Hamilton [Mon, 5 Nov 2018 16:59:33 +0000 (16:59 +0000)]
[Format] Add debugging to ObjC language guesser

Summary:
To handle diagnosing bugs where ObjCHeaderStyleGuesser guesses
wrong, this diff adds a bit more debug logging to the Objective-C
language guesser.

Reviewers: krasimir

Reviewed By: krasimir

Subscribers: cfe-commits

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

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

6 years ago[Tooling] Correct the total number of files being processed when `filter` is provided.
Haojian Wu [Mon, 5 Nov 2018 15:08:00 +0000 (15:08 +0000)]
[Tooling] Correct the total number of files being processed when `filter` is provided.

Reviewers: ioeric

Subscribers: cfe-commits

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

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

6 years ago[Tooling] Add "-filter" option to AllTUsExecution
Haojian Wu [Mon, 5 Nov 2018 13:42:05 +0000 (13:42 +0000)]
[Tooling] Add "-filter" option to AllTUsExecution

Summary: We can run the tools on a subset files of compilation database.

Reviewers: ioeric

Subscribers: cfe-commits

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

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

6 years agoReapply "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"
Benjamin Kramer [Mon, 5 Nov 2018 12:46:02 +0000 (12:46 +0000)]
Reapply "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"

This reverts commit r345963. We have a path forward now.

Original commit message:
The driver accidentally stopped passing the input filenames on to -cc1
in this mode due to confusion over what action was being requested.

This change also fixes a couple of crashes I encountered when passing
multiple files to such a -cc1 invocation.

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

6 years ago[mips][msa] Fix broken test
Aleksandar Beserminji [Mon, 5 Nov 2018 10:22:51 +0000 (10:22 +0000)]
[mips][msa] Fix broken test

Test builtins-mips-msa-error.c wasn't reporting errors.
This patch fixes the test, so further test cases can be added.

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

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

6 years agoFix breakage on FrontendTest by initializing new field on constructor
Kadir Cetinkaya [Mon, 5 Nov 2018 10:01:34 +0000 (10:01 +0000)]
Fix breakage on FrontendTest by initializing new field on constructor

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

6 years ago[analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to...
Kristof Umann [Mon, 5 Nov 2018 03:50:37 +0000 (03:50 +0000)]
[analyzer] Restrict AnalyzerOptions' interface so that non-checker objects have to be registered

One of the reasons why AnalyzerOptions is so chaotic is that options can be
retrieved from the command line whenever and wherever. This allowed for some
options to be forgotten for a looooooong time. Have you ever heard of
"region-store-small-struct-limit"? In order to prevent this in the future, I'm
proposing to restrict AnalyzerOptions' interface so that only checker options
can be retrieved without special getters. I would like to make every option be
accessible only through a getter, but checkers from plugins are a thing, so I'll
have to figure something out for that.

This also forces developers who'd like to add a new option to register it
properly in the .def file.

This is done by

* making the third checker pointer parameter non-optional, and checked by an
  assert to be non-null.
* I added new, but private non-checkers option initializers, meant only for
  internal use,
* Renamed these methods accordingly (mind the consistent name for once with
  getBooleanOption!):
  - getOptionAsString -> getCheckerStringOption,
  - getOptionAsInteger -> getCheckerIntegerOption
* The 3 functions meant for initializing data members (with the not very
  descriptive getBooleanOption, getOptionAsString and getOptionAsUInt names)
  were renamed to be overloads of the getAndInitOption function name.
* All options were in some way retrieved via getCheckerOption. I removed it, and
  moved the logic to getStringOption and getCheckerStringOption. This did cause
  some code duplication, but that's the only way I could do it, now that checker
  and non-checker options are separated. Note that the non-checker version
  inserts the new option to the ConfigTable with the default value, but the
  checker version only attempts to find already existing entries. This is how
  it always worked, but this is clunky and I might end reworking that too, so we
  can eventually get a ConfigTable that contains the entire configuration of the
  analyzer.

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

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

6 years agoEnsure the correct order of evaluation in part 2. of PlistMacroExpansion
Kristof Umann [Mon, 5 Nov 2018 02:37:29 +0000 (02:37 +0000)]
Ensure the correct order of evaluation in part 2. of PlistMacroExpansion

Windows buildbots break with the previous commit '[analyzer][PlistMacroExpansion]
Part 2.: Retrieving the macro name and primitive expansion'. This patch attempts
to solve this issue.

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

6 years agoReland '[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and primit...
Kristof Umann [Mon, 5 Nov 2018 02:14:36 +0000 (02:14 +0000)]
Reland '[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and primitive expansion'

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

6 years ago[Driver] Use -Bstatic/dynamic for libc++ on Fuchsia
Petr Hosek [Sun, 4 Nov 2018 22:38:47 +0000 (22:38 +0000)]
[Driver] Use -Bstatic/dynamic for libc++ on Fuchsia

-static relies on lld's behavior, but -Bstatic/dynamic is supported
across all linkers.

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

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

6 years agoAdd support of the next Ubuntu (Ubuntu 19.04 - Disco Dingo)
Sylvestre Ledru [Sun, 4 Nov 2018 17:41:41 +0000 (17:41 +0000)]
Add support of the next Ubuntu (Ubuntu 19.04 - Disco Dingo)

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

6 years agoUpdate our URLs in clang doc to use https
Sylvestre Ledru [Sun, 4 Nov 2018 17:02:00 +0000 (17:02 +0000)]
Update our URLs in clang doc to use https

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

6 years agoRevert '[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and primit...
Kristof Umann [Sun, 4 Nov 2018 14:18:37 +0000 (14:18 +0000)]
Revert '[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and primitive expansion'

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

6 years ago[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and primitive...
Kristof Umann [Sun, 4 Nov 2018 13:59:44 +0000 (13:59 +0000)]
[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and primitive expansion

This patch adds a couple new functions to acquire the macro's name, and also
expands it, although it doesn't expand the arguments, as seen from the test files

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

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

6 years ago[Driver] Always match resource dir in Fuchsia driver tests
Petr Hosek [Sun, 4 Nov 2018 03:53:07 +0000 (03:53 +0000)]
[Driver] Always match resource dir in Fuchsia driver tests

This makes the tests stricter by not only matching the runtime file
name, but the entire path into the resource directory.

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

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

6 years ago[coroutines] Fix fallthrough warning on try/catch
Brian Gesiak [Sat, 3 Nov 2018 22:35:17 +0000 (22:35 +0000)]
[coroutines] Fix fallthrough warning on try/catch

Summary:
The test case added in this diff would incorrectly warn that control
flow may fall through without returning. Here's a standalone example:
https://godbolt.org/z/dCwXEi

The same program, but using `return` instead of `co_return`, does not
produce a warning: https://godbolt.org/z/mVldqQ

The issue was in how Clang analysis would structure its representation
of the control-flow graph. Specifically, when constructing the CFG,
`CFGBuilder::Visit` had special handling of a `ReturnStmt`, in which it
would place object destructors in the same CFG block as a `return` statement,
immediately after it. Doing so would allow the logic in
`lib/Sema/AnalysisBasedWarning.cpp` `CheckFallThrough` to work properly in the
program that used `return`, correctly determining that no "plain edges" preceded
the exit block of the function.

Because a `co_return` statement would not enjoy the same treatment when
it was being built into the control-flow graph, object destructors
would not be placed in the same CFG block as the `co_return`, thus
resulting in a "plain edge" preceding the exit block of the function,
and so the warning logic would be triggered.

Add special casing for `co_return` to Clang analysis, thereby
remedying the mistaken warning.

Test Plan: `check-clang`

Reviewers: GorNishanov, tks2103, rsmith

Reviewed By: GorNishanov

Subscribers: EricWF, lewissbaker, cfe-commits

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

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

6 years agoFix test on Windows.
Douglas Yung [Sat, 3 Nov 2018 08:51:27 +0000 (08:51 +0000)]
Fix test on Windows.

This test checks the entire output of a help option, the problem
is that on Windows, the line break occurs in a different place
causing the CHECK to fail because it is not expecting a line break.

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

6 years agoAdd /Zc:DllexportInlines option to clang-cl
Takuto Ikuta [Sat, 3 Nov 2018 06:45:00 +0000 (06:45 +0000)]
Add /Zc:DllexportInlines option to clang-cl

Summary:
This CL adds /Zc:DllexportInlines flag to clang-cl.
When Zc:DllexportInlines- is specified, inline class member function is not exported if the function does not have local static variables.

By not exporting inline function, code for those functions are not generated and that reduces both compile time and obj size. Also this flag does not import inline functions from dllimported class if the function does not have local static variables.

On my 24C48T windows10 machine, build performance of chrome target in chromium repository is like below.
These stats are come with 'target_cpu="x86" enable_nacl = false is_component_build=true dcheck_always_on=true` build config and applied
* https://chromium-review.googlesource.com/c/chromium/src/+/1212379
* https://chromium-review.googlesource.com/c/v8/v8/+/1186017

Below stats were taken with this patch applied on https://github.com/llvm-project/llvm-project-20170507/commit/a05115cd4c57ff76b0f529e38118765b58ed7f2e

| config                          | build time | speedup | build dir size |
| with patch, PCH on, debug       | 1h10m0s    | x1.13   | 35.6GB         |
| without patch, PCH on, debug    | 1h19m17s   |         | 49.0GB         |
| with patch, PCH off, debug      | 1h15m45s   | x1.16   | 33.7GB         |
| without patch, PCH off, debug   | 1h28m10s   |         | 52.3GB         |
| with patch, PCH on, release     | 1h13m13s   | x1.22   | 26.2GB         |
| without patch, PCH on, release  | 1h29m57s   |         | 37.5GB         |
| with patch, PCH off, release    | 1h23m38s   | x1.32   | 23.7GB         |
| without patch, PCH off, release | 1h50m50s   |         | 38.7GB         |

This patch reduced obj size and the number of exported symbols largely, that improved link time too.
e.g. link time stats of blink_core.dll become like below
|                              | cold disk cache | warm disk cache |
| with patch, PCH on, debug    | 71s             | 30s             |
| without patch, PCH on, debug | 111s            | 48s             |

This patch's implementation is based on Nico Weber's patch. I modified to support static local variable, added tests and took stats.

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

Reviewers: hans, thakis, rnk, javed.absar

Reviewed By: hans

Subscribers: kristof.beyls, smeenai, dschuff, probinson, cfe-commits, eraman

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

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

6 years agoRevert r345562: "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of...
Richard Smith [Sat, 3 Nov 2018 02:23:33 +0000 (02:23 +0000)]
Revert r345562: "PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type"

This exposes a (known) CodeGen bug: it can't cope with emitting lvalue
expressions that denote non-odr-used but usable-in-constant-expression
variables. See PR39528 for a testcase.

Reverted for now until that issue can be fixed.

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

6 years ago[Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia
Petr Hosek [Sat, 3 Nov 2018 01:43:25 +0000 (01:43 +0000)]
[Driver] Use -push-/-pop-state and -as-needed for libc++ on Fuchsia

This avoids introducing unnecessary DT_NEEDED entries when using
C++ driver for linking C code or C++ code that doesn't use C++
standard library.

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

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

6 years ago[CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes
Petr Hosek [Fri, 2 Nov 2018 23:49:36 +0000 (23:49 +0000)]
[CMake][Fuchsia] Set -fuse-ld=lld explicitly for Linux runtimes

We set lld as the default linker on non-Darwin platforms, but we still
need to set -fuse-ld=lld explicitly in to support cross-compiling Linux
runtimes on Darwin.

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

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

6 years agoAdd an explicit -std=c++14 to this test.
Adrian Prantl [Fri, 2 Nov 2018 22:19:02 +0000 (22:19 +0000)]
Add an explicit -std=c++14 to this test.

rdar://problem/45642490

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

6 years ago[COFF, ARM64] Implement InterlockedExchange*_* builtins
Mandeep Singh Grang [Fri, 2 Nov 2018 21:18:23 +0000 (21:18 +0000)]
[COFF, ARM64] Implement InterlockedExchange*_* builtins

Summary: Windows SDK needs these intrinsics to be proper builtins.  This is second in a series of patches to move intrinsic defintions out of intrin.h.

Reviewers: rnk, mstorsjo, efriedma, TomTan

Reviewed By: rnk, efriedma

Subscribers: javed.absar, kristof.beyls, chrib, jfb, kristina, cfe-commits

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

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

6 years agoDiagnose parameter names that shadow the names of inherited fields under -Wshadow...
Aaron Ballman [Fri, 2 Nov 2018 21:04:44 +0000 (21:04 +0000)]
Diagnose parameter names that shadow the names of inherited fields under -Wshadow-field.

This addresses PR34120. Note, unlike GCC, we take into account the accessibility of the field when deciding whether to warn or not.

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

6 years agoAttempt to fix 'logical operation on address of string constant'
Kristof Umann [Fri, 2 Nov 2018 19:48:56 +0000 (19:48 +0000)]
Attempt to fix 'logical operation on address of string constant'

Caused a lot of warnings for Windows:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/21178/steps/build/logs/warnings%20%2867%29

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

6 years ago[analyzer] Fixup of the module build after https://reviews.llvm.org/D53277
George Karpenkov [Fri, 2 Nov 2018 18:28:52 +0000 (18:28 +0000)]
[analyzer] Fixup of the module build after https://reviews.llvm.org/D53277

Adds AnalyzerOptions.def to the list of textual headers.

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

6 years ago[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry
Mandeep Singh Grang [Fri, 2 Nov 2018 18:10:07 +0000 (18:10 +0000)]
[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry

Summary: ARM64 setjmp expects sp on entry instead of framepointer.

Patch by: Yin Ma (yinma@codeaurora.org)

Reviewers: mgrang, eli.friedman, ssijaric, mstorsjo, rnk, compnerd

Reviewed By: mgrang

Subscribers: efriedma, javed.absar, kristof.beyls, chrib, cfe-commits

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

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

6 years ago[CodeGen] Fix a crash when updating a designated initializer
Erik Pilkington [Fri, 2 Nov 2018 17:36:58 +0000 (17:36 +0000)]
[CodeGen] Fix a crash when updating a designated initializer

We need to handle the ConstantAggregateZero case here too.

rdar://45691981

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

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

6 years agoChange -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address...
Filipe Cabecinhas [Fri, 2 Nov 2018 17:29:04 +0000 (17:29 +0000)]
Change -fsanitize-address-poison-class-member-array-new-cookie to -fsanitize-address-poison-custom-array-cookie

Handle it in the driver and propagate it to cc1

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

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

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

6 years agoRemove the duplicated definition of size_t
Kristof Umann [Fri, 2 Nov 2018 17:00:07 +0000 (17:00 +0000)]
Remove the duplicated definition of size_t

So hopefully windows won't complain.

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

6 years agoDidn't -> didnt, because #errors complains about untermianted '
Kristof Umann [Fri, 2 Nov 2018 16:32:15 +0000 (16:32 +0000)]
Didn't -> didnt, because #errors complains about untermianted '

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

6 years ago[analyzer] Fix diagnostics/explicit-suppression.cpp
Fangrui Song [Fri, 2 Nov 2018 16:23:37 +0000 (16:23 +0000)]
[analyzer] Fix diagnostics/explicit-suppression.cpp

*OI++ = *II++ is on line 670, not 668

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

6 years ago[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.
Alexey Bataev [Fri, 2 Nov 2018 16:08:31 +0000 (16:08 +0000)]
[OPENMP][NVPTX]Use __kmpc_data_sharing_coalesced_push_stack function.

Coalesced memory access requires use of the new function
`__kmpc_data_sharing_coalesced_push_stack` instead of the
`__kmpc_data_sharing_push_stack`.

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

6 years ago[analyzer] Put llvm.Conventions back in alpha
Kristof Umann [Fri, 2 Nov 2018 16:02:10 +0000 (16:02 +0000)]
[analyzer] Put llvm.Conventions back in alpha

Interestingly, this many year old (when I last looked I remember 2010ish)
checker was committed without any tests, so I thought I'd implement them, but I
was shocked to see how I barely managed to get it working. The code is severely
outdated, I'm not even sure it has ever been used, so I'd propose to move it
back into alpha, and possibly even remove it.

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

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

6 years ago[analyzer] New flag to print all -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:59:37 +0000 (15:59 +0000)]
[analyzer] New flag to print all -analyzer-config options

A new -cc1 flag is avaible for the said purpose: -analyzer-config-help

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

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

6 years ago[analyzer][NFC] Collect all -analyzer-config options in a .def file
Kristof Umann [Fri, 2 Nov 2018 15:50:44 +0000 (15:50 +0000)]
[analyzer][NFC] Collect all -analyzer-config options in a .def file

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from the
command line, and be able to list them all.

In this patch, I'm moving all analyzer options to a def file, and move 2 enums
to global namespace.

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

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

6 years ago[analyzer][NFC] Fix some incorrect uses of -analyzer-config options
Kristof Umann [Fri, 2 Nov 2018 15:48:10 +0000 (15:48 +0000)]
[analyzer][NFC] Fix some incorrect uses of -analyzer-config options

I'm in the process of refactoring AnalyzerOptions. The main motivation behind
here is to emit warnings if an invalid -analyzer-config option is given from
the command line, and be able to list them all.

In this patch, I found some flags that should've been used as checker options,
or have absolutely no mention of in AnalyzerOptions, or are nonexistent.

- NonLocalizedStringChecker now uses its "AggressiveReport" flag as a checker
    option
- lib/StaticAnalyzer/Frontend/ModelInjector.cpp now accesses the "model-path"
    option through a getter in AnalyzerOptions
- -analyzer-config path-diagnostics-alternate=false is not a thing, I removed it,
- lib/StaticAnalyzer/Checkers/AllocationDiagnostics.cpp and
    lib/StaticAnalyzer/Checkers/AllocationDiagnostics.h are weird, they actually
    only contain an option getter. I deleted them, and fixed RetainCountChecker
    to get it's "leak-diagnostics-reference-allocation" option as a checker option,
- "region-store-small-struct-limit" has a proper getter now.

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

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

6 years ago[OPENMP]Change the mapping type for lambda captures.
Alexey Bataev [Fri, 2 Nov 2018 15:25:06 +0000 (15:25 +0000)]
[OPENMP]Change the mapping type for lambda captures.

The previously used combination `PTR_AND_OBJ | PRIVATE` could be used for mapping of some data in Fortran. Changed it to `PTR_AND_OBJ | LITERAL`.

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

6 years ago[OPENMP][NVPTX]Improve emission of the globalized variables for
Alexey Bataev [Fri, 2 Nov 2018 14:54:07 +0000 (14:54 +0000)]
[OPENMP][NVPTX]Improve emission of the globalized variables for
target/teams/distribute regions.

Target/teams/distribute regions exist for all the time the kernel is
executed. Thus, if the variable is declared in their context and then
escape it, we can allocate global memory statically instead of
allocating it dynamically.
Patch captures all the globalized variables in target/teams/distribute
contexts, merges them into the records, one per each target region.
Those records are then joined into the union, one per compilation unit
(to save the global memory). Those units are organized into
2 x dimensional arrays, where the first dimension is
the number of blocks per SM and the second one is the number of SMs.
Runtime functions manage this global memory space between the executing
teams.

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

6 years agoReapply Logging: make os_log buffer size an integer constant expression.
Tim Northover [Fri, 2 Nov 2018 13:14:11 +0000 (13:14 +0000)]
Reapply Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

This also moves the OSLog and other FormatString helpers from
libclangAnalysis to libclangAST to avoid a circular dependency.

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

6 years agoAdd support for 'atomic_default_mem_order' clause on 'requires' directive. Also renam...
Patrick Lyster [Fri, 2 Nov 2018 12:18:11 +0000 (12:18 +0000)]
Add support for 'atomic_default_mem_order' clause on 'requires' directive. Also renamed test files relating to 'requires'. Differntial review: https://reviews.llvm.org/D53513

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

6 years ago[analyzer][CTU] Correctly signal in the function index generation tool if there was...
Gabor Horvath [Fri, 2 Nov 2018 11:22:22 +0000 (11:22 +0000)]
[analyzer][CTU] Correctly signal in the function index generation tool if there was an error

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

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

6 years agoRevert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"
Ilya Biryukov [Fri, 2 Nov 2018 10:50:26 +0000 (10:50 +0000)]
Revert "Fix regression in behavior of clang -x c++-header -fmodule-name=XXX"

This reverts commit r345803 and r345915 (a follow-up fix to r345803).

Reason: r345803 blocks our internal integrate because of the new
warnings showing up in too many places. The fix is actually correct,
we will reland it after figuring out how to integrate properly.

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

6 years agoFix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds
Fangrui Song [Fri, 2 Nov 2018 04:09:08 +0000 (04:09 +0000)]
Fix -Wimplicit-fallthrough warning in LLVM_ENABLE_ASSERTIONS=Off builds

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

6 years agoWhen building a header module, treat inputs as headers rather than
Richard Smith [Fri, 2 Nov 2018 00:24:40 +0000 (00:24 +0000)]
When building a header module, treat inputs as headers rather than
source files.

This suppresses certain warnings (eg, '#include_next in main source
file').

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

6 years ago[CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.
Volodymyr Sapsai [Thu, 1 Nov 2018 22:50:08 +0000 (22:50 +0000)]
[CodeGen] Fix assertion on referencing constexpr Obj-C object with ARC.

Failed assertion is
> Assertion failed: ((ND->isUsed(false) || !isa<VarDecl>(ND) || !E->getLocation().isValid()) && "Should not use decl without marking it used!"), function EmitDeclRefLValue, file llvm-project/clang/lib/CodeGen/CGExpr.cpp, line 2437.

`EmitDeclRefLValue` mentions
> // A DeclRefExpr for a reference initialized by a constant expression can
> // appear without being odr-used. Directly emit the constant initializer.

The fix is to use the similar approach for non-references as for references. It
is achieved by trying to emit a constant before we attempt to load non-odr-used
variable as LValue.

rdar://problem/40650504

Reviewers: ahatanak, rjmccall

Reviewed By: rjmccall

Subscribers: dexonsmith, erik.pilkington, cfe-commits

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

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

6 years ago[CodeGen] Move `emitConstant` from ScalarExprEmitter to CodeGenFunction. NFC.
Volodymyr Sapsai [Thu, 1 Nov 2018 21:57:05 +0000 (21:57 +0000)]
[CodeGen] Move `emitConstant` from ScalarExprEmitter to CodeGenFunction. NFC.

The goal is to use `emitConstant` in more places. Didn't move
`ComplexExprEmitter::emitConstant` because it returns a different type.

Reviewers: rjmccall, ahatanak

Reviewed By: rjmccall

Subscribers: dexonsmith, erik.pilkington, cfe-commits

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

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

6 years ago[CMake][Fuchsia] Don't restrict Linux runtimes to UNIX
Petr Hosek [Thu, 1 Nov 2018 20:36:33 +0000 (20:36 +0000)]
[CMake][Fuchsia] Don't restrict Linux runtimes to UNIX

This allows building Linux runtimes on any platform if the correct
sysroot is provided via CMake option.

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

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

6 years agoFix clang -Wimplicit-fallthrough warnings across llvm, NFC
Reid Kleckner [Thu, 1 Nov 2018 19:54:45 +0000 (19:54 +0000)]
Fix clang -Wimplicit-fallthrough warnings across llvm, NFC

This patch should not introduce any behavior changes. It consists of
mostly one of two changes:
1. Replacing fall through comments with the LLVM_FALLTHROUGH macro
2. Inserting 'break' before falling through into a case block consisting
   of only 'break'.

We were already using this warning with GCC, but its warning behaves
slightly differently. In this patch, the following differences are
relevant:
1. GCC recognizes comments that say "fall through" as annotations, clang
   doesn't
2. GCC doesn't warn on "case N: foo(); default: break;", clang does
3. GCC doesn't warn when the case contains a switch, but falls through
   the outer case.

I will enable the warning separately in a follow-up patch so that it can
be cleanly reverted if necessary.

Reviewers: alexfh, rsmith, lattner, rtrieu, EricWF, bollu

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

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

6 years agoOutput "rule" information in SARIF exports.
Aaron Ballman [Thu, 1 Nov 2018 18:57:38 +0000 (18:57 +0000)]
Output "rule" information in SARIF exports.

SARIF allows you to export descriptions about rules that are present in the SARIF log. Expose the help text table generated into Checkers.inc as the rule's "full description" and export all of the rules present in the analysis output. This information is useful for analysis result viewers like CodeSonar.

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

6 years agoAdd LLVM_FALLTHROUGH annotation after switch
Reid Kleckner [Thu, 1 Nov 2018 18:53:02 +0000 (18:53 +0000)]
Add LLVM_FALLTHROUGH annotation after switch

This silences a -Wimplicit-fallthrough warning from clang. GCC does not
appear to warn when the case body ends in a switch.

This is a somewhat surprising but intended fallthrough that I pulled out
from my mechanical patch. The code intends to handle 'Yi' and related
constraints as the 'x' constraint.

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

6 years agoRevert "[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry"
Mandeep Singh Grang [Thu, 1 Nov 2018 18:38:26 +0000 (18:38 +0000)]
Revert "[COFF, ARM64] Change setjmp for AArch64 Windows to use Intrinsic.sponentry"

This reverts commit 619111f5ccf349b635e4987ec02d15777c571495.

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

6 years agoRevert "Reapply Logging: make os_log buffer size an integer constant expression."
Tim Northover [Thu, 1 Nov 2018 18:37:42 +0000 (18:37 +0000)]
Revert "Reapply Logging: make os_log buffer size an integer constant expression."

Still more dependency hell.

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

6 years agoReapply Logging: make os_log buffer size an integer constant expression.
Tim Northover [Thu, 1 Nov 2018 18:04:49 +0000 (18:04 +0000)]
Reapply Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

This also moves the OSLog helpers from libclangAnalysis to libclangAST
to avoid a circular dependency.

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

6 years agoReplace two fallthrough annotations after covered switch with unreachable
Reid Kleckner [Thu, 1 Nov 2018 17:51:48 +0000 (17:51 +0000)]
Replace two fallthrough annotations after covered switch with unreachable

Both preceding switches handle all possible enumerators, so the
fallthrough is actually unreachable. This strengthens that to an
assertion.

The first instance had a comment from 2010 indicating that fallthrough
was possible, but that was back when we had a unary operator for
offsetof. Now it is its own expression kind, so the annotation was
stale.

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

6 years ago[Diagnostics] Implement -Wsizeof-pointer-div
David Bolvansky [Thu, 1 Nov 2018 16:26:10 +0000 (16:26 +0000)]
[Diagnostics] Implement -Wsizeof-pointer-div

Summary:
void test(int *arr) {
    int arr_len = sizeof(arr) / sizeof(*arr);  // warn, incorrect way to compute number of array elements
}

Enabled under -Wall (same behaviour as GCC)

Reviewers: rsmith, MTC, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: MTC, thakis, jfb, cfe-commits

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

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

6 years agoRevert "Logging: make os_log buffer size an integer constant expression.
Tim Northover [Thu, 1 Nov 2018 16:15:24 +0000 (16:15 +0000)]
Revert "Logging: make os_log buffer size an integer constant expression.

This also reverts a couple of follow-up commits trying to fix the
dependency issues. Latest revision added a cyclic dependency that can't
just be patched up in 5 minutes.

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

6 years ago[clang] Improve ctor initializer completions.
Kadir Cetinkaya [Thu, 1 Nov 2018 15:54:18 +0000 (15:54 +0000)]
[clang] Improve ctor initializer completions.

Summary:
Instead of providing generic "args" for member and base class
initializers, tries to fetch relevant constructors and show their signatures.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: ZaMaZaN4iK, eraman, arphaman, cfe-commits

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

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

6 years agoMultiversioning- Ensure all MV functions are emitted.
Erich Keane [Thu, 1 Nov 2018 15:11:43 +0000 (15:11 +0000)]
Multiversioning- Ensure all MV functions are emitted.

Multiverson function versions are always used (by the resolver), so ensure that
they are always emitted.

Change-Id: I5d2e0841fddf0d18918b3fb92ae76814add7ee96

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

6 years agoCPU-Dispatch- Fix type of a member function, prevent deferrals
Erich Keane [Thu, 1 Nov 2018 15:11:41 +0000 (15:11 +0000)]
CPU-Dispatch- Fix type of a member function, prevent deferrals

The member type creation for a cpu-dispatch function was not correctly
including the 'this' parameter, so ensure that the type is properly
determined. Also, disable defer in the cases of emitting the functoins,
as it can end up resulting in the wrong version being emitted.

Change-Id: I0b8fc5e0b0d1ae1a9d98fd54f35f27f6e5d5d083

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

6 years agoLogging: put link against libclangAnalysis rather than libLLVMAnalysis for os_log
Tim Northover [Thu, 1 Nov 2018 14:43:35 +0000 (14:43 +0000)]
Logging: put link against libclangAnalysis rather than libLLVMAnalysis for os_log

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

6 years agoLogging: add CMake dependency so libAST can use OSLog analysis.
Tim Northover [Thu, 1 Nov 2018 14:22:20 +0000 (14:22 +0000)]
Logging: add CMake dependency so libAST can use OSLog analysis.

Should fix bots on platforms with slightly different symbol resolution
semantics.

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

6 years agoLogging: make os_log buffer size an integer constant expression.
Tim Northover [Thu, 1 Nov 2018 13:49:54 +0000 (13:49 +0000)]
Logging: make os_log buffer size an integer constant expression.

The size of an os_log buffer is known at any stage of compilation, so making it
a constant expression means that the common idiom of declaring a buffer for it
won't result in a VLA. That allows the compiler to skip saving and restoring
the stack pointer around such buffers.

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

6 years agoCPU-Dispatch-- Fix conflict between 'generic' and 'pentium'
Erich Keane [Thu, 1 Nov 2018 12:50:37 +0000 (12:50 +0000)]
CPU-Dispatch-- Fix conflict between 'generic' and 'pentium'

When a dispatch function was being emitted that had both a generic and a
pentium configuration listed, we would assert.  This is because neither
configuration has any 'features' associated with it so they were both
considered the 'default' version.  'pentium' lacks any features because
we implement it in terms of __builtin_cpu_supports (instead of Intel
proprietary checks), which is unable to decern between the two.

The fix for this is to omit the 'generic' version from the dispatcher if
both are present. This permits existing code to compile, and still will
choose the 'best' version available (since 'pentium' is technically
better than 'generic').

Change-Id: I4b69f3e0344e74cbdbb04497845d5895dd05fda0

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