]> granicus.if.org Git - clang/log
clang
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

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