]> granicus.if.org Git - clang/log
clang
7 years ago[Lexer] Finding beginning of token with escaped new line
Alexander Kornienko [Thu, 10 Aug 2017 10:06:16 +0000 (10:06 +0000)]
[Lexer] Finding beginning of token with escaped new line

Summary:
Lexer::GetBeginningOfToken produced invalid location when
backtracking across escaped new lines.

This fixes PR26228

Reviewers: akyrtzi, alexfh, rsmith, doug.gregor

Reviewed By: alexfh

Subscribers: alexfh, cfe-commits

Patch by Paweł Żukowski!

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

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

7 years ago[OpenMP] Provide a default GPU arch that is supported by
Gheorghe-Teodor Bercea [Thu, 10 Aug 2017 05:01:42 +0000 (05:01 +0000)]
[OpenMP] Provide a default GPU arch that is supported by
the underlying hardware.

This fixes a bug triggered by diff: D29660

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

7 years ago[Driver] Search compiler-rt paths in -print-file-name=
Petr Hosek [Thu, 10 Aug 2017 04:16:38 +0000 (04:16 +0000)]
[Driver] Search compiler-rt paths in -print-file-name=

This makes it possible to print the name of compiler-rt libraries
by using simply clang -print-file-name=libclang_rt.${runtime}-${arch}.so
same as other libraries, without having to know the details of the
resource directory organization.

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

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

7 years ago[clang-format] let PointerAlignment dictate spacing of function ref qualifiers
Jacob Bandes-Storch [Thu, 10 Aug 2017 01:30:22 +0000 (01:30 +0000)]
[clang-format] let PointerAlignment dictate spacing of function ref qualifiers

Summary: The original changes for ref qualifiers in rL272537 and rL272548 allowed function const+ref qualifier spacing to diverge from the spacing used for variables. It seems more consistent for `T const& x;` to match `void foo() const&;`.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRemove unused function
Matt Arsenault [Thu, 10 Aug 2017 00:19:43 +0000 (00:19 +0000)]
Remove unused function

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

7 years agoclang-format: Fix bug with ENAS_DontAlign and empty lines
Jacob Bandes-Storch [Thu, 10 Aug 2017 00:15:31 +0000 (00:15 +0000)]
clang-format: Fix bug with ENAS_DontAlign and empty lines

This fixes a bug in `ENAS_DontAlign` (introduced in D32733) where blank lines had an EscapedNewlineColumn of 0, causing a subtraction to overflow when converted back to unsigned and leading to runaway memory allocation.

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

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

7 years ago[OpenMP] Remove offending test.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 23:47:41 +0000 (23:47 +0000)]
[OpenMP] Remove offending test.

Diff: D29660

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

7 years ago[X86][Asm] Allow negative immediate to appear before bracketed expression
Coby Tayree [Wed, 9 Aug 2017 21:50:22 +0000 (21:50 +0000)]
[X86][Asm] Allow negative immediate to appear before bracketed expression

Currently, only non-negative immediate is allowed prior to a brac expression (memory reference).
MASM / GAS does not have any problem cope with the left side of the real line, so we should be able to as well.

llvm: D36229

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

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

7 years agoAMDGPU: Use direct struct returns and arguments
Matt Arsenault [Wed, 9 Aug 2017 21:44:58 +0000 (21:44 +0000)]
AMDGPU: Use direct struct returns and arguments

This is an improvement over always using byval for
structs.

This will use registers until ~16 are used, and then
switch back to byval. This needs more work, since I'm
not sure it ever really makes sense to use byval. If
the register limit is exceeded, the arguments still
end up passed on the stack, but with a different ABI.
It also may make sense to base this on number of
registers used for non-struct arguments, rather than
just arguments that appear first in the argument list.

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

7 years agoUse unsigned instead of an enum for map keys
George Burgess IV [Wed, 9 Aug 2017 21:20:41 +0000 (21:20 +0000)]
Use unsigned instead of an enum for map keys

ubsan's enum sanitizer doesn't like the latter, and we had to have
out-of-bounds values for DenseMapInfo's tombstone/empty keys.

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

7 years ago[Sema] Assign new flag -Wenum-compare-switch to switch-related parts of -Wenum-compare
Gabor Horvath [Wed, 9 Aug 2017 20:56:43 +0000 (20:56 +0000)]
[Sema] Assign new flag -Wenum-compare-switch to switch-related parts of -Wenum-compare

Patch by: Reka Nikolett Kovacs

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

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

7 years ago[OpenMP] Fix failing test for D29660.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 20:52:58 +0000 (20:52 +0000)]
[OpenMP] Fix failing test for D29660.

Non-functional change.

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

7 years agoMake -std=c++17 an alias of -std=c++1z
Hans Wennborg [Wed, 9 Aug 2017 20:12:53 +0000 (20:12 +0000)]
Make -std=c++17 an alias of -std=c++1z

As suggested on PR33912.

Trying to keep this small to make it easy to merge to the 5.0 branch. We
can do a follow-up with more thorough renaming (diagnostic text,
options, ids, etc.) later.

(For C++14 this was done in r215982, and I think a smaller patch for the
3.5 branch:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20140818/113013.html)

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

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

7 years ago[OpenMP] Enable executable lookup into driver directory.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 19:52:28 +0000 (19:52 +0000)]
[OpenMP] Enable executable lookup into driver directory.

Summary: Invoking the compiler inside a script causes the clang-offload-bundler executable to not be found. This patch enables the lookup for executables in the driver directory where the clang-offload-bundler resides.

Reviewers: hfinkel, carlo.bertolli, arpith-jacob, ABataev, caomhin

Reviewed By: hfinkel

Subscribers: cfe-commits

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

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

7 years ago[OPENMP] Emit non-debug version of outlined functions with original
Alexey Bataev [Wed, 9 Aug 2017 19:38:53 +0000 (19:38 +0000)]
[OPENMP] Emit non-debug version of outlined functions with original
name.

If the host code is compiled with the debug info, while the target
without, there is a problem that the compiler is unable to find the
debug wrapper. Patch fixes this problem by emitting special name for the
debug version of the code.

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

7 years agoPointerLikeTypeTraits: class->struct to match LLVM change
David Blaikie [Wed, 9 Aug 2017 18:34:22 +0000 (18:34 +0000)]
PointerLikeTypeTraits: class->struct to match LLVM change

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

7 years ago[OpenMP] Make the PTX version tests general enough to work on all toolchains.
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 18:25:52 +0000 (18:25 +0000)]
[OpenMP] Make the PTX version tests general enough to work on all toolchains.

Add explicit test for Darwin and PowerPC. Clean-up tests.

Non-functional change.

Original diff: D29660

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

7 years ago[OpenMP] Add flag for overwriting default PTX version for OpenMP targets
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 15:56:54 +0000 (15:56 +0000)]
[OpenMP] Add flag for overwriting default PTX version for OpenMP targets

Summary:
This flag "--fopenmp-ptx=" enables the overwriting of the default PTX version used for GPU offloaded OpenMP target regions: "+ptx42".

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: ABataev

Subscribers: rengolin, cfe-commits

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

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

7 years ago[OpenMP] Add flag for disabling the default generation of relocatable OpenMP target...
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 15:27:39 +0000 (15:27 +0000)]
[OpenMP] Add flag for disabling the default generation of relocatable OpenMP target code for NVIDIA GPUs.

Summary: Previously we have added the "-c" flag which gets passed to PTXAS by default to generate relocatable OpenMP target code by default. This set of flags exposes control over this behaviour.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: ABataev

Subscribers: Hahnfeld, rengolin, cfe-commits

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

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

7 years agoFix broken getAttributeSpellingListIndex for pragma attributes
Erich Keane [Wed, 9 Aug 2017 15:27:36 +0000 (15:27 +0000)]
Fix broken getAttributeSpellingListIndex for pragma attributes

We noticed when implementing a new pragma that the TableGen-generated function
getAttributeSpellingListIndex() did not work for pragma attributes. It relies
on the values in the enum AttributeList::Syntax and a new value
AS_ContextSensitiveKeyword was added changing the value for AS_Pragma.
Apparently no tests failed since no pragmas currently make use of the
generated function.

To fix this we can move AS_Pragma back to the value that TableGen code expects.
Also to prevent changes in the enum from breaking that routine again I added
calls to getAttributeSpellingListIndex() in the unroll pragma code. That will
cause some lit test failures if the order is changed. I added a comment to
remind of this issue in the future.

This assumes we don’t need/want full TableGen support for
AS_ContextSensitiveKeyword. It currently only appears in getAttrKind and no
other TableGen-generated routines.

Patch by: mikerice

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

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

7 years agoclang-format: [JS] detect ASI after closing parens.
Martin Probst [Wed, 9 Aug 2017 15:19:16 +0000 (15:19 +0000)]
clang-format: [JS] detect ASI after closing parens.

Summary: A closing parenthesis followed by a declaration or statement should always terminate the current statement.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 14:59:35 +0000 (14:59 +0000)]
[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default

Original Diff: D29642

This patch was previously reverted due to an error with patch D29654
that this depends on.

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

7 years agoReapply Sema: allow imaginary constants via GNU extension if UDL overloads not present.
Tim Northover [Wed, 9 Aug 2017 14:56:48 +0000 (14:56 +0000)]
Reapply Sema: allow imaginary constants via GNU extension if UDL overloads not present.

C++14 added user-defined literal support for complex numbers so that you
can write something like "complex<double> val = 2i". However, there is
an existing GNU extension supporting this syntax and interpreting the
result as a _Complex type.

This changes parsing so that such literals are interpreted in terms of
C++14's operators if an overload is present but otherwise falls back to
the original GNU extension.

(We now have more robust diagnostics for implicit conversions so the
libc++ test that caused the original revert still passes).

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

7 years ago[OpenCL] Minor refactoring to reduce copy/pasted code
Joey Gouly [Wed, 9 Aug 2017 14:52:47 +0000 (14:52 +0000)]
[OpenCL] Minor refactoring to reduce copy/pasted code

Set the type of TheCall inside SemaBuiltinReserveRWPipe to reduce
duplicated code.

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

7 years ago[X86][Ms-InlineAsm] Extend MS Dot operator to accept "this" + struct/class pointers...
Coby Tayree [Wed, 9 Aug 2017 13:31:41 +0000 (13:31 +0000)]
[X86][Ms-InlineAsm] Extend MS Dot operator to accept "this" + struct/class pointers aliases

MS InlineAsm Dot operator accepts "Bases" such as "this" (cpp) and class/struct pointer typedef.
This patch enhance its implementation with this behavior.

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

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

7 years ago[Sema] -Wenum-compare no longer warn on anonymous enums in switch statements
Gabor Horvath [Wed, 9 Aug 2017 12:34:58 +0000 (12:34 +0000)]
[Sema] -Wenum-compare no longer warn on anonymous enums in switch statements

Patch by: Reka Nikolett Kovacs

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

7 years agoRevert "PR19668, PR23034: Fix handling of move constructors and deleted copy construc...
Diana Picus [Wed, 9 Aug 2017 12:22:25 +0000 (12:22 +0000)]
Revert "PR19668, PR23034: Fix handling of move constructors and deleted copy constructors when deciding whether classes should be passed indirectly."

This reverts commit r310401 because it seems to have broken some ARM
bot(s).

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

7 years ago[clang-format] Put '/**' and '*/' on own lines in jsdocs ending in comment pragmas
Krasimir Georgiev [Wed, 9 Aug 2017 09:42:32 +0000 (09:42 +0000)]
[clang-format] Put '/**' and '*/' on own lines in jsdocs ending in comment pragmas

Summary:
This handles a case where the trailing '*/' of a multiline jsdoc eding in a
comment pragma wouldn't be put on a new line.

Reviewers: mprobst

Reviewed By: mprobst

Subscribers: cfe-commits, klimek

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

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

7 years ago[Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements
Gabor Horvath [Wed, 9 Aug 2017 08:57:09 +0000 (08:57 +0000)]
[Sema] Extend -Wenum-compare to handle mixed enum comparisons in switch statements

Patch by: Reka Nikolett Kovacs

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

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

7 years agoAttempt #2 to appease buildbots
George Burgess IV [Wed, 9 Aug 2017 06:07:08 +0000 (06:07 +0000)]
Attempt #2 to appease buildbots

"error: unable to create target: 'No available targets are compatible
with this triple.'"

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

7 years agoAttempt to appease msc buildbot
George Burgess IV [Wed, 9 Aug 2017 05:20:05 +0000 (05:20 +0000)]
Attempt to appease msc buildbot

It was timing out on this test, but for reasons unrelated to the
specific bug it was testing for. Randomly breaking in gdb with `clang
-target i686-windows -fmsc-version=1700` reveals *many* frames from
MicrosoftCXXNameMangler. So, it would seem that some caching is needed
there, as well...

Fingers crossed that specifying a triple is sufficient to work around
this.

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

7 years ago[clang-fuzzer] Resolve proto dependencies
Vitaly Buka [Wed, 9 Aug 2017 04:45:00 +0000 (04:45 +0000)]
[clang-fuzzer] Resolve proto dependencies

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

7 years ago[AST] Cache intermediate visibility/linkage results
George Burgess IV [Wed, 9 Aug 2017 04:12:17 +0000 (04:12 +0000)]
[AST] Cache intermediate visibility/linkage results

This is a follow-up to r310436 with actual functional changes. Please
see that commit message for a description of why a cache is appearing
here.

Suggestions for less-bad ways of testing this are appreciated. :)

This fixes PR29160.

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

7 years ago[AST] Move visibility computations into a class; NFC
George Burgess IV [Wed, 9 Aug 2017 04:02:49 +0000 (04:02 +0000)]
[AST] Move visibility computations into a class; NFC

This is patch 1 in a 2 patch series that aims to fix PR29160. Its goal
is to cache decl visibility/linkage for the duration of each
visibility+linkage query.

The simplest way I can see to do this is to put the visibility
calculation code that needs to (transitively) access this cache into a
class, which is what this patch does. Actual caching will come in patch
2. (Another way would be to keep the cache in ASTContext + manually
invalidate it or something, but that felt way too subtle to me.)

Caching visibility results across multiple queries seems a bit tricky,
since the user can add visibility attributes ~whenever they want, and
these attributes can apparently have far-reaching effects (e.g. class
visibility extends to its members, ...). Because a cache that's dropped
at the end of each top-level query seems to work nearly as well and
doesn't require any eviction logic, I opted for that design.

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

7 years agoAllow operator delete to be an invalid Decl.
Richard Trieu [Wed, 9 Aug 2017 02:03:59 +0000 (02:03 +0000)]
Allow operator delete to be an invalid Decl.

Do not discard invalid Decl when searching for the operator delete function.
The lookup for this function always expects to find a result, so sometimes the
invalid Decl is the only choice possible.  This fixes PR34109.

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

7 years ago[OpenMP] Fix bug regarding cubin integration into host binary
Gheorghe-Teodor Bercea [Wed, 9 Aug 2017 01:02:19 +0000 (01:02 +0000)]
[OpenMP] Fix bug regarding cubin integration into host binary
when a BindArchAction is used.

This is not a functional change.

Original Diff: D29654

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

7 years agoSema: disable implicit conversion from _Complex to real types in C++.
Tim Northover [Tue, 8 Aug 2017 23:18:05 +0000 (23:18 +0000)]
Sema: disable implicit conversion from _Complex to real types in C++.

Converting a _Complex type to a real one simply discards the imaginary part.
This can easily lead to loss of information so for safety (and GCC
compatibility) this patch disallows that when the conversion would be implicit.

The one exception is bool, which actually compares both real and imaginary
parts and so is safe.

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

7 years agoRevert "Lexer: always allow imaginary constants in GNU mode."
Tim Northover [Tue, 8 Aug 2017 23:17:51 +0000 (23:17 +0000)]
Revert "Lexer: always allow imaginary constants in GNU mode."

This reverts r310423. It was committed by mistake, I intended to commit the
improved diagnostics for implicit conversions instead.

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

7 years agoLexer: always allow imaginary constants in GNU mode.
Tim Northover [Tue, 8 Aug 2017 22:03:54 +0000 (22:03 +0000)]
Lexer: always allow imaginary constants in GNU mode.

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

7 years ago[mips] Enable `long_call/short_call` attributes on MIPS64
Simon Atanasyan [Tue, 8 Aug 2017 21:17:33 +0000 (21:17 +0000)]
[mips] Enable `long_call/short_call` attributes on MIPS64

This change enables `long_call/short_call/far/near` attributes on
MIPS64 targets.

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

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

7 years ago[codeview] Emit nested enums and typedefs from classes
Reid Kleckner [Tue, 8 Aug 2017 20:30:14 +0000 (20:30 +0000)]
[codeview] Emit nested enums and typedefs from classes

Previously we limited ourselves to only emitting nested classes, but we
need other kinds of types as well.

This fixes the Visual Studio STL visualizers, so that users can
visualize std::string and other objects.

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

7 years ago[sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters
Kostya Serebryany [Tue, 8 Aug 2017 20:20:40 +0000 (20:20 +0000)]
[sanitizer-coverage] -fsanitize-coverage=bb,inline-8bit-counters

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

7 years agoIntegrate Kostya's clang-proto-fuzzer with LLVM.
Matt Morehouse [Tue, 8 Aug 2017 20:15:04 +0000 (20:15 +0000)]
Integrate Kostya's clang-proto-fuzzer with LLVM.

Summary:
The clang-proto-fuzzer models a subset of C++ as a protobuf and
uses libprotobuf-mutator to generate interesting mutations of C++
programs.  Clang-proto-fuzzer has already found several bugs in
Clang (e.g., https://bugs.llvm.org/show_bug.cgi?id=33747,
https://bugs.llvm.org/show_bug.cgi?id=33749).

As with clang-fuzzer, clang-proto-fuzzer requires the following
cmake flags:
- CMAKE_C_COMPILER=clang
- CMAKE_CXX_COMPILER=clang++
- LLVM_USE_SANITIZE_COVERAGE=YES  // needed for libFuzzer
- LLVM_USE_SANITIZER=Address  // needed for libFuzzer

In addition, clang-proto-fuzzer requires:
- CLANG_ENABLE_PROTO_FUZZER=ON

clang-proto-fuzzer also requires the following dependencies:
- binutils  // needed for libprotobuf-mutator
- liblzma-dev  // needed for libprotobuf-mutator
- libz-dev  // needed for libprotobuf-mutator
- docbook2x  // needed for libprotobuf-mutator
- Recent version of protobuf [3.3.0 is known to work]

A working version of libprotobuf-mutator will automatically be
downloaded and built as an external project.

Implementation of clang-proto-fuzzer provided by Kostya
Serebryany.

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

Reviewers: kcc, vitalybuka, bogner

Reviewed By: kcc, vitalybuka

Subscribers: thakis, mgorny, cfe-commits

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

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

7 years ago[coverage] Special-case calls to noreturn functions.
Eli Friedman [Tue, 8 Aug 2017 20:10:14 +0000 (20:10 +0000)]
[coverage] Special-case calls to noreturn functions.

The code after a noreturn call doesn't execute.

The pattern in the testcase is pretty common in LLVM (a switch with
a default case that calls llvm_unreachable).

The original version of this patch was reverted in r309995 due to a
crash. This version includes a fix for that crash (testcase in
test/CoverageMapping/md.cpp).

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

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

7 years agoThread Safety Analysis: warn on nonsensical attributes.
Josh Gao [Tue, 8 Aug 2017 19:44:35 +0000 (19:44 +0000)]
Thread Safety Analysis: warn on nonsensical attributes.

Add warnings in cases where an implicit `this` argument is expected to
attributes because either `this` doesn't exist because the attribute is
on a free function, or because `this` is on a type that doesn't have a
corresponding capability/lockable/scoped_lockable attribute.

Reviewers: delesley, aaron.ballman

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

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

7 years agoReland "Thread Safety Analysis: fix assert_capability."
Josh Gao [Tue, 8 Aug 2017 19:44:34 +0000 (19:44 +0000)]
Reland "Thread Safety Analysis: fix assert_capability."

Delete the test that was broken by rL309725, and add it back in a
follow up commit. Also, improve the tests a bit.

Reviewers: delesley, aaron.ballman

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

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

7 years agoPR19668, PR23034: Fix handling of move constructors and deleted copy
Richard Smith [Tue, 8 Aug 2017 19:12:28 +0000 (19:12 +0000)]
PR19668, PR23034: Fix handling of move constructors and deleted copy
constructors when deciding whether classes should be passed indirectly.

This fixes ABI differences between Clang and GCC:

 * Previously, Clang ignored the move constructor when making this
   determination. It now takes the move constructor into account, per
   https://github.com/itanium-cxx-abi/cxx-abi/pull/17 (this change may
   seem recent, but the ABI change was agreed on the Itanium C++ ABI
   list a long time ago).

 * Previously, Clang's behavior when the copy constructor was deleted
   was unstable -- depending on whether the lazy declaration of the
   copy constructor had been triggered, you might get different behavior.
   We now eagerly declare the copy constructor whenever its deletedness
   is unclear, and ignore deleted copy/move constructors when looking for
   a trivial such constructor.

This also fixes an ABI difference between Clang and MSVC:

 * If the copy constructor would be implicitly deleted (but has not been
   lazily declared yet), for instance because the class has an rvalue
   reference member, we would pass it directly. We now pass such a class
   indirectly, matching MSVC.

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

7 years agoRestore previous structure ABI behavior for bit-fields with the packed attribute...
Aaron Ballman [Tue, 8 Aug 2017 18:07:17 +0000 (18:07 +0000)]
Restore previous structure ABI behavior for bit-fields with the packed attribute for PS4 targets.

An ABI change was introduced in r254596 that modified structure layouts when the 'packed' attribute was used on one-byte bitfields. Since the PS4 target needs to maintain backwards compatibility for all structure layouts, this change reintroduces the old behavior for PS4 targets only. It also introduces PS4 specific cases to the relevant test.

Patch by Matthew Voss.

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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 18:04:06 +0000 (18:04 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

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

7 years ago[X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports.
Craig Topper [Tue, 8 Aug 2017 17:43:44 +0000 (17:43 +0000)]
[X86] Support 'avx5124vnniw' and 'avx5124fmaps' for __builtin_cpu_supports.

They still need to be implemented in the intrinsics, the command line, and the backend. But this change isn't dependent on any of that and resolves a TODO.

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

7 years ago[Availability] Don't make an availability attribute imply default visibility on macOS
Erik Pilkington [Tue, 8 Aug 2017 17:09:09 +0000 (17:09 +0000)]
[Availability] Don't make an availability attribute imply default visibility on macOS

Fixes PR33796, rdar://33655115

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

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

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Tue, 8 Aug 2017 16:45:36 +0000 (16:45 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310377.

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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 16:29:11 +0000 (16:29 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

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

7 years agoUse "foo-12345.o.tmp" instead of "foo.o-12345" as temporary file name.
Nico Weber [Tue, 8 Aug 2017 16:21:23 +0000 (16:21 +0000)]
Use "foo-12345.o.tmp" instead of "foo.o-12345" as temporary file name.

This helps some tools that do things based on the output's extension.

For example, we got reports from users on Windows that have a tool that scan a
build output dir (but skip .obj files). The tool would keep the "foo.obj-12345"
file open, and then when clang tried to rename the temp file to the final
output filename, that would fail. By making the tempfile end in ".obj.tmp",
tools like this could now have a rule to ignore .tmp files.
This is a less ambitious reland of https://reviews.llvm.org/D36238

https://reviews.llvm.org/D36413

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

7 years agoNon-functional change. Fix test for D29654.
Gheorghe-Teodor Bercea [Tue, 8 Aug 2017 15:13:07 +0000 (15:13 +0000)]
Non-functional change. Fix test for D29654.

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

7 years agoclang-format: [JS] fix union type spacing in object & array types.
Martin Probst [Tue, 8 Aug 2017 15:00:58 +0000 (15:00 +0000)]
clang-format: [JS] fix union type spacing in object & array types.

Summary:
Previously, clang-format would insert whitespace in union types nested in object
and array types, as it wouldn't recognize those as a type operator:

    const x: {foo: number | null};
    const x: [number | null];

While this is correct for actual binary operators, clang-format should not
insert whitespace into union and intersection types to mark those:

    const x: {foo: number|null};
    const x: [number|null];

This change propagates that the context is not an expression by inspecting
the preceding token and marking as non-expression if it was a type colon.

Reviewers: djasper

Subscribers: klimek

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

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

7 years agoclang-format: [JS] handle single lines comments ending in `\\`.
Martin Probst [Tue, 8 Aug 2017 14:52:42 +0000 (14:52 +0000)]
clang-format: [JS] handle single lines comments ending in `\\`.

Summary:
Previously, clang-format would consider the following code line to be part of
the comment and incorrectly format the rest of the file.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Tue, 8 Aug 2017 14:44:43 +0000 (14:44 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310360.

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

7 years ago[OpenMP] OpenMP device offloading code generation produces a cubin file which is...
Gheorghe-Teodor Bercea [Tue, 8 Aug 2017 14:33:05 +0000 (14:33 +0000)]
[OpenMP] OpenMP device offloading code generation produces a cubin file which is then integrated in the host binary using the host linker.
Diff: D29654

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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Tue, 8 Aug 2017 14:25:14 +0000 (14:25 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

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

7 years ago[libclang] Fix PR34055 (incompatible update of clang-c/Index.h)
Nikolai Bozhenov [Tue, 8 Aug 2017 14:13:50 +0000 (14:13 +0000)]
[libclang] Fix PR34055 (incompatible update of clang-c/Index.h)

Fixes a regression introduced by r308218.

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

7 years agoDarwin's toolchain should be initialized before openmp offloading
Alex Lorenz [Tue, 8 Aug 2017 11:22:21 +0000 (11:22 +0000)]
Darwin's toolchain should be initialized before openmp offloading
is processed

This fixes an 'openmp-offload.c' test failure introduced by r310263.

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

7 years agoRevert r310291, r310300 and r310332 because of test failure on Darwin
Alex Lorenz [Tue, 8 Aug 2017 11:20:17 +0000 (11:20 +0000)]
Revert r310291, r310300 and r310332 because of test failure on Darwin

The commit r310291 introduced the failure. r310332 was a test fix commit and
r310300 was a followup commit. I reverted these two to avoid merge conflicts
when reverting.

The 'openmp-offload.c' test is failing on Darwin because the following
run lines:
// RUN:   touch %t1.o
// RUN:   touch %t2.o
// RUN:   %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %t1.o %t2.o 2>&1 \
// RUN:   | FileCheck -check-prefix=CHK-TWOCUBIN %s

trigger the following assertion:

Driver.cpp:3418:
    assert(CachedResults.find(ActionTC) != CachedResults.end() &&
           "Result does not exist??");

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

7 years agoFix openmp-offload.c test on Windows
Reid Kleckner [Tue, 8 Aug 2017 01:36:16 +0000 (01:36 +0000)]
Fix openmp-offload.c test on Windows

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

7 years ago[codeview] Fix class name formatting
Reid Kleckner [Tue, 8 Aug 2017 01:33:53 +0000 (01:33 +0000)]
[codeview] Fix class name formatting

In particular, removes spaces between template arguments of class
templates to better match VS type visualizers.

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

7 years agoThis adds the argument --dump-ir to clang-import-test, which allows
Sean Callanan [Mon, 7 Aug 2017 22:27:30 +0000 (22:27 +0000)]
This adds the argument --dump-ir to clang-import-test, which allows
viewing of the final IR. This is useful for confirming that
structure layout was correct.

I've added two tests:

- A test that checks that structs in top-level code are completed
  correctly during struct layout (they are)
- A test that checks that structs defined in function bodies are
  cpmpleted correctly during struct layout (currently they are not,
  so this is XFAIL).

The second test fails because LookupSameContext()
(ExternalASTMerger.cpp) can't find the struct. This is an issue I
intend to resolve separately.

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

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

7 years ago[OpenMP] Error when trying to offload to an unsupported architecture
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 21:11:10 +0000 (21:11 +0000)]
[OpenMP] Error when trying to offload to an unsupported architecture

Summary: Throw an error when offloading is unsupported for a particular target architecture.

Reviewers: sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld

Reviewed By: ABataev

Subscribers: cfe-commits, rengolin

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

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

7 years ago[OpenMP] Prevent emission of exception handling code when using OpenMP to offload...
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:57:59 +0000 (20:57 +0000)]
[OpenMP] Prevent emission of exception handling code when using OpenMP to offload to NVIDIA devices.

Summary: For the OpenMP toolchain which offloads to NVIDIA GPUs make sure that no exception handling code is emitted.

Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, hfinkel, tstellar

Reviewed By: ABataev, Hahnfeld

Subscribers: rengolin, Hahnfeld, cfe-commits

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

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

7 years ago[AArch64] Ignore stdcall and similar on aarch64/windows
Martin Storsjo [Mon, 7 Aug 2017 20:52:04 +0000 (20:52 +0000)]
[AArch64] Ignore stdcall and similar on aarch64/windows

This is similar to what's done on arm and x86_64, where
these calling conventions are silently ignored, as in
SVN r245076.

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

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

7 years ago[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:31:51 +0000 (20:31 +0000)]
[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default

Summary: When device offloading is enabled and the device is an NVIDIA GPU, OpenMP target regions must be compiled with relocation enabled by passing the "-c" flag to the PTXAS invocation.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: Hahnfeld, rengolin, mkuron, cfe-commits

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

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

7 years agoMark static variables static; NFC.
George Burgess IV [Mon, 7 Aug 2017 20:26:33 +0000 (20:26 +0000)]
Mark static variables static; NFC.

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

7 years ago[OpenMP] Pass -v to PTXAS if it was passed to the driver.
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:19:23 +0000 (20:19 +0000)]
[OpenMP] Pass -v to PTXAS if it was passed to the driver.

Summary: When compiling code being offloaded by OpenMP to an NVIDIA GPU, pass the -v to PTXAS if it was passed to the CLANG driver.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, jlebar, hfinkel, tstellar

Reviewed By: jlebar

Subscribers: Hahnfeld, rengolin, cfe-commits

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

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

7 years ago[OpenMP] Integrate OpenMP target region cubin into host binary
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 20:01:48 +0000 (20:01 +0000)]
[OpenMP] Integrate OpenMP target region cubin into host binary

Summary: OpenMP device offloading code generation produces a cubin file which is then integrated in the host binary using the host linker.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, rnk, hfinkel, tstellar

Reviewed By: hfinkel

Subscribers: sfantao, rnk, rengolin, cfe-commits

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

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

7 years agoNon-functional change. Fix previous patch D34784.
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 18:43:37 +0000 (18:43 +0000)]
Non-functional change. Fix previous patch D34784.

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

7 years agoAdd some missing -no-canonical-prefixes.
Benjamin Kramer [Mon, 7 Aug 2017 18:31:01 +0000 (18:31 +0000)]
Add some missing -no-canonical-prefixes.

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

7 years ago[OpenMP] Add flag for specifying the target device architecture for OpenMP device...
Gheorghe-Teodor Bercea [Mon, 7 Aug 2017 15:39:11 +0000 (15:39 +0000)]
[OpenMP] Add flag for specifying the target device architecture for OpenMP device offloading

Summary:
OpenMP has the ability to offload target regions to devices which may have different architectures.

A new -fopenmp-target-arch flag is introduced to specify the device architecture.

In this patch I use the new flag to specify the compute capability of the underlying NVIDIA architecture for the OpenMP offloading CUDA tool chain.

Only a host-offloading test is provided since full device offloading capability will only be available when [[ https://reviews.llvm.org/D29654 | D29654 ]] lands.

Reviewers: hfinkel, Hahnfeld, carlo.bertolli, caomhin, ABataev

Reviewed By: hfinkel

Subscribers: guansong, cfe-commits

Tags: #openmp

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

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

7 years agoEnable LLVM asan support for NetBSD/i386
Kamil Rytarowski [Mon, 7 Aug 2017 10:57:03 +0000 (10:57 +0000)]
Enable LLVM asan support for NetBSD/i386

Summary:
Verified to work and useful to run check-asan, as this target tests 32-bit and 64-bit execution.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, filcab, dim, vitalybuka

Reviewed By: vitalybuka

Subscribers: #sanitizers, cfe-commits

Tags: #sanitizers

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

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

7 years ago[test] Remove an unintentional -x cl flag in an aarch64-windows test
Martin Storsjo [Sun, 6 Aug 2017 19:57:49 +0000 (19:57 +0000)]
[test] Remove an unintentional -x cl flag in an aarch64-windows test

This test was only intended to test compiling C, not OpenCL.

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

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

7 years ago[X86] Enable isel to use the PAUSE instruction even when SSE2 is disabled. Clang...
Craig Topper [Sat, 5 Aug 2017 23:35:54 +0000 (23:35 +0000)]
[X86] Enable isel to use the PAUSE instruction even when SSE2 is disabled. Clang part

Summary:
On older processors this instruction encoding is treated as a NOP.

MSVC doesn't disable intrinsics based on features the way clang/gcc does. Because the PAUSE instruction encoding doesn't crash older processors, some software out there uses these intrinsics without checking for SSE2.

This change also seems to also be consistent with gcc behavior.

Fixes PR34079

Reviewers: RKSimon, zvi

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

7 years ago[OpenCL] Remove extra select functions from opencl-c.h
Yaxun Liu [Sat, 5 Aug 2017 02:23:47 +0000 (02:23 +0000)]
[OpenCL] Remove extra select functions from opencl-c.h

OpenCL spec v2.0 s6.13.6:

gentype select (gentype a,
gentype b,
igentype c)

gentype select (gentype a,
gentype b,
ugentype c)

igentype and ugentype must have the same number
of elements and bits as gentype.

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

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

7 years ago[ODRHash] Treat some non-templated classes as templated.
Richard Trieu [Sat, 5 Aug 2017 00:54:19 +0000 (00:54 +0000)]
[ODRHash] Treat some non-templated classes as templated.

When using nested classes, if the inner class is not templated, but the outer
class is templated, the inner class will not be templated, but may have some
traits as if it were.  This is particularly evident if the inner class
refers to the outer class in some fashion.  Treat any class that is in the
context of a templated class as also a templated class.

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

7 years agoRevert "[Coverage] Precise region termination with deferred regions"
Vedant Kumar [Sat, 5 Aug 2017 00:34:10 +0000 (00:34 +0000)]
Revert "[Coverage] Precise region termination with deferred regions"

This reverts commit r310010. I don't think there's anything wrong with
this commit, but it's causing clang to generate output that llvm-cov
doesn't do a good job with and the fix isn't immediately clear.

See Eli's comment in D36250 for more context.

I'm reverting the clang change so the coverage bot can revert back to
producing sensible output, and to give myself some time to investigate
what went wrong in llvm.

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

7 years agoDebug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.
Adrian Prantl [Fri, 4 Aug 2017 23:08:57 +0000 (23:08 +0000)]
Debug Info: Set the DICompileUnit's isOptimized flag when compiling with LTO.

rdar://problem/27640939

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

7 years agoClean up some lambda conversion operator code, NFC
Reid Kleckner [Fri, 4 Aug 2017 22:38:06 +0000 (22:38 +0000)]
Clean up some lambda conversion operator code, NFC

We don't need special handling in CodeGenFunction::GenerateCode for
lambda block pointer conversion operators anymore. The conversion
operator emission code immediately calls back to the generic
EmitFunctionBody.

Rename EmitLambdaStaticInvokeFunction to EmitLambdaStaticInvokeBody for
better consistency with the other Emit*Body methods.

I'm preparing to do something about PR28299, which touches this code.

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

7 years ago[libclang] Determinize order of platform availability attrs
Reid Kleckner [Fri, 4 Aug 2017 21:52:25 +0000 (21:52 +0000)]
[libclang] Determinize order of platform availability attrs

Previously this code was doing std::sort on IdentifierInfo pointers. Now
it sorts alphabetically by platform name.

This should de-flake clang/test/Index/availability.c, which was failing
non-deterministically for me.

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

7 years ago[Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows
Reid Kleckner [Fri, 4 Aug 2017 21:52:00 +0000 (21:52 +0000)]
[Support] Use FILE_SHARE_DELETE to fix RemoveFileOnSignal on Windows

Summary:
Tools like clang that use RemoveFileOnSignal on their output files
weren't actually able to clean up their outputs before this change.  Now
the call to llvm::sys::fs::remove succeeds and the temporary file is
deleted. This is a stop-gap to fix clang before implementing the
solution outlined in PR34070.

Reviewers: davide

Subscribers: llvm-commits, hiraditya

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

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

7 years ago[libFuzzer] add -fsanitize-coverage-pc-table to -fsanitize=fuzzer
Kostya Serebryany [Fri, 4 Aug 2017 21:35:11 +0000 (21:35 +0000)]
[libFuzzer] add -fsanitize-coverage-pc-table to -fsanitize=fuzzer

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

7 years agoRevert "[OPENMP][DEBUG] Set proper address space info if required by target."
Alexey Bataev [Fri, 4 Aug 2017 21:27:11 +0000 (21:27 +0000)]
Revert "[OPENMP][DEBUG] Set proper address space info if required by target."

This reverts commit r310104.

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

7 years agoRevert "[OPENMP] Fix for pacify buildbots, NFC."
Alexey Bataev [Fri, 4 Aug 2017 21:26:25 +0000 (21:26 +0000)]
Revert "[OPENMP] Fix for pacify buildbots, NFC."

This reverts commit r310120.

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

7 years agoReland "CFI: blacklist STL allocate() from unrelated-casts"
Vlad Tsyrklevich [Fri, 4 Aug 2017 21:21:00 +0000 (21:21 +0000)]
Reland "CFI: blacklist STL allocate() from unrelated-casts"

Reland r310097 with a fix for a debug assertion in NamedDecl.getName()

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

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

7 years agoRevert "Reland "CFI: blacklist STL allocate() from unrelated-casts""
Vlad Tsyrklevich [Fri, 4 Aug 2017 20:37:49 +0000 (20:37 +0000)]
Revert "Reland "CFI: blacklist STL allocate() from unrelated-casts""

This reverts commit r310105.

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

7 years ago[OPENMP] Fix for pacify buildbots, NFC.
Alexey Bataev [Fri, 4 Aug 2017 20:29:52 +0000 (20:29 +0000)]
[OPENMP] Fix for pacify buildbots, NFC.

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

7 years agoReland "CFI: blacklist STL allocate() from unrelated-casts"
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:50:39 +0000 (19:50 +0000)]
Reland "CFI: blacklist STL allocate() from unrelated-casts"

Reland r310097 with a unit test fix for MS ABI build bots.

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

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

7 years ago[OPENMP][DEBUG] Set proper address space info if required by target.
Alexey Bataev [Fri, 4 Aug 2017 19:46:10 +0000 (19:46 +0000)]
[OPENMP][DEBUG] Set proper address space info if required by target.

Arguments, passed to the outlined function, must have correct address
space info for proper Debug info support. Patch sets global address
space for arguments that are mapped and passed by reference.

Also, cuda-gdb does not handle reference types correctly, so reference
arguments are represented as pointers.

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

7 years agoRevert "CFI: blacklist STL allocate() from unrelated-casts"
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:17:16 +0000 (19:17 +0000)]
Revert "CFI: blacklist STL allocate() from unrelated-casts"

This reverts commit r310097.

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

7 years ago[OPENMP] Unify generation of outlined function calls.
Alexey Bataev [Fri, 4 Aug 2017 19:10:54 +0000 (19:10 +0000)]
[OPENMP] Unify generation of outlined function calls.

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

7 years agoCFI: blacklist STL allocate() from unrelated-casts
Vlad Tsyrklevich [Fri, 4 Aug 2017 19:10:11 +0000 (19:10 +0000)]
CFI: blacklist STL allocate() from unrelated-casts

Summary:
Previously, STL allocators were blacklisted in compiler_rt's
cfi_blacklist.txt because they mandated a cast from void* to T* before
object initialization completed. This change moves that logic into the
front end because C++ name mangling supports a substitution compression
mechanism for symbols that makes it difficult to blacklist the mangled
symbol for allocate() using a regular expression.

Motivated by crbug.com/751385.

Reviewers: pcc, kcc

Reviewed By: pcc

Subscribers: cfe-commits

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

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

7 years ago[ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher
Florian Gross [Fri, 4 Aug 2017 18:59:19 +0000 (18:59 +0000)]
[ASTMatcher] Add handling for DeducedType to HasDeclarationMatcher

HasDeclarationMatcher did not handle DeducedType, it always returned false for deduced types.

So with code like this:
struct X{};
auto x = X{};

This did no longer match:
varDecl(hasType(recordDecl(hasName("X"))))

Because HasDeclarationMatcher didn't resolve the DeducedType of x.

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

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

7 years agoAdd OpenCL 2.0 atomic builtin functions as Clang builtin
Yaxun Liu [Fri, 4 Aug 2017 18:16:31 +0000 (18:16 +0000)]
Add OpenCL 2.0 atomic builtin functions as Clang builtin

OpenCL 2.0 atomic builtin functions have a scope argument which is ideally
represented as synchronization scope argument in LLVM atomic instructions.

Clang supports translating Clang atomic builtin functions to LLVM atomic
instructions. However it currently does not support synchronization scope
of LLVM atomic instructions. Without this, users have to use LLVM assembly
code to implement OpenCL atomic builtin functions.

This patch adds OpenCL 2.0 atomic builtin functions as Clang builtin
functions, which supports generating LLVM atomic instructions with
synchronization scope operand.

Currently only constant memory scope argument is supported. Support of
non-constant memory scope argument will be added later.

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

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

7 years agoclang-format: [JS] support fields with case/switch/default labels.
Martin Probst [Fri, 4 Aug 2017 17:07:15 +0000 (17:07 +0000)]
clang-format: [JS] support fields with case/switch/default labels.

Summary:
`case:` and `default:` would normally parse as labels for a `switch` block.
However in TypeScript, they can be used in field declarations, e.g.:

    interface I {
      case: string;
    }

This change special cases parsing them in declaration lines to avoid wrapping
them.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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