]> granicus.if.org Git - clang/log
clang
6 years agoRemove the fixit for the diagnostics regarding capturing autoreleasing variables...
George Karpenkov [Mon, 14 May 2018 20:29:16 +0000 (20:29 +0000)]
Remove the fixit for the diagnostics regarding capturing autoreleasing variables in a block

The fixit is actively harmful, as it encourages developers to ignore the
warning and to write unsafe code.
It is almost impossible to write safe code while capturing autoreleasing
variables in the block, as in order to check that the block is never
called in the autoreleasing pool the developer has to check the
transitive closure of all potential callers of the block.

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

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

6 years ago[Tooling] Pull #include manipulation code from clangFormat into libToolingCore.
Eric Liu [Mon, 14 May 2018 20:17:53 +0000 (20:17 +0000)]
[Tooling] Pull #include manipulation code from clangFormat into libToolingCore.

Summary: Also pull #include related style out of FormatStyle as tooling::IncludeStyle.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: klimek, mgorny, cfe-commits, djasper

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

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

6 years agoPR37450: Fix bug that disabled some type checks for variables with deduced types.
Richard Smith [Mon, 14 May 2018 20:15:04 +0000 (20:15 +0000)]
PR37450: Fix bug that disabled some type checks for variables with deduced types.

Also improve diagnostic for the case where a type is non-literal because it's a lambda.

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

6 years ago[clang-format] Move #include related style to libToolingCore
Eric Liu [Mon, 14 May 2018 19:51:33 +0000 (19:51 +0000)]
[clang-format] Move #include related style to libToolingCore

Summary: This will be shared by include insertion/deletion library.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, klimek, cfe-commits

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

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

6 years ago[AST] Print correct tag decl for tag specifier
Joel E. Denny [Mon, 14 May 2018 19:36:45 +0000 (19:36 +0000)]
[AST] Print correct tag decl for tag specifier

For example, given:

  void fn() {
    struct T *p0;
    struct T { int i; } *p1;
  }

-ast-print produced:

  void fn() {
    struct T { int i; } *p0;
    struct T { int i; } *p1;
  }

Compiling that fails with a redefinition error.

Given:

  void fn() {
    struct T *p0;
    struct __attribute__((deprecated)) T *p1;
  }

-ast-print dropped the attribute.

Details:

For a tag specifier (that is, struct/union/class/enum used as a type
specifier in a declaration) that was also a tag declaration (that is,
first occurrence of the tag) or tag redeclaration (that is, later
occurrence that specifies attributes or a member list), clang printed
the tag specifier as either (1) the full tag definition if one
existed, or (2) the first tag declaration otherwise.  Redefinition
errors were sometimes introduced, as in the first example above.  Even
when that was impossible because no member list was ever specified,
attributes were sometimes lost, thus changing semantics and
diagnostics, as in the second example above.

This patch fixes a major culprit for these problems.  It does so by
creating an ElaboratedType with a new OwnedDecl member wherever an
occurrence of a tag type is a (re)declaration of that tag type.
PrintingPolicy's IncludeTagDefinition used to trigger printing of the
member list, attributes, etc. for a tag specifier by using a tag
(re)declaration selected as described above.  Now, it triggers the
same thing except it uses the tag (re)declaration stored in the
OwnedDecl.  Of course, other tooling can now make use of the new
OwnedDecl as well.

Also, to be more faithful to the original source, this patch
suppresses printing of attributes inherited from previous
declarations.

Reviewed by: rsmith, aaron.ballman

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

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

6 years agoCodeGen: Emit string literal in constant address space
Yaxun Liu [Mon, 14 May 2018 19:20:12 +0000 (19:20 +0000)]
CodeGen: Emit string literal in constant address space

Some targets have constant address space (e.g. amdgcn). For them string literal should be
emitted in constant address space then casted to default address space.

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

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

6 years ago[AST] Fix -ast-print for _Bool when have diagnostics
Joel E. Denny [Mon, 14 May 2018 18:41:44 +0000 (18:41 +0000)]
[AST] Fix -ast-print for _Bool when have diagnostics

For example, given:

  #define bool _Bool
  _Bool i;
  void fn() { 1; }

-ast-print produced:

  tmp.c:3:13: warning: expression result unused
  void fn() { 1; }
              ^
  bool i;
  void fn() {
      1;
  }

That fails to compile because bool is undefined.

Details:

Diagnostics print _Bool as bool when the latter is defined as the
former.  However, diagnostics were altering the printing policy for
-ast-print as well.  The printed source was then invalid because the
preprocessor eats the bool definition.

Problematic diagnostics included suppressed warnings (e.g., add
-Wno-unused-value to the above example), including those that are
suppressed by default.

This patch fixes this bug and cleans up some related comments.

Reviewed by: aaron.ballman, rsmith

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

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

6 years ago[X86] Use __builtin_convertvector to replace some of the avx512 truncate builtins.
Craig Topper [Mon, 14 May 2018 17:50:40 +0000 (17:50 +0000)]
[X86] Use __builtin_convertvector to replace some of the avx512 truncate builtins.

As long as the destination type is a 256 or 128 bit vector with the same number of elements we can use __builtin_convertvector to directly generate trunc IR instruction which will be handled natively by the backend.

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

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

6 years ago[ASTImporter] Turn StringRefs back to std::strings to avoid use-after-free
Aleksei Sidorin [Mon, 14 May 2018 16:12:31 +0000 (16:12 +0000)]
[ASTImporter] Turn StringRefs back to std::strings to avoid use-after-free

This is a workaround for the issue in buildASTFromCodeWithArgs()
where a local buffer can be used to store the program text
referred by SourceManager.
FIXME: Fix the root issue in buildASTFromCodeWithArgs().

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

6 years ago[CodeComplete] Provide completion in decls even for incomplete types
Ilya Biryukov [Mon, 14 May 2018 13:50:36 +0000 (13:50 +0000)]
[CodeComplete] Provide completion in decls even for incomplete types

Summary:
This change fixes lack of completions in the following case
('^'designates completion points) :

    void f(^);
    struct Incomplete;
    Incomplete g(^);

Reviewers: bkramer, aaron.ballman, sammccall

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years agoRedirect output to /dev/null in the tests added in r332160.
Eric Liu [Mon, 14 May 2018 12:07:56 +0000 (12:07 +0000)]
Redirect output to /dev/null in the tests added in r332160.

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

6 years agoRevert "[CodeGen] Disable aggressive structor optimizations at -O0"
Pavel Labath [Mon, 14 May 2018 11:35:44 +0000 (11:35 +0000)]
Revert "[CodeGen] Disable aggressive structor optimizations at -O0"

It breaks the sanitizer build
<http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/23739>

This reverts commit r332228.

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

6 years ago[CodeGen] Disable aggressive structor optimizations at -O0
Pavel Labath [Mon, 14 May 2018 11:02:23 +0000 (11:02 +0000)]
[CodeGen] Disable aggressive structor optimizations at -O0

Summary:
Removing the full structor and replacing all usages with the base one
can degrade debug quality as it will leave the debugger unable to locate
the full object structor. This is apparent when evaluating an expression
in the debugger which requires constructing an object of class which has
had this optimization applied to it.  When compiling the expression, we
pretend that the class and its methods have been defined in another
compilation unit, so the expression compiler assumes the structor
definition must be available. This didn't use to be the case for
structors with internal linkage. Less aggressive optimizations like
emitting the full structor as an alias remain in place, as they do not
cause the structor symbol to disappear completely.

This improves debug quality on non-darwin platforms (darwin does not
have -mconstructor-aliases on by default, so it is spared these
problems) and enable us to remove some workarounds from LLDB which attempt to
mitigate this issue.

Reviewers: rjmccall, aprantl

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Continue after non-scope-closers in getLengthToMatchingParen
Krasimir Georgiev [Mon, 14 May 2018 10:33:40 +0000 (10:33 +0000)]
[clang-format] Continue after non-scope-closers in getLengthToMatchingParen

Summary:
This fixes a regression introduced by `r331857` where we stop the search for
the End token as soon as we hit a non-scope-closer, which prematurely stops before
semicolons for example, which should otherwise be considered as part of the unbreakable tail.

Subscribers: klimek, cfe-commits

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

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

6 years ago[RISCV][NFC] Use more appropriate label for CHECK lines
Alex Bradbury [Mon, 14 May 2018 09:14:43 +0000 (09:14 +0000)]
[RISCV][NFC] Use more appropriate label for CHECK lines

'CC1' was a misleading prefix. Committing so as to simplify the diff for a
patch I'm about to put up for review.

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

6 years ago[X86] Use select instrution and fpextend in the implementation of _mm512_mask_cvtps_p...
Craig Topper [Mon, 14 May 2018 04:57:46 +0000 (04:57 +0000)]
[X86] Use select instrution and fpextend in the implementation of _mm512_mask_cvtps_pd and _mm512_maskz_cvtps_pd.

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

6 years ago[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.
Craig Topper [Mon, 14 May 2018 04:05:06 +0000 (04:05 +0000)]
[X86] Use __builtin_convertvector to implement _mm512_cvtps_pd.

If we're using default rounding mode we can let __builtin_convertvector to generate an fpextend. This matches 128 and 256 bit.

If we're using the version that takes an explicit rounding mode argument we would need to look at the immediate to see if its CUR_DIRECTION.

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

6 years ago[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu6...
Craig Topper [Sun, 13 May 2018 23:03:30 +0000 (23:03 +0000)]
[X86] Emit better code for _mm_cvtu32_sd, _mm_cvtu64_sd, _mm_cvtu32_ss, and _mm_cvtu64_ss.

We can use direct C code for these that will use uitofp and insertelement instructions.

For the versions that take an explicit rounding mode we can't do this.

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

6 years agoAdded atomic_fetch_min, max, umin, umax intrinsics to clang.
Elena Demikhovsky [Sun, 13 May 2018 07:45:58 +0000 (07:45 +0000)]
Added atomic_fetch_min, max, umin, umax intrinsics to clang.

These intrinsics work exactly as all other atomic_fetch_* intrinsics and allow to create *atomicrmw* with ordering.
Updated the clang-extensions document.

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

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

6 years agoAdd requirement of x86 target for test.
Douglas Yung [Sat, 12 May 2018 00:39:17 +0000 (00:39 +0000)]
Add requirement of x86 target for test.

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

6 years agoForce the PS4 clang ABI version to 6.
Douglas Yung [Sat, 12 May 2018 00:06:59 +0000 (00:06 +0000)]
Force the PS4 clang ABI version to 6.

The PS4 requires clang ABI version 6 for compatibility reasons. This change forces this and if the user specifies a different version when the PS4 target is specified, the compiler emits a warning that the specified version is being ignored.

Reviewers: probinson

Subscribers: cfe-commits

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

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

6 years ago[Driver] Only use -lc++ on Fuchsia
Petr Hosek [Fri, 11 May 2018 20:42:31 +0000 (20:42 +0000)]
[Driver] Only use -lc++ on Fuchsia

The fact that libc++ depends on libc++abi and libunwind is an internal
detail that's captured by the libc++.so linker script.

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

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

6 years ago[analyzer] Ignore the nullability quantifiers for autoreleasewritechecker
George Karpenkov [Fri, 11 May 2018 20:39:19 +0000 (20:39 +0000)]
[analyzer] Ignore the nullability quantifiers for autoreleasewritechecker

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

6 years ago[analyzer] Fix the filename for the exploration_order test.
George Karpenkov [Fri, 11 May 2018 20:38:39 +0000 (20:38 +0000)]
[analyzer] Fix the filename for the exploration_order test.

Ensures that the test is being run.

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

6 years ago[libclang] Stop assuming that the internal C++ ABI ExceptionSpecificationType enumera...
Richard Smith [Fri, 11 May 2018 19:46:31 +0000 (19:46 +0000)]
[libclang] Stop assuming that the internal C++ ABI ExceptionSpecificationType enumeration is the same as CXCursor_ExceptionSpecificationKind.

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

6 years ago[OPENMP, NVPTX] Do not use SPMD mode for target simd and target teams
Alexey Bataev [Fri, 11 May 2018 19:45:14 +0000 (19:45 +0000)]
[OPENMP, NVPTX] Do not use SPMD mode for target simd and target teams
distribute simd directives.

Directives `target simd` and `target teams distribute simd` must be
executed in non-SPMD mode.

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

6 years ago[HIP] Set proper triple and offload kind for the toolchain
Yaxun Liu [Fri, 11 May 2018 19:21:39 +0000 (19:21 +0000)]
[HIP] Set proper triple and offload kind for the toolchain

Also introduce --hip-link option to indicate HIP for linking.

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

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

6 years ago[HIP] Diagnose unsupported host triple
Yaxun Liu [Fri, 11 May 2018 19:14:34 +0000 (19:14 +0000)]
[HIP] Diagnose unsupported host triple

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

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

6 years ago[HIP] Let clang-offload-bundler support HIP
Yaxun Liu [Fri, 11 May 2018 19:02:18 +0000 (19:02 +0000)]
[HIP] Let clang-offload-bundler support HIP

When bundle/unbundle intermediate files for HIP, there may be multiple
sub archs, therefore BoundArch needs to be included in the target
and output file names for clang-offload-bundler.

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

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

6 years ago[X86] Fix the file header name on fmaintrin.h
Craig Topper [Fri, 11 May 2018 17:37:40 +0000 (17:37 +0000)]
[X86] Fix the file header name on fmaintrin.h

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

6 years ago[Hexagon] Implement checking arguments of builtin calls
Krzysztof Parzyszek [Fri, 11 May 2018 16:41:51 +0000 (16:41 +0000)]
[Hexagon] Implement checking arguments of builtin calls

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

6 years ago[X86] Assume alignment of movdir64b dst argument
Gabor Buella [Fri, 11 May 2018 14:22:04 +0000 (14:22 +0000)]
[X86] Assume alignment of movdir64b dst argument

Reviewers: craig.topper

Reviewed By: craig.topper

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

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

6 years agoImprove diagnostics and error recovery for template name lookup.
Richard Smith [Fri, 11 May 2018 02:43:08 +0000 (02:43 +0000)]
Improve diagnostics and error recovery for template name lookup.

For 'x::template y', consistently give a "no member named 'y' in 'x'"
diagnostic if there is no such member, and give a 'template keyword not
followed by a template' name error if there is such a member but it's not a
template. In the latter case, add a note pointing at the non-template.

Don't suggest inserting a 'template' keyword in 'X::Y<' if X is dependent
if the lookup of X::Y was actually not a dependent lookup and found only
non-templates.

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

6 years agoDon't propagate dllimport to base class template static data members
Reid Kleckner [Fri, 11 May 2018 01:26:11 +0000 (01:26 +0000)]
Don't propagate dllimport to base class template static data members

MSVC doesn't, so we shouldn't. Fixes PR37232.

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

6 years agoSupport XRay in the NetBSD driver
Kamil Rytarowski [Fri, 11 May 2018 01:00:38 +0000 (01:00 +0000)]
Support XRay in the NetBSD driver

Summary:
While there, perform a small cleanup, reducing delta
with drivers for other OSes.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, vitalybuka, dberris

Reviewed By: dberris

Subscribers: llvm-commits, #sanitizers

Tags: #sanitizers

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

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

6 years agoPermit -fxray-instrument for NetBSD/amd64
Kamil Rytarowski [Fri, 11 May 2018 00:58:55 +0000 (00:58 +0000)]
Permit -fxray-instrument for NetBSD/amd64

Summary:
Use the same branch as FreeBSD and OpenBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, dberris, vitalybuka

Reviewed By: vitalybuka

Subscribers: emaste, llvm-commits

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

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

6 years ago[clang-cl] Make -f[no-]coverage-mapping available
Reid Kleckner [Thu, 10 May 2018 22:24:00 +0000 (22:24 +0000)]
[clang-cl] Make -f[no-]coverage-mapping available

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

6 years agoimplementing Cursor.get_included_file in python bindings
Jonathan Coe [Thu, 10 May 2018 21:39:29 +0000 (21:39 +0000)]
implementing Cursor.get_included_file in python bindings

Summary:
adding function: `Cursor.get_included_file` , so the C API's `clang_getIncludedFile` function is available on the python binding interface
also adding test to unittests

related ticket: https://bugs.llvm.org/show_bug.cgi?id=15223

Reviewers: mgorny, arphaman, jbcoe

Reviewed By: jbcoe

Subscribers: cfe-commits

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

Patch by jlaz (József Láz)

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

6 years ago[Itanium] Emit type info names with external linkage.
Eric Fiselier [Thu, 10 May 2018 19:51:56 +0000 (19:51 +0000)]
[Itanium] Emit type info names with external linkage.

Summary:
The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed.  Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos.
For example:

```
// header.h
struct T;
extern std::type_info const& Info;

// tu_one.cpp
#include "header.h"
std::type_info const& Info = typeid(T*);

// tu_two.cpp
#include "header.h"
struct T {};
int main() {
  auto &TI1 = Info;
  auto &TI2 = typeid(T*);
  assert(TI1 == TI2); // Fails
  assert(TI1.hash_code() == TI2.hash_code()); // Fails
}
```

This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type.

Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to:

(A) Always perform strcmp/string hashes.
(B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++.

Reviewers: rsmith, rjmccall, majnemer, vsapsai

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

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

6 years agoReland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'
Julie Hockett [Thu, 10 May 2018 19:05:36 +0000 (19:05 +0000)]
Reland '[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective'

This commit relands r331904.

Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are
system
headers.

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

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

6 years agoAllow dllimport non-type template arguments in C++17
Reid Kleckner [Thu, 10 May 2018 18:57:35 +0000 (18:57 +0000)]
Allow dllimport non-type template arguments in C++17

Summary:
Fixes PR35772.

Reviewers: rsmith

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

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

6 years ago[OPENMP, NVPTX] Initial support for L2 parallelism in SPMD mode.
Alexey Bataev [Thu, 10 May 2018 18:32:08 +0000 (18:32 +0000)]
[OPENMP, NVPTX] Initial support for L2 parallelism in SPMD mode.

Added initial support for L2 parallelism in SPMD mode. Note, though,
that the orphaned parallel directives are not currently supported in
SPMD mode.

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

6 years agoThis patch provides that bitfields are splitted even in case
Strahinja Petrovic [Thu, 10 May 2018 12:31:12 +0000 (12:31 +0000)]
This patch provides that bitfields are splitted even in case
when current field is not legal integer type.

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

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

6 years agoAdd support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Sylvestre Ledru [Thu, 10 May 2018 08:45:43 +0000 (08:45 +0000)]
Add support of the next Ubuntu (Ubuntu 18.10 - Cosmic Canimal)
Patch by Adam Conrad

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

6 years agoRevert "[Itanium] Emit type info names with external linkage."
Eric Fiselier [Thu, 10 May 2018 08:10:57 +0000 (08:10 +0000)]
Revert "[Itanium] Emit type info names with external linkage."

This reverts commit r331957. It seems to be causing failures
on ppc64le-linux.

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

6 years ago[X86] ptwrite intrinsic
Gabor Buella [Thu, 10 May 2018 07:28:54 +0000 (07:28 +0000)]
[X86] ptwrite intrinsic

Reviewers: craig.topper, RKSimon

Reviewed By: craig.topper

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

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

6 years ago[X86] Change the implementation of scalar masked load/store intrinsics to not use...
Craig Topper [Thu, 10 May 2018 05:43:43 +0000 (05:43 +0000)]
[X86] Change the implementation of scalar masked load/store intrinsics to not use a 512-bit intermediate vector.

This is unnecessary for AVX512VL supporting CPUs like SKX. We can just emit a 128-bit masked load/store here no matter what. The backend will widen it to 512-bits on KNL CPUs.

Fixes the frontend portion of PR37386. Need to fix the backend to optimize the new sequences well.

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

6 years ago[Itanium] Emit type info names with external linkage.
Eric Fiselier [Thu, 10 May 2018 05:25:15 +0000 (05:25 +0000)]
[Itanium] Emit type info names with external linkage.

Summary:
The Itanium ABI requires that the type info for pointer-to-incomplete types to have internal linkage, so that it doesn't interfere with the type info once completed.  Currently it also marks the type info name as internal as well. However, this causes a bug with the STL implementations, which use the type info name pointer to perform ordering and hashing of type infos.
For example:

```
// header.h
struct T;
extern std::type_info const& Info;

// tu_one.cpp
#include "header.h"
std::type_info const& Info = typeid(T*);

// tu_two.cpp
#include "header.h"
struct T {};
int main() {
  auto &TI1 = Info;
  auto &TI2 = typeid(T*);
  assert(TI1 == TI2); // Fails
  assert(TI1.hash_code() == TI2.hash_code()); // Fails
}
```

This patch fixes the STL bug by emitting the type info name as linkonce_odr when the type-info is for a pointer-to-incomplete type.

Note that libc++ could fix this without a compiler change, but the quality of fix would be poor. The library would either have to:

(A) Always perform strcmp/string hashes.
(B) Determine if we have a pointer-to-incomplete type, and only do strcmp then. This would require an ABI break for libc++.

Reviewers: rsmith, rjmccall, majnemer, vsapsai

Reviewed By: rjmccall

Subscribers: smeenai, cfe-commits

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

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

6 years ago[Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to match...
Craig Topper [Thu, 10 May 2018 00:05:13 +0000 (00:05 +0000)]
[Builtins] Improve the IR emitted for MSVC compatible rotr/rotl builtins to match what the middle and backends understand

Previously we emitted something like

rotl(x, n) {
  n &= bitwidth-1;
  return n != 0 ? ((x << n) | (x >> (bitwidth - n)) : x;
}

We use a select to avoid the undefined behavior on the (bitwidth - n) shift.

The middle and backend don't really recognize this as a rotate and end up emitting a cmov or control flow because of the select.

A better pattern is (x << (n & mask)) | (x << (-n & mask)) where mask is bitwidth - 1.

Fixes the main complaint in PR37387. There's still some work to be done if the user writes that sequence directly on a short or char where type promotion rules can prevent it from being recognized. The builtin is emitting direct IR with unpromoted types so that isn't a problem for it.

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

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

6 years ago[CUDA] Added -f[no-]cuda-short-ptr option
Artem Belevich [Wed, 9 May 2018 23:10:09 +0000 (23:10 +0000)]
[CUDA] Added -f[no-]cuda-short-ptr option

The option enables use of 32-bit pointers for accessing
const/local/shared memory. The feature is disabled by default.

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

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

6 years agoRevert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"
Julie Hockett [Wed, 9 May 2018 22:25:47 +0000 (22:25 +0000)]
Revert "[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective"

This reverts commit r331904 because of a memory leak.

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

6 years agoUpdate pragma-attribute-supported-attributes-list.test.
Manoj Gupta [Wed, 9 May 2018 22:05:53 +0000 (22:05 +0000)]
Update pragma-attribute-supported-attributes-list.test.

Update the test to include the new attribute NoStackProtector
to fix the build fails.

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

6 years ago[Clang] Implement function attribute no_stack_protector.
Manoj Gupta [Wed, 9 May 2018 21:41:18 +0000 (21:41 +0000)]
[Clang] Implement function attribute no_stack_protector.

Summary:
This attribute tells clang to skip this function from stack protector
when -stack-protector option is passed.
GCC option for this is:
__attribute__((__optimize__("no-stack-protector"))) and the
equivalent clang syntax would be: __attribute__((no_stack_protector))

This is used in Linux kernel to selectively disable stack protector
in certain functions.

Reviewers: aaron.ballman, rsmith, rnk, probinson

Reviewed By: aaron.ballman

Subscribers: probinson, srhines, cfe-commits

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

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

6 years agoAdd SourceManagerForFile helper which sets up SourceManager and dependencies for...
Eric Liu [Wed, 9 May 2018 21:35:52 +0000 (21:35 +0000)]
Add SourceManagerForFile helper which sets up SourceManager and dependencies for a single file with code snippet

Summary: This can be used to create a virtual environment (incl. VFS, source manager) for code snippets.

Reviewers: sammccall, klimek

Reviewed By: sammccall

Subscribers: klimek, mgorny, cfe-commits

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

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

6 years ago[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective
Julie Hockett [Wed, 9 May 2018 18:27:33 +0000 (18:27 +0000)]
[clang] Adding CharacteristicKind to PPCallbacks::InclusionDirective

Adding a SrcMgr::CharacteristicKind parameter to the InclusionDirective
in PPCallbacks, and updating calls to that function. This will be useful
in https://reviews.llvm.org/D43778 to determine which includes are system
headers.

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

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

6 years ago[OPENMP] Generate unique names for offloading regions id.
Alexey Bataev [Wed, 9 May 2018 18:02:37 +0000 (18:02 +0000)]
[OPENMP] Generate unique names for offloading regions id.

It is required to emit unique names for offloading regions ids. Required
to support compilation and linking of several compilation units.

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

6 years ago[OpenCL] Fix typos in emitted enqueue kernel function names
Yaxun Liu [Wed, 9 May 2018 17:07:06 +0000 (17:07 +0000)]
[OpenCL] Fix typos in emitted enqueue kernel function names

Two typos:
vaarg => vararg
get_kernel_preferred_work_group_multiple => get_kernel_preferred_work_group_size_multiple

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

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

6 years ago[X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.
Craig Topper [Wed, 9 May 2018 16:57:48 +0000 (16:57 +0000)]
[X86] Only enable the __ud2 and __int2c builtins if intrin.h has been included.

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

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

6 years ago[OPENMP] Mark global tors/dtors as used.
Alexey Bataev [Wed, 9 May 2018 14:15:18 +0000 (14:15 +0000)]
[OPENMP] Mark global tors/dtors as used.

If the global variables are marked as declare target and they need
ctors/dtors, these ctors/dtors are emitted and then invoked by the
offloading runtime library. They are not explicitly used in the emitted
code and thus can be optimized out. Patch marks these functions as used,
so the optimizer cannot remove these function during the optimization
phase.

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

6 years ago[OpenCL] Add constant address space to __func__ in AST.
Anastasia Stulova [Wed, 9 May 2018 13:23:26 +0000 (13:23 +0000)]
[OpenCL] Add constant address space to __func__ in AST.

Added string literal helper function to obtain the type
attributed by a constant address space.

Also fixed predefind __func__ expr to use the helper
to constract the string literal correctly.

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

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

6 years ago[OpenCL] Restrict various keywords in OpenCL C++ mode
Sven van Haastregt [Wed, 9 May 2018 13:16:17 +0000 (13:16 +0000)]
[OpenCL] Restrict various keywords in OpenCL C++ mode

Restrict the following keywords in the OpenCL C++ language mode,
according to Sections 2.2 & 2.9 of the OpenCL C++ 1.0 Specification.

 - dynamic_cast
 - typeid
 - register (already restricted in OpenCL C, update the diagnostic)
 - thread_local
 - exceptions (try/catch/throw)
 - access qualifiers read_only, write_only, read_write

Support the `__global`, `__local`, `__constant`, `__private`, and
`__generic` keywords in OpenCL C++.  Leave the unprefixed address
space qualifiers such as global available, i.e., do not mark them as
reserved keywords in OpenCL C++.  libclcxx provides explicit address
space pointer classes such as `global_ptr` and `global<T>` that are
implemented using the `__`-prefixed qualifiers.

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

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

6 years agoRemove unused lit setting, see https://reviews.llvm.org/D46619
Nico Weber [Wed, 9 May 2018 12:38:51 +0000 (12:38 +0000)]
Remove unused lit setting, see https://reviews.llvm.org/D46619

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

6 years agoFixes issue introduced by r331556.
Alexander Kornienko [Wed, 9 May 2018 12:27:21 +0000 (12:27 +0000)]
Fixes issue introduced by r331556.

Closes bug: https://bugs.llvm.org/show_bug.cgi?id=37357

Patch by Rafael Stahl!

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

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

6 years agoRevert r331843 "[DebugInfo] Generate debug information for labels."
Hans Wennborg [Wed, 9 May 2018 09:29:58 +0000 (09:29 +0000)]
Revert r331843 "[DebugInfo] Generate debug information for labels."

It broke the Chromium build (see reply on the review).

> Generate DILabel metadata and call llvm.dbg.label after label
> statement to associate the metadata with the label.
>
> Differential Revision: https://reviews.llvm.org/D45045
>
> Patch by Hsiangkai Wang.

This doesn't revert the change to backend-unsupported-error.ll
that seems to correspond to an llvm-side change.

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

6 years agoRevert "[Driver] Use -fuse-line-directives by default in MSVC mode"
Martin Storsjo [Wed, 9 May 2018 09:11:01 +0000 (09:11 +0000)]
Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"

This reverts commit SVN r331666.

It was afterwards pointed out in https://reviews.llvm.org/D46520
that #line directives lose information about what parts come from a
system header. That means the result of -E usually won't compile,
since Windows headers are typically full of warnings and
default-error warnings.

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

6 years ago[clang-format] Respect BreakBeforeClosingBrace while calculating length
Krasimir Georgiev [Wed, 9 May 2018 09:02:11 +0000 (09:02 +0000)]
[clang-format] Respect BreakBeforeClosingBrace while calculating length

Summary:
This patch makes `getLengthToMatchingParen` respect the `BreakBeforeClosingBrace`
ParenState for matching scope closers. In order to distinguish between paren states
introduced by real vs. fake parens, I've added the token opening the ParensState
to that struct.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[driver] Add mips_Features_Group to Options to improve documentation sorting
Simon Atanasyan [Wed, 9 May 2018 08:42:30 +0000 (08:42 +0000)]
[driver] Add mips_Features_Group to Options to improve documentation sorting

Move all of the MIPS-only options into a new m_mips_Features_Group.
Nearly all other targets have most target-specific options grouped,
but MIPS does not.

The primary benefits are that the options will be listed together (and
thus identifiable as MIPS-specific even if they have no help string) in
the ClangCommandLineReference, and that Options.td is a bit more organized.

A secondary benefit is that a custom version of clang can more easily
hide/disable groups of options for unsupported targets.

Patch by Vince Del Vecchio

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

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

6 years ago_Atomic of empty struct shouldn't assert
JF Bastien [Wed, 9 May 2018 03:51:12 +0000 (03:51 +0000)]
_Atomic of empty struct shouldn't assert

Summary:

An _Atomic of an empty struct is pretty silly. In general we just widen empty
structs to hold a byte's worth of storage, and we represent size and alignment
as 0 internally and let LLVM figure out what to do. For _Atomic it's a bit
different: the memory model mandates concrete effects occur when atomic
operations occur, so in most cases actual instructions need to get emitted. It's
really not worth trying to optimize empty struct atomics by figuring out e.g.
that a fence would do, even though sane compilers should do optimize atomics.
Further, wg21.link/p0528 will fix C++20 atomics with padding bits so that
cmpxchg on them works, which means that we'll likely need to do the zero-init
song and dance for empty atomic structs anyways (and I think we shouldn't
special-case this behavior to C++20 because prior standards are just broken).

This patch therefore makes a minor change to r176658 "Promote atomic type sizes
up to a power of two": if the width of the atomic's value type is 0, just use 1
byte for width and leave alignment as-is (since it should never be zero, and
over-aligned zero-width structs are weird but fine).

This fixes an assertion:
   (NumBits >= MIN_INT_BITS && "bitwidth too small"), function get, file ../lib/IR/Type.cpp, line 241.

It seems like this has run into other assertions before (namely the unreachable
Kind check in ImpCastExprToType), but I haven't reproduced that issue with
tip-of-tree.

<rdar://problem/39678063>

Reviewers: arphaman, rjmccall

Subscribers: aheejin, cfe-commits

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

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

6 years ago[DebugInfo] Generate debug information for labels.
Shiva Chen [Wed, 9 May 2018 02:41:56 +0000 (02:41 +0000)]
[DebugInfo] Generate debug information for labels.

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

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

Patch by Hsiangkai Wang.

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

6 years agoRemove \brief commands from doxygen comments.
Adrian Prantl [Wed, 9 May 2018 01:00:01 +0000 (01:00 +0000)]
Remove \brief commands from doxygen comments.

This is similar to the LLVM change https://reviews.llvm.org/D46290.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

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

6 years agoSet CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes
Petr Hosek [Wed, 9 May 2018 00:58:12 +0000 (00:58 +0000)]
Set CMAKE_BUILD_WITH_INSTALL_RPATH for Fuchsia runtimes

This doesn't make any difference since we don't use RPATH/RUNPATH
on Fuchsia but it avoids the CMake error when re-linking libraries
while building with Ninja.

Differntial Revision: https://reviews.llvm.org/D46610

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

6 years ago[CMake] Include llvm-strip in Fuchsia toolchain distribution
Petr Hosek [Wed, 9 May 2018 00:05:28 +0000 (00:05 +0000)]
[CMake] Include llvm-strip in Fuchsia toolchain distribution

Now that llvm-strip is available, include it in the Fuchsia toolchain.

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

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

6 years ago[X86] Mark builtins 'const' where possible
Craig Topper [Tue, 8 May 2018 22:01:43 +0000 (22:01 +0000)]
[X86] Mark builtins 'const' where possible

I attempted to go through all the builtins and marked them const if they didn't touch memory or other hidden state.

I don't know how to test this or if it really matters.

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

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

6 years agoFix float->int conversion warnings when near barriers.
Erich Keane [Tue, 8 May 2018 21:26:21 +0000 (21:26 +0000)]
Fix float->int conversion warnings when near barriers.

As Eli brought up here: https://reviews.llvm.org/D46535
I'd previously messed up this fix by missing conversions
that are just slightly outside the range.  This patch fixes
this by no longer ignoring the return value of
convertToInteger.  Additionally, one of the error messages
wasn't very sensical (mentioning out of range value, when it
really was not), so it was cleaned up as well.

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

6 years ago[HIP] Add hip offload kind
Yaxun Liu [Tue, 8 May 2018 21:02:12 +0000 (21:02 +0000)]
[HIP] Add hip offload kind

There are quite differences in HIP action builder and action job creation,
which justifies to define a separate offload kind.

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

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

6 years agoAdd a mno-outline flag to disable the MachineOutliner
Jessica Paquette [Tue, 8 May 2018 20:58:32 +0000 (20:58 +0000)]
Add a mno-outline flag to disable the MachineOutliner

Since we're working on turning the MachineOutliner by default under -Oz for
AArch64, it makes sense to have an -mno-outline flag available. This currently
doesn't do much (it basically just undoes -moutline).

When the MachineOutliner is on by default under AArch64, this flag should
set -mllvm -enable-machine-outliner=never.

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

6 years ago[Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets
Martin Storsjo [Tue, 8 May 2018 20:55:23 +0000 (20:55 +0000)]
[Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets

-dwarf-column-info is omitted if -gcodeview is specified for msvc
targets at the moment, but since -gcodeview is an option that can be
specified for any target, there's little reason to restrict this
handling to msvc targets.

This allows getting proper codeview debug info by passing -gcodeview
for e.g. MinGW targets as well.

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

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

6 years agoChange -foutline to -moutline
Jessica Paquette [Tue, 8 May 2018 20:53:19 +0000 (20:53 +0000)]
Change -foutline to -moutline

Nitpicky, but the MachineOutliner is a machine-level pass, and so we should
reflect that by using "m" instead of "n".

Figured we should get this in before people get used to the letter f. :)

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

6 years agoAdd missing newlines to cl::extrahelp uses
Stephane Sezer [Tue, 8 May 2018 19:46:29 +0000 (19:46 +0000)]
Add missing newlines to cl::extrahelp uses

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

6 years ago[lit] Fix running tests that require 'examples'.
Zachary Turner [Tue, 8 May 2018 18:20:10 +0000 (18:20 +0000)]
[lit] Fix running tests that require 'examples'.

Differential Revision: https://reviews.llvm.org/D46514
Patch by Nikolai Kosjar.

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

6 years ago[OPENMP, NVPTX] Fix linkage of the global entries.
Alexey Bataev [Tue, 8 May 2018 14:16:57 +0000 (14:16 +0000)]
[OPENMP, NVPTX] Fix linkage of the global entries.

The linkage of the global entries must be weak to enable support of
redefinition of the same target regions in multiple compilation units.

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

6 years ago[OpenCL] Factor out language version printing
Sven van Haastregt [Tue, 8 May 2018 13:47:43 +0000 (13:47 +0000)]
[OpenCL] Factor out language version printing

Generate a printable OpenCL language version number in a single place
and select between the OpenCL C or OpenCL C++ version accordingly.

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

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

6 years ago[ASTImporter] Properly import SourceLocations of Attrs
Aleksei Sidorin [Tue, 8 May 2018 12:45:21 +0000 (12:45 +0000)]
[ASTImporter] Properly import SourceLocations of Attrs

Patch by Rafael Stahl!

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

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

6 years ago[ASTMatchers] Overload isConstexpr for ifStmts
Gabor Horvath [Tue, 8 May 2018 11:53:32 +0000 (11:53 +0000)]
[ASTMatchers] Overload isConstexpr for ifStmts

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

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

6 years agoFix 'not all control paths return a value' MSVC warnings. NFCI.
Simon Pilgrim [Tue, 8 May 2018 09:40:32 +0000 (09:40 +0000)]
Fix 'not all control paths return a value' MSVC warnings. NFCI.

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

6 years ago[clang-format] Add raw string formatting to release notes
Krasimir Georgiev [Tue, 8 May 2018 09:25:12 +0000 (09:25 +0000)]
[clang-format] Add raw string formatting to release notes

Reviewers: hans

Reviewed By: hans

Subscribers: cfe-commits

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

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

6 years ago[C++2a] Implement operator<=>: Fix another bug in the code gen tests.
Eric Fiselier [Tue, 8 May 2018 07:56:05 +0000 (07:56 +0000)]
[C++2a] Implement operator<=>: Fix another bug in the code gen tests.

Sorry for the failures. I'm quite new at writing code gen tests, and
I'm not sure the best way to make them portable.

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

6 years ago[x86] Introduce the encl[u|s|v] intrinsics
Gabor Buella [Tue, 8 May 2018 07:12:34 +0000 (07:12 +0000)]
[x86] Introduce the encl[u|s|v] intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years ago[x86] Introduce the pconfig intrinsic
Gabor Buella [Tue, 8 May 2018 06:49:41 +0000 (06:49 +0000)]
[x86] Introduce the pconfig intrinsic

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years ago[CMake] Pass additional CMake flags in Fuchsia cache files
Petr Hosek [Tue, 8 May 2018 02:47:13 +0000 (02:47 +0000)]
[CMake] Pass additional CMake flags in Fuchsia cache files

This allows passing additional CMake flags to builtins and runtimes
build through Fuchsia cache files.

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

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

6 years ago[C++2a] operator<=>: Fix incorrect use of Twine.
Eric Fiselier [Tue, 8 May 2018 02:28:47 +0000 (02:28 +0000)]
[C++2a] operator<=>: Fix incorrect use of Twine.

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

6 years ago[C++2a] Implement operator<=>: Address bugs and post-commit review comments after...
Eric Fiselier [Tue, 8 May 2018 00:52:19 +0000 (00:52 +0000)]
[C++2a] Implement operator<=>: Address bugs and post-commit review comments after r331677.

This patch addresses some mostly trivial post-commit review comments received
on r331677.

Additionally, this patch fixes an assertion in `getNarrowingKind` caused by
the use of an uninitialized value from `checkThreeWayNarrowingConversion`.

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

6 years agoMove test input file into same directory as test. NFC
Richard Trieu [Tue, 8 May 2018 00:29:21 +0000 (00:29 +0000)]
Move test input file into same directory as test.  NFC

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

6 years agoFix failing codegen test on non-x86_64 platforms
Eric Fiselier [Mon, 7 May 2018 23:15:34 +0000 (23:15 +0000)]
Fix failing codegen test on non-x86_64 platforms

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

6 years agoPR37352: mangle numbering for decomposition declarations.
Richard Smith [Mon, 7 May 2018 22:23:38 +0000 (22:23 +0000)]
PR37352: mangle numbering for decomposition declarations.

In order to match our mangling scheme, use a different set of numbers for
decomposition declarations, and consider all binding names when forming the
numbering. This does not yet affect any mangled names we produce, because
local decomposition declarations can't yet have linkage, but a C++ standard
proposal to change that is currently being processed.

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

6 years ago[NFC] Move 2 variable initialization from Ctor to member initializers.
Erich Keane [Mon, 7 May 2018 22:01:06 +0000 (22:01 +0000)]
[NFC] Move 2 variable initialization from Ctor to member initializers.

In response to dblaikie's suggestion on r331536, replace the two enum
typed variable initializers in the constructor with member initializers.

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

6 years ago[X86] Use target feature defines in tests instead of defining our own flag on the...
Craig Topper [Mon, 7 May 2018 21:47:13 +0000 (21:47 +0000)]
[X86] Use target feature defines in tests instead of defining our own flag on the command line. NFCI

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

6 years ago[X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.
Craig Topper [Mon, 7 May 2018 21:47:11 +0000 (21:47 +0000)]
[X86] Make _mm256_gf2p8mul_epi8 require avx features since its 256 bits.

Without this we throw an error on the header file instead of the user code when the right features aren't enabled in clang.

Rename the other DEFAULT_FN_ATTRS defines to _Z for 512-bit since I used _Y for this case.

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

6 years agoRelax a FileCheck pattern to make it pass on Windows.
Peter Collingbourne [Mon, 7 May 2018 21:40:53 +0000 (21:40 +0000)]
Relax a FileCheck pattern to make it pass on Windows.

Should fix Windows bot failure:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/16956

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

6 years ago[C++2a] Implement operator<=> CodeGen and ExprConstant
Eric Fiselier [Mon, 7 May 2018 21:07:10 +0000 (21:07 +0000)]
[C++2a] Implement operator<=> CodeGen and ExprConstant

Summary:
This patch tackles long hanging fruit for the builtin operator<=> expressions. It is currently needs some cleanup before landing, but I want to get some initial feedback.

The main changes are:

* Lookup, build, and store the required standard library types and expressions in `ASTContext`. By storing them in ASTContext we don't need to store (and duplicate) the required expressions in the BinaryOperator AST nodes.

* Implement [expr.spaceship] checking, including diagnosing narrowing conversions.

* Implement `ExprConstant` for builtin spaceship operators.

* Implement builitin operator<=> support in `CodeGenAgg`. Initially I emitted the required comparisons using `ScalarExprEmitter::VisitBinaryOperator`, but this caused the operand expressions to be emitted once for every required cmp.

* Implement [builtin.over] with modifications to support the intent of P0946R0. See the note on `BuiltinOperatorOverloadBuilder::addThreeWayArithmeticOverloads` for more information about the workaround.

Reviewers: rsmith, aaron.ballman, majnemer, rnk, compnerd, rjmccall

Reviewed By: rjmccall

Subscribers: rjmccall, rsmith, aaron.ballman, junbuml, mgorny, cfe-commits

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

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