]> granicus.if.org Git - clang/log
clang
5 years agoReapply: [Driver] Use forward slashes in most linker arguments
Martin Storsjo [Fri, 26 Oct 2018 07:01:59 +0000 (07:01 +0000)]
Reapply: [Driver] Use forward slashes in most linker arguments

libtool inspects the output of $CC -v to detect what object files and
libraries are linked in by default. When clang is built as a native
windows executable, all paths are formatted with backslashes, and
the backslashes cause each argument to be enclosed in quotes. The
backslashes and quotes break further processing within libtool (which
is implemented in shell script, running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked
to the msys runtime, essentially the same as cygwin) and proper windows
style paths (with backslashes, that can easily break shell scripts
and msys environments), the best compromise is to use windows style
paths (starting with e.g. c:) but with forward slashes, which both
msys based tools, shell scripts and native windows executables can
cope with. This incidentally turns out to be the form of paths that
GCC prints out when run with -v on windows as well.

This change potentially makes the output from clang -v a bit more
inconsistent, but it is isn't necessarily very consistent to begin with.

Compared to the previous attempt in SVN r345004, this now does
the same transformation on more paths, hopefully on the right set
of paths so that all tests pass (previously some tests failed, where
path fragments that were required to be identical turned out to
use different path separators in different places). This now also
is done only for non-windows, or cygwin/mingw targets, to preserve
all backslashes for MSVC cases (where the paths can end up e.g. embedded
into PDB files. (The transformation function itself,
llvm::sys::path::convert_to_slash only has an effect when run on windows.)

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

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

5 years agoPR31978: Don't crash if CodeGen sees a top-level BindingDecl.
Richard Smith [Fri, 26 Oct 2018 03:21:20 +0000 (03:21 +0000)]
PR31978: Don't crash if CodeGen sees a top-level BindingDecl.

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

5 years agoCodeGen: correct the case for swift 4.2, 5.0
Saleem Abdulrasool [Fri, 26 Oct 2018 03:16:16 +0000 (03:16 +0000)]
CodeGen: correct the case for swift 4.2, 5.0

This corrects the leader for the swift names.  The encoding for 4.2 and
5.0 differ by a single bit on the second character and were swapped.

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

5 years ago[AArch64] Support Windows stack probe command-line arguments.
Eli Friedman [Fri, 26 Oct 2018 01:31:57 +0000 (01:31 +0000)]
[AArch64] Support Windows stack probe command-line arguments.

Adds support for -mno-stack-arg-probe and -mstack-probe-size.

(Not really happy copy-pasting code, but that's what we do for all the
other Windows targets.)

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

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

5 years ago[AArch64] Implement FP16FML intrinsics
Bryan Chan [Thu, 25 Oct 2018 23:47:00 +0000 (23:47 +0000)]
[AArch64] Implement FP16FML intrinsics

Generate the FP16FML intrinsics into arm_neon.h (AArch64 only for now).
Add two new type modifiers to NeonEmitter to handle the new prototypes.
Define __ARM_FEATURE_FP16FML when +fp16fml is enabled and guard the
intrinsics with the macro in arm_neon.h.

Based on a patch by Gao Yiling.

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

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

5 years ago[analyzer] Fix a bug in "collapsed" graph viewer
George Karpenkov [Thu, 25 Oct 2018 23:38:58 +0000 (23:38 +0000)]
[analyzer] Fix a bug in "collapsed" graph viewer

Nodes which have only one predecessor and only one successor can not
always be hidden, even if all states are the same.
An additional condition is needed: the predecessor may have only one successor.
This can be seen on this example:

```
  A
 / \
B   C
 \ /
  D
```

Nodes B and C can not be hidden even if all nodes in the graph have the
same state.

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

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

5 years ago[analyzer] [RetainCountChecker] Do not invalidate references passed to constructors...
George Karpenkov [Thu, 25 Oct 2018 23:38:41 +0000 (23:38 +0000)]
[analyzer] [RetainCountChecker] Do not invalidate references passed to constructors and operators

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

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

5 years ago[analyzer] Remove custom rule for OSIterator in RetainCountChecker
George Karpenkov [Thu, 25 Oct 2018 23:38:24 +0000 (23:38 +0000)]
[analyzer] Remove custom rule for OSIterator in RetainCountChecker

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

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

5 years ago[analyzer] Correct modelling of OSDynamicCast: eagerly state split
George Karpenkov [Thu, 25 Oct 2018 23:38:07 +0000 (23:38 +0000)]
[analyzer] Correct modelling of OSDynamicCast: eagerly state split

Previously, OSDynamicCast was modeled as an identity.

This is not correct: the output of OSDynamicCast may be zero even if the
input was not zero (if the class is not of desired type), and thus the
modeling led to false positives.

Instead, we are doing eager state split:
in one branch, the returned value is identical to the input parameter,
and in the other branch, the returned value is zero.

This patch required a substantial refactoring of canEval infrastructure,
as now it can return different function summaries, and not just true/false.

rdar://45497400

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

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

5 years agoAdd MS ABI mangling for operator<=>.
Richard Smith [Thu, 25 Oct 2018 22:51:16 +0000 (22:51 +0000)]
Add MS ABI mangling for operator<=>.

Thanks to Cameron DaCamara at Microsoft for letting us know what their
chosen mangling is here!

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

5 years agoAvoid std::map&vector in hexagon builtin code to save code size
Reid Kleckner [Thu, 25 Oct 2018 22:37:30 +0000 (22:37 +0000)]
Avoid std::map&vector in hexagon builtin code to save code size

Constructing a global std::map requires clang to generate a linear
amount of code to construct the initializer list if the elements are not
constexpr-constructible. std::vector is not constexpr-constructible, so
this code pattern was generating large amounts of code.

Also, because of PR38829, LLVM is pathologically slow on large basic
blocks, and this causes slow compilation. This works around the bug and
reduces code size.

SemaChecking.cpp -debug-info-kind=limited:
        time      objsize
before: 1m45.023s 9.8M
after:  0m25.205s 6.9M

So, a 42% obj size reduction and 3.2x speedup.

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

5 years agoAvoid STMT_ and DECL_ bitcodes overlapping.
Richard Smith [Thu, 25 Oct 2018 22:35:16 +0000 (22:35 +0000)]
Avoid STMT_ and DECL_ bitcodes overlapping.

This doesn't appear to matter for deserialization purposes, because we
always know what kind of entity (declaration or statement/expression)
we're trying to load, but it makes the llvm-bcanalyzer output a lot less
mysterious.

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

5 years ago[C++17] Reject shadowing of capture by parameter in lambda
Nicolas Lesser [Thu, 25 Oct 2018 20:15:03 +0000 (20:15 +0000)]
[C++17] Reject shadowing of capture by parameter in lambda

Summary:
This change rejects the shadowing of a capture by a parameter in lambdas in C++17.

```
int main() {
  int a;
  auto f = [a](int a) { return a; };
}
```

results in:

```
main.cpp:3:20: error: a lambda parameter cannot shadow an explicitly captured entity
  auto f = [a](int a) { return a; };
                   ^
main.cpp:3:13: note: variable a is explicitly captured here
  auto f = [a](int a) { return a; };
            ^
```

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: lebedev.ri, erik.pilkington, cfe-commits

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

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

5 years agoRevert "[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03"
Eric Fiselier [Thu, 25 Oct 2018 19:50:43 +0000 (19:50 +0000)]
Revert "[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03"

This reverts commit b5d8d0de744d2c212bdb17d5c5fd4447dd14dbd2.

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

5 years agoRebase defect report list.
Nicolas Lesser [Thu, 25 Oct 2018 19:27:57 +0000 (19:27 +0000)]
Rebase defect report list.

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

5 years agoChange keep-static-consts to work on static storage duration, not
Erich Keane [Thu, 25 Oct 2018 19:13:46 +0000 (19:13 +0000)]
Change keep-static-consts to work on static storage duration, not
storage class.

To be more in line with what GCC does, switch the condition to be based
on the Static Storage duration instead of the storage class.

Change-Id: I8e959d762433cda48855099353bf3c950b9d54b8

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

5 years ago[WebAssembly] Bitselect and min/max builtins
Thomas Lively [Thu, 25 Oct 2018 19:11:41 +0000 (19:11 +0000)]
[WebAssembly] Bitselect and min/max builtins

Reviewers: aheejin, dschuff

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

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

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

5 years ago[WebAssembly] Lower to target-independent saturating add
Thomas Lively [Thu, 25 Oct 2018 19:06:15 +0000 (19:06 +0000)]
[WebAssembly] Lower to target-independent saturating add

Summary: Goes along with D53721.

Reviewers: aheejin, dschuff

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

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

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

5 years agoImplement Function Multiversioning for Non-ELF Systems.
Erich Keane [Thu, 25 Oct 2018 18:57:19 +0000 (18:57 +0000)]
Implement Function Multiversioning for Non-ELF Systems.

Similar to how ICC handles CPU-Dispatch on Windows, this patch uses the
resolver function directly to forward the call to the proper function.
This is not nearly as efficient as IFuncs of course, but is still quite
useful for large functions specifically developed for certain
processors.

This is unfortunately still limited to x86, since it depends on
__builtin_cpu_supports and __builtin_cpu_is, which are x86 builtins.

The naming for the resolver/forwarding function for cpu-dispatch was
taken from ICC's implementation, which uses the unmodified name for this
(no mangling additions).  This is possible, since cpu-dispatch uses '.A'
for the 'default' version.

In 'target' multiversioning, this function keeps the '.resolver'
extension in order to keep the default function keeping the default
mangling.

Change-Id: I4731555a39be26c7ad59a2d8fda6fa1a50f73284

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

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

5 years ago[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03
Eric Fiselier [Thu, 25 Oct 2018 18:16:16 +0000 (18:16 +0000)]
[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03

Summary:
When -faligned-allocation is specified in C++03 libc++ defines std::align_val_t as an unscoped enumeration type (because Clang didn't provide scoped enumerations as an extension until 8.0).
Unfortunately Clang confuses the `align_val_t` overloads of delete with the sized deallocation overloads which aren't enabled. This caused Clang to call the aligned deallocation function as if it were the sized deallocation overload.

For example: https://godbolt.org/z/xXJELh

This patch fixes the confusion.

Reviewers: rsmith, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

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

5 years agoCodeGen: alter CFConstantString class name for swift 5.0
Saleem Abdulrasool [Thu, 25 Oct 2018 17:52:13 +0000 (17:52 +0000)]
CodeGen: alter CFConstantString class name for swift 5.0

Swift 5.0 has changed the name decoration for swift symbols, using a 'S' sigil
rather than 's' as in 4.2.  Adopt the new convention.

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

5 years ago[analyzer] Move canReasonAbout from Z3ConstraintManager to SMTConstraintManager
Mikhail R. Gadelha [Thu, 25 Oct 2018 17:27:42 +0000 (17:27 +0000)]
[analyzer] Move canReasonAbout from Z3ConstraintManager to SMTConstraintManager

Summary:
This patch moves the last method in `Z3ConstraintManager` to `SMTConstraintManager`: `canReasonAbout()`.

The `canReasonAbout()` method checks if a given `SVal` can be encoded in SMT. I've added a new method to the SMT API to return true if a solver can encode floating-point arithmetics and it was enough to make `canReasonAbout()` solver independent.

As an annoying side-effect, `Z3ConstraintManager` is pretty empty now and only (1) creates the Z3 solver object by calling `CreateZ3Solver()` and (2) instantiates `SMTConstraintManager`. Maybe we can get rid of this class altogether in the future: a `CreateSMTConstraintManager()` method that does (1) and (2) and returns the constraint manager object?

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

Subscribers: mehdi_amini, xazax.hun, szepet, a.sidorin, dexonsmith, Szelethus, donat.nagy, dkrupp

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

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

5 years ago[analyzer] Fixed bitvector from model always being unsigned
Mikhail R. Gadelha [Thu, 25 Oct 2018 17:27:36 +0000 (17:27 +0000)]
[analyzer] Fixed bitvector from model always being unsigned

Summary:
Getting an `APSInt` from the model always returned an unsigned integer because of the unused parameter.

This was not breaking any test case because no code relies on the actual value of the integer returned here, but rather it is only used to check if a symbol has more than one solution in `getSymVal`.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, Szelethus, donat.nagy, dkrupp

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

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

5 years ago[OPENMP]Fix PR39422: variables are not firstprivatized in task context.
Alexey Bataev [Thu, 25 Oct 2018 15:35:27 +0000 (15:35 +0000)]
[OPENMP]Fix PR39422: variables are not firstprivatized in task context.

According to the OpenMP standard, In a task generating construct, if no
default clause is present, a variable for which the data-sharing
attribute is not determined by the rules above is firstprivatized.
Compiler tries to implement this, but if the variable is not directly
used in the task context, this variable may not be firstprivatized.
Patch fixes this problem.

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

5 years ago[AArch64] Branch Protection and Return Address Signing B Key Support
Luke Cheeseman [Thu, 25 Oct 2018 15:23:49 +0000 (15:23 +0000)]
[AArch64] Branch Protection and Return Address Signing B Key Support

- Add support for -mbranch-protection=<type>[+<type>]* where
  - <type> ::= [standard, none, bti, pac-ret[+b-key,+leaf]*]
- The protection emits relevant function attributes
  - sign-return-address=<scope>
  - sign-return-address-key=<key>
  - branch-protection

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

5 years agoupdate the clang doc about contributions
Sylvestre Ledru [Thu, 25 Oct 2018 14:19:06 +0000 (14:19 +0000)]
update the clang doc about contributions

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

5 years ago[ms] Prevent explicit constructor name lookup if scope is missing
Will Wilson [Thu, 25 Oct 2018 11:45:32 +0000 (11:45 +0000)]
[ms] Prevent explicit constructor name lookup if scope is missing

MicrosoftExt allows explicit constructor calls. Prevent lookup of constructor name unless the name has explicit scope.
This avoids a compile-time crash due to confusing a member access for a constructor name.

Test case included. All tests pass.

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

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

5 years ago[clang-format] Break before next parameter after a formatted multiline raw string...
Krasimir Georgiev [Thu, 25 Oct 2018 07:39:30 +0000 (07:39 +0000)]
[clang-format] Break before next parameter after a formatted multiline raw string parameter

Summary:
Currently clang-format breaks before the next parameter after multiline parameters (also recursively for the parent expressions of multiline parameters). However, it fails to do so for formatted multiline raw string literals:
```
$ cat test.cc
// Examples

// Regular multiline tokens
int x = f(R"(multi
             line)", 2);
}

int y = g(h(R"(multi
              line)"), 2);

// Formatted multiline tokens
int z = f(R"pb(multi: 1  #
               line: 2)pb", 2);

int w = g(h(R"pb(multi: 1  #
                 line: 2)pb"), 2);
$ clang-format -style=google test.cc
// Examples

// Regular multiline tokens
int x = f(R"(multi
             line)",
          2);
}

int y = g(h(R"(multi
              line)"),
          2);

// Formatted multiline tokens
int z = f(R"pb(multi: 1  #
               line: 2)pb", 2);

int w = g(h(R"pb(multi: 1  #
                 line: 2)pb"), 2);
```

This patch addresses this inconsistency by forcing breaking after multiline formatted raw string literals. This requires a little tweak to the indentation chosen for the contents of a formatted raw string literal: in case when that's a parameter and not the last one, the indentation is based off of the uniform indentation of all of the parameters.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

5 years ago[CodeGen] Always emit the 'min-legal-vector-width' attribute even when the value...
Craig Topper [Thu, 25 Oct 2018 05:04:35 +0000 (05:04 +0000)]
[CodeGen] Always emit the 'min-legal-vector-width' attribute even when the value is 0.

The X86 backend will need to see the attribute to make decisions. If it isn't present the backend will have to assume large vectors may be present.

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

5 years ago[Sema] Fix -Wcomma for C89
Richard Trieu [Thu, 25 Oct 2018 01:08:00 +0000 (01:08 +0000)]
[Sema] Fix -Wcomma for C89

There is a small difference in the scope flags for C89 versus the other C/C++
dialects.  This change ensures that the -Wcomma warning won't be duplicated or
issued in the wrong location.  Also, the test case is refactored into C and C++
parts, with the C++ parts guarded by a #ifdef to allow the test to run in both
modes.

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

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

5 years agoRevert "[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03"
Eric Fiselier [Wed, 24 Oct 2018 23:47:04 +0000 (23:47 +0000)]
Revert "[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03"

This reverts commit 6f47cdd51341344c0e32630e19e72c94cd25f34e.

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

5 years agoDriver,CodeGen: introduce support for Swift CFString layout
Saleem Abdulrasool [Wed, 24 Oct 2018 23:28:28 +0000 (23:28 +0000)]
Driver,CodeGen: introduce support for Swift CFString layout

Add a new driver level flag `-fcf-runtime-abi=` that allows one to specify the
runtime ABI for CoreFoundation.  This controls the language interoperability.
In particular, this is relevant for generating the CFConstantString classes
(primarily through the `__builtin___CFStringMakeConstantString` builtin) which
construct a reference to the "CFObject"'s `isa` field.  This type differs
between swift 4.1 and 4.2+.

Valid values for the new option include:
  - objc [default behaviour] - enable ObjectiveC interoperability
  - swift-4.1 - enable interoperability with swift 4.1
  - swift-4.2 - enable interoperability with swift 4.2
  - swift-5.0 - enable interoperability with swift 5.0
  - swift [alias] - target the latest swift ABI

Furthermore, swift 4.2+ changed the layout for the CFString when building
CoreFoundation *without* ObjectiveC interoperability.  In such a case, a field
was added to the CFObject base type changing it from: <{ const int*, int }> to
<{ uintptr_t, uintptr_t, uint64_t }>.

In swift 5.0, the CFString type will be further adjusted to change the length
from a uint32_t on everything but BE LP64 targets to uint64_t.

Note that the default behaviour for clang remains unchanged and the new layout
must be explicitly opted into via `-fcf-runtime-abi=swift*`.

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

5 years ago[VFS] Remove 'ignore-non-existent-contents' attribute for YAML-based VFS.
Volodymyr Sapsai [Wed, 24 Oct 2018 22:39:38 +0000 (22:39 +0000)]
[VFS] Remove 'ignore-non-existent-contents' attribute for YAML-based VFS.

'ignore-non-existent-contents' stopped working after r342232 in a way
that the actual attribute value isn't used and it works as if it is
always `true`.

Common use case for VFS iteration is iterating through files in umbrella
directories for modules. Ability to detect if some VFS entries point to
non-existing files is nice but non-critical. Instead of adding back
support for `'ignore-non-existent-contents': false` I am removing the
attribute, because such scenario isn't used widely enough and stricter
checks don't provide enough value to justify the maintenance.

rdar://problem/45176119

Reviewers: bruno

Reviewed By: bruno

Subscribers: hiraditya, dexonsmith, sammccall, cfe-commits

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

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

5 years ago[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03
Eric Fiselier [Wed, 24 Oct 2018 22:38:49 +0000 (22:38 +0000)]
[SemaCXX] Unconfuse Clang when std::align_val_t is unscoped in C++03

Summary:
When -faligned-allocation is specified in C++03 libc++ defines std::align_val_t as an unscoped enumeration type (because Clang didn't provide scoped enumerations as an extension until 8.0).
Unfortunately Clang confuses the `align_val_t` overloads of delete with the sized deallocation overloads which aren't enabled. This caused Clang to call the aligned deallocation function as if it were the sized deallocation overload.

For example: https://godbolt.org/z/xXJELh

This patch fixes the confusion.

Reviewers: rsmith, EricWF

Reviewed By: EricWF

Subscribers: cfe-commits

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

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

5 years agoAdd gfx909 to GPU Arch
Tim Renouf [Wed, 24 Oct 2018 21:19:02 +0000 (21:19 +0000)]
Add gfx909 to GPU Arch

Subscribers: jholewinski, cfe-commits

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

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

5 years agoAMDGPU: Handle gfx909 in AMDGPUTargetInfo::initFeatureMap
Konstantin Zhuravlyov [Wed, 24 Oct 2018 19:07:56 +0000 (19:07 +0000)]
AMDGPU: Handle gfx909 in AMDGPUTargetInfo::initFeatureMap

+ add required tests

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

5 years agoDo not always request an implicit taskgroup region inside the kmpc_taskloop function
Alexey Bataev [Wed, 24 Oct 2018 19:06:37 +0000 (19:06 +0000)]
Do not always request an implicit taskgroup region inside the kmpc_taskloop function

Summary:
For the following code:
```
    int i;
    #pragma omp taskloop
    for (i = 0; i < 100; ++i)
    {}

    #pragma omp taskloop nogroup
    for (i = 0; i < 100; ++i)
    {}
```

Clang emits the following LLVM IR:

```
 ...
  call void @__kmpc_taskgroup(%struct.ident_t* @0, i32 %0)
  %2 = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 %0, i32 1, i64 80, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates*)* @.omp_task_entry. to i32 (i32, i8*)*))
  ...
  call void @__kmpc_taskloop(%struct.ident_t* @0, i32 %0, i8* %2, i32 1, i64* %8, i64* %9, i64 %13, i32 0, i32 0, i64 0, i8* null)
  call void @__kmpc_end_taskgroup(%struct.ident_t* @0, i32 %0)

  ...
  %15 = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 %0, i32 1, i64 80, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %struct.kmp_task_t_with_privates.1*)* @.omp_task_entry..2 to i32 (i32, i8*)*))
  ...
  call void @__kmpc_taskloop(%struct.ident_t* @0, i32 %0, i8* %15, i32 1, i64* %21, i64* %22, i64 %26, i32 0, i32 0, i64 0, i8* null)

```

The first set of instructions corresponds to the first taskloop construct. It is important to note that the implicit taskgroup region associated with the taskloop construct has been materialized in our IR:  the `__kmpc_taskloop` occurs inside a taskgroup region. Note also that this taskgroup region does not exist in our second taskloop because we are using the `nogroup` clause.

The issue here is the 4th argument of the kmpc_taskloop call, starting from the end,  is always a zero. Checking the LLVM OpenMP RT implementation, we see that this argument corresponds to the nogroup parameter:

```
void __kmpc_taskloop(ident_t *loc, int gtid, kmp_task_t *task, int if_val,
                     kmp_uint64 *lb, kmp_uint64 *ub, kmp_int64 st, int nogroup,
                     int sched, kmp_uint64 grainsize, void *task_dup);
```

So basically we always tell to the RT to do another taskgroup region. For the first taskloop, this means that we create two taskgroup regions. For the second example, it means that despite the fact we had a nogroup clause we are going to have a taskgroup region, so we unnecessary wait until all descendant tasks have been executed.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: rogfer01, cfe-commits

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

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

5 years ago[OPENMP]Fix PR39366: do not try to private field if it is not captured.
Alexey Bataev [Wed, 24 Oct 2018 18:53:12 +0000 (18:53 +0000)]
[OPENMP]Fix PR39366: do not try to private field if it is not captured.

The compiler is crashing if we trying to post-capture the fields
implicitly captured inside of the task constructs. Seems, this kind of
processing is not supported and such fields should not be
firstprivatized.

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

5 years ago[CodeGen] Update test checks missed in r345168.
Craig Topper [Wed, 24 Oct 2018 18:45:44 +0000 (18:45 +0000)]
[CodeGen] Update test checks missed in r345168.

These tests don't run unless the aarch64 target is registered and my testing had been on an x86 only build directory.

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

5 years ago[Hexagon] Flip hexagon-autohvx to be true by default
Krzysztof Parzyszek [Wed, 24 Oct 2018 17:55:18 +0000 (17:55 +0000)]
[Hexagon] Flip hexagon-autohvx to be true by default

This will allow other generators of LLVM IR to use the auto-vectorizer
without having to change that flag.

Note: on its own, this patch will disable auto-vectorization on Hexagon
in all cases, regardless of the -fvectorize flag. There is a companion
LLVM patch that together with this one forms an NFC for clang users.

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

5 years ago[CodeGen] Update min-legal-vector width based on function argument and return types
Craig Topper [Wed, 24 Oct 2018 17:42:17 +0000 (17:42 +0000)]
[CodeGen] Update min-legal-vector width based on function argument and return types

This is a continuation of my patches to inform the X86 backend about what the largest IR types are in the function so that we can restrict the backend type legalizer to prevent 512-bit vectors on SKX when -mprefer-vector-width=256 is specified if no explicit 512 bit vectors were specified by the user.

This patch updates the vector width based on the argument and return types of the current function and from the types of any functions it calls. This is intended to make sure the backend type legalizer doesn't disturb any types that are required for ABI.

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

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

5 years agoCodeGen: extract some local variables in CFConstantString creation (NFC)
Saleem Abdulrasool [Wed, 24 Oct 2018 16:56:36 +0000 (16:56 +0000)]
CodeGen: extract some local variables in CFConstantString creation (NFC)

Extract the reference to the ASTContext and Triple and use them throughout the
function.  This is simply a cosmetic cleanup while in the area.  NFC.

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

5 years agoAST: unindent CFConstantStringDecl by inverting condition (NFC)
Saleem Abdulrasool [Wed, 24 Oct 2018 16:38:16 +0000 (16:38 +0000)]
AST: unindent CFConstantStringDecl by inverting condition (NFC)

Unindent the body of the function by inverting check at the top.  This is in
preparation for supporting CFString's new ABI with swift.  NFC.

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

5 years ago[clang] Introduce new completion context types
Kadir Cetinkaya [Wed, 24 Oct 2018 15:23:49 +0000 (15:23 +0000)]
[clang] Introduce new completion context types

Summary: New name suggestions were being used in places where existing names should have been used, this patch tries to fix some of those situations.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: arphaman, cfe-commits

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

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

5 years agoRemove a pair of unused dispatch multiversion declarations.
Erich Keane [Wed, 24 Oct 2018 14:33:30 +0000 (14:33 +0000)]
Remove a pair of unused dispatch multiversion declarations.

These declarations somehow survived a cleanup that combined them with the target
multiversioning functions.  This patch removes them as they are no
longer necessary or used.

Change-Id: I318286401ace63bef1aa48018dabb25be0117ca0

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

5 years ago[CodeComplete] Expose InBaseClass signal in code completion results.
Eric Liu [Wed, 24 Oct 2018 12:57:27 +0000 (12:57 +0000)]
[CodeComplete] Expose InBaseClass signal in code completion results.

Summary:
No new tests as the existing tests for result priority should give us
coverage. Also as the new flag is trivial enough, I'm reluctant to plumb the
flag to c-index-test output.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

5 years ago[autocompletion] Handle the space before pressing tab
Yuka Takahashi [Wed, 24 Oct 2018 12:43:25 +0000 (12:43 +0000)]
[autocompletion] Handle the space before pressing tab

Summary:
Distinguish "--autocomplete=-someflag" and "--autocomplete=-someflag,"
because the latter indicates that the user put a space before pushing tab
which should end up in a file completion.

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

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

5 years agoSupport accepting __gnu__ as a scoped attribute namespace that aliases to gnu.
Aaron Ballman [Wed, 24 Oct 2018 12:26:23 +0000 (12:26 +0000)]
Support accepting __gnu__ as a scoped attribute namespace that aliases to gnu.

This is useful in libstdc++ to avoid clashes with identifiers in the user's namespace.

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

5 years ago[Sema] Do not show unused parameter warnings when body is skipped
Ilya Biryukov [Wed, 24 Oct 2018 08:29:24 +0000 (08:29 +0000)]
[Sema] Do not show unused parameter warnings when body is skipped

Summary: Without the function body, we cannot determine is parameter was used.

Reviewers: ioeric, sammccall

Reviewed By: sammccall

Subscribers: arphaman, cfe-commits

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

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

5 years ago[bash-autocompletion] Fix bug when a flag ends with '='
Yuka Takahashi [Wed, 24 Oct 2018 08:24:16 +0000 (08:24 +0000)]
[bash-autocompletion] Fix bug when a flag ends with '='

There was a bug that when a flag ends with '=' and no value was suggested,
clang autocompletes the flag itself.
For example, in bash, it looked like this:
```
$ clang -fmodule-file=[tab]
-> $clang -fmodule-file=-fmodule-file
```
This is not what we expect. We expect a file autocompletion when no value
was found. With this patch, pressing tab suggests files in the current
directory.

Reviewers: teemperor, ruiu

Subscribers: cfe-commits

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

5 years ago[Sema] Fix -Wcomma in dependent context
Richard Trieu [Wed, 24 Oct 2018 02:07:41 +0000 (02:07 +0000)]
[Sema] Fix -Wcomma in dependent context

When there is a dependent type inside a cast, the CastKind becomes CK_Dependent
instead of CK_ToVoid.  This fix will check that there is a dependent cast,
the original type is dependent, and the target type is void to ignore the cast.

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

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

5 years agoDebug Info (-gmodules): emit full types for non-anchored template specializations
Adrian Prantl [Wed, 24 Oct 2018 00:06:02 +0000 (00:06 +0000)]
Debug Info (-gmodules): emit full types for non-anchored template specializations

Before this patch, clang would emit a (module-)forward declaration for
template instantiations that are not anchored by an explicit template
instantiation, but still are guaranteed to be available in an imported
module. Unfortunately detecting the owning module doesn't reliably
work when local submodule visibility is enabled and the template is
inside a cross-module namespace.

This make clang debuggable again with -gmodules and LSV enabled.

rdar://problem/41552377

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

5 years ago[analyzer] [NFC] Change scanReachableSymbols to use ranges
George Karpenkov [Tue, 23 Oct 2018 23:12:12 +0000 (23:12 +0000)]
[analyzer] [NFC] Change scanReachableSymbols to use ranges

Remove unused overload. Clean up some usages.

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

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

5 years ago[analyzer] Do not stop tracking CXX methods touching OSObject.
George Karpenkov [Tue, 23 Oct 2018 23:11:50 +0000 (23:11 +0000)]
[analyzer] Do not stop tracking CXX methods touching OSObject.

Trust generalized annotations for OSObject.

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

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

5 years ago[analyzer] Trust summaries for OSObject::retain and OSObject::release
George Karpenkov [Tue, 23 Oct 2018 23:11:30 +0000 (23:11 +0000)]
[analyzer] Trust summaries for OSObject::retain and OSObject::release

Refactor the way in which summaries are consumed for safeMetaCast

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

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

5 years agoNFC: Remove MANGLE_CHECKER from ItaniumMangle.cpp
Erik Pilkington [Tue, 23 Oct 2018 19:55:38 +0000 (19:55 +0000)]
NFC: Remove MANGLE_CHECKER from ItaniumMangle.cpp

This hasn't even compiled since 2011. It would be useful to have some test to
verify that ItaniumMangle and ItaniumDemangle agree, but this isn't it.

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

5 years agoChange getRedeclContext() to support enumerations as another kind of transparent...
Aaron Ballman [Tue, 23 Oct 2018 19:44:51 +0000 (19:44 +0000)]
Change getRedeclContext() to support enumerations as another kind of transparent context in C.

This change fixes PR15071 and ensures that enumerators redefined in a struct cannot conflict with enumerators defined outside of the struct.

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

5 years agoFix doxygen comment.
Adrian Prantl [Tue, 23 Oct 2018 19:39:02 +0000 (19:39 +0000)]
Fix doxygen comment.

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

5 years ago[analyzer] Rename trackNullOrUndefValue to trackExpressionValue
George Karpenkov [Tue, 23 Oct 2018 18:24:53 +0000 (18:24 +0000)]
[analyzer] Rename trackNullOrUndefValue to trackExpressionValue

trackNullOrUndefValue is a long and confusing name,
and it does not actually reflect what the function is doing.
Give a function a new name, with a relatively clear semantics.

Also remove some dead code.

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

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

5 years ago[Fixed Point Arithmetic] Fixed Point to Boolean Cast
Leonard Chan [Tue, 23 Oct 2018 17:55:35 +0000 (17:55 +0000)]
[Fixed Point Arithmetic] Fixed Point to Boolean Cast

This patch is a part of https://reviews.llvm.org/D48456 in an attempt to split
the casting logic up into smaller patches. This contains the code for casting
from fixed point types to boolean types.

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

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

5 years ago[OpenCL] Remove PIPE_RESERVE_ID_VALID_BIT from opencl-c.h
Andrew Savonichev [Tue, 23 Oct 2018 17:05:29 +0000 (17:05 +0000)]
[OpenCL] Remove PIPE_RESERVE_ID_VALID_BIT from opencl-c.h

Summary:
PIPE_RESERVE_ID_VALID_BIT is implementation defined, so lets not keep it in the header.

Previously the topic was discussed here: https://reviews.llvm.org/D32896

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: cfe-commits, asavonic, bader

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

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

5 years ago[OpenCL] Add cl_intel_planar_yuv extension
Andrew Savonichev [Tue, 23 Oct 2018 16:13:16 +0000 (16:13 +0000)]
[OpenCL] Add cl_intel_planar_yuv extension

Just adding a preprocessor #define for the extension.

Patch by Alexey Sotkin and Dmitry Sidorov

Phabricator review: https://reviews.llvm.org/D51402

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

5 years ago[OpenCL][NFC] Unify ZeroToOCL* cast types
Andrew Savonichev [Tue, 23 Oct 2018 15:19:20 +0000 (15:19 +0000)]
[OpenCL][NFC] Unify ZeroToOCL* cast types

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: asavonic, cfe-commits

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

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

5 years ago[clang] Fix a null pointer dereference.
Kadir Cetinkaya [Tue, 23 Oct 2018 13:49:37 +0000 (13:49 +0000)]
[clang] Fix a null pointer dereference.

Summary:
Sometimes expression inside switch statement can be invalid, for
example type might be incomplete. In those cases code were causing a null
pointer dereference. This patch fixes that.

Reviewers: sammccall, ioeric, hokein

Reviewed By: sammccall

Subscribers: arphaman, cfe-commits

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

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

5 years agoRevert r345009 "[DebugInfo] Generate debug information for labels. (After fix PR39094)"
Hans Wennborg [Tue, 23 Oct 2018 13:17:13 +0000 (13:17 +0000)]
Revert r345009 "[DebugInfo] Generate debug information for labels. (After fix PR39094)"

This broke the Chromium build. See
https://bugs.chromium.org/p/chromium/issues/detail?id=898152#c1 for the
reproducer.

> Generate DILabel metadata and call llvm.dbg.label after label
> statement to associate the metadata with the label.
>
> After fixing PR37395.
> After fixing problems in LiveDebugVariables.
> After fixing NULL symbol problems in AddressPool when enabling
> split-dwarf-file.
> After fixing PR39094.
>
> Differential Revision: https://reviews.llvm.org/D45045

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

5 years ago[AST] Do not align virtual bases in `MicrosoftRecordLayoutBuilder` when
Aleksandr Urakov [Tue, 23 Oct 2018 08:23:22 +0000 (08:23 +0000)]
[AST] Do not align virtual bases in `MicrosoftRecordLayoutBuilder` when
      an external layout is used

Summary:
The patch removes alignment of virtual bases when an external layout is used.
We have two cases:
- the external layout source has an information about virtual bases offsets,
  so we just use them;
- the external source has no information about virtual bases offsets. In this
  case we can't predict where the base will be located. If we will align it but
  there will be something like `#pragma pack(push, 1)` really, then likely our
  layout will not fit into the real structure size, and then some asserts will
  hit. The asserts look reasonable, so I don't think that we need to remove
  them. May be it would be better instead don't align fields / bases etc.
  (so treat it always as `#pragma pack(push, 1)`) when an external layout source
  is used but no info about a field location is presented.

This one is related to D49871

Reviewers: rnk, rsmith, zturner, mstorsjo, majnemer

Reviewed By: rnk

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[DebugInfo] Generate debug information for labels. (After fix PR39094)
Hsiangkai Wang [Tue, 23 Oct 2018 08:06:21 +0000 (08:06 +0000)]
[DebugInfo] Generate debug information for labels. (After fix PR39094)

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.
After fixing problems in LiveDebugVariables.
After fixing NULL symbol problems in AddressPool when enabling
split-dwarf-file.
After fixing PR39094.

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

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

5 years agoRevert "[Driver] Use forward slashes in most linker arguments"
Martin Storsjo [Tue, 23 Oct 2018 07:01:55 +0000 (07:01 +0000)]
Revert "[Driver] Use forward slashes in most linker arguments"

This reverts commit r345004, as it broke tests when actually run
on windows; see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/763.

This broke tests that had captured a variable containing a path
with backslashes, which failed to match cases in the output
where the path separators had been changed into forward slashes.

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

5 years ago[Driver] Use forward slashes in most linker arguments
Martin Storsjo [Tue, 23 Oct 2018 06:33:26 +0000 (06:33 +0000)]
[Driver] Use forward slashes in most linker arguments

libtool inspects the output of $CC -v to detect what object files and
libraries are linked in by default. When clang is built as a native
windows executable, all paths are formatted with backslashes, and
the backslashes cause each argument to be enclosed in quotes. The
backslashes and quotes break further processing within libtool (which
is implemented in shell script, running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked
to the msys runtime, essentially the same as cygwin) and proper windows
style paths (with backslashes, that can easily break shell scripts
and msys environments), the best compromise is to use windows style
paths (starting with e.g. c:) but with forward slashes, which both
msys based tools, shell scripts and native windows executables can
cope with. This incidentally turns out to be the form of paths that
GCC prints out when run with -v on windows as well.

This change potentially makes the output from clang -v a bit more
inconsistent, but it is isn't necessarily very consistent to begin with.

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

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

5 years ago[MinGW] Link to correct openmp library
Martin Storsjo [Tue, 23 Oct 2018 06:33:22 +0000 (06:33 +0000)]
[MinGW] Link to correct openmp library

Patch by Peiyuan Song!

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

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

5 years agoAdd gfx904 and gfx906 to GPU Arch
Yaxun Liu [Tue, 23 Oct 2018 02:05:31 +0000 (02:05 +0000)]
Add gfx904 and gfx906 to GPU Arch

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

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

5 years ago[analyzer] [NFC] Correct comment on RetainSummaryManager
George Karpenkov [Tue, 23 Oct 2018 01:31:08 +0000 (01:31 +0000)]
[analyzer] [NFC] Correct comment on RetainSummaryManager

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

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

5 years ago[analyzer] [www] Drop references to GC mode, which was deprecated years ago
George Karpenkov [Tue, 23 Oct 2018 01:30:45 +0000 (01:30 +0000)]
[analyzer] [www] Drop references to GC mode, which was deprecated years ago

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

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

5 years ago[analyzer] [testing] Compute data on path length, compute percentiles
George Karpenkov [Tue, 23 Oct 2018 01:30:26 +0000 (01:30 +0000)]
[analyzer] [testing] Compute data on path length, compute percentiles

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

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

5 years ago[CodeGen] Attach InlineHint to more functions
Richard Trieu [Tue, 23 Oct 2018 01:26:28 +0000 (01:26 +0000)]
[CodeGen] Attach InlineHint to more functions

For instantiated functions, search the template pattern to see if it marked
inline to determine if InlineHint attribute should be added to the function.

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

5 years ago[X86] Remove 'rtm' feature from KNL.
Craig Topper [Tue, 23 Oct 2018 00:15:37 +0000 (00:15 +0000)]
[X86] Remove 'rtm' feature from KNL.

I'm unsure if KNL has this feature, but the backend never thought it did, only clang did. The predefined-arch-macros test lost the check for __RTM__ on KNL when it was removed Skylake CPUs in r344117.

I think we want to drop it from KNL for consistency with Skylake anyway regardless of how we got here.

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

5 years agoRevert "[Driver] Reland again: Default Android toolchains to libc++."
Dan Albert [Mon, 22 Oct 2018 21:58:22 +0000 (21:58 +0000)]
Revert "[Driver] Reland again: Default Android toolchains to libc++."

More compiler-rt test bot breakages...

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

5 years agoRevert "Ensure sanitizer check function calls have a !dbg location"
Vlad Tsyrklevich [Mon, 22 Oct 2018 21:51:58 +0000 (21:51 +0000)]
Revert "Ensure sanitizer check function calls have a !dbg location"

This reverts commit r344915. It was causing exceptions on the
x86_64-linux-ubsan bot.

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

5 years ago[Driver] fix broken test
Nick Desaulniers [Mon, 22 Oct 2018 21:25:53 +0000 (21:25 +0000)]
[Driver] fix broken test

Summary:
Fixes test from r344941 which was broken on Windows. We want to check
the selected toolchain rather than the found toolchain anyways.

Reviewers: srhines, danalbert

Reviewed By: srhines

Subscribers: cfe-commits, bogner, pirama

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

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

5 years agoGive Multiversion-inline functions linkonce linkage
Erich Keane [Mon, 22 Oct 2018 21:20:45 +0000 (21:20 +0000)]
Give Multiversion-inline functions linkonce linkage

Since multiversion variant functions can be inline, in C they become
available-externally linkage.  This ends up causing the variants to not
be emitted, and not available to the linker.

The solution is to make sure that multiversion functions are always
emitted by marking them linkonce.

Change-Id: I897aa37c7cbba0c1eb2c57ee881d5000a2113b75

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

5 years ago[Driver] Reland again: Default Android toolchains to libc++.
Dan Albert [Mon, 22 Oct 2018 20:16:21 +0000 (20:16 +0000)]
[Driver] Reland again: Default Android toolchains to libc++.

Some of the test data went missing last time I tried to submit this,
causing the tests to fail when the build did not include libc++.

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

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

5 years ago[analyzer] Fix dumping for SymbolConjured conjured at no particular statement.
Artem Dergachev [Mon, 22 Oct 2018 20:11:10 +0000 (20:11 +0000)]
[analyzer] Fix dumping for SymbolConjured conjured at no particular statement.

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

5 years ago[Driver] allow Android triples to alias for non Android targets
Nick Desaulniers [Mon, 22 Oct 2018 19:48:08 +0000 (19:48 +0000)]
[Driver] allow Android triples to alias for non Android targets

Summary:
Partial revert of r330873 ('[Driver] Reland "Android triples are not
aliases for other triples."')

While we don't want `-target *-linux-android` to alias to non
*-linux-android libs and binaries, it turns out we do want the
opposite. Ie. We would like for `-target *-linux-gnu` to still be
able to use *-android libs and binaries.

In fact, this is used to cross assemble and link the Linux kernel for
Android devices.

`-target *-linux-gnu` needs to be used for the Linux kernel when
using the android binutils prebuilts (*-linux-android).

The use of `-target *-linux-android` on C source files will cause
Clang to perform optimizations based on the presence of bionic (due to
r265481 ('Faster stack-protector for Android/AArch64.')) which is
invalid within the Linux kernel and will produce a non-bootable kernel
image.

Of course, you could just use the standard binutils (*-linux-gnu),
but Android does not distribute these.  So this patch fixes a problem
that only occurs when cross assembling and linking a Linux kernel with
the Android provided binutils, which is what is done within Android's
build system.

Reviewers: srhines, pirama, danalbert

Reviewed By: srhines, danalbert

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

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

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

5 years agoHopefully fix the documentation generation issue
Sylvestre Ledru [Mon, 22 Oct 2018 19:07:29 +0000 (19:07 +0000)]
Hopefully fix the documentation generation issue

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

5 years agoGenerate ClangFormatStyleOptions.rst from Format.h (using docs/tools/dump_format_styl...
Sylvestre Ledru [Mon, 22 Oct 2018 18:48:58 +0000 (18:48 +0000)]
Generate ClangFormatStyleOptions.rst from Format.h (using docs/tools/dump_format_style.py)

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

5 years ago[X86] Add new features to the priority list for target attribute multiversioning.
Craig Topper [Mon, 22 Oct 2018 17:59:58 +0000 (17:59 +0000)]
[X86] Add new features to the priority list for target attribute multiversioning.

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

5 years agoEnsure sanitizer check function calls have a !dbg location
Adrian Prantl [Mon, 22 Oct 2018 16:27:41 +0000 (16:27 +0000)]
Ensure sanitizer check function calls have a !dbg location

Function calls without a !dbg location inside a function that has a
DISubprogram make it impossible to construct inline information and
are rejected by the verifier. This patch ensures that sanitizer check
function calls have a !dbg location, by carrying forward the location
of the preceding instruction or by inserting an artificial location if
necessary.

This fixes a crash when compiling the attached testcase with -Os.

rdar://problem/45311226

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

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

5 years agoAlways search sysroot for GCC installs
David Greene [Mon, 22 Oct 2018 13:46:12 +0000 (13:46 +0000)]
Always search sysroot for GCC installs

Previously, if clang was configured with -DGCC_INSTALL_PREFIX, then it
would not search a provided sysroot for a gcc install. This caused a
number of regression tests to fail.  If a sysroot is given, skip
searching GCC_INSTALL_PREFIX as it is likely not valid for the
provided sysroot.

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

5 years agoSilence the -Wshadow warning for enumerators shadowing a type.
Aaron Ballman [Mon, 22 Oct 2018 13:05:53 +0000 (13:05 +0000)]
Silence the -Wshadow warning for enumerators shadowing a type.

Amends r344259 so that enumerators shadowing types are not diagnosed, as shadowing under those circumstances is rarely (if ever) an issue in practice.

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

5 years agoFix MSVC "not all control paths return a value" warning. NFCI.
Simon Pilgrim [Mon, 22 Oct 2018 10:46:37 +0000 (10:46 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.

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

5 years ago[OpenCL] Fix definitions of __builtin_(add|sub|mul)_overflow
Marco Antognini [Mon, 22 Oct 2018 10:41:07 +0000 (10:41 +0000)]
[OpenCL] Fix definitions of __builtin_(add|sub|mul)_overflow

Ensure __builtin_(add|sub|mul)_overflow return bool instead of void as per
specification (LanguageExtensions).

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

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

5 years ago[ARM][AArch64] Add LLVM_FALLTHROUGH to silence warning [NFC]
Peter Smith [Mon, 22 Oct 2018 10:40:52 +0000 (10:40 +0000)]
[ARM][AArch64] Add LLVM_FALLTHROUGH to silence warning [NFC]

A follow up to D52784 to add in LLVM_FALLTHROUGH where there is an
intentional fall through in a switch statement. This will hopefully silence
a GCC warning.

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

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

5 years ago[CodeComplete] Fix accessibility of protected members when accessing members implicitly.
Eric Liu [Mon, 22 Oct 2018 08:47:31 +0000 (08:47 +0000)]
[CodeComplete] Fix accessibility of protected members when accessing members implicitly.

Reviewers: ilya-biryukov

Subscribers: arphaman, cfe-commits

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

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

5 years ago[analyzer][UninitializedObjectChecker] No longer using nonloc::LazyCompoundVal
Kristof Umann [Sun, 21 Oct 2018 23:30:01 +0000 (23:30 +0000)]
[analyzer][UninitializedObjectChecker] No longer using nonloc::LazyCompoundVal

As rightly pointed out by @NoQ, nonloc::LazyCompoundVals were only used to acquire a constructed object's region, which isn't what LazyCompoundVal was made for.

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

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

5 years ago[analyzer][www] Update alpha_checks.html
Kristof Umann [Sun, 21 Oct 2018 22:10:15 +0000 (22:10 +0000)]
[analyzer][www] Update alpha_checks.html

I added some missing doc. I have not developed any of these checkers, it might worth really inspecting whether I wrote something terribly incorrect.

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

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

5 years ago[analyzer][NFC] Fix inconsistencies in AnalyzerOptions
Kristof Umann [Sun, 21 Oct 2018 18:19:32 +0000 (18:19 +0000)]
[analyzer][NFC] Fix inconsistencies in AnalyzerOptions

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

This first NFC patch contains small modifications to make AnalyzerOptions.cpp a
little more consistent.

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

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

5 years ago[AST, analyzer] Transform rvalue cast outputs to lvalues (fheinous-gnu-extensions)
Aleksei Sidorin [Sat, 20 Oct 2018 22:49:23 +0000 (22:49 +0000)]
[AST, analyzer] Transform rvalue cast outputs to lvalues (fheinous-gnu-extensions)

Despite the fact that cast expressions return rvalues, GCC still
handles such outputs as lvalues when compiling inline assembler.
In this commit, we are treating it by removing LValueToRValue
casts inside GCCAsmStmt outputs.

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

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

5 years ago[X86] Add more intrinsics to match icc.
Craig Topper [Sat, 20 Oct 2018 19:28:52 +0000 (19:28 +0000)]
[X86] Add more intrinsics to match icc.

This adds
_mm_loadu_epi8, _mm256_loadu_epi8, _mm512_loadu_epi8
_mm_loadu_epi16, _mm256_loadu_epi16, _mm512_loadu_epi16
_mm_storeu_epi8, _mm256_storeu_epi8, _mm512_storeu_epi8
_mm_storeu_epi16, _mm256_storeu_epi16, _mm512_storeu_epi16

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

5 years ago[X86] Add missing intrinsics to match icc.
Craig Topper [Sat, 20 Oct 2018 19:28:50 +0000 (19:28 +0000)]
[X86] Add missing intrinsics to match icc.

This adds
_mm_and_epi32, _mm_and_epi64
_mm_andnot_epi32, _mm_andnot_epi64
_mm_or_epi32, _mm_or_epi64
_mm_xor_epi32, _mm_xor_epi64
_mm256_and_epi32, _mm256_and_epi64
_mm256_andnot_epi32, _mm256_andnot_epi64
_mm256_or_epi32, _mm256_or_epi64
_mm256_xor_epi32, _mm256_xor_epi64
_mm_loadu_epi32, _mm_loadu_epi64
_mm_load_epi32, _mm_load_epi64
_mm256_loadu_epi32, _mm256_loadu_epi64
_mm256_load_epi32, _mm256_load_epi64
_mm512_loadu_epi32, _mm512_loadu_epi64
_mm512_load_epi32, _mm512_load_epi64
_mm_storeu_epi32, _mm_storeu_epi64
_mm_store_epi32, _mm_load_epi64
_mm256_storeu_epi32, _mm256_storeu_epi64
_mm256_store_epi32, _mm256_load_epi64
_mm512_storeu_epi32, _mm512_storeu_epi64
_mm512_store_epi32,V _mm512_load_epi64

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

5 years agoUse llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC
Fangrui Song [Sat, 20 Oct 2018 17:53:42 +0000 (17:53 +0000)]
Use llvm::{all,any,none}_of instead std::{all,any,none}_of. NFC

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