Commit Graph

66376 Commits

Author SHA1 Message Date
Chris Bieneman c6c0f583a2 [CMake] Fixing clang standalone build
I broke this in r287406 and r287407.

llvm-svn: 287463
2016-11-19 21:14:59 +00:00
John McCall 18081afc1d Remove alignment from ctors/dtors lists in an attempt to placate LTO.
llvm-svn: 287458
2016-11-19 20:12:25 +00:00
Mehdi Amini 6f40836823 Change setDiagnosticsOutputFile to take a unique_ptr from a raw pointer (NFC)
Summary:
This makes it explicit that ownership is taken. Also replace all `new`
with make_unique<> at call sites.

Reviewers: anemet

Subscribers: llvm-commits

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

llvm-svn: 287449
2016-11-19 18:19:41 +00:00
John McCall 6c9f1fdb5c Introduce a helper class for building complex constant initializers. NFC.
I've adopted this in most of the places it makes sense, but v-tables
and CGObjCMac will need a second pass.

llvm-svn: 287437
2016-11-19 08:17:24 +00:00
Ekaterina Romanova 0a70076121 Doxygen comments for avxintrin.h.
Added doxygen comments to avxintrin.h's intrinsics. As of now, all the intrinsics in this file that were documented by Sony's intrinsics guide should have corresponding doxygen comments.

Note: The doxygen comments are automatically generated based on Sony's intrinsic
s document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream.

Reviewed by Wolfgang Pieb.

llvm-svn: 287436
2016-11-19 04:59:08 +00:00
Peter Collingbourne 66bfcb3ea5 Sema: As of MSVC 2015, a user-declared move operation causes the deletion of both copy operations.
Differential Revision: https://reviews.llvm.org/D26868

llvm-svn: 287411
2016-11-19 00:30:56 +00:00
Akira Hatanaka f7d563c76c [Sema] Don't allow applying address-of operator to a call to a function
with __unknown_anytype return type.

When the following code is compiled, Sema infers that the type of
__unknown_anytype is double:

extern __unknown_anytype func();
double *d = (double*)&func();

This triggers an assert in CodeGenFunction::EmitCallExprLValue because
it doesn't expect to see a call to a function with a non-reference
scalar return type.

This commit prevents the assert by making VisitUnaryAddrOf error out if
the address-of operator is applied to a call to a function with
__unknown_anytype return type.

rdar://problem/20287610

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

llvm-svn: 287410
2016-11-19 00:13:03 +00:00
Chris Bieneman 73f03752b6 [CMake] clang depends on intrinsics_gen
cc1_main.cpp has the following include chain:

llvm/LinkAllPasses.h
llvm/Analysis/AliasSetTracker.h
llvm/Analysis/AliasAnalysis.h
llvm/IR/CallSite.h
llvm/IR/Attributes.h
llvm/IR/Attributes.gen

This means clang needs to depend on intrinsics_gen.

llvm-svn: 287407
2016-11-18 23:31:16 +00:00
Chris Bieneman 3d1d968f18 [CMake] clang-offload-bundler depends on intrinsics_gen
ClangOffloadBundler.cpp has the following include chain:

llvm/Bitcode/BitcodeWriter.h
llvm/IR/ModuleSummaryIndex.h
llvm/IR/Module.h
llvm/IR/Function.h
llvm/IR/Argument.h
llvm/IR/Attributes.h
llvm/IR/Attributes.gen

This means clang-offload-bundler needs to depend on intrinsics_gen.

llvm-svn: 287406
2016-11-18 23:31:14 +00:00
Konstantin Zhuravlyov 62ae8f671c [AMDGPU] Change frexp.exp builtin to return i16 for f16 input
Differential Revision: https://reviews.llvm.org/D26863

llvm-svn: 287390
2016-11-18 22:31:51 +00:00
Dominic Chen c8629bd35a [analyzer] Refactor recursive symbol reachability check to use symbol_iterator
Reviewers: zaks.anna, dcoughlin

Subscribers: cfe-commits

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

llvm-svn: 287380
2016-11-18 21:07:03 +00:00
Oleg Ranevskyy 85d93a8778 [ARM] Fix sema check of ARM special register names
Summary:
This is a simple sema check patch for arguments of `__builtin_arm_rsr` and the related builtins, which currently do not allow special registers with indexes >7.

Some of the possible register name formats these builtins accept are:
```
{c}p<coprocessor>:<op1>:c<CRn>:c<CRm>:<op2>
```
```
o0:op1:CRn:CRm:op2
```
where `op1` / `op2` are integers in the range [0, 7] and `CRn` / `CRm` are integers in the range [0, 15].

The current sema check does not allow `CRn` > 7 and accepts `op2` up to 15.

Reviewers: LukeCheeseman, rengolin

Subscribers: asl, aemerson, rengolin, cfe-commits

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

llvm-svn: 287378
2016-11-18 21:00:08 +00:00
Matthias Braun ae032b6cf5 Adapt to llvm NamedRegionTimer changes
We have to specify a name and description for the timers and groups now.

llvm-svn: 287371
2016-11-18 19:43:25 +00:00
Chris Bieneman b82f97f4bb [CMake] Fixing variable names that were mistyped
This is a silly bug that I'm sure I caused...

llvm-svn: 287366
2016-11-18 19:20:39 +00:00
Adam Nemet e4b9fd9852 LTO support for -fsave-optimization-record on Darwin
I guess this would have to be added for each linker.

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

llvm-svn: 287358
2016-11-18 18:17:36 +00:00
Adam Nemet 62ff7bab72 Fix a comment for -fsave-optimization-record
Differential Revision: https://reviews.llvm.org/D26807

llvm-svn: 287357
2016-11-18 18:17:33 +00:00
Joey Gouly 5788b783ac [OpenCL] Introduce ReadPipeType and WritePipeType.
This allows Sema to diagnose passing a read_only pipe to a
write_only pipe argument.

llvm-svn: 287343
2016-11-18 14:10:54 +00:00
Simon Pilgrim 6e91750e06 Wdocumentation fix
llvm-svn: 287335
2016-11-18 11:18:28 +00:00
Ekaterina Romanova 06b1914cb7 Add doxygen comments for lzcntintrin.h's intrinsics.
The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Charles Li.

llvm-svn: 287317
2016-11-18 06:26:01 +00:00
Craig Topper 37bf5c6a3f [AVX-512] Replace masked 16-bit element variable shift builtins with new unmasked versions and selects.
llvm-svn: 287313
2016-11-18 05:04:51 +00:00
Ekaterina Romanova 53088dd44d Add doxygen comments to fxsrintrin.h's intrinsics.
The doxygen comments are automatically generated based on Sony's intrinsics document.

I got an OK from Eric Christopher to commit doxygen comments without prior code
review upstream. This patch was internally reviewed by Paul Robinson and Charles Li.

llvm-svn: 287295
2016-11-18 01:42:01 +00:00
Justin Lebar fbe0a57604 [CUDA] Attempt to fix test failures in cuda-macos-includes.cu.
Run clang -cc1 -E instead of -S, in an attempt to make this test work
cross-platform.

llvm-svn: 287292
2016-11-18 01:11:32 +00:00
John McCall 811b291d8c Forward ns_consumed delegate arguments with a move.
StartFunction enters a release cleanup for ns_consumed arguments in
ARC, so we need to balance that somehow.  We could teach StartFunction
that it's emitting a delegating function, so that the cleanup is
unnecessary, but that would be invasive and somewhat fraught.  We could
balance the consumed argument with an extra retain, but clearing the
original variable should be easier to optimize and avoid some extra work
at -O0.  And there shouldn't be any difference as long as nothing else
uses the argument, which should always be true for the places we emit
delegate arguments.

Fixes PR 27887.

llvm-svn: 287291
2016-11-18 01:08:24 +00:00
Justin Lebar 50fe985349 [CUDA] Wrapper header changes necessary to support MacOS.
Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287288
2016-11-18 00:41:35 +00:00
Justin Lebar d14fe8830e [CUDA] Use the right section and constant names for fatbins when compiling for macos.
Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287287
2016-11-18 00:41:31 +00:00
Justin Lebar f91086b0a8 [CUDA] Initialize our header search using the host triple.
Summary:
This used to work because system headers are found in a (somewhat)
predictable set of locations on Linux.  But this is not the case on
MacOS; without this change, we don't look in the right places for our
headers when doing device-side compilation on Mac.

Reviewers: tra

Subscribers: cfe-commits

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

llvm-svn: 287286
2016-11-18 00:41:27 +00:00
Justin Lebar 66c4fd7987 [CUDA] Driver changes to support CUDA compilation on MacOS.
Summary:
Compiling CUDA device code requires us to know the host toolchain,
because CUDA device-side compiles pull in e.g. host headers.

When we only supported Linux compilation, this worked because
CudaToolChain, which is responsible for device-side CUDA compilation,
inherited from the Linux toolchain.  But in order to support MacOS,
CudaToolChain needs to take a HostToolChain pointer.

Because a CUDA toolchain now requires a host TC, we no longer will
create a CUDA toolchain from Driver::getToolChain -- you have to go
through CreateOffloadingDeviceToolChains.  I am *pretty* sure this is
correct, and that previously any attempt to create a CUDA toolchain
through getToolChain() would eventually have resulted in us throwing
"error: unsupported use of NVPTX for host compilation".

In any case hacking getToolChain to create a CUDA+host toolchain would
be wrong, because a Driver can be reused for multiple compilations,
potentially with different host TCs, and getToolChain will cache the
result, causing us to potentially use a stale host TC.

So that's the main change in this patch.

In addition, we have to pull CudaInstallationDetector out of Generic_GCC
and into a top-level class.  It's now used by the Generic_GCC and MachO
toolchains.

Reviewers: tra

Subscribers: rryan, hfinkel, sfantao

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

llvm-svn: 287285
2016-11-18 00:41:22 +00:00
Ekaterina Romanova 2174b6fe72 Minor changes in x86 intrinsics headers; NFC
I made several changes for consistency with the rest of x86 instrinsics header files. Some of these changes help to render doxygen comments better.

1. avxintrin.h –  Moved the opening bracket on a separate line for several 
                  intrinsics (for consistency with the rest of the intrinsics).

2. emmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added braces after extern "C"  even though there is only 
                  one declaration each time

3. xmmintrin.h -  Moved the doxygen comment next to the body of the function;
               -  Added intrinsic prototypes for a couple of macro definitions
                  into the doxygen comment;
               -  Added braces after extern "C"  even though there is only one
                  declaration each time

4. ammintrin.h –  Removed extra line between the doxygen comment and the body
                  of the functions (for consistency with the rest of the files).

Desk reviewed by Paul Robinson.

llvm-svn: 287278
2016-11-17 23:02:00 +00:00
Bruno Cardoso Lopes 6fa3b742e0 [Preprocessor] Support for '-dI' flag
Re-introduce r285411.

Implement the -dI as supported by GCC: Output ‘#include’ directives in addition
to the result of preprocessing.

This change aims to add this option, pass it through to the preprocessor via
the options class, and when inclusions occur we output some information (+ test
cases).

Patch by Steve O'Brien!

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

llvm-svn: 287275
2016-11-17 22:45:31 +00:00
Bruno Cardoso Lopes 02681c4af6 [CrashReproducer][Darwin] Suggest attaching .crash diagnostic file
In addition to the preprocessed sources file and reproducer script, also
point to the .crash diagnostic files on Darwin. Example:

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cpp
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.cache
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.sh
clang-4.0: note: diagnostic msg: /var/folders/bk/1hj20g8j4xvdj5gd25ywhd3m0000gq/T/RegAllocGreedy-238f28.crash

When no match is found for the .crash, point the user to a directory
where those can be found. Example:

clang-4.0: note: diagnostic msg: Crash backtrace is located in
clang-4.0: note: diagnostic msg: /Users/bruno/Library/Logs/DiagnosticReports/clang-4.0_<YYYY-MM-DD-HHMMSS>_<hostname>.crash
clang-4.0: note: diagnostic msg: (choose the .crash file that corresponds to your crash)

rdar://problem/27286266

llvm-svn: 287262
2016-11-17 21:41:22 +00:00
Malcolm Parsons ca9d83475e Fixes for r287241. Use placement new. Apply clang-format.
llvm-svn: 287258
2016-11-17 21:00:09 +00:00
Manman Ren b666573238 ObjC Module: try to make objc module deterministic.
Make sure that comparing selectors in DeclarationName does its job.
rdar://problem/28988750

llvm-svn: 287244
2016-11-17 18:41:18 +00:00
Malcolm Parsons ff0382c161 Use unique_ptr for cached tokens for default arguments in C++.
Summary:
This changes pointers to cached tokens for default arguments in C++ from raw pointers to unique_ptrs.  There was a fixme in the code where the cached tokens are created  about using a smart pointer.

The change is straightforward, though I did have to track down and fix a memory corruption caused by the change.  memcpy was being used to copy parameter information.  This duplicated the unique_ptr, which led to the cached token buffer being deleted prematurely.

Patch by David Tarditi!

Reviewers: malcolm.parsons

Subscribers: arphaman, malcolm.parsons, cfe-commits

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

llvm-svn: 287241
2016-11-17 17:52:58 +00:00
Saleem Abdulrasool 765a219431 Sema: correct typo correction for ivars in @implementation
The previous typo correction handling assumed that ivars are only declared in
the interface declaration rather than as a private ivar in the implementation.
Adjust the handling to permit both interfaces.  Assert earlier that the
interface has been acquired to ensure that we can identify when both possible
casts have failed.

Addresses PR31040!

llvm-svn: 287238
2016-11-17 17:10:54 +00:00
Benjamin Kramer 9eba7354bb Link include-fixer into libclang if clang-tools-extra is checked out.
include-fixer only slightly bloats the size of libclang, but since
libclang has no explicit plugin mechanism it's the only way of getting
this to work. Clang-tidy is already there and so far there weren't many
complaints ;)

This is designed to be easy to remove again if libclang ever grows
proper plugin support.

llvm-svn: 287229
2016-11-17 15:22:36 +00:00
Alexey Bataev 957d856e7e [OPENMP] Fixed codegen for 'omp cancel' construct.
If 'omp cancel' construct is used in a worksharing construct it may
cause hanging of the software in case if reduction clause is used. Patch fixes this problem by avoiding extra reduction processing for branches that were canceled.

llvm-svn: 287227
2016-11-17 15:12:05 +00:00
Richard Smith 467b79c557 Remove -Wsigned-enum-bitfield from -Wmost. On a wide set of ABIs, this warning
is completely irrelevant, producing (effectively) false positives, and -Wmost
is used pretty widely. We should somehow turn it back on by default when
targeting the MS ABI, however, since it indicates the program will not do as
intended in those cases.

(Or perhaps we should just treat enum bitfields as having the signedness of the
enum, even when targeting the MS ABI...)

llvm-svn: 287193
2016-11-17 02:16:09 +00:00
George Burgess IV 004319554c [Sema] Fix a bug in enable_if condition instantiation.
During template instantiation, we currently fall back to just calling
Sema::SubstExpr for enable_if attributes that aren't value-dependent or
type-dependent. Since Sema::SubstExpr strips off any implicit casts
we've added to an expression, it's possible that this behavior will
leave us with an enable_if condition that's just a DeclRefExpr.
Conditions like that deeply confuse Sema::CheckEnableIf.

llvm-svn: 287187
2016-11-17 01:33:54 +00:00
Ivan Krasin 9103036f5f Explicitly specify that ubsan-vtable-checks is x86-64.
This should fix a failure on PowerPC introduced by r287181.

llvm-svn: 287185
2016-11-17 01:09:04 +00:00
Ivan Krasin d98f5d78cb Insert a type check before reading vtable.
Summary:
this is to prevent a situation when a pointer is invalid or null,
but we get to reading from vtable before we can check that
(possibly causing a segfault without a good diagnostics).

Reviewers: pcc

Subscribers: cfe-commits

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

llvm-svn: 287181
2016-11-17 00:39:48 +00:00
Petr Hosek 8e07a88bfa [CMake] Support lld with LTO bootstrap
lld has LTO support, if requested we should add a dependency on lld
rather than LLVMgold when doing LTO bootstrap build.

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

llvm-svn: 287179
2016-11-16 23:59:06 +00:00
Reid Kleckner ad425626d2 Add warning when assigning enums to bitfields without an explicit unsigned underlying type
Summary:
Add a warning when assigning enums to bitfields without an explicit
unsigned underlying type. This is to prevent problems with MSVC
compatibility, since the Microsoft ABI defaults to storing enums with a
signed type, causing inconsistencies with saving to/reading from
bitfields.

Also disabled the warning in the dr0xx.cpp test which throws the error,
and added a test for the warning.

The warning can be disabled with -Wno-signed-enum-bitfield.

Patch by Sasha Bermeister!

Reviewers: rnk, aaron.ballman

Subscribers: mehdi_amini, aaron.ballman, cfe-commits, thakis, dcheng

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

llvm-svn: 287177
2016-11-16 23:40:00 +00:00
Anna Zaks 1485992eb3 [analyzer] Remove unused check::RegionChanges::wantsRegionChangeUpdate callback
Remove the check::RegionChanges::wantsRegionChangeUpdate callback as it is no
longer used (since checkPointerEscape has been added).

A patch by Krzysztof Wiśniewski!

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

llvm-svn: 287175
2016-11-16 22:59:01 +00:00
George Burgess IV add6ab5084 Use the member function location in enable_if diagnostics.
Before:
<stdin>:3:3: error: no matching member function for call to 'bar'
  Foo().bar();
  ^

After:
<stdin>:3:9: error: no matching member function for call to 'bar'
  Foo().bar();
        ^

llvm-svn: 287154
2016-11-16 21:31:25 +00:00
Adrian Prantl 001c678992 Relax testcase.
This removes checks that are irrelevant for what is being tested.

llvm-svn: 287141
2016-11-16 19:31:44 +00:00
Adrian Prantl f4c5a0e630 Add the missing FileCheck invocation to this testcase.
llvm-svn: 287139
2016-11-16 19:26:11 +00:00
Yaron Keren 3998a09daf Rangify for loops, NFC.
llvm-svn: 287138
2016-11-16 19:24:10 +00:00
Adrian Prantl d3c4e1b11f Fix PR31029 by attaching an artificial debug location to msabi thunks.
This was a latent bug that was recently uncovered by r286400.

llvm-svn: 287134
2016-11-16 18:49:47 +00:00
Sean Callanan ee6d3fa07e Fixed layout of test/ASTMerge.
As outlined in a previous RFC, the test/ASTMerge/Inputs folder is getting full and the tests are starting to become interdependent. This is undesirable because

- it makes it harder to write new tests
- it makes it harder to figure out at a glance what old tests are doing, and
- it adds the risk of breaking one test while changing a different one, because of the interdependencies.

To fix this, according to the conversation in the RFC, I have changed the layout from

a.c
Inputs/a1.c
Inputs/a2.c

to

a/test.c
a/Inputs/a1.c
a/Inputs/a2.c
for all existing tests. I have also eliminated interdependencies by replicating the input files for each test that uses them.

https://reviews.llvm.org/D26571

llvm-svn: 287129
2016-11-16 18:21:00 +00:00
Benjamin Kramer 7de9969bb0 [Frontend] Allow attaching an external sema source to compiler instance and extra diags to TypoCorrections
This can be used to append alternative typo corrections to an existing diag.
include-fixer can use it to suggest includes to be added.

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

llvm-svn: 287128
2016-11-16 18:15:26 +00:00