Commit Graph

74076 Commits

Author SHA1 Message Date
Joel E. Denny 3cabf73270 [OPENMP] Fix incomplete type check for array reductions
A reduction for an incomplete array type used to produce an assert
fail during codegen.  Now it produces a diagnostic.

Reviewed By: ABataev

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

llvm-svn: 335911
2018-06-28 19:54:49 +00:00
Joel E. Denny e0e7a8ae58 Revert r335907: [OPENMP] Fix incomplete type check for array reductions
Sorry, forgot to add commit log attributes again.

llvm-svn: 335910
2018-06-28 19:54:27 +00:00
Joel E. Denny 82e9ea5b49 [OPENMP] Fix incomplete type check for array reductions
A reduction for an incomplete array type used to produce an assert
fail during codegen.  Now it produces a diagnostic.

llvm-svn: 335907
2018-06-28 19:46:10 +00:00
Ahmed Bougacha 8b597883a1 [CMake] Make bootstrap and compiler-rt depend on cxx-headers.
Since r334468, we no longer always copy the libcxx headers by virtue of
their presence when cmake runs.

This makes some of the later stages (compiler-rt, and the bootstrapped
stages) depend on them being copied, via the cxx-headers target.

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

llvm-svn: 335898
2018-06-28 18:35:25 +00:00
Vedant Kumar 29b46c469b [Darwin] Remove _VPMergeHook from the auto-export list
Remove _VPMergeHook from Darwin's automatically-exported symbol list for
PGO. As of r328987 this symbol is no longer weak.

An integration test in compiler-rt will follow.

rdar://41470205

llvm-svn: 335890
2018-06-28 17:53:35 +00:00
Artem Belevich 5ce0a08cf6 [CUDA] Place all CUDA sections in __NV_CUDA segment on Mac.
That's where CUDA binaries appear to put them.

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

llvm-svn: 335880
2018-06-28 17:15:52 +00:00
Krasimir Georgiev 2d69f5d82e [clang-format] Do not format raw string literals inside a recognized function with a non-recognized delimiter
Summary:
This stops clang-format from touching raw string contents with unrecognized delimiters inside recognized functions.
Unrecognized delimiters signal that the string might be special.

Subscribers: cfe-commits

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

llvm-svn: 335876
2018-06-28 16:58:24 +00:00
Filipe Cabecinhas 3c7b58d6b1 Fix test that was failing on Windows due to too many backslashes
llvm-svn: 335858
2018-06-28 14:16:13 +00:00
David Carlier 11f1d7e9e4 OpenBSD driver needs ld.lld in sanitizer context
Base GNU ld is pretty ancient and does not support --dynamic-list flag.
For conveniency, we can it automatically when compile with ubsan sanitizer flag.

Reviewers: dberris

Reviewed by: dberris

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

llvm-svn: 335856
2018-06-28 13:49:41 +00:00
Benjamin Kramer 456ee30036 Fix unittest build with GCC older than 5.
Old GCCs have an annoying bug where RVO disables the automatic
conversion to base for unique_ptr. Add a pessimizing std::move as a
workaround.

llvm-svn: 335854
2018-06-28 13:31:36 +00:00
Vassil Vassilev 61914d38dd [ODRHash] Do not rely on Type* when computing the hash.
ODRHash aims to provide Cross-TU stable hashing. Making clang::Type pointer
part of the hash connects (remotely) the ODRHash with the TU-specific
::Profile hasher.

r332281 exposed the issue by changing the way the ASTContext different
elaborated types if there is an owning tag. In that case, ODRHash stores two
 different types in its TypeMap which yields false ODR violation in modules.

The current state of implementation shouldn't need the TypeMap concept
anymore. Rip it out.

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

llvm-svn: 335853
2018-06-28 13:28:44 +00:00
Aaron Ballman 0050466976 The :option: syntax was generating Sphinx build warnings; switched to double backticks to silence the warning; NFC.
llvm-svn: 335843
2018-06-28 12:05:40 +00:00
Aaron Ballman 37485fdc45 Correct the code highlighting marker to be Objective-C rather than C++ which fixes a Sphinx build warning; NFC.
llvm-svn: 335842
2018-06-28 12:02:38 +00:00
Aaron Ballman 723209d013 Fix the indentation in this documentation to remove a Sphinx warning; NFC.
llvm-svn: 335841
2018-06-28 12:00:16 +00:00
Adam Balogh b03ed5e414 [Analyzer] Iterator Checker - Part 2: Increment, decrement operators and ahead-of-begin checks
Add handling of the begin() funcion of containers to the iterator checkers,
together with the pre- and postfix ++ and -- operators of the iterators. This
makes possible the checking of iterators dereferenced ahead of the begin of the
container.

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

llvm-svn: 335835
2018-06-28 10:58:53 +00:00
Jonas Devlieghere 9ef4965a0d [DebugInfo] Follow-up commit to improve consistency. NFC
Follow-up commit for r335757 to address some inconsistencies.

llvm-svn: 335834
2018-06-28 10:56:40 +00:00
Adam Balogh 77660ee89a [Analyzer] Constraint Manager Negates Difference
If range [m .. n] is stored for symbolic expression A - B, then we can deduce the range for B - A which is [-n .. -m]. This is only true for signed types, unless the range is [0 .. 0].

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

llvm-svn: 335814
2018-06-28 07:35:23 +00:00
Petr Hosek 2423c16935 [CMake] Use explicit targets for building Linux runtimes
Previously we were using default logic when building Linux runtimes
in Fuchsia toolchain, but that leads to various issues due to how
the CMake logic in compiler-rt for determining the platform support
is implemented. With this change, we will use explicit target for
every provided Linux sysroot.

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

llvm-svn: 335812
2018-06-28 05:15:46 +00:00
Petr Hosek 1a330a1acf Handle both Linux and Windows path separator for the resource dir
The resource dir path used for the multiarch runtimes support is
constructed in a platform independent way and therefore will use
native path separators on each platform. We need to make sure that
the per target runtime directory test handles both to not fail
when the test is being executed on Windows.

llvm-svn: 335810
2018-06-28 03:54:08 +00:00
Petr Hosek 887f26d470 Support for multiarch runtimes layout
This change adds a support for multiarch style runtimes layout, so in
addition to the existing layout where runtimes get installed to:

lib/clang/$version/lib/$os

Clang now allows runtimes to be installed to:

lib/clang/$version/$target/lib

This also includes libc++, libc++abi and libunwind; today those are
assumed to be in Clang library directory built for host, with the
new layout it is possible to install libc++, libc++abi and libunwind
into the runtime directory built for different targets.

The use of new layout is enabled by setting the
LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both
projects and runtimes layouts. The runtimes CMake build has been further
modified to use the new layout when building runtimes for multiple
targets.

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

llvm-svn: 335809
2018-06-28 03:11:52 +00:00
Artem Dergachev 4ba041fa25 [analyzer] Remove redundant ';'.
Fixes a compiler warning. No functionan change intended.

llvm-svn: 335808
2018-06-28 02:33:16 +00:00
Richard Smith f5262c6385 [modules] Do not serialize / deserialize pending new/delete mismatch
checks across module boundaries. This was causing us to load constructor
definitions for all consumers of a module with a pending check.

(In one case we saw ~7% of total frontend time spent loading
constructors for this check.)

llvm-svn: 335807
2018-06-28 01:57:04 +00:00
Richard Smith 0b70de15ac [modules] Ensure that an in-class function definition is attached to the
declaration of the function that ends up in the primary definition of
the class.

... at least for class templates. This is necessary for us to be able to
track when an inline friend function has a definition that needs to be
(lazily) instantiated.

llvm-svn: 335805
2018-06-28 01:07:28 +00:00
Artem Dergachev 0bb974e3ee [analyzer] Use sufficiently large types for index bounds calculation.
The ProgramState::assumeInBound() API is used by checkers to make an assumption
that a certain array index is within the array's bounds (i.e. is greater than or
equal to 0 and is less than the length of the array). When the type of the
index was unspecified by the caller, it assumed that the type is 'int', which
caused some indices and sizes to truncate during calculations.

Use ArrayIndexTy by default instead, which is used by the analyzer to represent
index types and is currently hardcoded to long long.

Patch by Bevin Hansson!

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

llvm-svn: 335803
2018-06-28 00:42:11 +00:00
Artem Dergachev 9a209ad1d8 [analyzer] Add support for pre-C++17 copy elision.
r335795 adds copy elision information to CFG. This commit allows static analyzer
to elide elidable copy constructors by constructing the objects that were
previously subject to elidable copy directly in the target region of the copy.

The chain of elided constructors may potentially be indefinitely long. This
only happens when the object is being returned from a function which in turn is
returned from another function, etc.

NRVO is not supported yet.

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

llvm-svn: 335800
2018-06-28 00:30:18 +00:00
Artem Dergachev d18639bd13 [CFG] [analyzer] Simplify lifetime-extended temporary construction contexts.
When a temporary object is materialized and through that obtain lifetime that
is longer than the duration of the full-expression, it does not require a
temporary object destructor; it will be destroyed in a different manner.

Therefore it's not necessary to include CXXBindTemporaryExpr into the
construction context for such temporary in the CFG only to make clients
throw it away.

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

llvm-svn: 335798
2018-06-28 00:18:52 +00:00
Artem Dergachev 4fb586c349 [analyzer] Re-enable lifetime extension for temporaries without destructors.
When an object's class provides no destructor, it's less important to
materialize that object properly because we don't have to model the destructor
correctly, so previously we skipped the support for these syntax patterns.

Additionally, fix support for construction contexts of "static temporaries"
(temporaries that are lifetime-extended by static references) because
it turned out that we only had tests for them without destructors, which caused
us to regress when we re-introduced the construction context for such
temporaries.

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

llvm-svn: 335796
2018-06-28 00:11:42 +00:00
Artem Dergachev ff267df0de [CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.
Before C++17 copy elision was optional, even if the elidable copy/move
constructor had arbitrary side effects. The elidable constructor is present
in the AST, but marked as elidable.

In these cases CFG now contains additional information that allows its clients
to figure out if a temporary object is only being constructed so that to pass
it to an elidable constructor. If so, it includes a reference to the elidable
constructor's construction context, so that the client could elide the
elidable constructor and construct the object directly at its final destination.

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

llvm-svn: 335795
2018-06-28 00:04:54 +00:00
Heejin Ahn da6b81cdb5 [analyzer] Add clangFrontend to target_link_libraries
Without this, builds with `-DSHARED_LIB=ON` fail.

llvm-svn: 335791
2018-06-27 22:05:09 +00:00
Richard Smith 8a62ef0e1d [www] Update cxx_dr_status for recent DR fixes.
llvm-svn: 335782
2018-06-27 20:30:36 +00:00
Richard Smith 1ef7554efd DR1687: When overload resolution selects a built-in operator, implicit
conversions are only applied to operands of class type, and the second
standard conversion sequence is not applied.

When diagnosing an invalid builtin binary operator, talk about the
original types rather than the converted types. If these differ by a
user-defined conversion, tell the user what happened.

llvm-svn: 335781
2018-06-27 20:30:34 +00:00
Bruno Cardoso Lopes 03e0d2d82b [Modules][ObjC] Warn on the use of '@import' in framework headers
Using @import in framework headers inhibit the use of such headers
when not using modules, this is specially bad for headers that end
up in the SDK (or any other system framework). Add a warning to give
users some indication that this is discouraged.

rdar://problem/39192894

llvm-svn: 335780
2018-06-27 20:29:36 +00:00
Richard Smith becac9eb56 DR1213: Ignore implicit conversions when determining if an operand of an
array subscript expression is an array prvalue.

Also apply DR1213 to vector prvalues for consistency.

llvm-svn: 335779
2018-06-27 20:29:32 +00:00
Aaron Enye Shi 02151cacca [HIP] Fix ordering of device-libs linking
Summary:
HIP should link the bitcodes with caller functions before callee functions. Also added lit test to check the ordering of the linked bitcodes is matches.

Reviewers: yaxunl, b-sumner

Reviewed By: yaxunl, b-sumner

Subscribers: cfe-commits, yaxunl, b-sumner, scchan

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

llvm-svn: 335774
2018-06-27 19:51:42 +00:00
Aaron Enye Shi dfb1bf0478 [HIP] Support flush denormals bitcode
Summary:
Use oclc_daz_opt_on.amdgcn.bc bitcode when option fcuda-flush-denormal-to-zero is enabled, otherwise use oclc_daz_opt_off.amdgcn.bc bitcode. Added lit tests to verify that the correct bitcode is linked when -fcuda-flush-denormal-to-zero option is enabled or disabled.

Reviewers: yaxunl, scchan, b-sumner

Reviewed By: yaxunl, scchan, b-sumner

Subscribers: cfe-commits, yaxunl

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

llvm-svn: 335765
2018-06-27 18:58:55 +00:00
Artem Belevich c66d254ded [CUDA] Use atexit() to call module destructor.
This matches the way NVCC does it. Doing module cleanup at global
destructor phase used to work, but is, apparently, too late for
the CUDA runtime in CUDA-9.2, which ends up crashing with double-free.

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

llvm-svn: 335763
2018-06-27 18:32:51 +00:00
Matt Morehouse 520748f01e [UBSan] Add silence_unsigned_overflow flag.
Summary:
Setting UBSAN_OPTIONS=silence_unsigned_overflow=1 will silence all UIO
reports.  This feature, combined with
-fsanitize-recover=unsigned-integer-overflow, is useful for providing
fuzzing signal without the excessive log output.

Helps with https://github.com/google/oss-fuzz/issues/910.

Reviewers: kcc, vsk

Reviewed By: vsk

Subscribers: vsk, kubamracek, Dor1s, llvm-commits

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

llvm-svn: 335762
2018-06-27 18:24:46 +00:00
Jonas Devlieghere d8ba8ae875 [DebugInfo] Emit ObjC methods as part of interface
As brought up during the discussion of the DWARF5 accelerator tables,
there is currently no way to associate Objective-C methods with the
interface they belong to, other than the .apple_objc accelerator table.

After due consideration we came to the conclusion that it makes more
sense to follow Pavel's suggestion of just emitting this information in
the .debug_info section. One concern was that categories were
emitted in the .apple_names as well, but it turns out that LLDB doesn't
rely on the accelerator tables for this information.

This patch changes the codegen behavior to emit subprograms for
structure types, like we do for C++. This will result in the
DW_TAG_subprogram being nested as a child under its
DW_TAG_structure_type. This behavior is only enabled for DWARF5 and
later, so we can have a unique code path in LLDB with regards to
obtaining the class methods.

This was tested on the LLDB side and doesn't lead to a regression.
There's already code in place to deal with member functions in C++,
which deals with this transparently.

For more background please refer to the discussion on the mailing list:
http://lists.llvm.org/pipermail/llvm-dev/2018-June/123986.html

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

llvm-svn: 335757
2018-06-27 17:31:59 +00:00
Mikhail R. Gadelha c607a9f6b8 Revert "[Analyzer] Moved RangeConstraintManager to header. NFC."
This broke a number of bots.

This reverts commit 5e1a89912d37a21c3b49ccf30600d7f498dffa9c.

llvm-svn: 335752
2018-06-27 16:45:58 +00:00
Francis Visoiu Mistrih 7b7b5eb60d [NEON] Remove empty test file from r335734
Fails on Green Dragon:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/50174/consoleFull

UNRESOLVED: Clang :: CodeGen/vld_dup.c (5546 of 38947)
******************** TEST 'Clang :: CodeGen/vld_dup.c' FAILED ********************
Test has no run line!

llvm-svn: 335750
2018-06-27 16:17:32 +00:00
Craig Topper 851f363691 [X86] Rename llvm.x86.avx512.mask.fpclass.p* to exclude 'mask.' from the name to match llvm.
llvm-svn: 335745
2018-06-27 15:57:57 +00:00
Alexander Kornienko d00ed8e2c2 [analyzer] Allow registering custom statically-linked analyzer checkers
Summary:
Add an extension point to allow registration of statically-linked Clang Static
Analyzer checkers that are not a part of the Clang tree. This extension point
employs the mechanism used when checkers are registered from dynamically loaded
plugins.

Reviewers: george.karpenkov, NoQ, xazax.hun, dcoughlin

Reviewed By: george.karpenkov

Subscribers: mgorny, mikhail.ramalho, rnkovacs, xazax.hun, szepet, a.sidorin, cfe-commits

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

llvm-svn: 335740
2018-06-27 14:56:12 +00:00
Mikhail R. Gadelha afc62b7032 [analyzer] Fix string not being formatted with extra arguments
Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
llvm-svn: 335739
2018-06-27 14:39:41 +00:00
Ivan A. Kosarev a9f484ac4a [NEON] Support vldNq intrinsics in AArch32 (Clang part)
This patch reworks the support for dup NEON intrinsics as
described in D48439.

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

llvm-svn: 335734
2018-06-27 13:58:43 +00:00
Gabor Marton 5254e64a8e Re-apply: [ASTImporter] Import the whole redecl chain of functions
Summary:
With this patch when any `FunctionDecl` of a redeclaration chain is imported
then we bring in the whole declaration chain.  This involves functions and
function template specializations.  Also friend functions are affected.  The
chain is imported as it is in the "from" tu, the order of the redeclarations
are kept.  I also changed the lookup logic in order to find friends, but first
making them visible in their declaration context.  We may have long
redeclaration chains if all TU contains the same prototype, but our
measurements shows no degradation in time of CTU analysis (Tmux, Xerces,
Bitcoin, Protobuf).  Also, as further work we could squash redundant
prototypes, but first ensure that functionality is working properly; then
should we optimize.

This may seem like a huge patch, sorry about that. But, most of the changes are
new tests, changes in the production code is not that much.  I also tried to
create a smaller patch which does not affect specializations, but that patch
failed to pass some of the `clang-import-test`s because there we import
function specializations. Also very importantly, we can't just change the
import of `FunctionDecl`s without changing the import of function template
specializations because they are handled as `FunctionDecl`s.

Reviewers: a.sidorin, r.stahl, xazax.hun, balazske, a_sidorin

Reviewed By: a_sidorin

Subscribers: labath, aprantl, a_sidorin, rnkovacs, dkrupp, cfe-commits

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

Re-apply commit rC335480

llvm-svn: 335731
2018-06-27 13:32:50 +00:00
Mikhail R. Gadelha 996965d67a [Analyzer] Moved RangeConstraintManager to header. NFC.
Summary: While at it, added a dump method to RangeSet.

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

llvm-svn: 335726
2018-06-27 12:42:48 +00:00
Nico Weber f08125c7c4 Add regression test for PR37935.
llvm-svn: 335725
2018-06-27 12:05:06 +00:00
Petr Hosek 7636840b87 [CMake] Support passing FUCHSIA_SDK as the only variable
Now that the structure of Fuchsia SDK has been formalized, we no
longer need to pass all the different CFLAGS/LDFLAGS to the CMake
build separately, we can simply set the FUCHSIA_SDK variable and
derive all the necessary variables from that one inside the cache
file.

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

llvm-svn: 335708
2018-06-27 05:50:43 +00:00
Petr Hosek 7e5e3edc95 [CMake] Provide direct support for building sanitized runtimes
This avoids having to rely on magic separators and special parsing.

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

llvm-svn: 335704
2018-06-27 03:35:53 +00:00
Zachary Turner a603022021 Fix warning about unhandled enumeration in switch.
llvm-svn: 335702
2018-06-27 02:49:22 +00:00