]> granicus.if.org Git - clang/log
clang
6 years agoThe :option: syntax was generating Sphinx build warnings; switched to double backtick...
Aaron Ballman [Thu, 28 Jun 2018 12:05:40 +0000 (12:05 +0000)]
The :option: syntax was generating Sphinx build warnings; switched to double backticks to silence the warning; NFC.

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

6 years agoCorrect the code highlighting marker to be Objective-C rather than C++ which fixes...
Aaron Ballman [Thu, 28 Jun 2018 12:02:38 +0000 (12:02 +0000)]
Correct the code highlighting marker to be Objective-C rather than C++ which fixes a Sphinx build warning; NFC.

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

6 years agoFix the indentation in this documentation to remove a Sphinx warning; NFC.
Aaron Ballman [Thu, 28 Jun 2018 12:00:16 +0000 (12:00 +0000)]
Fix the indentation in this documentation to remove a Sphinx warning; NFC.

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

6 years ago[Analyzer] Iterator Checker - Part 2: Increment, decrement operators and ahead-of...
Adam Balogh [Thu, 28 Jun 2018 10:58:53 +0000 (10:58 +0000)]
[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

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

6 years ago[DebugInfo] Follow-up commit to improve consistency. NFC
Jonas Devlieghere [Thu, 28 Jun 2018 10:56:40 +0000 (10:56 +0000)]
[DebugInfo] Follow-up commit to improve consistency. NFC

Follow-up commit for r335757 to address some inconsistencies.

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

6 years ago[Analyzer] Constraint Manager Negates Difference
Adam Balogh [Thu, 28 Jun 2018 07:35:23 +0000 (07:35 +0000)]
[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

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

6 years ago[CMake] Use explicit targets for building Linux runtimes
Petr Hosek [Thu, 28 Jun 2018 05:15:46 +0000 (05:15 +0000)]
[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

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

6 years agoHandle both Linux and Windows path separator for the resource dir
Petr Hosek [Thu, 28 Jun 2018 03:54:08 +0000 (03:54 +0000)]
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.

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

6 years agoSupport for multiarch runtimes layout
Petr Hosek [Thu, 28 Jun 2018 03:11:52 +0000 (03:11 +0000)]
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

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

6 years ago[analyzer] Remove redundant ';'.
Artem Dergachev [Thu, 28 Jun 2018 02:33:16 +0000 (02:33 +0000)]
[analyzer] Remove redundant ';'.

Fixes a compiler warning. No functionan change intended.

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

6 years ago[modules] Do not serialize / deserialize pending new/delete mismatch
Richard Smith [Thu, 28 Jun 2018 01:57:04 +0000 (01:57 +0000)]
[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.)

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

6 years ago[modules] Ensure that an in-class function definition is attached to the
Richard Smith [Thu, 28 Jun 2018 01:07:28 +0000 (01:07 +0000)]
[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.

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

6 years ago[analyzer] Use sufficiently large types for index bounds calculation.
Artem Dergachev [Thu, 28 Jun 2018 00:42:11 +0000 (00:42 +0000)]
[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

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

6 years ago[analyzer] Add support for pre-C++17 copy elision.
Artem Dergachev [Thu, 28 Jun 2018 00:30:18 +0000 (00:30 +0000)]
[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

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

6 years ago[CFG] [analyzer] Simplify lifetime-extended temporary construction contexts.
Artem Dergachev [Thu, 28 Jun 2018 00:18:52 +0000 (00:18 +0000)]
[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

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

6 years ago[analyzer] Re-enable lifetime extension for temporaries without destructors.
Artem Dergachev [Thu, 28 Jun 2018 00:11:42 +0000 (00:11 +0000)]
[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

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

6 years ago[CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.
Artem Dergachev [Thu, 28 Jun 2018 00:04:54 +0000 (00:04 +0000)]
[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

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

6 years ago[analyzer] Add clangFrontend to target_link_libraries
Heejin Ahn [Wed, 27 Jun 2018 22:05:09 +0000 (22:05 +0000)]
[analyzer] Add clangFrontend to target_link_libraries

Without this, builds with `-DSHARED_LIB=ON` fail.

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

6 years ago[www] Update cxx_dr_status for recent DR fixes.
Richard Smith [Wed, 27 Jun 2018 20:30:36 +0000 (20:30 +0000)]
[www] Update cxx_dr_status for recent DR fixes.

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

6 years agoDR1687: When overload resolution selects a built-in operator, implicit
Richard Smith [Wed, 27 Jun 2018 20:30:34 +0000 (20:30 +0000)]
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.

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

6 years ago[Modules][ObjC] Warn on the use of '@import' in framework headers
Bruno Cardoso Lopes [Wed, 27 Jun 2018 20:29:36 +0000 (20:29 +0000)]
[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

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

6 years agoDR1213: Ignore implicit conversions when determining if an operand of an
Richard Smith [Wed, 27 Jun 2018 20:29:32 +0000 (20:29 +0000)]
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.

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

6 years ago[HIP] Fix ordering of device-libs linking
Aaron Enye Shi [Wed, 27 Jun 2018 19:51:42 +0000 (19:51 +0000)]
[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

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

6 years ago[HIP] Support flush denormals bitcode
Aaron Enye Shi [Wed, 27 Jun 2018 18:58:55 +0000 (18:58 +0000)]
[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

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

6 years ago[CUDA] Use atexit() to call module destructor.
Artem Belevich [Wed, 27 Jun 2018 18:32:51 +0000 (18:32 +0000)]
[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

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

6 years ago[UBSan] Add silence_unsigned_overflow flag.
Matt Morehouse [Wed, 27 Jun 2018 18:24:46 +0000 (18:24 +0000)]
[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

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

6 years ago[DebugInfo] Emit ObjC methods as part of interface
Jonas Devlieghere [Wed, 27 Jun 2018 17:31:59 +0000 (17:31 +0000)]
[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

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

6 years agoRevert "[Analyzer] Moved RangeConstraintManager to header. NFC."
Mikhail R. Gadelha [Wed, 27 Jun 2018 16:45:58 +0000 (16:45 +0000)]
Revert "[Analyzer] Moved RangeConstraintManager to header. NFC."

This broke a number of bots.

This reverts commit 5e1a89912d37a21c3b49ccf30600d7f498dffa9c.

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

6 years ago[NEON] Remove empty test file from r335734
Francis Visoiu Mistrih [Wed, 27 Jun 2018 16:17:32 +0000 (16:17 +0000)]
[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!

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

6 years ago[X86] Rename llvm.x86.avx512.mask.fpclass.p* to exclude 'mask.' from the name to...
Craig Topper [Wed, 27 Jun 2018 15:57:57 +0000 (15:57 +0000)]
[X86] Rename llvm.x86.avx512.mask.fpclass.p* to exclude 'mask.' from the name to match llvm.

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

6 years ago[analyzer] Allow registering custom statically-linked analyzer checkers
Alexander Kornienko [Wed, 27 Jun 2018 14:56:12 +0000 (14:56 +0000)]
[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

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

6 years ago[analyzer] Fix string not being formatted with extra arguments
Mikhail R. Gadelha [Wed, 27 Jun 2018 14:39:41 +0000 (14:39 +0000)]
[analyzer] Fix string not being formatted with extra arguments

Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335739 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NEON] Support vldNq intrinsics in AArch32 (Clang part)
Ivan A. Kosarev [Wed, 27 Jun 2018 13:58:43 +0000 (13:58 +0000)]
[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

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

6 years agoRe-apply: [ASTImporter] Import the whole redecl chain of functions
Gabor Marton [Wed, 27 Jun 2018 13:32:50 +0000 (13:32 +0000)]
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

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

6 years ago[Analyzer] Moved RangeConstraintManager to header. NFC.
Mikhail R. Gadelha [Wed, 27 Jun 2018 12:42:48 +0000 (12:42 +0000)]
[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

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

6 years agoAdd regression test for PR37935.
Nico Weber [Wed, 27 Jun 2018 12:05:06 +0000 (12:05 +0000)]
Add regression test for PR37935.

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

6 years ago[CMake] Support passing FUCHSIA_SDK as the only variable
Petr Hosek [Wed, 27 Jun 2018 05:50:43 +0000 (05:50 +0000)]
[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

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

6 years ago[CMake] Provide direct support for building sanitized runtimes
Petr Hosek [Wed, 27 Jun 2018 03:35:53 +0000 (03:35 +0000)]
[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

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

6 years agoFix warning about unhandled enumeration in switch.
Zachary Turner [Wed, 27 Jun 2018 02:49:22 +0000 (02:49 +0000)]
Fix warning about unhandled enumeration in switch.

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

6 years ago[analyzer] [NFC] A convenient getter for getting a current stack frame
George Karpenkov [Wed, 27 Jun 2018 01:51:55 +0000 (01:51 +0000)]
[analyzer] [NFC] A convenient getter for getting a current stack frame

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

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

6 years ago[analyzer] [NFC] Add -verify to malloc checker test
George Karpenkov [Wed, 27 Jun 2018 01:51:36 +0000 (01:51 +0000)]
[analyzer] [NFC] Add -verify to malloc checker test

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

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

6 years agoDiagnose missing 'template' keywords in contexts where a comma is not a
Richard Smith [Wed, 27 Jun 2018 01:32:04 +0000 (01:32 +0000)]
Diagnose missing 'template' keywords in contexts where a comma is not a
binary operator.

Factor out the checking for a comma within potential angle brackets and
also call it from contexts where we parse a comma-separated list of
arguments or initializers.

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

6 years ago[mips] Explicitly specify the linker emulation for MIPS on FreeBSD.
John Baldwin [Wed, 27 Jun 2018 00:02:16 +0000 (00:02 +0000)]
[mips] Explicitly specify the linker emulation for MIPS on FreeBSD.

FreeBSD's mips64 builds O32 binaries for /usr/lib32 by default and
thus needs to be able to link O32 binaries which requires an explicit
linker emulation.  Go ahead and list all the linker emulation variants
for MIPS so that any supported MIPS ABI binary can be linked by any
linker supporting MIPS.

Reviewed By: atanasyan

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

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

6 years agoDiagnose missing 'template' keywords in more cases.
Richard Smith [Tue, 26 Jun 2018 23:20:26 +0000 (23:20 +0000)]
Diagnose missing 'template' keywords in more cases.

We track when we see a name-shaped expression followed by a '<' token
and parse the '<' as a comparison. Then:

 * if we see a token sequence that cannot possibly be an expression but
   can be a template argument (in particular, a type-id) that follows
   either a ',' or the '<', diagnose that the '<' was supposed to start
   a template argument list, and
 * if we see '>()', diagnose that the '<' was supposed to start a
   template argument list.

This only changes the diagnostic for error cases, and in practice
appears to catch the most common cases where a missing 'template'
keyword leads to parse errors within a template.

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

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

6 years ago[clang] Add test dependency on llvm-as
Shoaib Meenai [Tue, 26 Jun 2018 23:18:59 +0000 (23:18 +0000)]
[clang] Add test dependency on llvm-as

r335618 added tests that invoke llvm-as, so we should also ensure that
running clang tests rebuilds llvm-as.

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

6 years ago[analyzer] [tests] Include statistics in tests.
George Karpenkov [Tue, 26 Jun 2018 23:17:35 +0000 (23:17 +0000)]
[analyzer] [tests] Include statistics in tests.

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

6 years agoRevert "[MS] Use mangled names and comdats for string merging with ASan"
Evgeniy Stepanov [Tue, 26 Jun 2018 23:10:48 +0000 (23:10 +0000)]
Revert "[MS] Use mangled names and comdats for string merging with ASan"

Depends on r334313, which has been reverted in r335681.

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

6 years ago[analyzer] Minor cleanups for BugReporter, expose a getter for AnalyzerOptions.
George Karpenkov [Tue, 26 Jun 2018 23:10:05 +0000 (23:10 +0000)]
[analyzer] Minor cleanups for BugReporter, expose a getter for AnalyzerOptions.

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

6 years ago[MachineOutliner] Emit a warning when using -moutline on unsupported targets
Jessica Paquette [Tue, 26 Jun 2018 22:09:48 +0000 (22:09 +0000)]
[MachineOutliner] Emit a warning when using -moutline on unsupported targets

Instead of just saying "flag unused", we should tell the user that the
outliner isn't (at least officially) supported for some given architecture.

This adds a warning that will state something like

The 'blah' architecture does not support -moutline; flag ignored

when we call -moutline with the 'blah' architecture.

Since the outliner is still mostly an AArch64 thing, any architecture
other than AArch64 will emit this warning.

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

6 years ago[analyzer] Do not run visitors until the fixpoint, run only once.
George Karpenkov [Tue, 26 Jun 2018 21:12:08 +0000 (21:12 +0000)]
[analyzer] Do not run visitors until the fixpoint, run only once.

In the current implementation, we run visitors until the fixed point is
reached.
That is, if a visitor adds another visitor, the currently processed path
is destroyed, all diagnostics is discarded, and it is regenerated again,
until it's no longer modified.
This pattern has a few negative implications:

 - This loop does not even guarantee to terminate.
   E.g. just imagine two visitors bouncing a diagnostics around.
 - Performance-wise, e.g. for sqlite3 all visitors are being re-run at
   least 10 times for some bugs.
   We have already seen a few reports where it leads to timeouts.
 - If we want to add more computationally intense visitors, this will
   become worse.
 - From architectural standpoint, the current layout requires copying
   visitors, which is conceptually wrong, and can be annoying (e.g. no
   unique_ptr on visitors allowed).

The proposed change is a much simpler architecture: the outer loop
processes nodes upwards, and whenever the visitor is added it only
processes current nodes and above, thus guaranteeing termination.

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

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

6 years ago[AST] Fix typo in LazyOffsetPtr::get docs (NFC)
Brian Gesiak [Tue, 26 Jun 2018 20:05:18 +0000 (20:05 +0000)]
[AST] Fix typo in LazyOffsetPtr::get docs (NFC)

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

6 years ago[mips] Use more conservative default CPUs for MIPS on FreeBSD.
John Baldwin [Tue, 26 Jun 2018 19:48:05 +0000 (19:48 +0000)]
[mips] Use more conservative default CPUs for MIPS on FreeBSD.

FreeBSD defaults to mips3 for all MIPS ABIs with GCC as that is the
minimum MIPS architecture FreeBSD supports.  Use mips3 for MIPS64 and
mips2 for MIPS32 to match.

Reviewed By: atanasyan

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

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

6 years ago[Sema] Fix infinite typo correction loop.
Volodymyr Sapsai [Tue, 26 Jun 2018 17:56:48 +0000 (17:56 +0000)]
[Sema] Fix infinite typo correction loop.

NumTypos guard value ~0U doesn't prevent from creating new delayed typos. When
you create new delayed typos during typo correction, value ~0U wraps around to
0. When NumTypos is 0 we can miss some typos and treat an expression as it can
be typo-corrected. But if the expression is still invalid after correction, we
can get stuck in infinite loop trying to correct it.

Fix by not using value ~0U so that NumTypos correctly reflects the number of
typos.

rdar://problem/38642201

Reviewers: arphaman, majnemer, rsmith

Reviewed By: rsmith

Subscribers: rsmith, nicholas, cfe-commits

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

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

6 years agoCompile CodeGenModule.cpp with /bigobj.
Peter Collingbourne [Tue, 26 Jun 2018 17:45:26 +0000 (17:45 +0000)]
Compile CodeGenModule.cpp with /bigobj.

Apparently we're now hitting an object file section limit on this
file with expensive checks enabled.

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

6 years ago[HIP] Remove hip/hc.amdgcn.bc from HIP Toolchains
Aaron Enye Shi [Tue, 26 Jun 2018 17:40:36 +0000 (17:40 +0000)]
[HIP] Remove hip/hc.amdgcn.bc from HIP Toolchains

Summary:
The hc.amdgcn.bc and hip.amdgcn.bc are removed in VDI build and no longer needed.

Reviewers: yaxunl

Reviewed By: yaxunl

Subscribers: cfe-commits

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

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

6 years ago[OPENMP, NVPTX] Reduce the number of the globalized variables.
Alexey Bataev [Tue, 26 Jun 2018 17:24:03 +0000 (17:24 +0000)]
[OPENMP, NVPTX] Reduce the number of the globalized variables.

Patch tries to make better analysis of the variables that should be
globalized. From now, instead of all parallel directives it will check
only distribute parallel .. directives and check only for
firstprivte/lastprivate variables if they must be globalized.

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

6 years ago[Test] Initial test commit access
Aaron Enye Shi [Tue, 26 Jun 2018 17:12:29 +0000 (17:12 +0000)]
[Test] Initial test commit access

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

6 years agoRevert "[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename."
Francis Visoiu Mistrih [Tue, 26 Jun 2018 17:05:01 +0000 (17:05 +0000)]
Revert "[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename."

This reverts commit r334550. Try to fix the stage2 build failing on
Green Dragon for a while.

http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/11124/console

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

6 years ago[Driver] Do not add -lpthread & -lrt with -static-libsan on Android
Kostya Kortchinsky [Tue, 26 Jun 2018 16:14:35 +0000 (16:14 +0000)]
[Driver] Do not add -lpthread & -lrt with -static-libsan on Android

Summary:
I am not sure anyone has tried to compile an application with sanitizers on
Android with `-static-libsan`, and a recent NDK, but it fails with:
```
.../i686-linux-android/bin/ld.gold: error: cannot find -lpthread
.../i686-linux-android/bin/ld.gold: error: cannot find -lrt
```
My understanding is that both are included in Bionic and as such are not needed,
and actually error out.

So remove the addition of those two in `linkSanitizerRuntimeDeps` when dealing
with Android, and update the tests.

I am unfamiliar with the evolution of the NDK and I am not sure if this has
always been the case or if this is somewhat of a recent evolution. I'll let
Android people chime in.

Reviewers: eugenis, pirama, srhines

Reviewed By: eugenis, srhines

Subscribers: cfe-commits

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

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

6 years ago[ThinLTO] Add testing of summary index parsing to a couple CFI tests
Teresa Johnson [Tue, 26 Jun 2018 15:50:34 +0000 (15:50 +0000)]
[ThinLTO] Add testing of summary index parsing to a couple CFI tests

Summary:
Changes to some clang side tests to go with the summary parsing patch.

Depends on D47905.

Reviewers: pcc, dexonsmith, mehdi_amini

Subscribers: inglorion, eraman, cfe-commits, steven_wu

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

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

6 years agoAvoid spurious 'comma operator within array index expression' MSVC warning. NFCI.
Simon Pilgrim [Tue, 26 Jun 2018 15:20:20 +0000 (15:20 +0000)]
Avoid spurious 'comma operator within array index expression' MSVC warning. NFCI.

Split the braces list initialization from the [] map operator to keep MSVC happy.

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

6 years ago[ASTImporter] Use InjectedClassNameType at import of templated record.
Gabor Marton [Tue, 26 Jun 2018 13:44:24 +0000 (13:44 +0000)]
[ASTImporter] Use InjectedClassNameType at import of templated record.

Summary:
At import of a record describing a template set its type to
InjectedClassNameType (instead of RecordType).

Reviewers: a.sidorin, martong, r.stahl

Reviewed By: a.sidorin, martong, r.stahl

Subscribers: a_sidorin, rnkovacs, martong, cfe-commits

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

Patch by Balazs Keri!

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

6 years ago[clang-format] Enable text proto formatting in common functions
Krasimir Georgiev [Tue, 26 Jun 2018 12:00:14 +0000 (12:00 +0000)]
[clang-format] Enable text proto formatting in common functions

Subscribers: cfe-commits

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

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

6 years agoFix an ambiguous overload issue pointed out by MSVC
Vedant Kumar [Tue, 26 Jun 2018 03:53:06 +0000 (03:53 +0000)]
Fix an ambiguous overload issue pointed out by MSVC

Log:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11390

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

6 years ago[ubsan] Relax nullability-return for blocks with deduced types
Vedant Kumar [Tue, 26 Jun 2018 02:50:04 +0000 (02:50 +0000)]
[ubsan] Relax nullability-return for blocks with deduced types

When the return type of an ObjC-style block literals is deduced, pick
the candidate type with the strictest nullability annotation applicable
to every other candidate.

This suppresses a UBSan false-positive in situations where a too-strict
nullability would be deduced, despite the fact that the returned value
would be implicitly cast to _Nullable.

rdar://41317163

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

6 years agoModernize a function, NFC.
Vedant Kumar [Tue, 26 Jun 2018 02:50:01 +0000 (02:50 +0000)]
Modernize a function, NFC.

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

6 years agoImplement CFI for indirect calls via a member function pointer.
Peter Collingbourne [Tue, 26 Jun 2018 02:15:47 +0000 (02:15 +0000)]
Implement CFI for indirect calls via a member function pointer.

Similarly to CFI on virtual and indirect calls, this implementation
tries to use program type information to make the checks as precise
as possible.  The basic way that it works is as follows, where `C`
is the name of the class being defined or the target of a call and
the function type is assumed to be `void()`.

For virtual calls:
- Attach type metadata to the addresses of function pointers in vtables
  (not the functions themselves) of type `void (B::*)()` for each `B`
  that is a recursive dynamic base class of `C`, including `C` itself.
  This type metadata has an annotation that the type is for virtual
  calls (to distinguish it from the non-virtual case).
- At the call site, check that the computed address of the function
  pointer in the vtable has type `void (C::*)()`.

For non-virtual calls:
- Attach type metadata to each non-virtual member function whose address
  can be taken with a member function pointer. The type of a function
  in class `C` of type `void()` is each of the types `void (B::*)()`
  where `B` is a most-base class of `C`. A most-base class of `C`
  is defined as a recursive base class of `C`, including `C` itself,
  that does not have any bases.
- At the call site, check that the function pointer has one of the types
  `void (B::*)()` where `B` is a most-base class of `C`.

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

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

6 years ago[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement...
Craig Topper [Tue, 26 Jun 2018 00:44:02 +0000 (00:44 +0000)]
[X86] Redefine avx512 packed fpclass intrinsics to return a vXi1 mask and implement the mask input argument using an 'and' IR instruction.

Additional IR is emitted to convert between scalar and vXi1 type to match the expected software inferface for the builtin that clang exposes.

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

6 years ago[analyzer] Track null and undef values through expressions with cleanups.
Artem Dergachev [Mon, 25 Jun 2018 23:55:07 +0000 (23:55 +0000)]
[analyzer] Track null and undef values through expressions with cleanups.

ExprWithCleanups wraps full-expressions that require temporary destructors
and highlights the moment of time in which these destructors need to be called
(i.e., "at the end of the full-expression...").

Such expressions don't necessarily return an object; they may return anything,
including a null or undefined value.

When the analyzer tries to understand where the null or undefined value came
from in order to present better diagnostics to the user, it will now skip
any ExprWithCleanups it encounters and look into the expression itself.

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

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

6 years ago[analyzer] Fix invalidation on C++ const methods with arrow syntax.
Artem Dergachev [Mon, 25 Jun 2018 23:43:45 +0000 (23:43 +0000)]
[analyzer] Fix invalidation on C++ const methods with arrow syntax.

Conservative evaluation of a C++ method call would invalidate the object,
as long as the method is not const or the object has mutable fields.

When checking for mutable fields, we need to scan the type of the object on
which the method is called, which may be more specific than the type of the
object on which the method is defined, hence we look up the type from the
this-argument expression.

If arrow syntax or implicit-this syntax is used, this-argument expression
has pointer type, not record type, and lookup accidentally failed for that
reason. Obtain object type correctly.

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

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

6 years ago[MachineOutliner] NFC - simplify -moutline/-mno-outline logic
Jessica Paquette [Mon, 25 Jun 2018 23:20:18 +0000 (23:20 +0000)]
[MachineOutliner] NFC - simplify -moutline/-mno-outline logic

It's a bit cleaner to use `hasFlag` instead of nested ifs. This
just refactors the -moutline/-mno-outline logic to use that.

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

6 years agoAdd an option to support debug fission on implicit ThinLTO.
Yunlian Jiang [Mon, 25 Jun 2018 23:05:27 +0000 (23:05 +0000)]
Add an option to support debug fission on implicit ThinLTO.

Summary:
This adds an option -gsplit-dwarf=<arg>. LLVM can create .dwo files in the given directory
during the implicit ThinLTO link stage.

Reviewers: tejohnson, dblaikie, pcc

Reviewed By: pcc

Subscribers: steven_wu, aprantl, JDevlieghere, yunlian, probinson, mehdi_amini, inglorion, cfe-commits

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

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

6 years agoFix tests from r335542 to use %hmaptool
Bruno Cardoso Lopes [Mon, 25 Jun 2018 22:25:48 +0000 (22:25 +0000)]
Fix tests from r335542 to use %hmaptool

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

6 years agoWarning for framework include violation from Headers to PrivateHeaders
Bruno Cardoso Lopes [Mon, 25 Jun 2018 22:24:17 +0000 (22:24 +0000)]
Warning for framework include violation from Headers to PrivateHeaders

Framework vendors usually layout their framework headers in the
following way:

Foo.framework/Headers -> "public" headers
Foo.framework/PrivateHeader -> "private" headers

Since both headers in both directories can be found with #import
<Foo/some-header.h>, it's easy to make mistakes and include headers in
Foo.framework/PrivateHeader from headers in Foo.framework/Headers, which
usually configures a layering violation on Darwin ecosystems. One of the
problem this causes is dep cycles when modules are used, since it's very
common for "private" modules to include from the "public" ones; adding
an edge the other way around will trigger cycles.

Add a warning to catch those cases such that:

./A.framework/Headers/A.h:1:10: warning: public framework header includes private framework header 'A/APriv.h'
#include <A/APriv.h>
         ^

rdar://problem/38712182

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

6 years agoRevert "Append new attributes to the end of an AttributeList."
Michael Kruse [Mon, 25 Jun 2018 20:06:13 +0000 (20:06 +0000)]
Revert "Append new attributes to the end of an AttributeList."

This reverts commit r335084 as requested by David Jones and
Eric Christopher because of differences of emitted warnings.

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

6 years ago[WebAssembly] Add no-prototype attribute to prototype-less C functions
Sam Clegg [Mon, 25 Jun 2018 18:47:32 +0000 (18:47 +0000)]
[WebAssembly] Add no-prototype attribute to prototype-less C functions

The WebAssembly backend in particular benefits from being
able to distinguish between varargs functions (...) and prototype-less
C functions.

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

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

6 years ago[MachineOutliner] Outline from linkonceodrs by default in LTO when -moutline is passed
Jessica Paquette [Mon, 25 Jun 2018 17:36:05 +0000 (17:36 +0000)]
[MachineOutliner] Outline from linkonceodrs by default in LTO when -moutline is passed

Pass -enable-linkonceodr-outlining by default when LTO is enabled.

The outliner shouldn't compete with any sort of linker deduplication
on linkonceodr functions when LTO is enabled. Therefore, this behaviour
should be the default.

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

6 years ago[MachineOutliner] Make last of -moutline/-mno-outline win
Jessica Paquette [Mon, 25 Jun 2018 17:27:51 +0000 (17:27 +0000)]
[MachineOutliner] Make last of -moutline/-mno-outline win

The expected behaviour of command-line flags to clang is to have
the last of -m(whatever) and -mno-(whatever) win. The outliner
didn't do that. This fixes that and updates the test.

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

6 years agoUse Triple::isMIPS() instead of enumerating all Triples. NFC
Alexander Richardson [Mon, 25 Jun 2018 16:49:52 +0000 (16:49 +0000)]
Use Triple::isMIPS() instead of enumerating all Triples. NFC

Reviewed By: atanasyan

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

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

6 years ago[clang-format] Add a default format style that can be used by users of `getStyle`
Eric Liu [Mon, 25 Jun 2018 16:29:19 +0000 (16:29 +0000)]
[clang-format] Add a default format style that can be used by users of `getStyle`

Summary:
Tools that reformat code often call `getStyle` to decide the format style
to use on a certain source file. In practice, "file" style is widely used. As a
result, many tools hardcode "file" when calling `getStyle`, which makes it hard
to control the default style in tools across a codebase when needed. This change
introduces a `DefaultFormatStyle` constant (default to "file" in upstream), which
can be modified downstream if wanted, so that all users/tools built from the same
source tree can have a consistent default format style.

This also adds an DefaultFallbackStyle that is recommended to be used by tools and can be modified downstream.

Reviewers: sammccall, djasper

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years agoRevert "[ASTImporter] Import the whole redecl chain of functions"
Gabor Marton [Mon, 25 Jun 2018 16:25:30 +0000 (16:25 +0000)]
Revert "[ASTImporter] Import the whole redecl chain of functions"

This reverts commit r335480.

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

6 years ago[OPENMP] Do not consider address constant vars as possibly
Alexey Bataev [Mon, 25 Jun 2018 15:32:05 +0000 (15:32 +0000)]
[OPENMP] Do not consider address constant vars as possibly
threadprivate.

Do not delay emission of the address constant variables in OpenMP mode
as they cannot be defined as threadprivate.

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

6 years ago[ASTImporter] Import the whole redecl chain of functions
Gabor Marton [Mon, 25 Jun 2018 14:41:58 +0000 (14:41 +0000)]
[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

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)
Hans Wennborg [Mon, 25 Jun 2018 13:23:49 +0000 (13:23 +0000)]
[clang-cl] Don't emit dllexport inline functions etc. from pch files (PR37801)

With MSVC, PCH files are created along with an object file that needs to
be linked into the final library or executable. That object file
contains the code generated when building the headers. In particular, it
will include definitions of inline dllexport functions, and because they
are emitted in this object file, other files using the PCH do not need
to emit them. See the bug for an example.

This patch makes clang-cl match MSVC's behaviour in this regard, causing
significant compile-time savings when building dlls using precompiled
headers.

For example, in a 64-bit optimized shared library build of Chromium with
PCH, it reduces the binary size and compile time of
stroke_opacity_custom.obj from 9315564 bytes to 3659629 bytes and 14.6
to 6.63 s. The wall-clock time of building blink_core.dll goes from
38m41s to 22m33s. ("user" time goes from 1979m to 1142m).

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

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

6 years ago[ASTImporter] Add ms compatibility to tests which use the TestBase
Gabor Marton [Mon, 25 Jun 2018 13:04:37 +0000 (13:04 +0000)]
[ASTImporter] Add ms compatibility to tests which use the TestBase

Summary:
In order to avoid build failures on MS, we use -fms-compatibility too in
the tests which use the TestBase.  Moved the family of `testImport`
functions under a test fixture class, so we can use parameterized tests.
Refactored `testImport` and `testImportSequence`, because `for` loops over
the different compiler options is no longer needed, that is handeld by
the test framework via parameters from now on.

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

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format] Keep @message together in text protos
Krasimir Georgiev [Mon, 25 Jun 2018 12:43:12 +0000 (12:43 +0000)]
[clang-format] Keep @message together in text protos

Summary:
In C++ code snippets of the form `@field` are common. This makes clang-format
keep them together in text protos, whereas before it would break them.

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Add new tests about templated-described swing
Gabor Marton [Mon, 25 Jun 2018 11:38:43 +0000 (11:38 +0000)]
[ASTImporter] Add new tests about templated-described swing

Summary:
Add a new test about importing a partial specialization (of a class).  Also,
this patch adds new tests about the templated-described swing, some of these
fail ATM, but subsequent patches will fix them.

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

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[clang-format] Fix end-of-file comments text proto formatting
Krasimir Georgiev [Mon, 25 Jun 2018 11:08:24 +0000 (11:08 +0000)]
[clang-format] Fix end-of-file comments text proto formatting

Summary:
The case of end-of-file comments was formatted badly:
```
key: value
    # end-of-file comment
```
This patch fixes that formatting:
```
key: value
# end-of-file comment
```

Subscribers: cfe-commits

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

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

6 years ago[CodeGen] Provide source locations for UBSan type checks when emitting constructor...
Igor Kudrin [Mon, 25 Jun 2018 05:48:04 +0000 (05:48 +0000)]
[CodeGen] Provide source locations for UBSan type checks when emitting constructor calls.

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

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

6 years ago[Coroutines] Less IR for noexcept await_resume
Brian Gesiak [Sat, 23 Jun 2018 18:57:26 +0000 (18:57 +0000)]
[Coroutines] Less IR for noexcept await_resume

Summary:
In his review of https://reviews.llvm.org/D45860, @GorNishanov suggested
avoiding generating additional exception-handling IR in the case that
the resume function was marked as 'noexcept', and exceptions could not
occur. This implements that suggestion.

Test Plan: `check-clang`

Reviewers: GorNishanov, EricWF

Reviewed By: GorNishanov

Subscribers: cfe-commits, GorNishanov

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

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

6 years ago[Sema] isValidCoroutineContext FIXME and citations
Brian Gesiak [Sat, 23 Jun 2018 18:01:02 +0000 (18:01 +0000)]
[Sema] isValidCoroutineContext FIXME and citations

Summary:
Add citations to the Coroutines TS to the `isValidCoroutineContext`
function, as well as a FIXME and test for [expr.await]p2, which states
a co_await expression cannot be used in a default argument.

Test Plan: check-clang

Reviewers: GorNishanov, EricWF

Reviewed By: GorNishanov

Subscribers: rsmith, cfe-commits

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

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

6 years agoAttempt to fix latent tablegen dependency issue
Reid Kleckner [Sat, 23 Jun 2018 17:32:51 +0000 (17:32 +0000)]
Attempt to fix latent tablegen dependency issue

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

6 years ago[Fuchsia] Enable static libc++, libc++abi, libunwind
Petr Hosek [Sat, 23 Jun 2018 03:15:07 +0000 (03:15 +0000)]
[Fuchsia] Enable static libc++, libc++abi, libunwind

This is needed for building Fuchsia drivers.

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

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

6 years ago[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %zu/%zi on Darwin
JF Bastien [Fri, 22 Jun 2018 21:54:40 +0000 (21:54 +0000)]
[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %zu/%zi on Darwin

Summary:
Pick D42933 back up, and make NSInteger/NSUInteger with %zu/%zi specifiers on Darwin warn only in pedantic mode. The default -Wformat recently started warning for the following code because of the added support for analysis for the '%zi' specifier.

     NSInteger i = NSIntegerMax;
     NSLog(@"max NSInteger = %zi", i);

The problem is that on armv7 %zi is 'long', and NSInteger is typedefed to 'int' in Foundation. We should avoid this warning as it's inconvenient to our users: it's target specific (happens only on armv7 and not arm64), and breaks their existing code. We should also silence the warning for the '%zu' specifier to ensure consistency. This is acceptable because Darwin guarantees that, despite the unfortunate choice of typedef, sizeof(size_t) == sizeof(NS[U]Integer), the warning is therefore noisy for pedantic reasons. Once this is in I'll update public documentation.

Related discussion on cfe-dev:
http://lists.llvm.org/pipermail/cfe-dev/2018-May/058050.html

<rdar://36874921&40501559>

Reviewers: ahatanak, vsapsai, alexshap, aaron.ballman, javed.absar, jfb, rjmccall

Subscribers: kristof.beyls, aheejin, cfe-commits

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

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

6 years agoRe-land "[LTO] Enable module summary emission by default for regular LTO"
Tobias Edler von Koch [Fri, 22 Jun 2018 20:23:21 +0000 (20:23 +0000)]
Re-land "[LTO] Enable module summary emission by default for regular LTO"

Since we are now producing a summary also for regular LTO builds, we
need to run the NameAnonGlobals pass in those cases as well (the
summary cannot handle anonymous globals).

See https://reviews.llvm.org/D34156 for details on the original change.

This reverts commit 6c9ee4a4a438a8059aacc809b2dd57128fccd6b3.

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

6 years agoReinstate quotes around the path to python that I accidentaly removed in r335330
Benjamin Kramer [Fri, 22 Jun 2018 20:03:32 +0000 (20:03 +0000)]
Reinstate quotes around the path to python that I accidentaly removed in r335330

This broke users with spaces in the path, like C:\Program Files\Python

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

6 years agoRestore pre-r335182 behavior for naming inherited constructors as
Richard Smith [Fri, 22 Jun 2018 19:50:19 +0000 (19:50 +0000)]
Restore pre-r335182 behavior for naming inherited constructors as
members of dependent contexts.

This permits cases where the names before and after the '::' in a
dependent inherited constructor using-declaration do not match, but
where we can nonetheless tell when parsing the template that a
constructor is being named. Under (open) core language DR 2070, such
cases will probably be ill-formed, but r335182 does not quite give
that result and didn't intend to change this, so restore the old
behavior for now.

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

6 years agoFix BUILD_SHARED_LIBS=1 build of libclangHandleLLVM
Sam Clegg [Fri, 22 Jun 2018 19:44:48 +0000 (19:44 +0000)]
Fix BUILD_SHARED_LIBS=1 build of libclangHandleLLVM

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

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

6 years ago[OPENMP, NVPTX] Fix reduction of the big data types/structures.
Alexey Bataev [Fri, 22 Jun 2018 19:10:38 +0000 (19:10 +0000)]
[OPENMP, NVPTX] Fix reduction of the big data types/structures.

If the shuffle is required for the reduced structures/big data type,
current code may cause compiler crash because of the loading of the
aggregate values. Patch fixes this problem.

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

6 years agoRe-apply: Warning for framework headers using double quote includes
Bruno Cardoso Lopes [Fri, 22 Jun 2018 18:05:17 +0000 (18:05 +0000)]
Re-apply: Warning for framework headers using double quote includes

Introduce -Wquoted-include-in-framework-header, which should fire a warning
whenever a quote include appears in a framework header and suggest a fix-it.
For instance, for header A.h added in the tests, this is how the warning looks
like:

./A.framework/Headers/A.h:2:10: warning: double-quoted include "A0.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "A0.h"
         ^~~~~~
         <A/A0.h>
./A.framework/Headers/A.h:3:10: warning: double-quoted include "B.h" in framework header, expected angle-bracketed instead [-Wquoted-include-in-framework-header]
#include "B.h"
         ^~~~~
         <B.h>

This helps users to prevent frameworks from using local headers when in fact
they should be targetting system level ones.

The warning is off by default.

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

rdar://problem/37077034

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