Commit Graph

65667 Commits

Author SHA1 Message Date
Hal Finkel 60ebf61274 When optimizing for size, enable loop rerolling by default
We have a loop-rerolling optimization which can be enabled by using
-freroll-loops. While sometimes loops are hand-unrolled for performance
reasons, when optimizing for size, we should always undo this manual
optimization to produce smaller code (our optimizer's unroller will still
unroll the rerolled loops if it thinks that is a good idea).

llvm-svn: 283685
2016-10-09 03:06:31 +00:00
Justin Lebar 3b593f56fc [CUDA] Don't install cuda_wrappers/{algorithm,complex} into the main include dir.
This is obviously wrong -- if we do this, then all compiles will pick up
these wrappers, which is not what we want.

llvm-svn: 283683
2016-10-09 00:27:39 +00:00
Justin Lebar d3c5d2a4de [CUDA] Support <complex> and std::min/max on the device.
Summary:
We do this by wrapping <complex> and <algorithm>.

Tests are in the test-suite.

Reviewers: tra

Subscribers: jhen, beanz, cfe-commits, mgorny

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

llvm-svn: 283680
2016-10-08 22:16:12 +00:00
Justin Lebar 2dfbe9a3b4 [CUDA] Rename cuda_builtin_vars.h to __clang_cuda_builtin_vars.h.
Summary: This matches the idiom we use for our other CUDA wrapper headers.

Reviewers: tra

Subscribers: beanz, mgorny, cfe-commits

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

llvm-svn: 283679
2016-10-08 22:16:08 +00:00
Justin Lebar e9eb792a0f [CUDA] Declare our __device__ math functions in the same inline namespace as our standard library.
Summary:
Currently we declare our inline __device__ math functions in namespace
std.  But libstdc++ and libc++ declare these functions in an inline
namespace inside namespace std.  We need to match this because, in a
later patch, we want to get e.g. <complex> to use our device overloads,
and it only will if those overloads are in the right inline namespace.

Reviewers: tra

Subscribers: cfe-commits, jhen

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

llvm-svn: 283678
2016-10-08 22:16:03 +00:00
Justin Lebar 67a78a6cc0 [CUDA] Add #pragma clang force_cuda_host_device_{begin,end} pragmas.
Summary:
These cause us to consider all functions in-between to be __host__
__device__.

You can nest these pragmas; you just can't have more 'end's than
'begin's.

Reviewers: rsmith

Subscribers: tra, jhen, cfe-commits

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

llvm-svn: 283677
2016-10-08 22:15:58 +00:00
Mehdi Amini 732afdd09a Turn cl::values() (for enum) from a vararg function to using C++ variadic template
The core of the change is supposed to be NFC, however it also fixes
what I believe was an undefined behavior when calling:

 va_start(ValueArgs, Desc);

with Desc being a StringRef.

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

llvm-svn: 283671
2016-10-08 19:41:06 +00:00
Artem Dergachev 83ebea4cb6 [analyzer] Fix build error after r283660 - remove constexpr strings.
llvm-svn: 283662
2016-10-08 11:07:21 +00:00
Artem Dergachev 4eca0de7b7 [analyzer] Re-apply r283094 "Improve CloneChecker diagnostics"
The parent commit (r283092) was reverted before and now finally landed.

llvm-svn: 283661
2016-10-08 10:54:30 +00:00
Artem Dergachev 46209e1dd0 [analyzer] Re-apply r283093 "Add extra notes to ObjCDeallocChecker"
The parent commit (r283092) was reverted before and now finally landed.

llvm-svn: 283660
2016-10-08 10:53:00 +00:00
Yaron Keren e0bcdd4d25 Un-tabify source files, NFC.
llvm-svn: 283657
2016-10-08 06:45:10 +00:00
Mehdi Amini 5bf825b764 Use StringRef in Command::printArg() instead of raw pointer (NFC)
llvm-svn: 283645
2016-10-08 01:38:43 +00:00
Justin Lebar 9fdb46e71c [CUDA] Do a better job at detecting wrong-side calls.
Summary:
Move CheckCUDACall from ActOnCallExpr and BuildDeclRefExpr to
DiagnoseUseOfDecl.  This lets us catch some edge cases we were missing,
specifically around class operators.

This necessitates a few other changes:

 - Avoid emitting duplicate deferred diags in CheckCUDACall.

   Previously we'd carefully placed our call to CheckCUDACall such that
   it would only ever run once for a particular callsite.  But now this
   isn't the case.

 - Emit deferred diagnostics from a template
   specialization/instantiation's primary template, in addition to from
   the specialization/instantiation itself.  DiagnoseUseOfDecl ends up
   putting the deferred diagnostics on the template, rather than the
   specialization, so we need to check both.

Reviewers: rsmith

Subscribers: cfe-commits, tra

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

llvm-svn: 283637
2016-10-08 01:07:11 +00:00
Mehdi Amini 087f1fbb53 Rename variable to not use C++ reserved name (leading underscore + capital) (NFC)
llvm-svn: 283616
2016-10-07 22:03:03 +00:00
Mehdi Amini 44f0eda077 Fix MSVC build: requires namespace in front of StringRef (NFC)
llvm-svn: 283615
2016-10-07 22:02:59 +00:00
Mehdi Amini 6fcd4eb9fc Driver: use StringRef instead of raw pointer in lookupTypeForExtension() (NFC)
llvm-svn: 283611
2016-10-07 21:41:00 +00:00
Mehdi Amini c50b1a263b Turn ArchName/BoundArch in Driver from raw pointer to StringRef (NFC)
llvm-svn: 283605
2016-10-07 21:27:26 +00:00
Douglas Katzman 4f25bf6ac9 Visually align table def with respective enum. NFC
'warn_attribute_wrong_decl_type' has to stay in sync with
'enum AttributeDeclKind' which is much easier when they line up.

llvm-svn: 283601
2016-10-07 21:02:38 +00:00
Michal Gorny 822629db5d Revert r283572 - [Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Revert the -print-libgcc-file-name change as the new test fails
on Darwin. It needs to be updated to run the libgcc part only on systems
supporting that rtlib.

llvm-svn: 283586
2016-10-07 20:04:00 +00:00
Artem Dergachev b1991c5fa7 [analyzer] Re-apply r283092, attempt no.4, chunk no.4 (last)
The problem that caused the msvc crash has been indentified and fixed
in the previous commit. This patch contains the rest of r283092.

llvm-svn: 283584
2016-10-07 19:25:10 +00:00
Nirav Dave 2620d22b2b Silence Warning. NFC.
llvm-svn: 283583
2016-10-07 19:11:33 +00:00
Artem Dergachev 9913583e06 [analyzer] Re-apply r283092, attempt no.4, chunk no.3, fixup 1.
Remove the brace default initializer to see if this is what's causing
the msvc crash.

llvm-svn: 283574
2016-10-07 17:24:06 +00:00
Artem Dergachev a458828fe7 [analyzer] Re-apply r283092, attempt no.4, chunk no.3.
This is the primary suspect for causing the msvc crash, now that vector of
smart pointers was proven to be safe. Probably the default {}-initializer
is the problem.

llvm-svn: 283573
2016-10-07 17:12:05 +00:00
Michal Gorny 81684a0676 [Driver] Make -print-libgcc-file-name print compiler-rt lib when used
Make the -print-libgcc-file-name option print an appropriate compiler
runtime library, that is libgcc.a if gcc runtime is used
and an appropriate compiler-rt library if that runtime is used.

The main use for this is to allow linking executables built with
-nodefaultlibs (e.g. to avoid linking to the standard C++ library) to
the compiler runtime library, e.g. using:

  clang++ ... -nodefaultlibs $(clang++ ... -print-libgcc-file-name)

in which case currently a program built like this linked to the gcc
runtime unconditionally. The patch fixes it to use compiler-rt libraries
instead when compiler-rt is the active runtime.

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

llvm-svn: 283572
2016-10-07 17:08:06 +00:00
Artem Dergachev ae22c0752d [analyzer] Re-apply r283092, attempt no.4, chunk no.2.
Define the list of pieces in BugReport class. This is half of the changes
in the BugReport class code, which is pointed to by the msvc crash message.

llvm-svn: 283568
2016-10-07 15:55:18 +00:00
Artem Dergachev 8b70c4e529 [analyzer] Re-apply r283092, attempt no.4, a small chunk.
Define PathDiagnosticNotePiece. The next commit would be able to address the
BugReport class code that is pointed to by the msvc crash message.

llvm-svn: 283566
2016-10-07 15:23:02 +00:00
Dehao Chen e239e95160 Update clang test to accomendate discriminator change in https://reviews.llvm.org/D25132
Summary: https://reviews.llvm.org/D25132 added discriminator even add -g0. This leads to test fail which is addressed in thie patch.

Reviewers: davidxl, dnovillo

Subscribers: llvm-commits

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

llvm-svn: 283564
2016-10-07 15:21:29 +00:00
Daniel Marjamaki d99ebc03f4 [analyzer] Don't merge different return nodes in ExplodedGraph
Returns when calling an inline function should not be merged in the ExplodedGraph unless they are same.

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

llvm-svn: 283554
2016-10-07 14:21:08 +00:00
Simon Pilgrim 12d6baf5e4 Wdocumentation fix
llvm-svn: 283549
2016-10-07 13:25:41 +00:00
Javed Absar 00b7444dc1 [ARM]: Add Cortex-R52 target
This patch adds Cortex-R52, the new ARM real-time processor.
Cortex-R52 implements the ARMv8-R architecture.

llvm-svn: 283543
2016-10-07 12:08:41 +00:00
Artem Dergachev f03039fb4d Revert "[analyzer] Re-apply r283092, attempt no.3, in small chunks this time."
llvm-svn: 283541
2016-10-07 11:29:32 +00:00
Artem Dergachev 7258ca3ab7 [analyzer] Re-apply r283092, attempt no.3, in small chunks this time.
llvm-svn: 283540
2016-10-07 11:26:15 +00:00
Artem Dergachev 5d9278ef00 Revert "[analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"
Vector of smart pointers wasn't the thing that caused msvc crash.

llvm-svn: 283537
2016-10-07 10:56:44 +00:00
Artem Dergachev fc36b586fb [analyzer] Try to re-apply r283092 "Extend bug reports with extra notes"
Replace SmallVector<IntrusiveRefCntPtr> with a vector of plain pointers.
Would insignificantly increase memory usage.

llvm-svn: 283536
2016-10-07 10:44:09 +00:00
Mehdi Amini a0016ec95f Use StringReg in TargetParser APIs (NFC)
llvm-svn: 283527
2016-10-07 08:37:29 +00:00
Richard Smith e15a370084 PR25890: Fix incoherent error handling in PerformImplicitConversion and
CheckSingleAssignmentConstraints. These no longer produce ExprError() when they
have not emitted an error, and reliably inform the caller when they *have*
emitted an error.

This fixes some serious issues where we would fail to emit any diagnostic for
invalid code and then attempt to emit code for an invalid AST, and conversely
some issues where we would emit two diagnostics for the same problem.

llvm-svn: 283508
2016-10-06 23:12:58 +00:00
Anton Yartsev 0509d047f4 [analyzer] Add explanation why analyzer report is not generated (fix for PR12421).
Currently if the path diagnostic consumer (e.g HTMLDiagnostics and PlistDiagnostics) do not support cross file diagnostics then the path diagnostic report is silently omitted in the case of cross file diagnostics. The patch adds a little verbosity to Clang in this case.
The patch also adds help entry for the "--analyzer-output" driver option.

llvm-svn: 283499
2016-10-06 21:42:21 +00:00
Richard Smith 254a45ee65 Add another .def file to module map to fix modules buildbot's displeasure.
llvm-svn: 283498
2016-10-06 21:31:04 +00:00
Eric Fiselier 9813131936 [coroutines] Fix co_return statement for initializer list arguments
Summary:
Previously the statement `co_return {42}` would be transformed into `P.return_void()`, since the type of `{42}` is represented as `void` by Clang.

This patch fixes the bug by checking for `InitListExpr` arguments and transforming them accordingly.

Reviewers: majnemer, GorNishanov, rsmith

Subscribers: mehdi_amini, cfe-commits

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

llvm-svn: 283495
2016-10-06 21:23:38 +00:00
Richard Smith c26d97401c [modules] Be sure to emit local specializations of imported templates, even if
the resulting specialization is not referenced by the rest of the AST. This
both avoids performing unnecessary reinstantiations in downstream users of the
AST file and fixes a bug (breaking modules self-host right now) where we would
sometimes fail to emit a definition of a class template specialization if we
imported just a declaration of it from elsewhere (see new testcase for reduced
example).

llvm-svn: 283489
2016-10-06 20:30:51 +00:00
Justin Lebar 14299363af [Sema] Replace smart quote with "'" in comment.
Looks like the smart quote was copy/pasted from the C++ standard.

The smart quote was not encoded as valid UTF-8 (?), even though vim was
detecting the file as UTF-8.  This broke the clang-format Python script,
which tried to read the file using the same encoding as vim detected.

llvm-svn: 283487
2016-10-06 19:47:56 +00:00
David Sheinkman d03c85c02e [OpenMP] Check if the template specialization is mappable instead of specialized template Differential Revision: https://reviews.llvm.org/D25252
llvm-svn: 283460
2016-10-06 15:47:36 +00:00
Vassil Vassilev 916d8be252 Allocate after the early exit checks. NFC.
llvm-svn: 283448
2016-10-06 13:18:06 +00:00
Vassil Vassilev d1a88130c4 [modules] Allow VarDecls with initializers to use special var abbrev.
Update storage sizes to fit the (past) changes in the VarDecl's data model.
Update some comments.

Patch partially reviewed by Richard Smith as part of https://reviews.llvm.org/D24508

llvm-svn: 283444
2016-10-06 13:04:54 +00:00
Alex Lorenz 6f4bc4f68d [Sema] Fix PR30520: Handle incomplete field types in transparent_union unions
This commit fixes a crash that happens when clang is analyzing a
transparent_union attribute on a union which has a field with incomplete type.

rdar://28630028

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

llvm-svn: 283432
2016-10-06 09:47:29 +00:00
Benjamin Kramer 6aa14cbce7 Add missing -no-canonical-prefixes.
llvm-svn: 283430
2016-10-06 09:40:37 +00:00
Alex Lorenz 7ba609a220 Fix PR30440: Initialize FunctionTypeDepth in CXXNameMangler
This commit fixes PR 30440 by initializing CXXNameMangler's FunctionTypeDepth
in the two constructors added in r274222 (The commit that caused this
regression).

rdar://28455269

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

llvm-svn: 283428
2016-10-06 09:37:15 +00:00
Petr Hosek 62e1d23986 [Driver] Add driver support for Fuchsia
Provide toolchain and tool support for Fuchsia operating system.
Fuchsia uses compiler-rt as the runtime library and libc++, libc++abi
and libunwind as the C++ standard library. lld is used as a default
linker.

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

llvm-svn: 283420
2016-10-06 06:08:09 +00:00
Mehdi Amini 1201117e60 Taking StringRef in Driver.h APIs instead of raw pointers (NFC)
llvm-svn: 283417
2016-10-06 05:11:48 +00:00
Mehdi Amini 2d487db031 Use llvm::raw_string_ostream instead of std::stringstream (NFC)
As a side effect, this avoid having to call .data() on the StringRef.

llvm-svn: 283416
2016-10-06 04:26:16 +00:00