]> granicus.if.org Git - clang/log
clang
6 years agoSupport -fdebug-prefix-map for assembler source (pass to cc1as). This
Paul Robinson [Tue, 10 Jul 2018 15:15:24 +0000 (15:15 +0000)]
Support -fdebug-prefix-map for assembler source (pass to cc1as).  This
is useful to omit the debug compilation dir when compiling assembly
files with -g.  Part of PR38050.

Patch by Siddhartha Bagaria!

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

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

6 years agoAMDGPU: Try to fix test again
Matt Arsenault [Tue, 10 Jul 2018 14:47:31 +0000 (14:47 +0000)]
AMDGPU: Try to fix test again

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

6 years agoUpdate test for backend error message change
Matt Arsenault [Tue, 10 Jul 2018 14:03:50 +0000 (14:03 +0000)]
Update test for backend error message change

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

6 years ago[analyzer] Add option to set maximum symbol complexity threshold
Mikhail R. Gadelha [Tue, 10 Jul 2018 13:46:05 +0000 (13:46 +0000)]
[analyzer] Add option to set maximum symbol complexity threshold

Summary:
This adds an option, max-symbol-complexity, so an user can set the maximum symbol complexity threshold.

Note that the current behaviour is equivalent to max complexity = 0, when taint analysis is not enabled and tests show that in a number of tests, having complexity = 25 yields the same results as complexity = 10000.

This patch was extracted and modified from Dominic Chen's patch, D35450.

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts
Yuka Takahashi [Tue, 10 Jul 2018 12:17:34 +0000 (12:17 +0000)]
[modules] Fix 37878; Autoload subdirectory modulemaps with specific LangOpts

Summary:
Reproducer and errors:
https://bugs.llvm.org/show_bug.cgi?id=37878

lookupModule was falling back to loadSubdirectoryModuleMaps when it couldn't
find ModuleName in (proper) search paths. This was causing iteration over all
files in the search path subdirectories for example "/usr/include/foobar" in
bugzilla case.

Users don't expect Clang to load modulemaps in subdirectories implicitly, and
also the disk access is not cheap.

if (AllowExtraModuleMapSearch) true with ObjC with @import ModuleName.

Reviewers: rsmith, aprantl, bruno

Subscribers: cfe-commits, teemperor, v.g.vassilev

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

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

6 years agoFixing builtin __atomic_fetch_min declaration
Omer Paparo Bivas [Tue, 10 Jul 2018 12:04:04 +0000 (12:04 +0000)]
Fixing builtin __atomic_fetch_min declaration

Differential Revision: http://reviews.llvm.org/D49068

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

6 years ago[MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified
Martin Storsjo [Tue, 10 Jul 2018 10:46:51 +0000 (10:46 +0000)]
[MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified

In this setup, skip adding all the default windows import libraries,
if linking to windowsapp (which replaces them, when targeting the
windows store/UWP api subset).

With GCC, the same is achieved by using a custom spec file, but
since clang doesn't use spec files, we have to allow other means of
overriding what default libraries to use (without going all the
way to using -nostdlib, which would exclude everything). The same
approach, in detecting certain user specified libraries and omitting
others from the defaults, was already used in SVN r314138.

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

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

6 years ago[MinGW] Treat any -lucrt* as replacing -lmsvcrt
Martin Storsjo [Tue, 10 Jul 2018 10:46:45 +0000 (10:46 +0000)]
[MinGW] Treat any -lucrt* as replacing -lmsvcrt

Since SVN r314138, we check if the user has specified any particular
alternative msvcrt/ucrt version, and skip the default -lmsvcrt
in those cases.

In addition to the existing names checked, we should also treat
a plain -lucrt in the same way, mingw-w64 has now added a separate
import library named libucrt.a, in addition to libucrtbase.a.

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

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

6 years ago[X86] Lowering integer truncation intrinsics to native IR
Mikhail Dvoretckii [Tue, 10 Jul 2018 08:22:44 +0000 (08:22 +0000)]
[X86] Lowering integer truncation intrinsics to native IR

This patch lowers the _mm[256|512]_cvtepi{64|32|16}_epi{32|16|8} intrinsics to
native IR in cases where the result's length is less than 128 bits.

The resulting IR for 256-bit inputs is folded into VPMOV instructions, while for
128-bit inputs the vpshufb (or, in the 64-to-32-bit case, vinsertps)
instructions are generated instead

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

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

6 years agoTest commit
Stephen Kelly [Tue, 10 Jul 2018 06:55:12 +0000 (06:55 +0000)]
Test commit

Add redundant doc.

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

6 years ago[X86] Use masked the masked scalar fma builtins to implement the default rounding...
Craig Topper [Tue, 10 Jul 2018 04:38:29 +0000 (04:38 +0000)]
[X86] Use masked the masked scalar fma builtins to implement the default rounding version of the fma intrinsics.

The rounding mode is checked in CGBuiltin.cpp to generate the correct intrinsic call.

Making this switch switchs the masking to use the i8 bitcast to <8 x i1> and extract i1 version of the IR for the mask. Previously we ended up with a scalar 'and' plus an icmp.

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

6 years ago[Sema] Fix a structured binding typo correction bug
Erik Pilkington [Tue, 10 Jul 2018 02:15:07 +0000 (02:15 +0000)]
[Sema] Fix a structured binding typo correction bug

BindingDecls have null type until their initializer is processed, so we can't
assume that a correction candidate has non-null type.

rdar://41559582

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

6 years ago[ODRHash] Merge the two function hashes into one.
Richard Trieu [Tue, 10 Jul 2018 01:40:50 +0000 (01:40 +0000)]
[ODRHash] Merge the two function hashes into one.

Functions that are a sub-Decl of a record were hashed differently than other
functions.  This change keeps the AddFunctionDecl function and the hash of
records now calls this function.  In addition, AddFunctionDecl has an option
to perform a hash as if the body was absent, which is required for some
checks after loading modules.  Additional logic prevents multiple error
message from being printed.

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

6 years agoUpdate crash diagnostics test to avoid attempting to write into various
Eric Christopher [Tue, 10 Jul 2018 01:01:38 +0000 (01:01 +0000)]
Update crash diagnostics test to avoid attempting to write into various
directories if possible and to not require %t to have "Output" in the name.

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

6 years agoFix parsing of privacy annotations in os_log format strings.
Akira Hatanaka [Tue, 10 Jul 2018 00:50:25 +0000 (00:50 +0000)]
Fix parsing of privacy annotations in os_log format strings.

Privacy annotations shouldn't have to appear in the first
comma-delimited string in order to be recognized. Also, they should be
ignored if they are preceded or followed by non-whitespace characters.

rdar://problem/40706280

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

6 years ago[X86] Remove custom handling for __builtin_ia32_divss_round_mask and __builtin_ia32_d...
Craig Topper [Tue, 10 Jul 2018 00:50:03 +0000 (00:50 +0000)]
[X86] Remove custom handling for __builtin_ia32_divss_round_mask and __builtin_ia32_divsd_round_mask.

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

6 years ago[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitabl...
Craig Topper [Tue, 10 Jul 2018 00:37:25 +0000 (00:37 +0000)]
[X86] Add __builtin_ia32_selectss_128 and __builtin_ia32_selectsd_128 that is suitable for use in scalar mask intrinsics.

This will convert the i8 mask argument to <8 x i1> and extract an i1 and then emit a select instruction. This replaces the '(__U & 1)" and ternary operator used in some of intrinsics. The old sequence was lowered to a scalar and and compare. The new sequence uses an i1 vector that will interoperate better with other mask intrinsics.

This removes the need to handle div_ss/sd specially in CGBuiltin.cpp. A follow up patch will add the GCCBuiltin name back in llvm and remove the custom handling.

I made some adjustments to legacy move_ss/sd intrinsics which we reused here to do a simpler extract and insert instead of 2 extracts and two inserts or a shuffle.

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

6 years agoRename function calls missed in r336605
Richard Trieu [Mon, 9 Jul 2018 22:09:33 +0000 (22:09 +0000)]
Rename function calls missed in r336605

NextIsLatest -> isFirst

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

6 years ago[Index] Add index::IndexingOptions::IndexImplicitInstantiation
Fangrui Song [Mon, 9 Jul 2018 21:49:06 +0000 (21:49 +0000)]
[Index] Add index::IndexingOptions::IndexImplicitInstantiation

Summary:
With IndexImplicitInstantiation=true, the following case records an occurrence of B::bar in A::foo, which will benefit cross reference tools.

template <class T> struct B { void bar() {}};
template <class T> struct A { void foo(B<T> *x) { x->bar(); }};
int main() { A<int> a; a.foo(0); }

Reviewers: akyrtzi, arphaman, rsmith

Subscribers: cfe-commits

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

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

6 years ago[AST] Rename some Redeclarable functions to reduce confusion
Fangrui Song [Mon, 9 Jul 2018 21:31:20 +0000 (21:31 +0000)]
[AST] Rename some Redeclarable functions to reduce confusion

Reviewers: rsmith, akyrtzi

Subscribers: cfe-commits

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

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

6 years agoAdded -fcrash-diagnostics-dir flag
Bob Haarman [Mon, 9 Jul 2018 21:07:20 +0000 (21:07 +0000)]
Added -fcrash-diagnostics-dir flag

Summary:
New flag causes crash reports to be written in the specified directory
rather than the temp directory.

Patch by Chijioke Kamanu.

Reviewers: hans, inglorion, rnk

Reviewed By: hans

Subscribers: zturner, hiraditya, llvm-commits, cfe-commits

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

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

6 years ago[Power9] [CLANG] Add __float128 support for trunc to double round to odd
Stefan Pintilie [Mon, 9 Jul 2018 20:09:52 +0000 (20:09 +0000)]
[Power9] [CLANG] Add __float128 support for trunc to double round to odd

Add support for this builtin:
double builtin_truncf128_round_to_odd(float128)

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

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

6 years ago[OPENMP] Do not mark local variables as declare target.
Alexey Bataev [Mon, 9 Jul 2018 19:58:08 +0000 (19:58 +0000)]
[OPENMP] Do not mark local variables as declare target.

When the parsing of the functions happens inside of the declare target
region, we may erroneously mark local variables as declare target
thought they are not. This attribute can be applied only to global
variables.

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

6 years ago[libclang] NFC, simplify clang_Cursor_Evaluate
Alex Lorenz [Mon, 9 Jul 2018 19:56:45 +0000 (19:56 +0000)]
[libclang] NFC, simplify clang_Cursor_Evaluate

Take advantage of early returns as suggested by Duncan in
https://reviews.llvm.org/D49051

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

6 years ago[libclang] evalute compound statement cursors before trying to evaluate
Alex Lorenz [Mon, 9 Jul 2018 19:41:28 +0000 (19:41 +0000)]
[libclang] evalute compound statement cursors before trying to evaluate
the cursor like a declaration

This change fixes a bug in libclang in which it tries to evaluate a statement
cursor as a declaration cursor, because that statement still has a pointer to
the declaration parent.

rdar://38888477

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

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

6 years ago[Index] Ignore noop #undef's when handling macro occurrences.
Eric Liu [Mon, 9 Jul 2018 19:02:41 +0000 (19:02 +0000)]
[Index] Ignore noop #undef's when handling macro occurrences.

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

6 years ago[Builtins][Attributes][X86] Tag all X86 builtins with their required vector width...
Craig Topper [Mon, 9 Jul 2018 19:00:16 +0000 (19:00 +0000)]
[Builtins][Attributes][X86] Tag all X86 builtins with their required vector width. Add a min_vector_width function attribute and tag all x86 instrinsics with it

This is part of an ongoing attempt at making 512 bit vectors illegal in the X86 backend type legalizer due to CPU frequency penalties associated with wide vectors on Skylake Server CPUs. We want the loop vectorizer to be able to emit IR containing wide vectors as intermediate operations in vectorized code and allow these wide vectors to be legalized to 256 bits by the X86 backend even though we are targetting a CPU that supports 512 bit vectors. This is similar to what happens with an AVX2 CPU, the vectorizer can emit wide vectors and the backend will split them. We want this splitting behavior, but still be able to use new Skylake instructions that work on 256-bit vectors and support things like masking and gather/scatter.

Of course if the user uses explicit vector code in their source code we need to not split those operations. Especially if they have used any of the 512-bit vector intrinsics from immintrin.h. And we need to make it so that merely using the intrinsics produces the expected code in order to be backwards compatible.

To support this goal, this patch adds a new IR function attribute "min-legal-vector-width" that can indicate the need for a minimum vector width to be legal in the backend. We need to ensure this attribute is set to the largest vector width needed by any intrinsics from immintrin.h that the function uses. The inliner will be reponsible for merging this attribute when a function is inlined. We may also need a way to limit inlining in the future as well, but we can discuss that in the future.

To make things more complicated, there are two different ways intrinsics are implemented in immintrin.h. Either as an always_inline function containing calls to builtins(can be target specific or target independent) or vector extension code. Or as a macro wrapper around a taget specific builtin. I believe I've removed all cases where the macro was around a target independent builtin.

To support the always_inline function case this patch adds attribute((min_vector_width(128))) that can be used to tag these functions with their vector width. All x86 intrinsic functions that operate on vectors have been tagged with this attribute.

To support the macro case, all x86 specific builtins have also been tagged with the vector width that they require. Use of any builtin with this property will implicitly increase the min_vector_width of the function that calls it. I've done this as a new property in the attribute string for the builtin rather than basing it on the type string so that we can opt into it on a per builtin basis and avoid any impact to target independent builtins.

There will be future work to support vectors passed as function arguments and supporting inline assembly. And whatever else we can find that isn't covered by this patch.

Special thanks to Chandler who suggested this direction and reviewed a preview version of this patch. And thanks to Eric Christopher who has had many conversations with me about this issue.

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

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

6 years ago[Power9] Add __float128 builtins for Round To Odd
Stefan Pintilie [Mon, 9 Jul 2018 18:50:40 +0000 (18:50 +0000)]
[Power9] Add __float128 builtins for Round To Odd

Add a number of builtins for __float128 Round To Odd.
This is the Clang portion of the builtins work.

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

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

6 years ago[OPENMP, NVPTX] Do not globalize local variables in parallel regions.
Alexey Bataev [Mon, 9 Jul 2018 17:43:58 +0000 (17:43 +0000)]
[OPENMP, NVPTX] Do not globalize local variables in parallel regions.

In generic data-sharing mode we are allowed to not globalize local
variables that escape their declaration context iff they are declared
inside of the parallel region. We can do this because L2 parallel
regions are executed sequentially and, thus, we do not need to put
shared local variables in the global memory.

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

6 years ago[PCH] Add an option to not write comments into PCH
Ilya Biryukov [Mon, 9 Jul 2018 11:33:23 +0000 (11:33 +0000)]
[PCH] Add an option to not write comments into PCH

Summary:
Will be used in clangd, see the follow-up change.
Clangd does not use comments read from PCH to avoid crashes due to
changed contents of the file. However, reading them considerably slows
down code completion on files with large preambles.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ioeric, cfe-commits

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

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

6 years agoTry to fix build bot after r336524
Eric Liu [Mon, 9 Jul 2018 09:17:25 +0000 (09:17 +0000)]
Try to fix build bot after r336524

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

6 years ago[Preamble] Check system dependencies in preamble too
Ilya Biryukov [Mon, 9 Jul 2018 09:07:01 +0000 (09:07 +0000)]
[Preamble] Check system dependencies in preamble too

Summary:
PrecompiledPreamble hasn't checked if the system dependencies changed
before. This resulted in invalid preamble not being rebuilt if headers
that changed were found in -isystem include paths.

This pattern is sometimes used to avoid showing warnings in third
party code, so we want to correctly handle those cases.

Tested in clangd, see the follow-up patch.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: omtcyfz, cfe-commits

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

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

6 years ago[ASTImporter] fix test failure corrected by fixed func end locs
Rafael Stahl [Mon, 9 Jul 2018 09:02:53 +0000 (09:02 +0000)]
[ASTImporter] fix test failure corrected by fixed func end locs

fix to rC336523 / D48941

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

6 years ago[Index] Add clangLex to LINK_LIBS
Heejin Ahn [Mon, 9 Jul 2018 08:54:42 +0000 (08:54 +0000)]
[Index] Add clangLex to LINK_LIBS

Without this, builds with `-DSHARED_LIB=ON` fail.

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

6 years ago[Index] Add indexing support for MACROs.
Eric Liu [Mon, 9 Jul 2018 08:44:05 +0000 (08:44 +0000)]
[Index] Add indexing support for MACROs.

Reviewers: akyrtzi, arphaman, sammccall

Reviewed By: sammccall

Subscribers: malaperle, sammccall, cfe-commits

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

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

6 years ago[ASTImporter] import FunctionDecl end locations
Rafael Stahl [Mon, 9 Jul 2018 08:40:17 +0000 (08:40 +0000)]
[ASTImporter] import FunctionDecl end locations

Summary: On constructors that do not take the end source location, it was not imported. Fixes test from D47698 / rC336269.

Reviewers: martong, a.sidorin, balazske, xazax.hun, a_sidorin

Reviewed By: martong, a_sidorin

Subscribers: a_sidorin, rnkovacs, cfe-commits

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

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

6 years ago[clang-format/ObjC] Put ObjC method arguments into one line when they fit
Jacek Olesiak [Mon, 9 Jul 2018 07:08:45 +0000 (07:08 +0000)]
[clang-format/ObjC] Put ObjC method arguments into one line when they fit

Reapply D47195:
Currently BreakBeforeParameter is set to true everytime message receiver spans multiple lines, e.g.:
```
[[object block:^{
  return 42;
}] aa:42 bb:42];
```
will be formatted:
```
[[object block:^{
  return 42;
}] aa:42
   bb:42];
```
even though arguments could fit into one line. This change fixes this behavior.

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

6 years ago[clang-format/ObjC] Improve split priorities for ObjC methods
Jacek Olesiak [Mon, 9 Jul 2018 06:54:52 +0000 (06:54 +0000)]
[clang-format/ObjC] Improve split priorities for ObjC methods

Reduce penalty for aligning ObjC method arguments using the colon alignment as
this is the canonical way.

Trying to fit a whole expression into one line should not force other line
breaks (e.g. when ObjC method expression is a part of other expression).

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

6 years ago[clang-format/ObjC] Prohibit breaking after a bracket opening ObjC method expression
Jacek Olesiak [Mon, 9 Jul 2018 06:04:58 +0000 (06:04 +0000)]
[clang-format/ObjC] Prohibit breaking after a bracket opening ObjC method expression

Summary:
Don't break after a "[" opening an ObjC method expression.
Tests are added in D48719 where formatting is improved (to avoid adding and changing tests immediately).

Reviewers: benhamilton, klimek

Reviewed By: benhamilton

Subscribers: acoomans, cfe-commits

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

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

6 years ago[clang-format/ObjC] Fix counting selector name parts for ObjC
Jacek Olesiak [Mon, 9 Jul 2018 05:58:51 +0000 (05:58 +0000)]
[clang-format/ObjC] Fix counting selector name parts for ObjC

Summary:
Counts selector parts also for method declarations and counts correctly for methods without arguments.
This is an internal change and doesn't influence formatting on its own (at the current state). Its lack would be visible after applying D48719.

Reviewers: benhamilton, klimek

Reviewed By: benhamilton

Subscribers: acoomans, cfe-commits

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

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

6 years ago[X86] Add new scalar fma intrinsics with rounding mode that use f32/f64 types.
Craig Topper [Sun, 8 Jul 2018 01:10:47 +0000 (01:10 +0000)]
[X86] Add new scalar fma intrinsics with rounding mode that use f32/f64 types.

This allows us to handle masking in a very similar way to the default rounding version that uses llvm.fma

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

6 years ago[X86] Remove __builtin_ia32_vfnmsubsd3_mask3 and __builtin_ia32_vfnmsubss3_mask3...
Craig Topper [Sat, 7 Jul 2018 22:03:20 +0000 (22:03 +0000)]
[X86] Remove __builtin_ia32_vfnmsubsd3_mask3 and __builtin_ia32_vfnmsubss3_mask3 from clang.

They are no longer used by clang.

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

6 years ago[X86] Remove some unnecessarily escaped new lines from avx512fintrin.h
Craig Topper [Sat, 7 Jul 2018 22:03:19 +0000 (22:03 +0000)]
[X86] Remove some unnecessarily escaped new lines from avx512fintrin.h

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

6 years ago[X86] Fix a few intrinsics that were ignoring their rounding mode argument and hardco...
Craig Topper [Sat, 7 Jul 2018 22:03:16 +0000 (22:03 +0000)]
[X86] Fix a few intrinsics that were ignoring their rounding mode argument and hardcoded _MM_FROUND_CUR_DIRECTION internally.

I believe these have been broken since their introduction into clang.

I've enhanced the tests for these intrinsics to using a real rounding mode and checking all the intrinsic arguments instead of just the name.

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

6 years ago[analyzer] Add support for data() in DanglingInternalBufferChecker.
Reka Kovacs [Sat, 7 Jul 2018 20:29:24 +0000 (20:29 +0000)]
[analyzer] Add support for data() in DanglingInternalBufferChecker.

DanglingInternalBufferChecker now tracks use-after-free problems related
to the incorrect usage of std::basic_string::data().

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

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

6 years ago[analyzer] Highlight c_str() call in DanglingInternalBufferChecker.
Reka Kovacs [Sat, 7 Jul 2018 19:27:18 +0000 (19:27 +0000)]
[analyzer] Highlight c_str() call in DanglingInternalBufferChecker.

Add a bug visitor to DanglingInternalBufferChecker that places a note
at the point where the dangling pointer was obtained. The visitor is
handed over to MallocChecker and attached to the report there.

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

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

6 years ago[analyzer] Fix -Wcovered-switch-default warning in MallocChecker.
Reka Kovacs [Sat, 7 Jul 2018 18:37:37 +0000 (18:37 +0000)]
[analyzer] Fix -Wcovered-switch-default warning in MallocChecker.

Remove unnecessary default case that caused buildbot failures.

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

6 years ago[analyzer] Highlight container object destruction in MallocChecker.
Reka Kovacs [Sat, 7 Jul 2018 17:22:45 +0000 (17:22 +0000)]
[analyzer] Highlight container object destruction in MallocChecker.

Extend MallocBugVisitor to place a note at the point where objects with
AF_InternalBuffer allocation family are destroyed.

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

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

6 years ago[X86] Change _mm512_shuffle_pd and _mm512_shuffle_ps to use target specific shuffle...
Craig Topper [Sat, 7 Jul 2018 17:03:34 +0000 (17:03 +0000)]
[X86] Change _mm512_shuffle_pd and _mm512_shuffle_ps to use target specific shuffle builtins instead of generic __builtin_shufflevector.

I added the builtins for 128, 256, and 512 bits recently but looks like I failed to convert to using the 512 bit one.

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

6 years ago[X86] Fix various type mismatches in intrinsic headers and intrinsic tests that cause...
Craig Topper [Sat, 7 Jul 2018 17:03:32 +0000 (17:03 +0000)]
[X86] Fix various type mismatches in intrinsic headers and intrinsic tests that cause extra bitcasts to be emitted in the IR.

Found via imprecise grepping of the -O0 IR. There could still be more bugs out there.

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

6 years agoP0806R2 Implicit capture of this with a capture-default of [=] is
Richard Smith [Sat, 7 Jul 2018 05:58:48 +0000 (05:58 +0000)]
P0806R2 Implicit capture of this with a capture-default of [=] is
deprecated.

Add a -Wdeprecated warning for this in C++2a onwards. (In C++17 and
before, there isn't a reasonable alternative because [=,this] is
ill-formed.)

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

6 years ago[Sema] Emit -Wincomplete-implementation for partial methods.
Erik Pilkington [Sat, 7 Jul 2018 01:50:20 +0000 (01:50 +0000)]
[Sema] Emit -Wincomplete-implementation for partial methods.

Fixes rdar://40634455

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

6 years agoCheck returned type is valid before using it.
Richard Trieu [Sat, 7 Jul 2018 00:17:25 +0000 (00:17 +0000)]
Check returned type is valid before using it.

Add a .isNull() check to returned QualType.  Fixes PR38077

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

6 years ago[X86] When creating a select for scalar masked sqrt and div builtins make sure we...
Craig Topper [Fri, 6 Jul 2018 22:46:52 +0000 (22:46 +0000)]
[X86] When creating a select for scalar masked sqrt and div builtins make sure we optimize the all ones mask case.

This case occurs in the intrinsic headers so we should avoid emitting the mask in those cases.

Factor the code into a helper function to make this easy.

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

6 years ago[MachineOutliner] Properly pass -moutline along to the toolchain
Jessica Paquette [Fri, 6 Jul 2018 22:24:56 +0000 (22:24 +0000)]
[MachineOutliner] Properly pass -moutline along to the toolchain

This moves the LTO-specific code for outlining from ToolChains/Clang.cpp to
ToolChains/Darwin.cpp. Passing -mllvm flags isn't sufficient for making sure
that the specified pass will actually run in LTO. This makes sure that when
-moutline is passed, the MachineOutliner will actually be added to the LTO
pass pipeline as expected.

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

6 years ago[X86] Add missing scalar fma intrinsics with rounding, but no mask.
Craig Topper [Fri, 6 Jul 2018 22:08:43 +0000 (22:08 +0000)]
[X86] Add missing scalar fma intrinsics with rounding, but no mask.

We had the mask versions of the rounding intrinsics, but not one without masking.

Also change the rounding tests to not use the CUR_DIRECTION rounding mode.

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

6 years ago[ASTMatchers] A matcher for Objective-C @autoreleasepool
George Karpenkov [Fri, 6 Jul 2018 21:36:04 +0000 (21:36 +0000)]
[ASTMatchers] A matcher for Objective-C @autoreleasepool

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

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

6 years ago[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used.
Alexey Bataev [Fri, 6 Jul 2018 21:13:41 +0000 (21:13 +0000)]
[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used.

On Linux atomic constructs in OpenMP require libatomic library. Patch
links libatomic when -fopenmp is used.

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

6 years ago[OPENMP] Make clauses closing loc point to right bracket.
Alexey Bataev [Fri, 6 Jul 2018 19:35:42 +0000 (19:35 +0000)]
[OPENMP] Make clauses closing loc point to right bracket.

For some of the clauses the closing location erroneously points to the
beginning of the next clause rather than on the location of the closing
bracket of the clause.

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

6 years ago[Driver,AArch64] Add support for -mcpu=native.
Florian Hahn [Fri, 6 Jul 2018 10:49:59 +0000 (10:49 +0000)]
[Driver,AArch64] Add support for -mcpu=native.

This patches adds support for passing -mcpu=native for AArch64. It will
get turned into the host CPU name, before we get the target features.

CPU = native is handled in a similar fashion in
getAArch64MicroArchFetauresFromMtune and getAArch64TargetCPU already.

Having a good test case for this is hard, as it depends on the host CPU
of the machine running the test. But we can check that native has been
replaced with something else.

When cross-compiling, we will get a CPU name from the host architecture
and get ` the clang compiler does not support '-mcpu=native'` as error
message, which seems reasonable to me.

Reviewers: rengolin, peter.smith, dlj, javed.absar, t.p.northover

Reviewed By: peter.smith

Tags: #clang

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

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

6 years ago[SemaCodeComplete] Expose a method to create CodeCompletionString for macros.
Eric Liu [Fri, 6 Jul 2018 09:43:57 +0000 (09:43 +0000)]
[SemaCodeComplete] Expose a method to create CodeCompletionString for macros.

Summary:
The method only takes PPreprocessor and don't require structures that
might not be available (e.g. Sema and ASTContext) when CodeCompletionString
needs to be generated for macros.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years ago[X86] Implement _builtin_ia32_vfmaddss and _builtin_ia32_vfmaddsd with native IR...
Craig Topper [Fri, 6 Jul 2018 07:14:47 +0000 (07:14 +0000)]
[X86] Implement _builtin_ia32_vfmaddss and _builtin_ia32_vfmaddsd with native IR using llvm.fma intrinsic.

This generates some extra zeroing currently, but we should be able to quickly address that with some isel patterns.

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

6 years ago[ms] Fix mangling of string literals used to initialize arrays larger or smaller...
Hans Wennborg [Fri, 6 Jul 2018 06:54:16 +0000 (06:54 +0000)]
[ms] Fix mangling of string literals used to initialize arrays larger or smaller than the literal

A Chromium developer reported a bug which turned out to be a mangling
collision between these two literals:

  char s[] = "foo";
  char t[32] = "foo";

They may look the same, but for the initialization of t we will (under
some circumstances) use a literal that's extended with zeros, and
both the length and those zeros should be accounted for by the mangling.

This actually makes the mangling code simpler: where it previously had
special logic for null terminators, which are not part of the
StringLiteral, that is now covered by the general algorithm.

(The problem was reported at https://crbug.com/857442)

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

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

6 years ago[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %tu/%td on Darwin
Alex Lorenz [Thu, 5 Jul 2018 22:51:11 +0000 (22:51 +0000)]
[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %tu/%td on Darwin

The '%tu'/'%td' as formatting specifiers have been used to print out the
NSInteger/NSUInteger values for a long time. Typically their ABI matches, but that's
not the case on watchOS. The ABI difference boils down to the following:

- Regular 32-bit darwin targets (like armv7) use 'ptrdiff_t' of type 'int',
  which matches 'NSInteger'.
- WatchOS arm target (armv7k) uses 'ptrdiff_t' of type 'long', which doesn't
  match 'NSInteger' of type 'int'.

Because of this ABI difference these specifiers trigger -Wformat warnings only
for watchOS builds, which is really inconvenient for cross-platform code.

This patch avoids this -Wformat warning for '%tu'/'%td' and NS[U]Integer only,
and instead uses the new -Wformat-pedantic warning that JF introduced in
https://reviews.llvm.org/D47290. This is acceptable because Darwin guarantees that,
despite the watchOS ABI differences, sizeof(ptrdiff_t) == sizeof(NS[U]Integer),
and alignof(ptrdiff_t) == alignof(NS[U]Integer) so the warning is therefore noisy
for pedantic reasons.

I'll update public documentation to ensure that this behaviour is properly
communicated.

rdar://41739204

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

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

6 years ago[X86] Use shufflevector instead of a select with a constant mask for fmaddsub/fmsubad...
Craig Topper [Thu, 5 Jul 2018 20:38:31 +0000 (20:38 +0000)]
[X86] Use shufflevector instead of a select with a constant mask for fmaddsub/fmsubadd IR emission.

Shufflevector is easier to generate and matches what the backend pattern matches without relying on constant selects being turned into shuffles.

While I was there I also made the IR regular expressions a little stricter to ensure operand order on the shuffle.

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

6 years agoAdd PCH tests for R336379
Erich Keane [Thu, 5 Jul 2018 17:23:15 +0000 (17:23 +0000)]
Add PCH tests for R336379

I seemingly forgot the tests for this commit, added here.

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

6 years ago[clang-cl, PCH] Implement support for MS-style PCH through headers
Erich Keane [Thu, 5 Jul 2018 17:22:13 +0000 (17:22 +0000)]
[clang-cl, PCH] Implement support for MS-style PCH through headers

Implement support for MS-style PCH through headers.

This enables support for /Yc and /Yu where the through header is either
on the command line or included in the source. It replaces the current
support the requires the header also be specified with /FI.

This change adds a -cc1 option -pch-through-header that is used to either
start or stop compilation during PCH create or use.

When creating a PCH, the compilation ends after compilation of the through
header.

When using a PCH, tokens are skipped until after the through header is seen.

Patch By: mikerice
Differential Revision: https://reviews.llvm.org/D46652

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

6 years agoFix __builtin_*_overflow when out-param isn't constexpr
Erich Keane [Thu, 5 Jul 2018 15:52:58 +0000 (15:52 +0000)]
Fix __builtin_*_overflow when out-param isn't constexpr

As brought up on cfe-commits[1], r334650 causes the dependency of the
out parameter to the __builtin_*_overflow functions to be ignored. The result
was a usage that was otherwise constexpr (both operands to the operation were
constexpr) would be evaluated, but the out parameter wouldn't be modified, so
it would still be 'undef'.

This patch correctly handles the return value of handleAssignment to ensure that
this value is properly considered/evaluated.

[1] http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180702/233667.html

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

6 years ago[X86] Fix some vector cmp builtins - TRUE/FALSE predicates
Gabor Buella [Thu, 5 Jul 2018 14:26:56 +0000 (14:26 +0000)]
[X86] Fix some vector cmp builtins - TRUE/FALSE predicates

This patch removes on optimization used with the TRUE/FALSE
predicates, as was suggested in https://reviews.llvm.org/D45616
for r335339.
The optimization was buggy, since r335339 used it also
for *_mask builtins, without actually applying the mask -- the
mask argument was just ignored.

Reviewers: craig.topper, uriel.k, RKSimon, andrew.w.kaylor, spatel, scanon, efriedma

Reviewed By: spatel

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

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

6 years ago[mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASE
Vladimir Stefanovic [Thu, 5 Jul 2018 13:10:23 +0000 (13:10 +0000)]
[mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASE

'-mcrc' is shared with ARM.
'-mno-crc' is Mips-only (ARM uses '-mnocrc').

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

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

6 years ago[X86] NFC - add more test cases for vector cmp intrinsics
Gabor Buella [Thu, 5 Jul 2018 12:57:47 +0000 (12:57 +0000)]
[X86] NFC - add more test cases for vector cmp intrinsics

Add test cases with each predicate using the following
intrinsics:
_mm_cmp_pd
_mm_cmp_ps
_mm256_cmp_pd
_mm256_cmp_ps
_mm_cmp_pd_mask
_mm_cmp_ps_mask
_mm256_cmp_pd_mask
_mm256_cmp_ps_mask
_mm512_cmp_pd_mask
_mm512_cmp_ps_mask
_mm_mask_cmp_pd_mask
_mm_mask_cmp_ps_mask
_mm256_mask_cmp_pd_mask
_mm256_mask_cmp_ps_mask
_mm512_mask_cmp_pd_mask
_mm512_mask_cmp_ps_mask

Some of these are marked with FIXME, as there is bug in lowering
e.g. _mm512_mask_cmp_ps_mask.

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

6 years ago[ASTImporter] Fix import of objects with anonymous types
Gabor Marton [Thu, 5 Jul 2018 09:51:13 +0000 (09:51 +0000)]
[ASTImporter] Fix import of objects with anonymous types

Summary:
Currently, anonymous types are merged into the same redecl chain even if they
are structurally inequivalent. This results that global objects are not
imported, if there are at least two global objects with different anonymous
types. This patch provides a fix.

Reviewers: a.sidorin, balazske, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[NFS] Wipe trailing whitespaces
Kirill Bobyrev [Thu, 5 Jul 2018 09:37:26 +0000 (09:37 +0000)]
[NFS] Wipe trailing whitespaces

This patch is a preparation for another one containing meaningful
changes. This patch simply removes trailing whitespaces in few files
affected by the upcoming patch and reformats

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

6 years ago[Power9] Update fp128 as a valid homogenous aggregate base type
Lei Huang [Thu, 5 Jul 2018 04:32:01 +0000 (04:32 +0000)]
[Power9] Update fp128 as a valid homogenous aggregate base type

Update clang to treat fp128 as a valid base type for homogeneous aggregate
passing and returning.

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

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

6 years ago[Index] Remove unused index::IndexDataConsumer::_anchor()
Fangrui Song [Thu, 5 Jul 2018 00:33:03 +0000 (00:33 +0000)]
[Index] Remove unused index::IndexDataConsumer::_anchor()

It was supposed to serve as a key function, but it was invalid as it was not the first out-of-line non-pure virtual function.

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

6 years ago[analyzer][ctu] fix unsortable diagnostics
Rafael Stahl [Wed, 4 Jul 2018 14:12:58 +0000 (14:12 +0000)]
[analyzer][ctu] fix unsortable diagnostics

Summary: In the provided test case the PathDiagnostic compare function was not able to find a difference.

Reviewers: xazax.hun, NoQ, dcoughlin, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: a_sidorin, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits

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

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

6 years ago[ASTImporter] import macro source locations
Rafael Stahl [Wed, 4 Jul 2018 13:34:05 +0000 (13:34 +0000)]
[ASTImporter] import macro source locations

Summary: Implement full import of macro expansion info with spelling and expansion locations.

Reviewers: a.sidorin, klimek, martong, balazske, xazax.hun

Reviewed By: martong

Subscribers: thakis, xazax.hun, balazske, rnkovacs, cfe-commits

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

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

6 years agoNFC - Fix type in builtins-ppc-p9vector.c test
Gabor Buella [Wed, 4 Jul 2018 11:29:21 +0000 (11:29 +0000)]
NFC - Fix type in builtins-ppc-p9vector.c test

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

6 years agoNFC - Fix typo in test/CodeGenObjC/gnustep2-class.m
Gabor Buella [Wed, 4 Jul 2018 11:26:09 +0000 (11:26 +0000)]
NFC - Fix typo in test/CodeGenObjC/gnustep2-class.m

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

6 years agoNFC - Fix typo in test/Layout/itanium-pack-and-align.cpp
Gabor Buella [Wed, 4 Jul 2018 11:21:44 +0000 (11:21 +0000)]
NFC - Fix typo in test/Layout/itanium-pack-and-align.cpp

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

6 years agoAdd missing include for size_t
Eric Fiselier [Wed, 4 Jul 2018 11:14:18 +0000 (11:14 +0000)]
Add missing include for size_t

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

6 years ago[SemaCodeComplete] Make sure visited contexts are passed to completion results handler.
Eric Liu [Wed, 4 Jul 2018 10:01:18 +0000 (10:01 +0000)]
[SemaCodeComplete] Make sure visited contexts are passed to completion results handler.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[Sema] Fix crash in getConstructorName.
Ilya Biryukov [Wed, 4 Jul 2018 08:50:12 +0000 (08:50 +0000)]
[Sema] Fix crash in getConstructorName.

Summary:
Can happen when getConstructorName is called on invalid decls,
specifically the ones that do not have the injected class name.

Reviewers: bkramer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years agoNFC - typo fix in test/CodeGen/avx512f-builtins.c
Gabor Buella [Wed, 4 Jul 2018 08:32:02 +0000 (08:32 +0000)]
NFC - typo fix in test/CodeGen/avx512f-builtins.c

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

6 years agoPR33924: merge local declarations that have linkage of some kind within
Richard Smith [Wed, 4 Jul 2018 02:25:38 +0000 (02:25 +0000)]
PR33924: merge local declarations that have linkage of some kind within
merged function definitions; also merge functions with deduced return
types.

This seems like two independent fixes, but unfortunately they are hard
to separate because it's challenging to reliably test either one of them
without also testing the other.

A complication arises with deduced return type support: we need the type
of the function in order to know how to merge it, but we can't load the
actual type of the function because it might reference an entity
declared within the function (and we need to have already merged the
function to correctly merge that entity, which we would need to do to
determine if the function types match). So we instead compare the
declared function type when merging functions, and defer loading the
actual type of a function with a deduced type until we've finished
loading and merging the function.

This reverts r336175, reinstating r336021, with one change (for PR38015):
we look at the TypeSourceInfo of the first-so-far declaration of each
function when considering whether to merge two functions. This works
around a problem where the calling convention in the TypeSourceInfo for
subsequent redeclarations may not match if it was implicitly adjusted.

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

6 years ago[Sema] Consider all format_arg attributes.
Michael Kruse [Wed, 4 Jul 2018 01:37:11 +0000 (01:37 +0000)]
[Sema] Consider all format_arg attributes.

If a function has multiple format_arg attributes, clang only considers
the first it finds (because AttributeLists are in reverse order, not
necessarily the textually first) and ignores all others.

Loop over all FormatArgAttr to print warnings for all declared
format_arg attributes.

For instance, libintl's ngettext (select plural or singular version of
format string) has two __format_arg__ attributes.

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

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

6 years ago[Sema] Discarded statment should be an evaluatable context.
Erik Pilkington [Tue, 3 Jul 2018 22:15:36 +0000 (22:15 +0000)]
[Sema] Discarded statment should be an evaluatable context.

The constexpr evaluator was erroring out because these templates weren't
defined. Despite being used in a discarded statement, we still need to constexpr
evaluate them, which means that we need to instantiate them. Fixes PR37585.

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

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

6 years agoFactor out Clang's desired 8MB stack size constant from the various
Richard Smith [Tue, 3 Jul 2018 21:34:13 +0000 (21:34 +0000)]
Factor out Clang's desired 8MB stack size constant from the various
places we hardcode it.

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

6 years agoFix allocation of Nullability attribute.
Erich Keane [Tue, 3 Jul 2018 20:30:34 +0000 (20:30 +0000)]
Fix allocation of Nullability attribute.

Existing code always allocates for on the declarator's attribute pool,
but sometimes adds it to the declspec.  This patch ensures that the
correct pool is used.

Discovered while testing: https://reviews.llvm.org/D48788

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

6 years agoFix crash in clang.
Zachary Turner [Tue, 3 Jul 2018 18:12:39 +0000 (18:12 +0000)]
Fix crash in clang.

This happened during a recent refactor.  toStringRefArray() returns
a vector<StringRef>, which was being implicitly converted to an
ArrayRef<StringRef>, and then the vector was immediately being
destroyed, so the ArrayRef<> was losing its backing storage.
Fix this by making sure the vector gets permanent storage.

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

6 years ago[Driver] Add PPC64 as supported for Scudo
Kostya Kortchinsky [Tue, 3 Jul 2018 14:39:29 +0000 (14:39 +0000)]
[Driver] Add PPC64 as supported for Scudo

Summary:
Scudo works on PPC64 as is, so mark the architecture as supported for it. This
will also require a change to config-ix.cmake on the compiler-rt side.

Update the tests accordingly.

Reviewers: eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: cfe-commits

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

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

6 years agoRevert r336021 "PR33924: merge local declarations that have linkage of some kind...
Hans Wennborg [Tue, 3 Jul 2018 07:51:41 +0000 (07:51 +0000)]
Revert r336021 "PR33924: merge local declarations that have linkage of some kind within"

This caused test failures in 32-bit builds (PR38015).

> merged function definitions; also merge functions with deduced return
> types.
>
> This seems like two independent fixes, but unfortunately they are hard
> to separate because it's challenging to reliably test either one of them
> without also testing the other.
>
> A complication arises with deduced return type support: we need the type
> of the function in order to know how to merge it, but we can't load the
> actual type of the function because it might reference an entity
> declared within the function (and we need to have already merged the
> function to correctly merge that entity, which we would need to do to
> determine if the function types match). So we instead compare the
> declared function type when merging functions, and defer loading the
> actual type of a function with a deduced type until we've finished
> loading and merging the function.

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

6 years ago[Driver][Darwin] Use Host Triple to infer target os version
Steven Wu [Tue, 3 Jul 2018 04:15:49 +0000 (04:15 +0000)]
[Driver][Darwin] Use Host Triple to infer target os version

Summary:
When clang required to infer target os version from --target option and
the os version is not specified in targets, check the host triple. If the
host and target are both macOS, use host triple to infer target os
version.

rdar://problem/41651999

Reviewers: arphaman, dexonsmith

Reviewed By: arphaman

Subscribers: cfe-commits

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

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

6 years agoPer C++ [over.match.copy]p1, direct-initialization of a reference can
Richard Smith [Mon, 2 Jul 2018 23:25:22 +0000 (23:25 +0000)]
Per C++ [over.match.copy]p1, direct-initialization of a reference can
only invoke converting constructors of the reference's underlying type.

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

6 years ago[CodeGenCXX] Emit strip.invariant.group with -fstrict-vtable-pointers
Piotr Padlewski [Mon, 2 Jul 2018 19:21:36 +0000 (19:21 +0000)]
[CodeGenCXX] Emit strip.invariant.group with -fstrict-vtable-pointers

Summary:
Emmiting new intrinsic that strips invariant.groups to make
devirtulization sound, as described in RFC: Devirtualization v2.

Reviewers: rjmccall, rsmith, amharc, kuhar

Subscribers: llvm-commits, cfe-commits

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

Co-authored-by: Krzysztof Pszeniczny <krzysztof.pszeniczny@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336137 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] [tests] Pass clang executable path to prefix-less executor scripts.
George Karpenkov [Mon, 2 Jul 2018 17:10:40 +0000 (17:10 +0000)]
[analyzer] [tests] Pass clang executable path to prefix-less executor scripts.

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

6 years agoTest commit access
Balazs Keri [Mon, 2 Jul 2018 14:14:07 +0000 (14:14 +0000)]
Test commit access

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

6 years ago[ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.
Nico Weber [Mon, 2 Jul 2018 12:31:20 +0000 (12:31 +0000)]
[ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.

MSVC limits char16_t and char32_t string literal names to 32 bytes of character
data, not to 32 characters. wchar_t string literal names on the other hand can
get up to 64 bytes of character data.

https://reviews.llvm.org/D48781

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

6 years agoAdd expected fail triple x86_64-pc-windows-gnu to test as x86_64-w64-mingw32 is alrea...
Yaron Keren [Sat, 30 Jun 2018 11:18:44 +0000 (11:18 +0000)]
Add expected fail triple x86_64-pc-windows-gnu to test as x86_64-w64-mingw32 is already there

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

6 years ago[X86] Correct the width of mask arguments in intrinsic headers and tests.
Craig Topper [Sat, 30 Jun 2018 06:05:17 +0000 (06:05 +0000)]
[X86] Correct the width of mask arguments in intrinsic headers and tests.

All of these found by grepping through IR from the builtin tests for extra trunc and zext/sext instructions that shouldn't have been there.

Some of these were real bugs where we lost bits from the user input:
_mm512_mask_broadcast_f32x8
_mm512_maskz_broadcast_f32x8
_mm512_mask_broadcast_i32x8
_mm512_maskz_broadcast_i32x8
_mm256_mask_cvtusepi16_storeu_epi8

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