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

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

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

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

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

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

Reviewed By: atanasyan

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Depends on r334313, which has been reverted in r335681.

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

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

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

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

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

This adds a warning that will state something like

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reviewed By: atanasyan

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

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

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

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

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

rdar://problem/38642201

Reviewers: arphaman, majnemer, rsmith

Reviewed By: rsmith

Subscribers: rsmith, nicholas, cfe-commits

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

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

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

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

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

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

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

Reviewers: yaxunl

Reviewed By: yaxunl

Subscribers: cfe-commits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reviewers: eugenis, pirama, srhines

Reviewed By: eugenis, srhines

Subscribers: cfe-commits

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

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

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

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

Depends on D47905.

Reviewers: pcc, dexonsmith, mehdi_amini

Subscribers: inglorion, eraman, cfe-commits, steven_wu

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

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

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

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

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

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

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

Reviewers: a.sidorin, martong, r.stahl

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

Subscribers: a_sidorin, rnkovacs, martong, cfe-commits

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

Patch by Balazs Keri!

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

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

Subscribers: cfe-commits

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

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

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

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

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

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

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

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

rdar://41317163

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

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

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