]> granicus.if.org Git - clang/log
clang
6 years ago[Preprocessor] Hide include typo correction behind SpellChecking.
Haojian Wu [Tue, 2 Oct 2018 13:59:49 +0000 (13:59 +0000)]
[Preprocessor] Hide include typo correction behind SpellChecking.

Summary:
Similar to Sema typo correction, the Preprocessor typo correction should
also be hidden behind the SpellChecking flag.

Reviewers: sammccall

Subscribers: cfe-commits

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

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

6 years ago[OpenCL] Add block argument CodeGen test
Sven van Haastregt [Tue, 2 Oct 2018 13:02:27 +0000 (13:02 +0000)]
[OpenCL] Add block argument CodeGen test

r326937 ("[OpenCL] Remove block invoke function from emitted block
literal struct", 2018-03-07) broke block argument handling.  In
particular the commit was causing a crash during code generation, see
the discussion in https://reviews.llvm.org/D43783 .

The offending commit has just been reverted; add a test to avoid
breaking this again in the future.

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

6 years agoRevert r326937 "[OpenCL] Remove block invoke function from emitted block literal...
Sven van Haastregt [Tue, 2 Oct 2018 13:02:24 +0000 (13:02 +0000)]
Revert r326937 "[OpenCL] Remove block invoke function from emitted block literal struct"

This reverts r326937 as it broke block argument handling in OpenCL.
See the discussion on https://reviews.llvm.org/D43783 .

The next commit will add a test case that revealed the issue.

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

6 years ago[analyzer] Improvements to the SMT API
Mikhail R. Gadelha [Tue, 2 Oct 2018 12:55:48 +0000 (12:55 +0000)]
[analyzer] Improvements to the SMT API

Summary:
Several improvements in preparation for the new backends.

Refactoring:

- Removed duplicated methods `fromBoolean`, `fromAPSInt`, `fromInt` and `fromAPFloat`. The methods `mkBoolean`, `mkBitvector` and `mkFloat` are now used instead.
- The names of the functions that convert BVs to FPs were swapped (`mkSBVtoFP`, `mkUBVtoFP`, `mkFPtoSBV`, `mkFPtoUBV`).
- Added a couple of comments in function calls.

Crosscheck encoding:

- Changed how constraints are encoded in the refutation manager so it doesn't start with (false OR ...). This change introduces one duplicated line (see file `BugReporterVisitors.cpp`, the `SMTConv::getRangeExpr is called twice, so I can remove this change if the duplication is a problem.

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

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

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

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

6 years ago[AST] Pack the bit-fields of FunctionProtoType into Type.
Bruno Ricci [Tue, 2 Oct 2018 11:46:38 +0000 (11:46 +0000)]
[AST] Pack the bit-fields of FunctionProtoType into Type.

Move the bit-fields of FunctionProtoType into FunctionTypeBitfields.
This cuts the size of FunctionProtoType by a pointer. Additionally use
llvm::TrailingObjects instead of manually doing the casts + arithmetic.

This patch is bigger then what could be expected for the following reasons:

1. As discussed before in D50631 it would be nice if there was some space left
   in FunctionTypeBitfields for future additions. This patch introduces an
   extra structure FunctionTypeExtraBitfields which is supposed to hold
   uncommon bits and is stored in a trailing object. The number of exception
   types NumExceptions is moved to this struct. As of this patch this trailing
   struct will only be allocated if we have > 0 types in a dynamic exception
   specification.

2. TrailingObjects cannot handle repeated types. Therefore the QualType
   representing an exception type is wrapped in a struct ExceptionType.
   The ExceptionType * is then reinterpret_cast'd to QualType *.

3. TrailingObjects needs the definition of the various trailing classes.
   Therefore ExtParameterInfo, ExceptionType and FunctionTypeExtraBitfields
   are put in FunctionType.

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

Reviewed By: rjmccall

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

6 years ago[CodeComplete] Re-fix accessibilty of protected members from base class.
Eric Liu [Tue, 2 Oct 2018 10:29:00 +0000 (10:29 +0000)]
[CodeComplete] Re-fix accessibilty of protected members from base class.

Summary:
The initial fix (r337453) had bug and was partially reverted (r338255).
This simplies the original fix by explicitly passing the naming class to the
completion consumer.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years agoRevert untintentionally commited changes
Eric Liu [Tue, 2 Oct 2018 10:28:54 +0000 (10:28 +0000)]
Revert untintentionally commited changes

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

6 years ago[Lex] TokenConcatenation now takes const Preprocessor
Eric Liu [Tue, 2 Oct 2018 10:28:50 +0000 (10:28 +0000)]
[Lex] TokenConcatenation now takes const Preprocessor

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

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

6 years ago[clang] Implement Override Suggestions in Sema.
Kadir Cetinkaya [Tue, 2 Oct 2018 09:42:31 +0000 (09:42 +0000)]
[clang] Implement Override Suggestions in Sema.

Summary:
In clangd we had a new type of completion suggestions for cpp
class/struct/unions that will show override signatures for virtual methods in
base classes. This patch implements it in sema because it is hard to deduce more
info about completion token outside of Sema and handle itchy cases.

See the patch D50898 for more info on the functionality.

In addition to above patch this one also converts the suggestion into a
CK_Pattern with whole insertion text as the name of the suggestion and factors
out CodeCompletionString generation for declerations so that it can be re-used
by others.

Reviewers: ioeric, ilya-biryukov

Reviewed By: ioeric

Subscribers: cfe-commits

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

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

6 years ago[AArch64][v8.5A] Test clang option for the Memory Tagging Extension
Oliver Stannard [Tue, 2 Oct 2018 09:38:59 +0000 (09:38 +0000)]
[AArch64][v8.5A] Test clang option for the Memory Tagging Extension

The implementation of this is in TargetParser, so we only need to add a
test for it in clang.

Patch by Pablo Barrio!

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

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

6 years agoAdded warning for unary minus used with unsigned type
David Bolvansky [Tue, 2 Oct 2018 06:02:30 +0000 (06:02 +0000)]
Added warning for unary minus used with unsigned type

Summary:
Inspired by MSVC, which found some occurrences of this expression on our code base.

Fixes PR38950

Reviewers: rsmith, craig.topper, spatel, RKSimon, aaron.ballman, thakis

Reviewed By: rsmith

Subscribers: joerg, Quuxplusone, lebedev.ri, craig.topper, RKSimon, cfe-commits

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

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

6 years ago[CodeGen] Before entering the loop that copies a non-trivial array field
Akira Hatanaka [Tue, 2 Oct 2018 01:00:44 +0000 (01:00 +0000)]
[CodeGen] Before entering the loop that copies a non-trivial array field
of a non-trivial C struct, copy the preceding trivial fields that
haven't been copied.

This commit fixes a bug where the instructions used to copy the
preceding trivial fields were emitted inside the loop body.

rdar://problem/44185064

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

6 years agoDistinguish `__block` variables that are captured by escaping blocks
Akira Hatanaka [Mon, 1 Oct 2018 21:51:28 +0000 (21:51 +0000)]
Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

This reapplies r343518 after fixing a use-after-free bug in function
Sema::ActOnBlockStmtExpr where the BlockScopeInfo was dereferenced after
it was popped and deleted.

rdar://problem/39352313

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

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

6 years ago[MinGW] Allow using ASan
Martin Storsjo [Mon, 1 Oct 2018 20:53:25 +0000 (20:53 +0000)]
[MinGW] Allow using ASan

Linking to ASan for MinGW is similar to MSVC, but MinGW always links
the MSVCRT dynamically, so there is only one of the MSVC cases to
consider.

When linking to a shared compiler runtime library on MinGW, the suffix
of the import library is .dll.a.

The existing case of .dll as suffix for windows in general doesn't
seem correct (since this is used for linking). As long as callers never
actually set the Shared flag, the default static suffix of .lib also
worked fine for import libraries as well.

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

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

6 years agoRevert r343518.
Akira Hatanaka [Mon, 1 Oct 2018 20:29:34 +0000 (20:29 +0000)]
Revert r343518.

Bots are still failing.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/24420
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/12958

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

6 years agoUpdate CMakeLists.txt snippet so that example compiles
Stephen Kelly [Mon, 1 Oct 2018 20:28:07 +0000 (20:28 +0000)]
Update CMakeLists.txt snippet so that example compiles

Summary: Previous to this the example didn't work out of the box, it seems some cmake config changed between when this was written and now.

Author: Dan Zimmerman <daniel.zimmerman@me.com>

Reviewers: modocache, steveire

Reviewed By: steveire

Subscribers: smeenai, steveire, cfe-commits

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

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

6 years agoDistinguish `__block` variables that are captured by escaping blocks
Akira Hatanaka [Mon, 1 Oct 2018 18:50:14 +0000 (18:50 +0000)]
Distinguish `__block` variables that are captured by escaping blocks
from those that aren't.

This patch changes the way __block variables that aren't captured by
escaping blocks are handled:

- Since non-escaping blocks on the stack never get copied to the heap
  (see https://reviews.llvm.org/D49303), Sema shouldn't error out when
  the type of a non-escaping __block variable doesn't have an accessible
  copy constructor.

- IRGen doesn't have to use the specialized byref structure (see
  https://clang.llvm.org/docs/Block-ABI-Apple.html#id8) for a
  non-escaping __block variable anymore. Instead IRGen can emit the
  variable as a normal variable and copy the reference to the block
  literal. Byref copy/dispose helpers aren't needed either.

This reapplies r341754, which was reverted in r341757 because it broke a
couple of bots. r341754 was calling markEscapingByrefs after the call to
PopFunctionScopeInfo, which caused the popped function scope to be
cleared out when the following code was compiled, for example:

$ cat test.m
struct A {
  id data[10];
};

void foo() {
  __block A v;
  ^{ (void)v; };
}

This commit calls markEscapingByrefs before calling PopFunctionScopeInfo
to prevent that from happening.

rdar://problem/39352313

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

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

6 years ago[clang-format] Update comment, NFCI
Krasimir Georgiev [Mon, 1 Oct 2018 18:41:21 +0000 (18:41 +0000)]
[clang-format] Update comment, NFCI

The initializer of `ParameterCount` was updated from 1 to 0 in r175165,
but the comment was never touched:
https://github.com/llvm-mirror/clang/commit/9fc56f2636137fcde8acb38865555ed6c7b84dfd

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

6 years ago[clang-format] Fix typo in comment, NFCI
Krasimir Georgiev [Mon, 1 Oct 2018 18:18:00 +0000 (18:18 +0000)]
[clang-format] Fix typo in comment, NFCI

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

6 years ago[analyzer][NFC] Refactor functions in PlistDiagnostics to take Preproc as parameter
Kristof Umann [Mon, 1 Oct 2018 18:11:51 +0000 (18:11 +0000)]
[analyzer][NFC] Refactor functions in PlistDiagnostics to take Preproc as parameter

This is patch is a preparation for the proposed inclusion of macro expansions in the plist output.

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

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

6 years ago[OPENMP][NVPTX] Handle `requires datasharing` flag correctly with
Alexey Bataev [Mon, 1 Oct 2018 16:20:57 +0000 (16:20 +0000)]
[OPENMP][NVPTX] Handle `requires datasharing` flag correctly with
lightweight runtime.

The datasharing flag must be set to `1` when executing SPMD-mode compatible directive with reduction|lastprivate clauses.

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

6 years ago[Basic] Update clang tests (really testing sys::fs) that broke with r343460
Sam McCall [Mon, 1 Oct 2018 16:07:03 +0000 (16:07 +0000)]
[Basic] Update clang tests (really testing sys::fs) that broke with r343460

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

6 years ago[OPENMP] Simplify code, NFC.
Alexey Bataev [Mon, 1 Oct 2018 14:40:06 +0000 (14:40 +0000)]
[OPENMP] Simplify code, NFC.

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

6 years ago[Preprocessor] Fix a crash when handling non-alpha include header.
Haojian Wu [Mon, 1 Oct 2018 14:38:43 +0000 (14:38 +0000)]
[Preprocessor] Fix a crash when handling non-alpha include header.

Summary: the crash is casued by an assertion in StringRef.
(llvm::StringRef::front() const: Assertion `!empty()' failed.)

Reviewers: sammccall

Subscribers: jsji, cfe-commits

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

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

6 years ago[OPENMP] Fix enum identifier, NFC.
Alexey Bataev [Mon, 1 Oct 2018 14:26:31 +0000 (14:26 +0000)]
[OPENMP] Fix enum identifier, NFC.

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

6 years agoAdd support for unified_shared_memory clause on requires directive
Patrick Lyster [Mon, 1 Oct 2018 13:47:43 +0000 (13:47 +0000)]
Add support for unified_shared_memory clause on requires directive

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

6 years agoBuild clang-headers when building clang tools.
Haojian Wu [Mon, 1 Oct 2018 12:16:38 +0000 (12:16 +0000)]
Build clang-headers when building clang tools.

Summary:
clang tools require clang headers to work on real project, e.g. when we
build clangd via `ninja clangd`, we expect the binary can run on
real-world project (without running another command `ninja clang-headers`).

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: mgorny, ilya-biryukov, ioeric, kadircet, cfe-commits

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

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

6 years ago[CodeComplete] #include completion treats -I as non-system (require header-like exten...
Sam McCall [Mon, 1 Oct 2018 11:56:42 +0000 (11:56 +0000)]
[CodeComplete] #include completion treats -I as non-system (require header-like extension).

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

6 years agoUse the container form llvm::sort(C, ...)
Fangrui Song [Sun, 30 Sep 2018 21:41:11 +0000 (21:41 +0000)]
Use the container form llvm::sort(C, ...)

There are a few leftovers of rC343147 that are not (\w+)\.begin but in
the form of ([-[:alnum:]>.]+)\.begin or spanning two lines. Change them
to use the container form in this commit. The 12 occurrences have been
inspected manually for safety.

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

6 years agoFix linkage error on ProgramPoint's dump method.
Eric Fiselier [Sun, 30 Sep 2018 18:05:39 +0000 (18:05 +0000)]
Fix linkage error on ProgramPoint's dump method.

Currently, ProgramPoint::dump calls the out-of-line function ProgramPoint::print. This causes
libraries which include ProgramPoint.h to become dependent on libclangAnalysis, which in turn
causes missing symbol link error when building with -DBUILD_SHARED_LIBS=ON -DLLVM_ENABLE_MODULES=ON.

The breakage was introduced in r343160.

This patch fixes the issues by moving ProgramPoint::dump's declaration out of line.

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

6 years agoUpdate ifunc attribute support documentation
Ed Maste [Sun, 30 Sep 2018 15:08:18 +0000 (15:08 +0000)]
Update ifunc attribute support documentation

Previously we documented GNU binutils and glibc versions required for
ifunc support, but our own lld linker and FreeBSD's rtld also support
ifuncs.

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

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

6 years ago[X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics
Craig Topper [Sat, 29 Sep 2018 17:49:42 +0000 (17:49 +0000)]
[X86] Add more of the icc unaligned load/store to/from 128 bit vector intrinsics

Summary:
This patch adds
_mm_loadu_si32
_mm_loadu_si16
_mm_storeu_si64
_mm_storeu_si32
_mm_storeu_si16

We already had _mm_load_si64.

Reviewers: spatel, RKSimon

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

6 years agoAttempt to fix a -Wdocumentation-html warning. NFCI.
Simon Pilgrim [Sat, 29 Sep 2018 13:30:43 +0000 (13:30 +0000)]
Attempt to fix a -Wdocumentation-html warning. NFCI.

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

6 years ago[clang][www] Fix typo. NFC
Kristina Brooks [Sat, 29 Sep 2018 09:45:21 +0000 (09:45 +0000)]
[clang][www] Fix typo. NFC

Fix a one letter typo in diagnostics.html. (Wanted to try it with
arcanist).

Patch by king6cong

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

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

6 years ago[cxx2a] Fix warning triggered by r343285
Vitaly Buka [Sat, 29 Sep 2018 02:17:12 +0000 (02:17 +0000)]
[cxx2a] Fix warning triggered by r343285

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

6 years agoSupport enums with a fixed underlying type in all language modes.
Erik Pilkington [Fri, 28 Sep 2018 20:24:58 +0000 (20:24 +0000)]
Support enums with a fixed underlying type in all language modes.

Previously we supported these in C++, ObjC, and C with -fms-extensions.

rdar://43831380

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

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

6 years ago[OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.
Alexey Bataev [Fri, 28 Sep 2018 19:33:14 +0000 (19:33 +0000)]
[OPENMP]Fix PR39084: Check datasharing attributes of reduction variables only.

According to OpenMP, the reduction item must be shared in parent region.
But the item can be an array section or array subscript. In this case,
we should not check for the datasharing of the base declaration.

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

6 years ago[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter
George Karpenkov [Fri, 28 Sep 2018 18:49:41 +0000 (18:49 +0000)]
[analyzer] [NFC] Remove unused parameters, as found by -Wunused-parameter

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

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

6 years ago[analyzer] Provide an option to dump generated exploded graphs to a given file.
George Karpenkov [Fri, 28 Sep 2018 18:49:21 +0000 (18:49 +0000)]
[analyzer] Provide an option to dump generated exploded graphs to a given file.

Dumping graphs instead of opening them is often very useful,
e.g. for transfer or converting to SVG.

Basic sanity check for generated exploded graphs.

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

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

6 years ago[cxx2a] P0614R1: Support init-statements in range-based for loops.
Richard Smith [Fri, 28 Sep 2018 18:44:09 +0000 (18:44 +0000)]
[cxx2a] P0614R1: Support init-statements in range-based for loops.

We don't yet support this for the case where a range-based for loop is
implicitly rewritten to an ObjC for..in statement.

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

6 years ago[X86] Add the movbe instruction intrinsics from icc.
Craig Topper [Fri, 28 Sep 2018 17:09:51 +0000 (17:09 +0000)]
[X86] Add the movbe instruction intrinsics from icc.

These intrinsics exist in icc. They can be found on the Intel Intrinsics Guide website.

All the backend support is in place to pattern match a load+bswap or a bswap+store pattern to the MOVBE instructions. So we just need to get the frontend to emit the correct IR. The pointer arguments in icc are declared as void so I had to jump through a packed struct to forcing a specific alignment on the load/store. Same trick we use in the unaligned vector load/store intrinsics

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

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

6 years agoAST: add missing ObjC extensions to MS style name decoration
Saleem Abdulrasool [Fri, 28 Sep 2018 16:47:53 +0000 (16:47 +0000)]
AST: add missing ObjC extensions to MS style name decoration

Add support for encoding type arguments for lightweight generics in
Objective-C++ mode.  Additionally, add support for the `__kindof` modifier.
This should complete the coverage of the ObjC extensions that clang currently
supports under the MS style name decoration scheme.

This is implemented similar to the Objective-C lifetime qualifiers decoration:
a template specialization in the `__ObjC` namespace so that we can interoperate
with Microsoft's tools as well as ensure that we do not accidentally collide
with new features in the Microsoft implementation.

Since the `__kindof` appertains to the type and not the pointer, we apply the
template specialization to the underlying type instead of the pointer type.

Unfortunately, until D52581 is resolved, the generated name is not really
compatible with the MS tools as well as breaks interoperability with
Objective-C++ and C++.

This resolves PR37754!

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

6 years ago[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
Alexey Bataev [Fri, 28 Sep 2018 16:17:59 +0000 (16:17 +0000)]
[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.

clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

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

6 years ago[ARM] Prevent DSP and SIM32 being set for v6m
Sam Parker [Fri, 28 Sep 2018 10:18:02 +0000 (10:18 +0000)]
[ARM] Prevent DSP and SIM32 being set for v6m

My previous change (rL340911) set the two features for architectures
>= 6, which wrongly includes v6m. Now set to >= 6 and not Cortex-M.

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

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

6 years ago[ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping
Owen Pan [Fri, 28 Sep 2018 09:17:00 +0000 (09:17 +0000)]
[ClangFormat] 'try' of function-try-block doesn't obey BraceWrapping

It should respond to AfterFunction, not AfterControlStatement.

Fixes PR39067

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

6 years ago[ARM] Alter test to account for change to armv6k default CPU
Peter Smith [Fri, 28 Sep 2018 09:04:31 +0000 (09:04 +0000)]
[ARM] Alter test to account for change to armv6k default CPU

Review D52594 will change the default in llvm for armv6k from the
non-existent cpu arm1176jf-s to mpcore. The tests in arm-cortex-cpus.c
need to be updated to account for this change.

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

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

6 years agoHandle dependent class template names in class template argument
Richard Smith [Fri, 28 Sep 2018 03:18:53 +0000 (03:18 +0000)]
Handle dependent class template names in class template argument
deduction for new-expressions.

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

6 years ago[cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
Richard Smith [Fri, 28 Sep 2018 01:16:43 +0000 (01:16 +0000)]
[cxx2a] P0641R2: (Some) type mismatches on defaulted functions only
render the function deleted instead of rendering the program ill-formed.

This change also adds an enabled-by-default warning for the case where
an explicitly-defaulted special member function of a non-template class
is implicitly deleted by the type checking rules. (This fires either due
to this language change or due to pre-C++20 reasons for the member being
implicitly deleted). I've tested this on a large codebase and found only
bugs (where the program means something that's clearly different from
what the programmer intended), so this is enabled by default, but we
should revisit this if there are problems with this being enabled by
default.

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

6 years ago[cxx2a] P0624R2: Lambdas with no capture-default are
Richard Smith [Thu, 27 Sep 2018 22:47:04 +0000 (22:47 +0000)]
[cxx2a] P0624R2: Lambdas with no capture-default are
default-constructible and assignable.

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

6 years ago[analyzer] Hotfix for the bug in exploded graph printing
George Karpenkov [Thu, 27 Sep 2018 22:31:13 +0000 (22:31 +0000)]
[analyzer] Hotfix for the bug in exploded graph printing

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

6 years agoNFC: Fix some darwin linker warnings introduced in r338385
Erik Pilkington [Thu, 27 Sep 2018 20:36:28 +0000 (20:36 +0000)]
NFC: Fix some darwin linker warnings introduced in r338385

The darwin linker was complaining about Toolchains/RISCV.cpp and
Toolchains/Arch/RISCV.cpp had the same name. Fix is to just rename
Toolchains/RISCV.cpp to Toolchains/RISCVToolchain.cpp.

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

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

6 years ago[OpenMP] Make default parallel for schedule in NVPTX target regions in SPMD mode...
Gheorghe-Teodor Bercea [Thu, 27 Sep 2018 20:29:00 +0000 (20:29 +0000)]
[OpenMP] Make default parallel for schedule in NVPTX target regions in SPMD mode achieve coalescing

Summary: Set default schedule for parallel for loops to schedule(static, 1) when using SPMD mode on the NVPTX device offloading toolchain to ensure coalescing.

Reviewers: ABataev, Hahnfeld, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

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

6 years agoTest commit. NFC
Patrick Lyster [Thu, 27 Sep 2018 19:30:32 +0000 (19:30 +0000)]
Test commit. NFC

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

6 years ago[OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achie...
Gheorghe-Teodor Bercea [Thu, 27 Sep 2018 19:22:56 +0000 (19:22 +0000)]
[OpenMP] Make default distribute schedule for NVPTX target regions in SPMD mode achieve coalescing

Summary: For the OpenMP NVPTX toolchain choose a default distribute schedule that ensures coalescing on the GPU when in SPMD mode. This significantly increases the performance of offloaded target code and reduces the number of registers used on the GPU side.

Reviewers: ABataev, caomhin, Hahnfeld

Reviewed By: ABataev, Hahnfeld

Subscribers: Hahnfeld, jholewinski, guansong, cfe-commits

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

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

6 years ago[clang][ubsan][NFC] Slight test cleanup in preparation for D50901
Roman Lebedev [Thu, 27 Sep 2018 19:07:48 +0000 (19:07 +0000)]
[clang][ubsan][NFC] Slight test cleanup in preparation for D50901

Reviewers: vsk, vitalybuka, filcab

Reviewed By: vitalybuka

Subscribers: cfe-commits

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

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

6 years agoFix greedy FileCheck expression in test/Driver/mips-abi.c
Jonas Hahnfeld [Thu, 27 Sep 2018 17:27:48 +0000 (17:27 +0000)]
Fix greedy FileCheck expression in test/Driver/mips-abi.c

'ld{{.*}}"' seems to match the complete line for me which is failing
the test. Only allow an optional '.exe' for Windows systems as most
other tests do.
Another possibility would be to collapse the greedy expression with
the next check to avoid matching the full line.

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

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

6 years ago[analyzer] Highlight nodes which have error reports in them in red in exploded graph
George Karpenkov [Thu, 27 Sep 2018 17:26:41 +0000 (17:26 +0000)]
[analyzer] Highlight nodes which have error reports in them in red in exploded graph

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

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

6 years ago[OpenMP] Improve search for libomptarget-nvptx
Jonas Hahnfeld [Thu, 27 Sep 2018 16:12:32 +0000 (16:12 +0000)]
[OpenMP] Improve search for libomptarget-nvptx

When looking for the bclib Clang considered the default library
path first while it preferred directories in LIBRARY_PATH when
constructing the invocation of nvlink. The latter actually makes
more sense because during development it allows using a non-default
runtime library. So change the search for the bclib to start
looking in directories given by LIBRARY_PATH.
Additionally add a new option --libomptarget-nvptx-path= which
will be searched first. This will be handy for testing purposes.

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

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

6 years ago[Tooling] Get rid of uses of llvm::Twine::str which is slow. NFC
Eric Liu [Thu, 27 Sep 2018 14:50:24 +0000 (14:50 +0000)]
[Tooling] Get rid of uses of llvm::Twine::str which is slow. NFC

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

6 years ago[AArch64][v8.5A] Test optional Armv8.5-A random number extension
Oliver Stannard [Thu, 27 Sep 2018 14:20:59 +0000 (14:20 +0000)]
[AArch64][v8.5A] Test optional Armv8.5-A random number extension

The implementation of this is in TargetParser, so we only need to add a
test for it in clang.

Patch by Pablo Barrio!

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

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

6 years ago[OpenCL] Improve extension-version.cl and to_addr_builtin.cl tests
Sven van Haastregt [Thu, 27 Sep 2018 13:20:29 +0000 (13:20 +0000)]
[OpenCL] Improve extension-version.cl and to_addr_builtin.cl tests

Add cl_khr_depth_images to extension-version.cl.

Extend to_addr_builtin.cl to additionally test the built-in methods
to_private and to_local, and test assignment with to_global to
incorrect types.

Patch by Alistair Davies.

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

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

6 years agoRevert untintentionally commited changes
Kristof Umann [Thu, 27 Sep 2018 12:46:37 +0000 (12:46 +0000)]
Revert untintentionally commited changes

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

6 years ago[Lex] TokenConcatenation now takes const Preprocessor
Kristof Umann [Thu, 27 Sep 2018 12:40:16 +0000 (12:40 +0000)]
[Lex] TokenConcatenation now takes const Preprocessor

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

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

6 years ago[Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM
Martin Storsjo [Thu, 27 Sep 2018 08:24:15 +0000 (08:24 +0000)]
[Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM

This fixes PR39090.

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

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

6 years agoRevert "[DebugInfo] Generate debug information for labels."
Vitaly Buka [Thu, 27 Sep 2018 08:15:24 +0000 (08:15 +0000)]
Revert "[DebugInfo] Generate debug information for labels."

This reverts commit r343148.

It crashes on sanitizer-x86_64-linux-autoconf.

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

6 years agoclang-format: [JS] conditional types.
Martin Probst [Thu, 27 Sep 2018 06:48:13 +0000 (06:48 +0000)]
clang-format: [JS] conditional types.

Summary:
This change adds some rudimentary support for conditional types.
Specifically it avoids breaking before `extends` and `infer` keywords,
which are subject to Automatic Semicolon Insertion, so breaking before
them creates incorrect syntax.

The actual formatting of the type expression is odd, but there is as of
yet no clear idea on how to format these.

See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#conditional-types.

Reviewers: krasimir

Subscribers: cfe-commits

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

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

6 years ago[driver][mips] Adjust target triple accordingly to provided ABI name
Simon Atanasyan [Thu, 27 Sep 2018 05:04:50 +0000 (05:04 +0000)]
[driver][mips] Adjust target triple accordingly to provided ABI name

Explicitly selected MIPS ABI using the `-mabi` option implies
corresponding target triple. For 'O32' ABI it's a 32-bit target triple
like `mips-linux-gnu`. For 'N32' and 'N64' ABIs it's a 64-bit target
triple like `mips64-linux-gnu`. This patch adjusts target triple
accordingly these rules like we do for pseudo-target flags '-m64',
'-m32' etc already.

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

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

6 years ago[analyzer] [NFC] Move the code for dumping the program point to ProgramPoint
George Karpenkov [Thu, 27 Sep 2018 01:46:18 +0000 (01:46 +0000)]
[analyzer] [NFC] Move the code for dumping the program point to ProgramPoint

So we can dump them outside of viewing the exploded grpah.

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

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

6 years ago[analyzer] [NFC] Heavy refactoring of trackNullOrUndefValue
George Karpenkov [Thu, 27 Sep 2018 01:45:57 +0000 (01:45 +0000)]
[analyzer] [NFC] Heavy refactoring of trackNullOrUndefValue

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

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

6 years ago[analyzer] [testing] Pass through an extra argument for specifying extra analyzer...
George Karpenkov [Thu, 27 Sep 2018 01:10:59 +0000 (01:10 +0000)]
[analyzer] [testing] Pass through an extra argument for specifying extra analyzer options

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

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

6 years agoRemove trailing space in rC343150
Fangrui Song [Wed, 26 Sep 2018 23:47:00 +0000 (23:47 +0000)]
Remove trailing space in rC343150

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

6 years agoInit LookupResult::AmbiguityKind
Vitaly Buka [Wed, 26 Sep 2018 22:58:53 +0000 (22:58 +0000)]
Init LookupResult::AmbiguityKind

We don't expect useful value there unless it's "ambiguous".
However we use read it for copying and moving, so we need either init the field
add login to avoid reading invalid values. Such reads trigger ubsan errors.

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

6 years ago[DebugInfo] Generate debug information for labels.
Hsiangkai Wang [Wed, 26 Sep 2018 22:18:45 +0000 (22:18 +0000)]
[DebugInfo] Generate debug information for labels.

Generate DILabel metadata and call llvm.dbg.label after label
statement to associate the metadata with the label.

After fixing PR37395.
After fixing problems in LiveDebugVariables.
After fixing NULL symbol problems in AddressPool when enabling
split-dwarf-file.

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

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

6 years agollvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)
Fangrui Song [Wed, 26 Sep 2018 22:16:28 +0000 (22:16 +0000)]
llvm::sort(C.begin(), C.end(), ...) -> llvm::sort(C, ...)

Summary: The convenience wrapper in STLExtras is available since rL342102.

Reviewers: rsmith, #clang, dblaikie

Reviewed By: rsmith, #clang

Subscribers: mgrang, arphaman, kadircet, cfe-commits

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

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

6 years agoP1008R1 Classes with user-declared constructors are never aggregates in
Richard Smith [Wed, 26 Sep 2018 19:00:16 +0000 (19:00 +0000)]
P1008R1 Classes with user-declared constructors are never aggregates in
C++20.

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

6 years ago[X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set...
Craig Topper [Wed, 26 Sep 2018 17:01:44 +0000 (17:01 +0000)]
[X86] For lzcnt/tzcnt intrinsics use cttz/ctlz intrinsics with zero_undef flag set to false.

Previously we used a select and the zero_undef=true intrinsic. In -O2 this pattern will get optimized to zero_undef=false. But in -O0 this optimization won't happen. This results in a compare and cmov being wrapped around a tzcnt/lzcnt instruction.

By using the zero_undef=false intrinsic directly without the select, we can improve the -O0 codegen to just an lzcnt/tzcnt instruction.

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

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

6 years ago[ARM/AArch64][v8.5A] Add Armv8.5-A target
Oliver Stannard [Wed, 26 Sep 2018 14:20:29 +0000 (14:20 +0000)]
[ARM/AArch64][v8.5A] Add Armv8.5-A target

This patch allows targetting Armv8.5-A from Clang. Most of the
implementation is in TargetParser, so this is mostly just adding tests.

Patch by Pablo Barrio!

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

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

6 years ago[analyzer] scan-build: if --status-bugs is passed, don't forget about the exit status...
Roman Lebedev [Wed, 26 Sep 2018 13:08:44 +0000 (13:08 +0000)]
[analyzer] scan-build: if --status-bugs is passed, don't forget about the exit status of the actual build

Summary:
This has been bothering me for a while, but only now i have actually looked into this.
I'm using one CI job for static analysis - clang static analyzers as compilers + clang-tidy via cmake.
And i'd like for the build to fail if at least one of those finds issues.
If clang-tidy finds issues, it will fail the build since the warnings-as-errors is set.
If static analyzer finds anything, since --status-bugs is set, it will fail the build.
But if clang-tidy find anything, but static analyzer does not, the build succeeds :/

Reviewers: sylvestre.ledru, alexfh, jroelofs, ygribov, george.karpenkov, krememek

Reviewed By: jroelofs

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

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

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

6 years agoRemoved extra semicolon to fix Wpedantic. (NFCI).
Simon Pilgrim [Wed, 26 Sep 2018 09:12:55 +0000 (09:12 +0000)]
Removed extra semicolon to fix Wpedantic. (NFCI).

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

6 years agoclang-format: [JS] space after parameter naming.
Martin Probst [Wed, 26 Sep 2018 08:28:33 +0000 (08:28 +0000)]
clang-format: [JS] space after parameter naming.

Summary:
Previously:
    foo(/*bar=*/baz);

Now:
    foo(/*bar=*/ baz);

The run-in parameter naming comment is not intended in JS.

Reviewers: mboehme

Subscribers: cfe-commits

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

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

6 years ago[clang-cl] Make /Gs imply default stack probes, not /Gs0 (PR39074)
Hans Wennborg [Wed, 26 Sep 2018 07:39:04 +0000 (07:39 +0000)]
[clang-cl] Make /Gs imply default stack probes, not /Gs0 (PR39074)

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

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

6 years ago[CUDA] Fix two failed test cases using --cuda-path-ignore-env
Jiading Gai [Wed, 26 Sep 2018 07:07:48 +0000 (07:07 +0000)]
[CUDA] Fix two failed test cases using --cuda-path-ignore-env

Add --cuda-path-ignore-env option to those test cases to ensure the clang
driver always pick the CUDA path specified by --sysroot.

Reviewers: tra, Hahnfeld

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

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

6 years ago[Frontend] Tidy up -print-decl-contexts conditions
Fangrui Song [Wed, 26 Sep 2018 06:28:14 +0000 (06:28 +0000)]
[Frontend] Tidy up -print-decl-contexts conditions

The existing conditions are not consistent. Some have braces and define a temporary Decl while others simply call `<< *cast<XXXDecl>(I)` (mostly the NamedDecl overload of operator<<).
Just use the latter for consistency and brevity.

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

6 years agoP0859R0: List-initialization is potentially-constant-evaluated and
Richard Smith [Wed, 26 Sep 2018 04:36:55 +0000 (04:36 +0000)]
P0859R0: List-initialization is potentially-constant-evaluated and
triggers instantiation of constexpr functions.

We mostly implemented this since Clang 6, but missed the template
instantiation case.

We do not implement the '&cast-expression' special case. It appears to
be a mistake / oversight. I've mailed CWG to see if we can remove it.

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

6 years ago[OPENMP] Add support for OMP5 requires directive + unified_address clause
Kelvin Li [Wed, 26 Sep 2018 04:28:39 +0000 (04:28 +0000)]
[OPENMP] Add support for OMP5 requires directive + unified_address clause

Add support for OMP5.0 requires directive and unified_address clause.
Patches to follow will include support for additional clauses.

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

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

6 years ago[analyzer] Fix a crash on casting symbolic pointers to derived classes.
Artem Dergachev [Wed, 26 Sep 2018 00:17:14 +0000 (00:17 +0000)]
[analyzer] Fix a crash on casting symbolic pointers to derived classes.

Commit r340984 causes a crash when a pointer to a completely unrelated type
UnrelatedT (eg., opaque struct pattern) is being casted from base class BaseT to
derived class DerivedT, which results in an ill-formed region
Derived{SymRegion{$<UnrelatedT x>}, DerivedT}.

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

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

6 years agoFix a bot failure from r343042.
Erik Pilkington [Tue, 25 Sep 2018 23:52:29 +0000 (23:52 +0000)]
Fix a bot failure from r343042.

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

6 years ago[analyzer] Add a testing facility for testing relationships between symbols.
Artem Dergachev [Tue, 25 Sep 2018 23:50:53 +0000 (23:50 +0000)]
[analyzer] Add a testing facility for testing relationships between symbols.

Tests introduced in r329780 was disabled in r342317 because these tests
were accidentally testing dump infrastructure, when all they cared about was
how symbols relate to each other. So when dump infrastructure changed,
tests became annoying to maintain.

Add a new feature to ExprInspection: clang_analyzer_denote() and
clang_analyzer_explain(). The former adds a notation to a symbol, the latter
expresses another symbol in terms of previously denoted symbols.

It's currently a bit wonky - doesn't print parentheses and only supports
denoting atomic symbols. But it's even more readable that way.

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

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

6 years ago[clang-check-codegen][cfstring] Accept either @ or % for progbits to make ppc64be...
Kristina Brooks [Tue, 25 Sep 2018 23:17:09 +0000 (23:17 +0000)]
[clang-check-codegen][cfstring] Accept either @ or % for progbits to make ppc64be bots happy.

PPC64BE bots use % instead of @ for directives like progbits. Since CFString tests also
check asm output, they fail on the following:

  cfstring3.c:44:19: error: CHECK-ASM-ELF: expected string not found in input
  // CHECK-ASM-ELF: .section cfstring,"aw",@progbits
  <stdin>:30:2: note: possible intended match here
  .section cfstring,"aw",%progbits

Updating that check with a {{[@%]}}progbits regex to make those bots happy.

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

6 years ago[Sema] Use a more civilized hash map to implement -Wduplicate-enum.
Erik Pilkington [Tue, 25 Sep 2018 22:53:06 +0000 (22:53 +0000)]
[Sema] Use a more civilized hash map to implement -Wduplicate-enum.

DenseMap<long, SOMETHING> used LONG_MAX as a tombstone, so it asserts
when you try to insert it!

rdar://44774672

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

6 years agoDon't emit "will be treated as an identifier character" warning for
Richard Smith [Tue, 25 Sep 2018 22:34:45 +0000 (22:34 +0000)]
Don't emit "will be treated as an identifier character" warning for
UTF-8 characters that aren't identifier characters in the current
language mode.

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

6 years agoReland "[Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`"
Kristina Brooks [Tue, 25 Sep 2018 22:27:40 +0000 (22:27 +0000)]
Reland "[Clang][CodeGen][ObjC]: Fix CoreFoundation on ELF with `-fconstant-cfstrings`"

Relanding rL342883 with more fragmented tests to test ELF-specific
section emission separately from broad-scope CFString tests. Now this
tests the following separately

1). CoreFoundation builds and linkage for ELF while building it.
2). CFString ELF section emission outside CF in assembly output.
3). Broad scope `cfstring3.c` tests which cover all object formats at
    bitcode level and assembly level (including ELF).

This fixes non-bridged CoreFoundation builds on ELF targets
that use -fconstant-cfstrings. The original changes from differential
for a similar patch to PE/COFF (https://reviews.llvm.org/D44491) did not
check for an edge case where the global could be a constant which surfaced
as an issue when building for ELF because of different linkage semantics.

This patch addresses several issues with crashes related to CF builds on ELF
as well as improves data layout by ensuring string literals that back
the actual CFConstStrings end up in .rodata in line with Mach-O.

Change itself tested with CoreFoundation on Linux x86_64 but should be valid
for BSD-like systems as well that use ELF as the native object format.

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

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

6 years ago[analyzer] NFC: CallDescription: Improve array management.
Artem Dergachev [Tue, 25 Sep 2018 22:13:31 +0000 (22:13 +0000)]
[analyzer] NFC: CallDescription: Improve array management.

Combine the two constructor overrides into a single ArrayRef constructor
to allow easier brace initializations and simplify how the respective field
is used internally.

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

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

6 years agoP0969R0: allow structured binding of accessible members, not only public members.
Richard Smith [Tue, 25 Sep 2018 22:12:44 +0000 (22:12 +0000)]
P0969R0: allow structured binding of accessible members, not only public members.

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

6 years ago[analyzer] NFC: Legalize state manager factory injection.
Artem Dergachev [Tue, 25 Sep 2018 22:10:12 +0000 (22:10 +0000)]
[analyzer] NFC: Legalize state manager factory injection.

When a checker maintains a program state trait that isn't a simple list/set/map, but is a combination of multiple lists/sets/maps (eg., a multimap - which may be implemented as a map from something to set of something), ProgramStateManager only contains the factory for the trait itself. All auxiliary lists/sets/maps need a factory to be provided by the checker, which is annoying.

So far two checkers wanted a multimap, and both decided to trick the
ProgramStateManager into keeping the auxiliary factory within itself
by pretending that it's some sort of trait they're interested in,
but then never using this trait but only using the factory.

Make this trick legal. Define a convenient macro.

One thing that becomes apparent once all pieces are put together is that
these two checkers are in fact using the same factory, because the type that
identifies it, ImmutableMap<const MemRegion *, ImmutableSet<SymbolRef>>,
is the same. This situation is different from two checkers registering similar
primitive traits.

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

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

6 years agoRevert "[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file
Alexey Bataev [Tue, 25 Sep 2018 18:31:56 +0000 (18:31 +0000)]
Revert "[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file
types."

It reverts commit r342991 + several other commits intended to fix the
tests. Still have some failed tests, need to investigate it.

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

6 years ago[OPENMP] Fix the test, NFC.
Alexey Bataev [Tue, 25 Sep 2018 17:58:08 +0000 (17:58 +0000)]
[OPENMP] Fix the test, NFC.

Fixed test to pacify buildbot.

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

6 years ago[OPENMP] Fix failed test, NFC.
Alexey Bataev [Tue, 25 Sep 2018 17:47:53 +0000 (17:47 +0000)]
[OPENMP] Fix failed test, NFC.

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

6 years ago[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.
Alexey Bataev [Tue, 25 Sep 2018 17:09:17 +0000 (17:09 +0000)]
[DRIVER][OFFLOAD] Do not invoke unbundler on unsupported file types.

clang-offload-bundler should not be invoked with the unbundling action
when the input file type does not match the action type. For example,
.so files should be unbundled during linking phase and should be linked
only with the host code.

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

6 years ago[AArch64] Support adding X[8-15,18] registers as CSRs.
Tri Vo [Tue, 25 Sep 2018 16:48:40 +0000 (16:48 +0000)]
[AArch64] Support adding X[8-15,18] registers as CSRs.

Summary:
Making X[8-15,18] registers call-saved is used to support
CONFIG_ARM64_LSE_ATOMICS in Linux kernel.

Signed-off-by: Tri Vo <trong@android.com>
Reviewers: srhines, nickdesaulniers, javed.absar

Reviewed By: nickdesaulniers

Subscribers: kristof.beyls, jfb, cfe-commits

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

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