]> granicus.if.org Git - clang/log
clang
6 years ago[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used.
Alexey Bataev [Fri, 6 Jul 2018 21:13:41 +0000 (21:13 +0000)]
[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used.

On Linux atomic constructs in OpenMP require libatomic library. Patch
links libatomic when -fopenmp is used.

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

6 years ago[OPENMP] Make clauses closing loc point to right bracket.
Alexey Bataev [Fri, 6 Jul 2018 19:35:42 +0000 (19:35 +0000)]
[OPENMP] Make clauses closing loc point to right bracket.

For some of the clauses the closing location erroneously points to the
beginning of the next clause rather than on the location of the closing
bracket of the clause.

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

6 years ago[Driver,AArch64] Add support for -mcpu=native.
Florian Hahn [Fri, 6 Jul 2018 10:49:59 +0000 (10:49 +0000)]
[Driver,AArch64] Add support for -mcpu=native.

This patches adds support for passing -mcpu=native for AArch64. It will
get turned into the host CPU name, before we get the target features.

CPU = native is handled in a similar fashion in
getAArch64MicroArchFetauresFromMtune and getAArch64TargetCPU already.

Having a good test case for this is hard, as it depends on the host CPU
of the machine running the test. But we can check that native has been
replaced with something else.

When cross-compiling, we will get a CPU name from the host architecture
and get ` the clang compiler does not support '-mcpu=native'` as error
message, which seems reasonable to me.

Reviewers: rengolin, peter.smith, dlj, javed.absar, t.p.northover

Reviewed By: peter.smith

Tags: #clang

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

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

6 years ago[SemaCodeComplete] Expose a method to create CodeCompletionString for macros.
Eric Liu [Fri, 6 Jul 2018 09:43:57 +0000 (09:43 +0000)]
[SemaCodeComplete] Expose a method to create CodeCompletionString for macros.

Summary:
The method only takes PPreprocessor and don't require structures that
might not be available (e.g. Sema and ASTContext) when CodeCompletionString
needs to be generated for macros.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years ago[X86] Implement _builtin_ia32_vfmaddss and _builtin_ia32_vfmaddsd with native IR...
Craig Topper [Fri, 6 Jul 2018 07:14:47 +0000 (07:14 +0000)]
[X86] Implement _builtin_ia32_vfmaddss and _builtin_ia32_vfmaddsd with native IR using llvm.fma intrinsic.

This generates some extra zeroing currently, but we should be able to quickly address that with some isel patterns.

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

6 years ago[ms] Fix mangling of string literals used to initialize arrays larger or smaller...
Hans Wennborg [Fri, 6 Jul 2018 06:54:16 +0000 (06:54 +0000)]
[ms] Fix mangling of string literals used to initialize arrays larger or smaller than the literal

A Chromium developer reported a bug which turned out to be a mangling
collision between these two literals:

  char s[] = "foo";
  char t[32] = "foo";

They may look the same, but for the initialization of t we will (under
some circumstances) use a literal that's extended with zeros, and
both the length and those zeros should be accounted for by the mangling.

This actually makes the mangling code simpler: where it previously had
special logic for null terminators, which are not part of the
StringLiteral, that is now covered by the general algorithm.

(The problem was reported at https://crbug.com/857442)

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

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

6 years ago[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %tu/%td on Darwin
Alex Lorenz [Thu, 5 Jul 2018 22:51:11 +0000 (22:51 +0000)]
[Sema] -Wformat-pedantic only for NSInteger/NSUInteger %tu/%td on Darwin

The '%tu'/'%td' as formatting specifiers have been used to print out the
NSInteger/NSUInteger values for a long time. Typically their ABI matches, but that's
not the case on watchOS. The ABI difference boils down to the following:

- Regular 32-bit darwin targets (like armv7) use 'ptrdiff_t' of type 'int',
  which matches 'NSInteger'.
- WatchOS arm target (armv7k) uses 'ptrdiff_t' of type 'long', which doesn't
  match 'NSInteger' of type 'int'.

Because of this ABI difference these specifiers trigger -Wformat warnings only
for watchOS builds, which is really inconvenient for cross-platform code.

This patch avoids this -Wformat warning for '%tu'/'%td' and NS[U]Integer only,
and instead uses the new -Wformat-pedantic warning that JF introduced in
https://reviews.llvm.org/D47290. This is acceptable because Darwin guarantees that,
despite the watchOS ABI differences, sizeof(ptrdiff_t) == sizeof(NS[U]Integer),
and alignof(ptrdiff_t) == alignof(NS[U]Integer) so the warning is therefore noisy
for pedantic reasons.

I'll update public documentation to ensure that this behaviour is properly
communicated.

rdar://41739204

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

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

6 years ago[X86] Use shufflevector instead of a select with a constant mask for fmaddsub/fmsubad...
Craig Topper [Thu, 5 Jul 2018 20:38:31 +0000 (20:38 +0000)]
[X86] Use shufflevector instead of a select with a constant mask for fmaddsub/fmsubadd IR emission.

Shufflevector is easier to generate and matches what the backend pattern matches without relying on constant selects being turned into shuffles.

While I was there I also made the IR regular expressions a little stricter to ensure operand order on the shuffle.

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

6 years agoAdd PCH tests for R336379
Erich Keane [Thu, 5 Jul 2018 17:23:15 +0000 (17:23 +0000)]
Add PCH tests for R336379

I seemingly forgot the tests for this commit, added here.

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

6 years ago[clang-cl, PCH] Implement support for MS-style PCH through headers
Erich Keane [Thu, 5 Jul 2018 17:22:13 +0000 (17:22 +0000)]
[clang-cl, PCH] Implement support for MS-style PCH through headers

Implement support for MS-style PCH through headers.

This enables support for /Yc and /Yu where the through header is either
on the command line or included in the source. It replaces the current
support the requires the header also be specified with /FI.

This change adds a -cc1 option -pch-through-header that is used to either
start or stop compilation during PCH create or use.

When creating a PCH, the compilation ends after compilation of the through
header.

When using a PCH, tokens are skipped until after the through header is seen.

Patch By: mikerice
Differential Revision: https://reviews.llvm.org/D46652

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

6 years agoFix __builtin_*_overflow when out-param isn't constexpr
Erich Keane [Thu, 5 Jul 2018 15:52:58 +0000 (15:52 +0000)]
Fix __builtin_*_overflow when out-param isn't constexpr

As brought up on cfe-commits[1], r334650 causes the dependency of the
out parameter to the __builtin_*_overflow functions to be ignored. The result
was a usage that was otherwise constexpr (both operands to the operation were
constexpr) would be evaluated, but the out parameter wouldn't be modified, so
it would still be 'undef'.

This patch correctly handles the return value of handleAssignment to ensure that
this value is properly considered/evaluated.

[1] http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180702/233667.html

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

6 years ago[X86] Fix some vector cmp builtins - TRUE/FALSE predicates
Gabor Buella [Thu, 5 Jul 2018 14:26:56 +0000 (14:26 +0000)]
[X86] Fix some vector cmp builtins - TRUE/FALSE predicates

This patch removes on optimization used with the TRUE/FALSE
predicates, as was suggested in https://reviews.llvm.org/D45616
for r335339.
The optimization was buggy, since r335339 used it also
for *_mask builtins, without actually applying the mask -- the
mask argument was just ignored.

Reviewers: craig.topper, uriel.k, RKSimon, andrew.w.kaylor, spatel, scanon, efriedma

Reviewed By: spatel

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

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

6 years ago[mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASE
Vladimir Stefanovic [Thu, 5 Jul 2018 13:10:23 +0000 (13:10 +0000)]
[mips] Add '-mcrc', '-mno-crc' options to enable/disable CRC ASE

'-mcrc' is shared with ARM.
'-mno-crc' is Mips-only (ARM uses '-mnocrc').

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

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

6 years ago[X86] NFC - add more test cases for vector cmp intrinsics
Gabor Buella [Thu, 5 Jul 2018 12:57:47 +0000 (12:57 +0000)]
[X86] NFC - add more test cases for vector cmp intrinsics

Add test cases with each predicate using the following
intrinsics:
_mm_cmp_pd
_mm_cmp_ps
_mm256_cmp_pd
_mm256_cmp_ps
_mm_cmp_pd_mask
_mm_cmp_ps_mask
_mm256_cmp_pd_mask
_mm256_cmp_ps_mask
_mm512_cmp_pd_mask
_mm512_cmp_ps_mask
_mm_mask_cmp_pd_mask
_mm_mask_cmp_ps_mask
_mm256_mask_cmp_pd_mask
_mm256_mask_cmp_ps_mask
_mm512_mask_cmp_pd_mask
_mm512_mask_cmp_ps_mask

Some of these are marked with FIXME, as there is bug in lowering
e.g. _mm512_mask_cmp_ps_mask.

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

6 years ago[ASTImporter] Fix import of objects with anonymous types
Gabor Marton [Thu, 5 Jul 2018 09:51:13 +0000 (09:51 +0000)]
[ASTImporter] Fix import of objects with anonymous types

Summary:
Currently, anonymous types are merged into the same redecl chain even if they
are structurally inequivalent. This results that global objects are not
imported, if there are at least two global objects with different anonymous
types. This patch provides a fix.

Reviewers: a.sidorin, balazske, r.stahl

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[NFS] Wipe trailing whitespaces
Kirill Bobyrev [Thu, 5 Jul 2018 09:37:26 +0000 (09:37 +0000)]
[NFS] Wipe trailing whitespaces

This patch is a preparation for another one containing meaningful
changes. This patch simply removes trailing whitespaces in few files
affected by the upcoming patch and reformats

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

6 years ago[Power9] Update fp128 as a valid homogenous aggregate base type
Lei Huang [Thu, 5 Jul 2018 04:32:01 +0000 (04:32 +0000)]
[Power9] Update fp128 as a valid homogenous aggregate base type

Update clang to treat fp128 as a valid base type for homogeneous aggregate
passing and returning.

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

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

6 years ago[Index] Remove unused index::IndexDataConsumer::_anchor()
Fangrui Song [Thu, 5 Jul 2018 00:33:03 +0000 (00:33 +0000)]
[Index] Remove unused index::IndexDataConsumer::_anchor()

It was supposed to serve as a key function, but it was invalid as it was not the first out-of-line non-pure virtual function.

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

6 years ago[analyzer][ctu] fix unsortable diagnostics
Rafael Stahl [Wed, 4 Jul 2018 14:12:58 +0000 (14:12 +0000)]
[analyzer][ctu] fix unsortable diagnostics

Summary: In the provided test case the PathDiagnostic compare function was not able to find a difference.

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

Reviewed By: george.karpenkov

Subscribers: a_sidorin, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits

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

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

6 years ago[ASTImporter] import macro source locations
Rafael Stahl [Wed, 4 Jul 2018 13:34:05 +0000 (13:34 +0000)]
[ASTImporter] import macro source locations

Summary: Implement full import of macro expansion info with spelling and expansion locations.

Reviewers: a.sidorin, klimek, martong, balazske, xazax.hun

Reviewed By: martong

Subscribers: thakis, xazax.hun, balazske, rnkovacs, cfe-commits

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

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

6 years agoNFC - Fix type in builtins-ppc-p9vector.c test
Gabor Buella [Wed, 4 Jul 2018 11:29:21 +0000 (11:29 +0000)]
NFC - Fix type in builtins-ppc-p9vector.c test

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

6 years agoNFC - Fix typo in test/CodeGenObjC/gnustep2-class.m
Gabor Buella [Wed, 4 Jul 2018 11:26:09 +0000 (11:26 +0000)]
NFC - Fix typo in test/CodeGenObjC/gnustep2-class.m

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

6 years agoNFC - Fix typo in test/Layout/itanium-pack-and-align.cpp
Gabor Buella [Wed, 4 Jul 2018 11:21:44 +0000 (11:21 +0000)]
NFC - Fix typo in test/Layout/itanium-pack-and-align.cpp

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

6 years agoAdd missing include for size_t
Eric Fiselier [Wed, 4 Jul 2018 11:14:18 +0000 (11:14 +0000)]
Add missing include for size_t

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

6 years ago[SemaCodeComplete] Make sure visited contexts are passed to completion results handler.
Eric Liu [Wed, 4 Jul 2018 10:01:18 +0000 (10:01 +0000)]
[SemaCodeComplete] Make sure visited contexts are passed to completion results handler.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[Sema] Fix crash in getConstructorName.
Ilya Biryukov [Wed, 4 Jul 2018 08:50:12 +0000 (08:50 +0000)]
[Sema] Fix crash in getConstructorName.

Summary:
Can happen when getConstructorName is called on invalid decls,
specifically the ones that do not have the injected class name.

Reviewers: bkramer, rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years agoNFC - typo fix in test/CodeGen/avx512f-builtins.c
Gabor Buella [Wed, 4 Jul 2018 08:32:02 +0000 (08:32 +0000)]
NFC - typo fix in test/CodeGen/avx512f-builtins.c

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

6 years agoPR33924: merge local declarations that have linkage of some kind within
Richard Smith [Wed, 4 Jul 2018 02:25:38 +0000 (02:25 +0000)]
PR33924: merge local declarations that have linkage of some kind within
merged function definitions; also merge functions with deduced return
types.

This seems like two independent fixes, but unfortunately they are hard
to separate because it's challenging to reliably test either one of them
without also testing the other.

A complication arises with deduced return type support: we need the type
of the function in order to know how to merge it, but we can't load the
actual type of the function because it might reference an entity
declared within the function (and we need to have already merged the
function to correctly merge that entity, which we would need to do to
determine if the function types match). So we instead compare the
declared function type when merging functions, and defer loading the
actual type of a function with a deduced type until we've finished
loading and merging the function.

This reverts r336175, reinstating r336021, with one change (for PR38015):
we look at the TypeSourceInfo of the first-so-far declaration of each
function when considering whether to merge two functions. This works
around a problem where the calling convention in the TypeSourceInfo for
subsequent redeclarations may not match if it was implicitly adjusted.

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

6 years ago[Sema] Consider all format_arg attributes.
Michael Kruse [Wed, 4 Jul 2018 01:37:11 +0000 (01:37 +0000)]
[Sema] Consider all format_arg attributes.

If a function has multiple format_arg attributes, clang only considers
the first it finds (because AttributeLists are in reverse order, not
necessarily the textually first) and ignores all others.

Loop over all FormatArgAttr to print warnings for all declared
format_arg attributes.

For instance, libintl's ngettext (select plural or singular version of
format string) has two __format_arg__ attributes.

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

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

6 years ago[Sema] Discarded statment should be an evaluatable context.
Erik Pilkington [Tue, 3 Jul 2018 22:15:36 +0000 (22:15 +0000)]
[Sema] Discarded statment should be an evaluatable context.

The constexpr evaluator was erroring out because these templates weren't
defined. Despite being used in a discarded statement, we still need to constexpr
evaluate them, which means that we need to instantiate them. Fixes PR37585.

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

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

6 years agoFactor out Clang's desired 8MB stack size constant from the various
Richard Smith [Tue, 3 Jul 2018 21:34:13 +0000 (21:34 +0000)]
Factor out Clang's desired 8MB stack size constant from the various
places we hardcode it.

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

6 years agoFix allocation of Nullability attribute.
Erich Keane [Tue, 3 Jul 2018 20:30:34 +0000 (20:30 +0000)]
Fix allocation of Nullability attribute.

Existing code always allocates for on the declarator's attribute pool,
but sometimes adds it to the declspec.  This patch ensures that the
correct pool is used.

Discovered while testing: https://reviews.llvm.org/D48788

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

6 years agoFix crash in clang.
Zachary Turner [Tue, 3 Jul 2018 18:12:39 +0000 (18:12 +0000)]
Fix crash in clang.

This happened during a recent refactor.  toStringRefArray() returns
a vector<StringRef>, which was being implicitly converted to an
ArrayRef<StringRef>, and then the vector was immediately being
destroyed, so the ArrayRef<> was losing its backing storage.
Fix this by making sure the vector gets permanent storage.

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

6 years ago[Driver] Add PPC64 as supported for Scudo
Kostya Kortchinsky [Tue, 3 Jul 2018 14:39:29 +0000 (14:39 +0000)]
[Driver] Add PPC64 as supported for Scudo

Summary:
Scudo works on PPC64 as is, so mark the architecture as supported for it. This
will also require a change to config-ix.cmake on the compiler-rt side.

Update the tests accordingly.

Reviewers: eugenis, alekseyshl

Reviewed By: alekseyshl

Subscribers: cfe-commits

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

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

6 years agoRevert r336021 "PR33924: merge local declarations that have linkage of some kind...
Hans Wennborg [Tue, 3 Jul 2018 07:51:41 +0000 (07:51 +0000)]
Revert r336021 "PR33924: merge local declarations that have linkage of some kind within"

This caused test failures in 32-bit builds (PR38015).

> merged function definitions; also merge functions with deduced return
> types.
>
> This seems like two independent fixes, but unfortunately they are hard
> to separate because it's challenging to reliably test either one of them
> without also testing the other.
>
> A complication arises with deduced return type support: we need the type
> of the function in order to know how to merge it, but we can't load the
> actual type of the function because it might reference an entity
> declared within the function (and we need to have already merged the
> function to correctly merge that entity, which we would need to do to
> determine if the function types match). So we instead compare the
> declared function type when merging functions, and defer loading the
> actual type of a function with a deduced type until we've finished
> loading and merging the function.

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

6 years ago[Driver][Darwin] Use Host Triple to infer target os version
Steven Wu [Tue, 3 Jul 2018 04:15:49 +0000 (04:15 +0000)]
[Driver][Darwin] Use Host Triple to infer target os version

Summary:
When clang required to infer target os version from --target option and
the os version is not specified in targets, check the host triple. If the
host and target are both macOS, use host triple to infer target os
version.

rdar://problem/41651999

Reviewers: arphaman, dexonsmith

Reviewed By: arphaman

Subscribers: cfe-commits

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

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

6 years agoPer C++ [over.match.copy]p1, direct-initialization of a reference can
Richard Smith [Mon, 2 Jul 2018 23:25:22 +0000 (23:25 +0000)]
Per C++ [over.match.copy]p1, direct-initialization of a reference can
only invoke converting constructors of the reference's underlying type.

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

6 years ago[CodeGenCXX] Emit strip.invariant.group with -fstrict-vtable-pointers
Piotr Padlewski [Mon, 2 Jul 2018 19:21:36 +0000 (19:21 +0000)]
[CodeGenCXX] Emit strip.invariant.group with -fstrict-vtable-pointers

Summary:
Emmiting new intrinsic that strips invariant.groups to make
devirtulization sound, as described in RFC: Devirtualization v2.

Reviewers: rjmccall, rsmith, amharc, kuhar

Subscribers: llvm-commits, cfe-commits

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

Co-authored-by: Krzysztof Pszeniczny <krzysztof.pszeniczny@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336137 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] [tests] Pass clang executable path to prefix-less executor scripts.
George Karpenkov [Mon, 2 Jul 2018 17:10:40 +0000 (17:10 +0000)]
[analyzer] [tests] Pass clang executable path to prefix-less executor scripts.

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

6 years agoTest commit access
Balazs Keri [Mon, 2 Jul 2018 14:14:07 +0000 (14:14 +0000)]
Test commit access

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

6 years ago[ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.
Nico Weber [Mon, 2 Jul 2018 12:31:20 +0000 (12:31 +0000)]
[ms] Fix mangling of char16_t and char32_t to be compatible with MSVC.

MSVC limits char16_t and char32_t string literal names to 32 bytes of character
data, not to 32 characters. wchar_t string literal names on the other hand can
get up to 64 bytes of character data.

https://reviews.llvm.org/D48781

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

6 years agoAdd expected fail triple x86_64-pc-windows-gnu to test as x86_64-w64-mingw32 is alrea...
Yaron Keren [Sat, 30 Jun 2018 11:18:44 +0000 (11:18 +0000)]
Add expected fail triple x86_64-pc-windows-gnu to test as x86_64-w64-mingw32 is already there

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

6 years ago[X86] Correct the width of mask arguments in intrinsic headers and tests.
Craig Topper [Sat, 30 Jun 2018 06:05:17 +0000 (06:05 +0000)]
[X86] Correct the width of mask arguments in intrinsic headers and tests.

All of these found by grepping through IR from the builtin tests for extra trunc and zext/sext instructions that shouldn't have been there.

Some of these were real bugs where we lost bits from the user input:
_mm512_mask_broadcast_f32x8
_mm512_maskz_broadcast_f32x8
_mm512_mask_broadcast_i32x8
_mm512_maskz_broadcast_i32x8
_mm256_mask_cvtusepi16_storeu_epi8

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

6 years agoDriver: Add an explicit target to testcase from r336037
Tom Stellard [Sat, 30 Jun 2018 03:50:10 +0000 (03:50 +0000)]
Driver: Add an explicit target to testcase from r336037

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

6 years agoDriver: Don't mix system tools with devtoolset tools on RHEL
Tom Stellard [Sat, 30 Jun 2018 02:55:54 +0000 (02:55 +0000)]
Driver: Don't mix system tools with devtoolset tools on RHEL

Summary:
On RHEL, devtoolset provides a more up-to-date toolchain than the base
install, and we want to make sure all the tools use are from the same
toolchain.

Reviewers: rsmith, bruno

Reviewed By: bruno

Subscribers: bruno, cfe-commits

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

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

6 years ago[X86] Remove masking from the avx512 rotate builtins. Use a select builtin instead.
Craig Topper [Sat, 30 Jun 2018 01:32:14 +0000 (01:32 +0000)]
[X86] Remove masking from the avx512 rotate builtins. Use a select builtin instead.

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

6 years agoAdd protocol redefinition to the current scope/context
Bruno Cardoso Lopes [Sat, 30 Jun 2018 00:49:27 +0000 (00:49 +0000)]
Add protocol redefinition to the current scope/context

Not doing so causes the AST writter to assert since the decl in question
never gets emitted. This is fine when modules is not used, but otherwise
we need to serialize something other than garbage.

rdar://problem/39844933

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

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

6 years ago[CUDA] Make __host__/__device__ min/max overloads constexpr in C++14.
Justin Lebar [Fri, 29 Jun 2018 22:28:09 +0000 (22:28 +0000)]
[CUDA] Make __host__/__device__ min/max overloads constexpr in C++14.

Summary: Tests in a separate change to the test-suite.

Reviewers: rsmith, tra

Subscribers: lahwaacz, sanjoy, cfe-commits

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

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

6 years ago[CUDA] Make min/max shims host+device.
Justin Lebar [Fri, 29 Jun 2018 22:27:56 +0000 (22:27 +0000)]
[CUDA] Make min/max shims host+device.

Summary:
Fixes PR37753: min/max can't be called from __host__ __device__
functions in C++14 mode.

Testcase in a separate test-suite commit.

Reviewers: rsmith

Subscribers: sanjoy, lahwaacz, cfe-commits

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

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

6 years ago[analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper
George Karpenkov [Fri, 29 Jun 2018 22:05:32 +0000 (22:05 +0000)]
[analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper

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

6 years ago[analyzer] [tests] Fix 80 column violation in SATestBuild.py
George Karpenkov [Fri, 29 Jun 2018 22:05:13 +0000 (22:05 +0000)]
[analyzer] [tests] Fix 80 column violation in SATestBuild.py

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

6 years agoPR33924: merge local declarations that have linkage of some kind within
Richard Smith [Fri, 29 Jun 2018 21:58:50 +0000 (21:58 +0000)]
PR33924: merge local declarations that have linkage of some kind within
merged function definitions; also merge functions with deduced return
types.

This seems like two independent fixes, but unfortunately they are hard
to separate because it's challenging to reliably test either one of them
without also testing the other.

A complication arises with deduced return type support: we need the type
of the function in order to know how to merge it, but we can't load the
actual type of the function because it might reference an entity
declared within the function (and we need to have already merged the
function to correctly merge that entity, which we would need to do to
determine if the function types match). So we instead compare the
declared function type when merging functions, and defer loading the
actual type of a function with a deduced type until we've finished
loading and merging the function.

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

6 years agoSpurious commit just to help Richard, because git is weird.
David Blaikie [Fri, 29 Jun 2018 21:58:24 +0000 (21:58 +0000)]
Spurious commit just to help Richard, because git is weird.

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

6 years ago[modules] Emit the type of the TypeSourceInfo for a DeclaratorDecl (but
Richard Smith [Fri, 29 Jun 2018 20:46:25 +0000 (20:46 +0000)]
[modules] Emit the type of the TypeSourceInfo for a DeclaratorDecl (but
not the corresponding location information) earlier.

We need the type as written in order to properly merge functions with
deduced return types, so we need to load that early. But we don't want
to load the location information early, because that contains
problematic things such as the function parameters.

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

6 years agoSpecify an explicit underlying type for this enum to fix Windows
Richard Smith [Fri, 29 Jun 2018 20:41:23 +0000 (20:41 +0000)]
Specify an explicit underlying type for this enum to fix Windows
buildbots.

On Windows targets, enums always get an underlying type of 'int', even
if they have wider enumerators. (This is non-conforming, but it's
effectively part of the target ABI.)

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

6 years agoRequest init/fini array on FreeBSD 12 and later
Dimitry Andric [Fri, 29 Jun 2018 19:18:17 +0000 (19:18 +0000)]
Request init/fini array on FreeBSD 12 and later

Summary:
It seems a bad idea to change the default in the middle of a release
branch due to possible changes in global ctor / dtor ordering between
.ctors and .init_array. With FreeBSD 11.0's release imminent lets change
the default now for FreeBSD 12 (the current development stream) and
later.

FreeBSD rtld has supported .init_array / .fini_array for many years. As
of Jan 1 2017 all supported FreeBSD releases and branches will have
support.

Reviewers: dim, brooks, arichardson

Reviewed By: dim, brooks, arichardson

Subscribers: bsdjhb, krytarowski, emaste, cfe-commits

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

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

6 years ago[mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.
Brad Smith [Fri, 29 Jun 2018 19:03:03 +0000 (19:03 +0000)]
[mips][ias] Enable IAS by default for OpenBSD / FreeBSD mips64/mips64el.

Reviewers: atanasyan

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

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

6 years ago[analyzer] Replace the vector of ConstraintSets by a single ConstraintSet and a funct...
Mikhail R. Gadelha [Fri, 29 Jun 2018 18:11:43 +0000 (18:11 +0000)]
[analyzer] Replace the vector of ConstraintSets by a single ConstraintSet and a function to merge ConstraintSets

Now, instead of adding the constraints when they are removed, this patch adds them when they first appear and, since we walk the bug report backward, it should be the last set of ranges generated by the CSA for a given symbol.

These are the number before and after the patch:
```
Project    |  current |   patch  |
tmux       |  283.222 |  123.052 |
redis      |  614.858 |  400.347 |
openssl    |  308.292 |  307.149 |
twin       |  274.478 |  245.411 |
git        |  547.687 |  477.335 |
postgresql | 2927.495 | 2002.526 |
sqlite3    | 3264.305 | 1028.416 |
```

Major speedups in tmux and sqlite (less than half of the time), redis and postgresql were about 25% faster while the rest are basically the same.

Reviewers: NoQ, george.karpenkov

Reviewed By: george.karpenkov

Subscribers: rnkovacs, xazax.hun, szepet, a.sidorin

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

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

6 years ago[MachineOutliner] Make -mno-outline use -enable-machine-outliner=never
Jessica Paquette [Fri, 29 Jun 2018 18:06:10 +0000 (18:06 +0000)]
[MachineOutliner] Make -mno-outline use -enable-machine-outliner=never

This updates -mno-outline so that it passes -enable-machine-outliner=never
instead of nothing. This puts it in sync with the behaviour in llc and
other tools.

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

6 years ago[Fixed Point Arithmetic] Rename `-fsame-fbits` flag
Leonard Chan [Fri, 29 Jun 2018 17:08:19 +0000 (17:08 +0000)]
[Fixed Point Arithmetic] Rename `-fsame-fbits` flag

- Rename the `-fsame-fbits` flag to `-fpadding-on-unsigned-fixed-point`
- Move the flag from a driver option to a cc1 option
- Rename the `SameFBits` member in TargetInfo to `PaddingOnUnsignedFixedPoint`
- Updated descriptions

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

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

6 years ago[clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method decl
Ben Hamilton [Fri, 29 Jun 2018 15:26:37 +0000 (15:26 +0000)]
[clang-format/ObjC] Fix NS_SWIFT_NAME(foo(bar:baz:)) after ObjC method decl

Summary:
In D44638, I partially fixed `NS_SWIFT_NAME(foo(bar:baz:))`-style
annotations on C functions, but didn't add a test for Objective-C
method declarations.

For ObjC method declarations which are annotated with `NS_SWIFT_NAME(...)`,
we currently fail to annotate the final component of the selector
name as `TT_SelectorName`.

Because the token type is left unknown, clang-format will happily
cause a compilation error when it changes the following:

```
@interface Foo
- (void)doStuffWithFoo:(id)name
                   bar:(id)bar
                   baz:(id)baz
    NS_SWIFT_NAME(doStuff(withFoo:bar:baz:));
@end
```

to:

```
@interface Foo
- (void)doStuffWithFoo:(id)name
                   bar:(id)bar
                   baz:(id)baz
    NS_SWIFT_NAME(doStuff(withFoo:bar:baz
:));
@end
```

(note the linebreak before the final `:`).

The logic which decides whether or not to annotate the token before a
`:` with `TT_SelectorName` is pretty fragile, and has to handle some
pretty odd cases like pair-parameters:

```
[I drawRectOn:surface ofSize:aa:bbb atOrigin:cc:dd];
```

So, to minimize the effect of this change, I decided to only annotate
unknown identifiers before a `:` as `TT_SelectorName` for Objective-C
declaration lines.

Test Plan: New tests included. Confirmed tests failed before change and
  passed after change. Ran tests with:
  % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, krasimir, jolesiak

Reviewed By: krasimir

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Support additional common functions for text proto formatting
Krasimir Georgiev [Fri, 29 Jun 2018 14:25:25 +0000 (14:25 +0000)]
[clang-format] Support additional common functions for text proto formatting

Summary: This adds a few more common function names expecting a text proto argument.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Added import of CXXStdInitializerListExpr
Gabor Marton [Fri, 29 Jun 2018 12:17:34 +0000 (12:17 +0000)]
[ASTImporter] Added import of CXXStdInitializerListExpr

Reviewers: a.sidorin

Reviewed By: a.sidorin

Subscribers: martong, cfe-commits

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

Patch by Balazs Keri!

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

6 years ago[analyzer][UninitializedObjectChecker] Added a NotesAsWarnings flag
Kristof Umann [Fri, 29 Jun 2018 11:25:24 +0000 (11:25 +0000)]
[analyzer][UninitializedObjectChecker] Added a NotesAsWarnings flag

In order to better support consumers of the plist output that don't
parse note entries just yet, a 'NotesAsWarnings' flag was added.
If it's set to true, all notes will be converted to warnings.

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

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

6 years ago[ASTImporter] Eliminated some unittest warnings.
Gabor Marton [Fri, 29 Jun 2018 10:25:19 +0000 (10:25 +0000)]
[ASTImporter] Eliminated some unittest warnings.

Summary:
When running the ASTTests test, warnings produced by the compiler can be
distracting when looking for test errors. A part of the warnings is removed
by setting extra compiler options.

Reviewers: a.sidorin

Reviewed By: a.sidorin

Subscribers: a_sidorin, martong, cfe-commits

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

Patch by Balazs Keri!

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

6 years ago[X86] Remove masking from the avx512 packed sqrt builtins. Use select builtins instead.
Craig Topper [Fri, 29 Jun 2018 05:43:33 +0000 (05:43 +0000)]
[X86] Remove masking from the avx512 packed sqrt builtins. Use select builtins instead.

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

6 years ago[frontend] Don't include the C++ stdlib for -x assembler-with-cpp
Alex Lorenz [Thu, 28 Jun 2018 23:23:45 +0000 (23:23 +0000)]
[frontend] Don't include the C++ stdlib for -x assembler-with-cpp

The new C++ stdlib warning added in r335081 gets
triggered when compiling an assembly file with -x assembler-with-cpp.
This commit ensures that the C++ stdlib is not included when compiling assembly.
In general, it's not really useful to include the C++ stdlib search path when
compiling assembly source.

rdar://41359632

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

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

6 years agoDebugInfo: Add -gno-gnu-pubnames to allow disabling gnu-pubnames later in the command...
David Blaikie [Thu, 28 Jun 2018 22:58:04 +0000 (22:58 +0000)]
DebugInfo: Add -gno-gnu-pubnames to allow disabling gnu-pubnames later in the command line

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

6 years ago[analyzer] fix test case expected warning
Mikhail R. Gadelha [Thu, 28 Jun 2018 22:08:44 +0000 (22:08 +0000)]
[analyzer] fix test case expected warning

After r335814, the constraint manager is no longer generating a false bug report
about the division by zero in the test case.

This patch removes the expected false bug report.

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

6 years ago[analyzer] Move test to the correct directory
Mikhail R. Gadelha [Thu, 28 Jun 2018 21:39:41 +0000 (21:39 +0000)]
[analyzer] Move test to the correct directory

It was accidentaly pushed in r335926

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

6 years ago[Parse] Make -Wgcc-compat complain about for loop inits in C89
George Burgess IV [Thu, 28 Jun 2018 21:36:00 +0000 (21:36 +0000)]
[Parse] Make -Wgcc-compat complain about for loop inits in C89

While clang allows declarations in for loop init statements in c89 and
gnu89, gcc does not. So, we should probably warn if users care about gcc
compatibility.

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

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

6 years ago[analyzer] Fix wrong comparison generation of the ranges generated by the refutation...
Mikhail R. Gadelha [Thu, 28 Jun 2018 21:26:52 +0000 (21:26 +0000)]
[analyzer] Fix wrong comparison generation of the ranges generated by the refutation manager

The refutation manager is removing a true bug from the test in this patch.

The problem is that the following constraint:
```
(conj_$1{struct o *}) - (reg_$3<int * r>): [-9223372036854775808, 0]
```
is encoded as:
```
(and (bvuge (bvsub $1 $3) #x8000000000000000)
     (bvule (bvsub $1 $3) #x0000000000000000))
```
The issue is that unsigned comparisons (bvuge and bvule) are being generated instead of signed comparisons (bvsge and bvsle).

When generating the expressions:
```
(conj_$1{p *}) - (reg_$3<int * r>) >= -9223372036854775808
```
and
```
(conj_$1{p *}) - (reg_$3<int * r>) <= 0
```
both -9223372036854775808 and 0 are casted to pointer type and `LTy->isSignedIntegerOrEnumerationType()` in `Z3ConstraintManager::getZ3BinExpr` only checks if the type is signed, not if it's a pointer.

Reviewers: NoQ, george.karpenkov, ddcc

Subscribers: rnkovacs, NoQ, george.karpenkov, ddcc, xazax.hun, szepet, a.sidorin

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

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

6 years agoPR37979: integral promotions in C++ treat enum bit-fields like enums,
Richard Smith [Thu, 28 Jun 2018 21:17:55 +0000 (21:17 +0000)]
PR37979: integral promotions in C++ treat enum bit-fields like enums,
not like bit-fields.

We used to get this right "by accident", because conversions for the
selected built-in overloaded operator would convert the enum bit-field
to its corresponding underlying type early. But after DR1687 that no
longer happens.

Technically this change should also apply to C, where bit-fields only
have special promotion rules if the bit-field's declared type is
_Bool, int, signed int, or unsigned int, but for GCC compatibility we
only look at the bit-width and not the underlying type when performing
bit-field integral promotions in C.

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

6 years ago[CMake] Don't build Linux targets on Darwin in Fuchsia toolchain
Petr Hosek [Thu, 28 Jun 2018 20:33:18 +0000 (20:33 +0000)]
[CMake] Don't build Linux targets on Darwin in Fuchsia toolchain

This is currently breaking because Linux target sysroots rely on
case sensitive filesystem which is not by default enabled on macOS.

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

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

6 years ago[CMake] Build static runtimes for host in Fuchsia first stage
Petr Hosek [Thu, 28 Jun 2018 20:19:11 +0000 (20:19 +0000)]
[CMake] Build static runtimes for host in Fuchsia first stage

First stage build is only a minimal build where we don't need
a complete multiarch support, but we need enough to build the
second stage.

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

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

6 years ago[OPENMP] Fix incomplete type check for array reductions
Joel E. Denny [Thu, 28 Jun 2018 19:54:49 +0000 (19:54 +0000)]
[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

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

6 years agoRevert r335907: [OPENMP] Fix incomplete type check for array reductions
Joel E. Denny [Thu, 28 Jun 2018 19:54:27 +0000 (19:54 +0000)]
Revert r335907: [OPENMP] Fix incomplete type check for array reductions

Sorry, forgot to add commit log attributes again.

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

6 years ago[OPENMP] Fix incomplete type check for array reductions
Joel E. Denny [Thu, 28 Jun 2018 19:46:10 +0000 (19:46 +0000)]
[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.

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

6 years ago[CMake] Make bootstrap and compiler-rt depend on cxx-headers.
Ahmed Bougacha [Thu, 28 Jun 2018 18:35:25 +0000 (18:35 +0000)]
[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

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

6 years agoSet the line ending of clang.natvis to CRLF.
Aaron Ballman [Thu, 28 Jun 2018 18:03:00 +0000 (18:03 +0000)]
Set the line ending of clang.natvis to CRLF.

This corresponds to r335889, which does the same thing for llvm.natvis.

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

6 years ago[Darwin] Remove _VPMergeHook from the auto-export list
Vedant Kumar [Thu, 28 Jun 2018 17:53:35 +0000 (17:53 +0000)]
[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

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

6 years ago[CUDA] Place all CUDA sections in __NV_CUDA segment on Mac.
Artem Belevich [Thu, 28 Jun 2018 17:15:52 +0000 (17:15 +0000)]
[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

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

6 years ago[clang-format] Do not format raw string literals inside a recognized function with...
Krasimir Georgiev [Thu, 28 Jun 2018 16:58:24 +0000 (16:58 +0000)]
[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

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

6 years agoFix test that was failing on Windows due to too many backslashes
Filipe Cabecinhas [Thu, 28 Jun 2018 14:16:13 +0000 (14:16 +0000)]
Fix test that was failing on Windows due to too many backslashes

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

6 years agoOpenBSD driver needs ld.lld in sanitizer context
David Carlier [Thu, 28 Jun 2018 13:49:41 +0000 (13:49 +0000)]
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

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

6 years agoFix unittest build with GCC older than 5.
Benjamin Kramer [Thu, 28 Jun 2018 13:31:36 +0000 (13:31 +0000)]
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.

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

6 years ago[ODRHash] Do not rely on Type* when computing the hash.
Vassil Vassilev [Thu, 28 Jun 2018 13:28:44 +0000 (13:28 +0000)]
[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

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

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