]> granicus.if.org Git - clang/log
clang
7 years agoRemove duplicate condition (PR30648). NFCI.
Simon Pilgrim [Wed, 16 Nov 2016 16:11:08 +0000 (16:11 +0000)]
Remove duplicate condition (PR30648). NFCI.

We only need to check that the bitstream entry is a Record.

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

7 years agoAdd a little endian variant of TCE.
Pekka Jaaskelainen [Wed, 16 Nov 2016 15:22:31 +0000 (15:22 +0000)]
Add a little endian variant of TCE.

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

7 years ago[www] Fix spelling error in checker release notes.
Devin Coughlin [Wed, 16 Nov 2016 14:23:41 +0000 (14:23 +0000)]
[www] Fix spelling error in checker release notes.

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

7 years agoRangify for loop, NFC.
Yaron Keren [Wed, 16 Nov 2016 13:45:34 +0000 (13:45 +0000)]
Rangify for loop, NFC.

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

7 years ago[OpenCL] Use the semantic spelling of the Access attribute, rather than a string.
Joey Gouly [Wed, 16 Nov 2016 11:34:09 +0000 (11:34 +0000)]
[OpenCL] Use the semantic spelling of the Access attribute, rather than a string.

Also fix a latent bug, due to an incorrect traversal of the AttributeList.

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

7 years ago[X86][AVX512] Replace lossless i32/u32 to f64 conversion intrinsics with generic IR
Simon Pilgrim [Wed, 16 Nov 2016 09:27:40 +0000 (09:27 +0000)]
[X86][AVX512] Replace lossless i32/u32 to f64 conversion intrinsics with generic IR

Both the (V)CVTDQ2PD (i32 to f64) and (V)CVTUDQ2PD (u32 to f64) conversion instructions are lossless and can be safely represented as generic __builtin_convertvector calls instead of x86 intrinsics without affecting final codegen.

This patch removes the clang builtins and their use in the headers - a future patch will deal with removing the llvm intrinsics.

This is an extension patch to D20528 which dealt with the equivalent sse/avx cases.

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

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

7 years agoImprove handling of __FUNCTION__ and other predefined expression for Objective-C...
Mehdi Amini [Wed, 16 Nov 2016 07:07:28 +0000 (07:07 +0000)]
Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks

Instead of always displaying the mangled name, try to do better
and get something closer to regular functions.

Recommit r287039 (that was reverted in r287039) with a tweak to
be more generic, and test fixes!

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

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

7 years ago[Driver] Infer the correct option to ld64 for -fembed-bitcode
Steven Wu [Wed, 16 Nov 2016 06:06:44 +0000 (06:06 +0000)]
[Driver] Infer the correct option to ld64 for -fembed-bitcode

Summary:
-fembed-bitcode infers -bitcode_bundle to ld64 but it is not correctly
passed when using LTO. LTO is a special case of -fembed-bitcode which
it doesn't require embed the bitcode in a special section in the object
file but it requires linker to save that as part of the final executable.

rdar://problem/29274226

Reviewers: mehdi_amini

Subscribers: cfe-commits

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

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

7 years agoRevert "[OPENMP] Fixed codegen for 'omp cancel' construct."
Vitaly Buka [Wed, 16 Nov 2016 01:01:22 +0000 (01:01 +0000)]
Revert "[OPENMP] Fixed codegen for 'omp cancel' construct."

Summary:
r286944 introduced bugs detected by ASAN as use-after-return.
r287025 have not fixed them completely.

This reverts commit r286944 and r287025.

Reviewers: ABataev

Subscribers: cfe-commits

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

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

7 years agoOutline evaluation of calls to builtins to avoid inflating stack usage for the
Richard Smith [Wed, 16 Nov 2016 00:57:23 +0000 (00:57 +0000)]
Outline evaluation of calls to builtins to avoid inflating stack usage for the
common case of a call to a non-builtin, particularly for unoptimized ASan
builds (where the per-variable stack usage can be quite high).

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

7 years ago[www] Update analyzer website for release of checker-279
Devin Coughlin [Wed, 16 Nov 2016 00:47:56 +0000 (00:47 +0000)]
[www] Update analyzer website for release of checker-279

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

7 years agoPR23281: Fix implementation of DR1891 to implement the intent: that is, a
Richard Smith [Wed, 16 Nov 2016 00:03:24 +0000 (00:03 +0000)]
PR23281: Fix implementation of DR1891 to implement the intent: that is, a
lambda-expression does not have a move-assignment operator.

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

7 years ago[analyzer] NumberObjectConversion: Workaround for a linker error with modules.
Artem Dergachev [Tue, 15 Nov 2016 22:22:57 +0000 (22:22 +0000)]
[analyzer] NumberObjectConversion: Workaround for a linker error with modules.

A combination of C++ modules, variadic functions with more than one argument,
and const globals in headers (all three being necessary) causes some releases
of clang to misplace the matcher objects, which causes the linker to fail.

No functional change - the extra allOf() matcher is no-op here.

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

7 years agoRevert "Improve handling of __FUNCTION__ and other predefined expression for Objectiv...
Mehdi Amini [Tue, 15 Nov 2016 22:19:50 +0000 (22:19 +0000)]
Revert "Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks"

This reverts commit r287039, tests are broken.

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

7 years agoImprove handling of __FUNCTION__ and other predefined expression for Objective-C...
Mehdi Amini [Tue, 15 Nov 2016 21:47:11 +0000 (21:47 +0000)]
Improve handling of __FUNCTION__ and other predefined expression for Objective-C Blocks

Instead of always displaying the mangled name, try to do better
and get something closer to regular functions.

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

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

7 years ago[AArch64] Add driver tests for Qualcomm's Falkor CPU.
Chad Rosier [Tue, 15 Nov 2016 21:34:31 +0000 (21:34 +0000)]
[AArch64] Add driver tests for Qualcomm's Falkor CPU.

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

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

7 years ago[OPENMP] Fix stack use after delete, NFC.
Alexey Bataev [Tue, 15 Nov 2016 20:57:18 +0000 (20:57 +0000)]
[OPENMP] Fix stack use after delete, NFC.

Fixed possible use of stack variable after deletion.

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

7 years ago[libclang] Generalize clang_getNumTemplateArguments and clang_getTemplateArgumentAsTy...
Argyrios Kyrtzidis [Tue, 15 Nov 2016 20:51:46 +0000 (20:51 +0000)]
[libclang] Generalize clang_getNumTemplateArguments and clang_getTemplateArgumentAsType to other kind of specializations.

Patch by Emilio Cobos Álvarez!
https://reviews.llvm.org/D26663

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

7 years agoAdd comments on how to print error retuned by tooling::Replacements::add().
Eric Liu [Tue, 15 Nov 2016 19:05:40 +0000 (19:05 +0000)]
Add comments on how to print error retuned by tooling::Replacements::add().

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

7 years ago[AMDGPU] Add wave barrier builtin
Stanislav Mekhanoshin [Tue, 15 Nov 2016 18:58:03 +0000 (18:58 +0000)]
[AMDGPU] Add wave barrier builtin

The wave barrier represents the discardable barrier. Its main purpose is to
carry convergent attribute, thus preventing illegal CFG optimizations. All lanes
in a wave come to convergence point simultaneously with SIMT, thus no special
instruction is needed in the ISA. The barrier is discarded during code generation.

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

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

7 years ago[Modules] Replace arrays with init lists.
Benjamin Kramer [Tue, 15 Nov 2016 18:56:39 +0000 (18:56 +0000)]
[Modules] Replace arrays with init lists.

Thi way the compiler can pick the optimal storage duration. It's also
more readable. No functional change intended.

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

7 years ago[analyzer] Add check for when block is called with too few arguments.
Devin Coughlin [Tue, 15 Nov 2016 18:40:46 +0000 (18:40 +0000)]
[analyzer] Add check for when block is called with too few arguments.

The CallAndMessageChecker has an existing check for when a function pointer
is called with too few arguments. Extend this logic to handle the block
case, as well. While we're at it, do a drive-by grammar correction
("less" --> "fewer") on the diagnostic text.

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

7 years agoFixed spelling in comments. NFCI.
Simon Pilgrim [Tue, 15 Nov 2016 18:28:07 +0000 (18:28 +0000)]
Fixed spelling in comments. NFCI.

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

7 years agovector load store with length (left justified) clang portion
Zaara Syeda [Tue, 15 Nov 2016 18:04:13 +0000 (18:04 +0000)]
vector load store with length (left justified) clang portion

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

7 years agotest commmit
Zaara Syeda [Tue, 15 Nov 2016 15:57:33 +0000 (15:57 +0000)]
test commmit

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

7 years ago[clang-format] Fixed line merging of more than two lines
Cameron Desrochers [Tue, 15 Nov 2016 15:07:07 +0000 (15:07 +0000)]
[clang-format] Fixed line merging of more than two lines

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

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

7 years ago[PowerPC] Implement BE VSX load/store builtins - clang portion.
Tony Jiang [Tue, 15 Nov 2016 14:30:56 +0000 (14:30 +0000)]
[PowerPC] Implement BE VSX load/store builtins - clang portion.

This patch implements all the overloads for vec_xl_be and vec_xst_be. On BE,
they behaves exactly the same with vec_xl and vec_xst, therefore they are
simply implemented by defining a matching macro. On LE, they are implemented
by defining new builtins and intrinsics. For int/float/long long/double, it
is just a load (lxvw4x/lxvd2x) or store(stxvw4x/stxvd2x). For char/char/short,
we also need some extra shuffling before or after call the builtins to get the
desired BE order. For int128, simply call vec_xl or vec_xst.

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

7 years ago[OPENMP] Fix for PR30632: Name mangling issue.
Alexey Bataev [Tue, 15 Nov 2016 13:15:20 +0000 (13:15 +0000)]
[OPENMP] Fix for PR30632: Name mangling issue.

Reworked fix after comments from Richard Smith. We must skip all
CapturedDecl-based contexts when trying to get correct mangling number
context.

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

7 years ago[test] Correctly include build llvm_shlib_dir in stand-alone builds
Michal Gorny [Tue, 15 Nov 2016 12:54:10 +0000 (12:54 +0000)]
[test] Correctly include build llvm_shlib_dir in stand-alone builds

Add the build llvm_shlib_dir into LD_LIBRARY_PATH before the directory
specified as llvm_libs_dir, in order to fix stand-alone builds
attempting to use installed clang libraries.

In case of stand-alone builds llvm_libs_dir specifies the location of
installed LLVM libraries which can also contain an older version
(previous build) of clang libraries. Therefore, ensure to specify
llvm_shlib_dir (which is always the build tree path) before
the potentially-system llvm_libs_dir.

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

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

7 years ago[OPENMP] Fixed codegen for 'omp cancel' construct.
Alexey Bataev [Tue, 15 Nov 2016 09:11:50 +0000 (09:11 +0000)]
[OPENMP] Fixed codegen for 'omp cancel' construct.

If 'omp cancel' construct is used in a worksharing construct it may cause
hanging of the software in case if reduction clause is used. Patch fixes
this problem by avoiding extra reduction processing for branches that
were canceled.

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

7 years ago[analyzer] Rename assumeWithinInclusiveRange*()
Dominic Chen [Tue, 15 Nov 2016 01:54:41 +0000 (01:54 +0000)]
[analyzer] Rename assumeWithinInclusiveRange*()

Summary: The name is slightly confusing, since the constraint is not necessarily within the range unless `Assumption` is true. Split out renaming for ConstraintManager.h from D26061

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

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

7 years ago[analyzer] Minor optimization: avoid setting state if unchanged
Dominic Chen [Tue, 15 Nov 2016 01:40:58 +0000 (01:40 +0000)]
[analyzer] Minor optimization: avoid setting state if unchanged

Summary: Split out optimization from D26061

Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

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

7 years ago[analyzer] Fix crash in NullabilityChecker calling block with too few arguments
Devin Coughlin [Mon, 14 Nov 2016 22:46:02 +0000 (22:46 +0000)]
[analyzer] Fix crash in NullabilityChecker calling block with too few arguments

Fix a crash when checking parameter nullability on a block invocation
with fewer arguments than the block declaration requires.

rdar://problem/29237566

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

7 years ago[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET when building compiler-rt from...
Kuba Brecka [Mon, 14 Nov 2016 22:38:57 +0000 (22:38 +0000)]
[sanitizer] Passthrough CMAKE_OSX_DEPLOYMENT_TARGET when building compiler-rt from clang/runtime/CMakeLists.txt

This breaks some Swift builds, because Swift's build scripts explicitly set CMAKE_OSX_DEPLOYMENT_TARGET. This however isn't propagated to the compiler-rt build, causing build errors.

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

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

7 years ago[PPC] altivec.h functions for converting half precision to single precision.
Sean Fertile [Mon, 14 Nov 2016 18:47:15 +0000 (18:47 +0000)]
[PPC] altivec.h functions for converting half precision to single precision.

Adds 2 vector functions for converting from a vector of unsigned short to a
vector of float. One converts the low 4 halfwords and one converts the high
4 halfwords.

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

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

7 years agoFix OpenCL test for buildbot by removing extra (erroneous) RUN line
Anastasia Stulova [Mon, 14 Nov 2016 18:11:09 +0000 (18:11 +0000)]
Fix OpenCL test for buildbot by removing extra (erroneous) RUN line

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

7 years ago[OpenCL] Fix for integer parameters of enqueue_kernel
Anastasia Stulova [Mon, 14 Nov 2016 17:39:58 +0000 (17:39 +0000)]
[OpenCL] Fix for integer parameters of enqueue_kernel

Make handling integer parameters more flexible:

- For the number of events argument allow to pass larger
integers than 32 bits as soon as compiler can prove that
the range fits in 32 bits. If not, the diagnostic will be given.

- Change type of the arguments specifying the sizes of
the corresponding block arguments to be size_t.

Review: https://reviews.llvm.org/D26509

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

7 years ago[clang docs] Minor fix in ClangCheck.rst
Mandeep Singh Grang [Mon, 14 Nov 2016 17:31:24 +0000 (17:31 +0000)]
[clang docs] Minor fix in ClangCheck.rst

Reviewers: djasper, rengolin

Subscribers: Eugene.Zelenko

Tags: #clang-c

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

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

7 years agoFix the unit test darwin-multiarch-arm.c for windows
Sumanth Gundapaneni [Mon, 14 Nov 2016 17:09:39 +0000 (17:09 +0000)]
Fix the unit test darwin-multiarch-arm.c for windows

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

7 years ago[OpenCL] Change to clk_event parameter in enqueue_kernel.
Anastasia Stulova [Mon, 14 Nov 2016 15:34:01 +0000 (15:34 +0000)]
[OpenCL] Change to clk_event parameter in enqueue_kernel.

- Accept NULL pointer as a valid parameter value for clk_event.
- Generate clk_event_t arguments of internal
__enqueue_kernel_XXX function as pointers in generic address space.

Review: https://reviews.llvm.org/D26507

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

7 years ago[PPC] add extract sig/exp test data class for vec float and vec double.
Sean Fertile [Mon, 14 Nov 2016 14:43:27 +0000 (14:43 +0000)]
[PPC] add extract sig/exp test data class for vec float and vec double.

 Add vector extract exponent/significand functions to altivec.h, as well as
 functions (and related constants) to test the data class of vector float
 and vector double.

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

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

7 years agoFix r286819 (accidentally patched multiple times.
Pekka Jaaskelainen [Mon, 14 Nov 2016 13:14:38 +0000 (13:14 +0000)]
Fix r286819 (accidentally patched multiple times.

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

7 years ago[OpenCL] always use SPIR address spaces for kernel_arg_addr_space MD
Pekka Jaaskelainen [Mon, 14 Nov 2016 13:08:30 +0000 (13:08 +0000)]
[OpenCL] always use SPIR address spaces for kernel_arg_addr_space MD

It doesn't make sense to use the target's address space ids in this context as
this is metadata that should be referring to the "logical" OpenCL address spaces.
For flat AS machines like all "CPUs" in general, the logical AS info gets lost as
there's only one address space (0).

This commit changes the logic such that we always use the SPIR address space
ids for the argument metadata. It thus allows implementing the clGetKernelArgInfo()
and the other detection needs.

https://reviews.llvm.org/D26157

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

7 years agoRevert "Improve handling of floating point literals in OpenCL to only use double...
Renato Golin [Mon, 14 Nov 2016 12:19:18 +0000 (12:19 +0000)]
Revert "Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64."

This reverts commit r286815, as it broke all ARM and AArch64 bots.

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

7 years agoImprove handling of floating point literals in OpenCL to only use double precision...
Neil Hickey [Mon, 14 Nov 2016 11:15:51 +0000 (11:15 +0000)]
Improve handling of floating point literals in OpenCL to only use double precision if the target supports fp64.

This change makes sure single-precision floating point types are used if the
cl_fp64 extension is not supported by the target.

Also removed the check to see whether the OpenCL version is >= 1.2, as this has
been incorporated into the extension setting code.

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

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

7 years agoRemove some false positives when taking the address of packed members
Roger Ferrer Ibanez [Mon, 14 Nov 2016 08:53:27 +0000 (08:53 +0000)]
Remove some false positives when taking the address of packed members

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

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

7 years agoAdd explicit (void) cast to result of unique_ptr::release()
Eric Fiselier [Mon, 14 Nov 2016 07:03:50 +0000 (07:03 +0000)]
Add explicit (void) cast to result of unique_ptr::release()

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

7 years ago[AVX-512] Replace masked dword and qword variable shift builtins with unmasked builti...
Craig Topper [Sun, 13 Nov 2016 07:26:34 +0000 (07:26 +0000)]
[AVX-512] Replace masked dword and qword variable shift builtins with unmasked builtins and a select.

This is part of a set of changes to allow InstCombine in the backend to optimize variable shifts without having to know about masking.

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

7 years ago[X86] Remove extra escaped new lines in intrinsic headers left over from an earlier...
Craig Topper [Sun, 13 Nov 2016 07:26:31 +0000 (07:26 +0000)]
[X86] Remove extra escaped new lines in intrinsic headers left over from an earlier conversion away from a macro. NFC

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

7 years agoBitcode: Change module reader functions to return an llvm::Expected.
Peter Collingbourne [Sun, 13 Nov 2016 07:00:17 +0000 (07:00 +0000)]
Bitcode: Change module reader functions to return an llvm::Expected.

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

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

7 years agoFix PR28366: Handle variables from enclosing local scopes more gracefully during...
Faisal Vali [Sun, 13 Nov 2016 06:09:16 +0000 (06:09 +0000)]
Fix PR28366: Handle variables from enclosing local scopes more gracefully during constant expression evaluation.

Only look for a variable's value in the constant expression evaluation activation frame, if the variable was indeed declared in that frame, otherwise it might be a constant expression and be usable within a nested local scope or emit an error.

void f(char c) {
  struct X {
    static constexpr char f() {
      return c; // error gracefully here as opposed to crashing.
    }
  };
  int I = X::f();
}

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

7 years ago[AMDGPU] Add f16 builtin functions (VI+)
Konstantin Zhuravlyov [Sun, 13 Nov 2016 02:37:05 +0000 (02:37 +0000)]
[AMDGPU] Add f16 builtin functions (VI+)

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

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

7 years ago[AVX-512] Add returns to shift intrinsics that converted from macros in r286714.
Craig Topper [Sun, 13 Nov 2016 00:35:01 +0000 (00:35 +0000)]
[AVX-512] Add returns to shift intrinsics that converted from macros in r286714.

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

7 years agoRevert r286735 due to test failure
Brad Smith [Sun, 13 Nov 2016 00:16:21 +0000 (00:16 +0000)]
Revert r286735 due to test failure

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

7 years agoLink static PIE programs against rcrt0.o on OpenBSD
Brad Smith [Sat, 12 Nov 2016 23:52:03 +0000 (23:52 +0000)]
Link static PIE programs against rcrt0.o on OpenBSD

Patch by Stefan Kempf.

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

7 years ago[AVX-512] Use scalar vfmsub/vfnmsub mask3 intrinsics instead of inverting the mask...
Craig Topper [Sat, 12 Nov 2016 23:24:34 +0000 (23:24 +0000)]
[AVX-512] Use scalar vfmsub/vfnmsub mask3 intrinsics instead of inverting the mask argument of a vfmadd intrinsic.

Summary: Inverting the mask argument does not reflect the intended semantics of the intrinsic.

Reviewers: igorb, delena

Subscribers: cfe-commits

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

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

7 years agoUse descriptive message if list initializer is incorrectly parenthesized.
Serge Pavlov [Sat, 12 Nov 2016 15:38:55 +0000 (15:38 +0000)]
Use descriptive message if list initializer is incorrectly parenthesized.

If initializer contains parentheses around braced list where it is not allowed,
as in construct int({0}), clang issued message like `functional-style cast
from 'void' to 'int' is not allowed`, which does not help much. Both gcc and
msvc issue message `list-initializer for non-class type must not be
parenthesized`, which is more descriptive. This change implements similar
message for clang.

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

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

7 years agoAs we released 3.9, from the 4.0 release notes, points to version 3.9 instead of 3.8
Sylvestre Ledru [Sat, 12 Nov 2016 10:38:18 +0000 (10:38 +0000)]
As we released 3.9, from the 4.0 release notes, points to version 3.9 instead of 3.8

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

7 years agoAdd the new option -Og in the release notes. See r286602 for more information
Sylvestre Ledru [Sat, 12 Nov 2016 10:37:17 +0000 (10:37 +0000)]
Add the new option -Og in the release notes. See r286602 for more information

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

7 years agoAdd support of the next Ubuntu (17.04 - Zesty Zapus)
Sylvestre Ledru [Sat, 12 Nov 2016 09:26:30 +0000 (09:26 +0000)]
Add support of the next Ubuntu (17.04 - Zesty Zapus)

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

7 years agoclang-format: Support ObjC selectors with unnamed parameters.
Daniel Jasper [Sat, 12 Nov 2016 07:38:22 +0000 (07:38 +0000)]
clang-format: Support ObjC selectors with unnamed parameters.

This fixes llvm.org/PR28063.

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

7 years ago[AVX-512] Convert the rest of the masked shift by immediate and by single element...
Craig Topper [Sat, 12 Nov 2016 07:16:59 +0000 (07:16 +0000)]
[AVX-512] Convert the rest of the masked shift by immediate and by single element builtins over to the newly added unmasked builtins and a select.

This should also fix PR30691 since the new builtins are handled like the legacy builtins in the backend.

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

7 years ago[analyzer] Update 'Automated' to 'Automatic' from r286694.
Devin Coughlin [Sat, 12 Nov 2016 01:50:04 +0000 (01:50 +0000)]
[analyzer] Update 'Automated' to 'Automatic' from r286694.

ARC is 'Automatic Reference Counting' and not 'Automated Reference Counting'.

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

7 years ago[c++1z] Support constant folding for __builtin_strchr and __builtin_memchr.
Richard Smith [Sat, 12 Nov 2016 01:39:56 +0000 (01:39 +0000)]
[c++1z] Support constant folding for __builtin_strchr and __builtin_memchr.

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

7 years ago[analyzer] Fix copy-pasta in NullableReturnedFromNonnullChecker checker name.
Devin Coughlin [Sat, 12 Nov 2016 01:23:01 +0000 (01:23 +0000)]
[analyzer] Fix copy-pasta in NullableReturnedFromNonnullChecker checker name.

The name of the NullableReturnedFromNonnullChecker in Checkers.td
was accidentally "NullablePassedToNonnull", which made it impossible
to explicitly turn the checker on.

rdar://problem/28354459

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

7 years agoAdd instructions in clang get_started page about working with a monorepo
Mehdi Amini [Sat, 12 Nov 2016 01:18:17 +0000 (01:18 +0000)]
Add instructions in clang get_started page about working with a monorepo

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

7 years ago[analyzer] Improve misleading RetainCountChcker diagnostic under ARC
Devin Coughlin [Sat, 12 Nov 2016 01:03:06 +0000 (01:03 +0000)]
[analyzer] Improve misleading RetainCountChcker diagnostic under ARC

Under automated reference counting the analyzer treats a methods -- even those
starting with  'copy' and friends -- as returning an unowned value. This is
because ownership of CoreFoundation objects must be transferred to ARC
with __bridge_transfer or CFBridgingRelease() before being returned as
ARC-managed bridged objects.

Unfortunately this could lead to a poor diagnostic inside copy methods under
ARC where the analyzer would complain about a leak of a returned CF value inside
a method "whose name does not start with 'copy'" -- even though the name did
start with 'copy'.

This commit improves the diagnostic under ARC to say inside a method "returned
from a method managed by Automated Reference Counting".

rdar://problem/28849667

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

7 years ago[c++1z] std::byte didn't make it
Richard Smith [Sat, 12 Nov 2016 00:15:24 +0000 (00:15 +0000)]
[c++1z] std::byte didn't make it

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

7 years ago[c++1z] Two more features have been accepted.
Richard Smith [Fri, 11 Nov 2016 23:51:47 +0000 (23:51 +0000)]
[c++1z] Two more features have been accepted.

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

7 years ago[index] Rename SymbolSubKind -> SymbolProperty, NFC.
Argyrios Kyrtzidis [Fri, 11 Nov 2016 23:49:55 +0000 (23:49 +0000)]
[index] Rename SymbolSubKind -> SymbolProperty, NFC.

This better reflects what it represents.

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

7 years ago[c++1z] p0522 is approved.
Richard Smith [Fri, 11 Nov 2016 23:46:25 +0000 (23:46 +0000)]
[c++1z] p0522 is approved.

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

7 years ago[c++1z] Add constant-folding support for strcmp, strncmp, and memcmp, to
Richard Smith [Fri, 11 Nov 2016 23:43:35 +0000 (23:43 +0000)]
[c++1z] Add constant-folding support for strcmp, strncmp, and memcmp, to
support constexpr char_traits.

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

7 years ago[tsan][clang] Introduce a function attribute to disable TSan checking at run time
Anna Zaks [Fri, 11 Nov 2016 23:22:44 +0000 (23:22 +0000)]
[tsan][clang] Introduce a function attribute to disable TSan checking at run time

This introduces a function annotation that disables TSan checking for the
function at run time. The benefit over attribute((no_sanitize("thread")))
is that the accesses within the callees will also be suppressed.

The motivation for this attribute is a guarantee given by the objective C
language that the calls to the reference count decrement and object
deallocation will be synchronized. To model this properly, we would need to
intercept all ref count decrement calls (which are very common in ObjC due
to use of ARC) and also every single message send. Instead, we propose to
just ignore all accesses made from within dealloc at run time. The main
downside is that this still does not introduce any synchronization, which
means we might still report false positives if the code that relies on this
synchronization is not executed from within dealloc. However, we have not
seen this in practice so far and think these cases will be very rare.

(This problem is similar in nature to https://reviews.llvm.org/D21609;
unfortunately, the same solution does not apply here.)

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

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

7 years agoTread TSan LLVM flags to driver: add TSan controlling flags to clang.
Evgeniy Stepanov [Fri, 11 Nov 2016 23:17:36 +0000 (23:17 +0000)]
Tread TSan LLVM flags to driver: add TSan controlling flags to clang.

Summary:
New clang flags, all default to true:
-f[no-]sanitize-thread-data-races
-f[no-]sanitize-thread-stack-traces
-f[no-]sanitize-thread-atomics

Reviewers: dvyukov, pcc, eugenis

Subscribers: pcc, cfe-commits

Patch by Alex Shlyapnikov.

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

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

7 years ago[cxx_status] Prepare features list for WG21 motions.
Richard Smith [Fri, 11 Nov 2016 22:48:43 +0000 (22:48 +0000)]
[cxx_status] Prepare features list for WG21 motions.

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

7 years ago[ASTMatchers] Fix a typo in cStyleCastExpr() HTML docs as well. NFC.
Artem Dergachev [Fri, 11 Nov 2016 22:34:53 +0000 (22:34 +0000)]
[ASTMatchers] Fix a typo in cStyleCastExpr() HTML docs as well. NFC.

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

7 years ago[PowerPC] Implement remaining permute builtins in altivec.h - Clang portion
Nemanja Ivanovic [Fri, 11 Nov 2016 22:34:44 +0000 (22:34 +0000)]
[PowerPC] Implement remaining permute builtins in altivec.h - Clang portion

This patch corresponds to review:
https://reviews.llvm.org/D26479

It adds the remaining vector permute/rotate builtins to altivec.h.

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

7 years agoRemove double setting of invalid flag.
Richard Trieu [Fri, 11 Nov 2016 21:50:39 +0000 (21:50 +0000)]
Remove double setting of invalid flag.

In r286630, Decl::setInvalidDecl will automatically set the invalid flag for
BindingDecl for children in invalid DecompositionDecl.  It no longer is
necessary to do a separate setInvalidDecl when finalizing a BindingDecl.

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

7 years ago[analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()
Devin Coughlin [Fri, 11 Nov 2016 21:31:38 +0000 (21:31 +0000)]
[analyzer] Teach RetainCountChecker about VTCompressionSessionEncodeFrame()

The context argument passed to VideoToolbox's
VTCompressionSessionEncodeFrame() function is ultimately passed to a callback
supplied when creating the compression session and so may be freed by that
callback.  To suppress false positives in this case, teach the retain count
checker to stop tracking that argument.

This isn't suppressed by the usual callback context mechanism because the call
to VTCompressionSessionEncodeFrame() doesn't include the callback itself.

rdar://problem/27685213

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

7 years agoWhen a DecompositionDecl is marked invalid, also set the child BindingDecl's to
Richard Trieu [Fri, 11 Nov 2016 20:51:04 +0000 (20:51 +0000)]
When a DecompositionDecl is marked invalid, also set the child BindingDecl's to
invalid.

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

7 years ago[ASTMatchers] Fix a typo in cStyleCastExpr() docs. NFC.
Artem Dergachev [Fri, 11 Nov 2016 20:29:59 +0000 (20:29 +0000)]
[ASTMatchers] Fix a typo in cStyleCastExpr() docs. NFC.

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

7 years ago[PowerPC] Add vector conversion builtins to altivec.h - clang portion
Nemanja Ivanovic [Fri, 11 Nov 2016 19:56:17 +0000 (19:56 +0000)]
[PowerPC] Add vector conversion builtins to altivec.h - clang portion

This patch corresponds to review:
https://reviews.llvm.org/D26308

It adds a number of vector type conversion builtins to altivec.h.

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

7 years agoBitcode: Change getModuleSummaryIndex() to return an llvm::Expected.
Peter Collingbourne [Fri, 11 Nov 2016 19:50:39 +0000 (19:50 +0000)]
Bitcode: Change getModuleSummaryIndex() to return an llvm::Expected.

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

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

7 years ago[cfi] Enable cfi-icall on ARM and AArch64.
Evgeniy Stepanov [Fri, 11 Nov 2016 18:49:49 +0000 (18:49 +0000)]
[cfi] Enable cfi-icall on ARM and AArch64.

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

7 years agoAdd a new optimization option -Og
Sylvestre Ledru [Fri, 11 Nov 2016 17:29:56 +0000 (17:29 +0000)]
Add a new optimization option -Og

Summary:
Just like gcc, we should have the -Og option as more and more software are using it:
https://llvm.org/bugs/show_bug.cgi?id=20765

Reviewers: echristo, dberlin, dblaikie, keith.walker.arm, rengolin

Subscribers: aprantl, friss, mehdi_amini, RKSimon, probinson, majnemer, cfe-commits

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

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

7 years agoFix mismatched enum value name and diagnostic text.
Douglas Katzman [Fri, 11 Nov 2016 16:51:40 +0000 (16:51 +0000)]
Fix mismatched enum value name and diagnostic text.

ExpectedFunctionGlobalVarMethodOrProperty
would previously say "functions and global variables"
instead of "functions, methods, properties, and global variables"

The newly added ExpectedFunctionOrGlobalVariable
says "functions and global variables"

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

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

7 years ago[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.
Simon Pilgrim [Fri, 11 Nov 2016 14:38:34 +0000 (14:38 +0000)]
[X86] Merge (near) duplicate scalar non-temporal store code. NFCI.

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

7 years agoFix for PR28523: unexpected compilation error.
Alexey Bataev [Fri, 11 Nov 2016 12:36:20 +0000 (12:36 +0000)]
Fix for PR28523: unexpected compilation error.

Clang emits error message for the following code:
```
template <class F> void parallel_loop(F &&f) { f(0); }

int main() {
  int x;
  parallel_loop([&](auto y) {
    {
      x = y;
    };
  });
}
```

$ clang++ --std=gnu++14 clang_test.cc -o clang_test
clang_test.cc:9:7: error: reference to local variable 'x' declared in enclosing function 'main'
      x = y;
            ^
clang_test.cc:2:48: note: in instantiation of function template specialization 'main()::(anonymous class)::operator()<int>' requested here
            template <class F> void parallel_loop(F &&f) { f(0); }
                                                           ^
clang_test.cc:6:3: note: in instantiation of function template specialization 'parallel_loop<(lambda at clang_test.cc:6:17)>' requested here parallel_loop([&](auto y) {
           ^
clang_test.cc:5:7: note: 'x' declared here
      int x;
          ^
1 error generated.

Patch fixes this issue.

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

7 years agoMirror the llvm changes that split Bitcode/ReaderWriter.h
Teresa Johnson [Fri, 11 Nov 2016 05:35:12 +0000 (05:35 +0000)]
Mirror the llvm changes that split Bitcode/ReaderWriter.h

The change in D26502 splits ReaderWriter.h, which contains the APIs
into both the BitReader and BitWriter libraries, into BitcodeReader.h
and BitcodeWriter.h.

Change clang uses to the appropriate split header(s).

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

7 years agoDefine __ANDROID_API__ when specified as part of an Android target.
Stephen Hines [Fri, 11 Nov 2016 01:29:39 +0000 (01:29 +0000)]
Define __ANDROID_API__ when specified as part of an Android target.

Summary:
This macro should be defined only when the user directly specifies an
API level as part of an Android target. For any regular Android target,
we leave this macro undefined.

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

Reviewers: eugenis, pirama

Subscribers: tberghammer, cfe-commits, pirama, eugenis, danalbert

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

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

7 years agoDon't require nullability on 'va_list', even when it's a pointer.
Jordan Rose [Fri, 11 Nov 2016 01:29:18 +0000 (01:29 +0000)]
Don't require nullability on 'va_list', even when it's a pointer.

Take 3! This should finally fix the Hexagon, PPC, and Windows bots.

rdar://problem/25846421

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

7 years agoRevert "Speculative fix for va_list/nullability test on Hexagon and PPC."
Jordan Rose [Fri, 11 Nov 2016 01:29:15 +0000 (01:29 +0000)]
Revert "Speculative fix for va_list/nullability test on Hexagon and PPC."

This reverts commit r286533. At this point an array really is still an
array, but the problem is with /non-/array va_lists anyway.

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

7 years agoPR30937: don't devirtualize if we find that the callee is a pure virtual
Richard Smith [Fri, 11 Nov 2016 01:01:31 +0000 (01:01 +0000)]
PR30937: don't devirtualize if we find that the callee is a pure virtual
function. In that case, there is no requirement that the callee is actually
defined, and the code may in fact be valid and have defined behavior if the
virtual call is unreachable.

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

7 years agoSpeculative fix for va_list/nullability test on Hexagon and PPC.
Jordan Rose [Fri, 11 Nov 2016 00:55:14 +0000 (00:55 +0000)]
Speculative fix for va_list/nullability test on Hexagon and PPC.

PowerPC's va_list, at least, is a typedef for an array, which means it
decays to a pointer in parameter position. Since the decayed type is
built from the array element type, the typedef sugar is lost.

More rdar://problem/25846421.

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

7 years agoDon't require nullability on 'va_list' harder.
Jordan Rose [Fri, 11 Nov 2016 00:23:59 +0000 (00:23 +0000)]
Don't require nullability on 'va_list' harder.

Platform headers don't always define 'va_list' in terms of Clang's
'__builtin_va_list', so in addition to checking for our own
synthesized decl, also just look for typedefs literally named
'va_list'. Better to err on the side of false negatives here.

Fix-up for rdar://problem/25846421.

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

7 years ago[Sema] Fix-up for MSVC, which is stricter about template types.
Jordan Rose [Thu, 10 Nov 2016 23:41:18 +0000 (23:41 +0000)]
[Sema] Fix-up for MSVC, which is stricter about template types.

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

7 years agoDon't require nullability on 'va_list'.
Jordan Rose [Thu, 10 Nov 2016 23:28:34 +0000 (23:28 +0000)]
Don't require nullability on 'va_list'.

There are many non-portable typedefs, but va_list is one that nobody
ever thinks of as a pointer or an array. (When's the last time you saw
someone check for a NULL va_list?) Make an exception for this one
special type.

Part of rdar://problem/25846421.

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

7 years agoWarn when 'assume_nonnull' infers nullability within an array.
Jordan Rose [Thu, 10 Nov 2016 23:28:30 +0000 (23:28 +0000)]
Warn when 'assume_nonnull' infers nullability within an array.

...or within a reference. Both of these add an extra level of
indirection that make us less certain that the pointer really was
supposed to be non-nullable. However, changing the default behavior
would be a breaking change, so we'll just make it a warning instead.

Part of rdar://problem/25846421

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

7 years agoAdd -Wnullability-completeness-on-arrays.
Jordan Rose [Thu, 10 Nov 2016 23:28:26 +0000 (23:28 +0000)]
Add -Wnullability-completeness-on-arrays.

This is an addition to (and sub-warning of) -Wnullability-completeness
that warns when an array parameter is missing nullability. When the
specific warning is switched off, the compiler falls back to only
warning on pointer types written as pointer types.

Note that use of nullability /within/ an array triggers the
completeness checks regardless of whether or not the array-specific
warning is enabled; the intent there is simply to determine whether a
particular header is trying to be nullability-aware at all.

Part of rdar://problem/25846421.

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

7 years agoAccept nullability qualifiers on array parameters.
Jordan Rose [Thu, 10 Nov 2016 23:28:17 +0000 (23:28 +0000)]
Accept nullability qualifiers on array parameters.

Since array parameters decay to pointers, '_Nullable' and friends
should be available for use there as well. This is especially
important for parameters that are typedefs of arrays. The unsugared
syntax for this follows the syntax for 'static'-sized arrays in C:

  void test(int values[_Nullable]);

This syntax was previously accepted but the '_Nullable' (and any other
attributes) were silently discarded. However, applying '_Nullable' to
a typedef was previously rejected and is now accepted; therefore, it
may be necessary to test for the presence of this feature:

  #if __has_feature(nullability_on_arrays)

One important change here is that DecayedTypes don't always
immediately contain PointerTypes anymore; they may contain an
AttributedType instead. This only affected one place in-tree, so I
would guess it's not likely to cause problems elsewhere.

This commit does not change -Wnullability-completeness just yet. I
want to think about whether it's worth doing something special to
avoid breaking existing clients that compile with -Werror. It also
doesn't change '#pragma clang assume_nonnull' behavior, which
currently treats the following two declarations as equivalent:

  #pragma clang assume_nonnull begin
  void test(void *pointers[]);
  #pragma clang assume_nonnull end

  void test(void * _Nonnull pointers[]);

This is not the desired behavior, but changing it would break
backwards-compatibility. Most likely the best answer is going to be
adding a new warning.

Part of rdar://problem/25846421

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