]> granicus.if.org Git - clang/log
clang
5 years agoRevert "Support attribute used in member funcs of class templates"
Rafael Auler [Thu, 31 Jan 2019 13:31:33 +0000 (13:31 +0000)]
Revert "Support attribute used in member funcs of class templates"

This reverts commit 352740: broke swift build

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

5 years agoSupport attribute used in member funcs of class templates
Rafael Auler [Thu, 31 Jan 2019 09:38:31 +0000 (09:38 +0000)]
Support attribute used in member funcs of class templates

Summary:
As PR17480 describes, clang does not support the used attribute
for member functions of class templates. This means that if the member
function is not used, its definition is never instantiated. This patch
changes clang to emit the definition if it has the used attribute.

Test Plan: Added a testcase

Reviewed By: aaron.ballman

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

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

5 years agoRevert "[CMake] Unify scripts for generating VCS headers"
Petr Hosek [Thu, 31 Jan 2019 07:12:43 +0000 (07:12 +0000)]
Revert "[CMake] Unify scripts for generating VCS headers"

This reverts commits r352729 and r352731: this broke Sanitizer Windows bots

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

5 years ago[CMake] Unify scripts for generating VCS headers
Petr Hosek [Thu, 31 Jan 2019 06:21:01 +0000 (06:21 +0000)]
[CMake] Unify scripts for generating VCS headers

Previously, there were two different scripts for generating VCS headers:
one used by LLVM and one used by Clang. They were both similar, but
different. They were both broken in their own ways, for example the one
used by Clang didn't properly handle monorepo resulting in an incorrect
version information reported by Clang.

This change unifies two the scripts by introducing a new script that's
used from both LLVM and Clang, ensures that the new script supports both
monorepo and standalone SVN and Git setups, and removes the old scripts.

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

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

5 years ago[analyzer] Make NullReturnedFromNonnullChecker depend on NullabilityBase
Kristof Umann [Wed, 30 Jan 2019 23:48:37 +0000 (23:48 +0000)]
[analyzer] Make NullReturnedFromNonnullChecker depend on NullabilityBase

Accidentally left this dependency out after D54438.

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

5 years ago[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn...
Julian Lettner [Wed, 30 Jan 2019 23:42:13 +0000 (23:42 +0000)]
[Sanitizers] UBSan unreachable incompatible with ASan in the presence of `noreturn` calls

Summary:
UBSan wants to detect when unreachable code is actually reached, so it
adds instrumentation before every unreachable instruction. However, the
optimizer will remove code after calls to functions marked with
noreturn. To avoid this UBSan removes noreturn from both the call
instruction as well as from the function itself. Unfortunately, ASan
relies on this annotation to unpoison the stack by inserting calls to
_asan_handle_no_return before noreturn functions. This is important for
functions that do not return but access the the stack memory, e.g.,
unwinder functions *like* longjmp (longjmp itself is actually
"double-proofed" via its interceptor). The result is that when ASan and
UBSan are combined, the noreturn attributes are missing and ASan cannot
unpoison the stack, so it has false positives when stack unwinding is
used.

Changes:
Clang-CodeGen now directly insert calls to `__asan_handle_no_return`
when a call to a noreturn function is encountered and both
UBsan-unreachable and ASan are enabled. This allows UBSan to continue
removing the noreturn attribute from functions without any changes to
the ASan pass.

Previously generated code:
```
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

Generated code (for now):
```
  call void @__asan_handle_no_return
  call void @longjmp
  call void @__asan_handle_no_return
  call void @__ubsan_handle_builtin_unreachable
```

rdar://problem/40723397

Reviewers: delcypher, eugenis, vsk

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

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

5 years ago[CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone
Erik Pilkington [Wed, 30 Jan 2019 23:17:38 +0000 (23:17 +0000)]
[CodeGenObjC] Handle exceptions when calling objc_alloc or objc_allocWithZone

objc_alloc and objc_allocWithZone may throw exceptions if the
underlying method does. If we're in a @try block, then make sure we
emit an invoke instead of a call.

rdar://47610407

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

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

5 years ago[ASTDump] Inline traverse methods into class
Stephen Kelly [Wed, 30 Jan 2019 21:48:32 +0000 (21:48 +0000)]
[ASTDump] Inline traverse methods into class

This API will be extracted into a new template class.  This change will
make the follow-up commit easier to review.

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

5 years agoDon't define __has_feature(objc_fixed_enum) in non-objc mode
Erik Pilkington [Wed, 30 Jan 2019 21:14:08 +0000 (21:14 +0000)]
Don't define __has_feature(objc_fixed_enum) in non-objc mode

This is only a formal language feature in ObjC, otherwise its just an
extension. Making this change was also an ABI break.

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

5 years ago[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
Alexey Bataev [Wed, 30 Jan 2019 20:49:52 +0000 (20:49 +0000)]
[OPENMP]Fix PR40536: Do not emit __kmpc_push_target_tripcount if not
required.

Function __kmpc_push_target_tripcount should be emitted only if the
offloading entry is going to be emitted (for use in tgt_target...
functions). Otherwise, it should not be emitted.

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

5 years agoAdd a new builtin: __builtin_dynamic_object_size
Erik Pilkington [Wed, 30 Jan 2019 20:34:53 +0000 (20:34 +0000)]
Add a new builtin: __builtin_dynamic_object_size

This builtin has the same UI as __builtin_object_size, but has the
potential to be evaluated dynamically. It is meant to be used as a
drop-in replacement for libraries that use __builtin_object_size when
a dynamic checking mode is enabled. For instance,
__builtin_object_size fails to provide any extra checking in the
following function:

  void f(size_t alloc) {
    char* p = malloc(alloc);
    strcpy(p, "foobar"); // expands to __builtin___strcpy_chk(p, "foobar", __builtin_object_size(p, 0))
  }

This is an overflow if alloc < 7, but because LLVM can't fold the
object size intrinsic statically, it folds __builtin_object_size to
-1. With __builtin_dynamic_object_size, alloc is passed through to
__builtin___strcpy_chk.

rdar://32212419

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

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

5 years agoAdd a 'dynamic' parameter to the objectsize intrinsic
Erik Pilkington [Wed, 30 Jan 2019 20:34:35 +0000 (20:34 +0000)]
Add a 'dynamic' parameter to the objectsize intrinsic

This is meant to be used with clang's __builtin_dynamic_object_size.
When 'true' is passed to this parameter, the intrinsic has the
potential to be folded into instructions that will be evaluated
at run time. When 'false', the objectsize intrinsic behaviour is
unchanged.

rdar://32212419

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

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

5 years ago[ASTDump] Make method definition order matches declaration order
Stephen Kelly [Wed, 30 Jan 2019 20:06:52 +0000 (20:06 +0000)]
[ASTDump] Make method definition order matches declaration order

This will make follow-up changes easier to review.

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

5 years ago[ASTDump] Re-arrange method declarations to group Visit together
Stephen Kelly [Wed, 30 Jan 2019 20:03:47 +0000 (20:03 +0000)]
[ASTDump] Re-arrange method declarations to group Visit together

This will make follow-up commits easier to review.

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

5 years ago[ASTDump] Rename methods which are conceptually Visits
Stephen Kelly [Wed, 30 Jan 2019 19:49:49 +0000 (19:49 +0000)]
[ASTDump] Rename methods which are conceptually Visits

This is consistent with the TextNodeDumper, and is the appropriate name
for the traverser class which will be extracted.

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

5 years ago[ASTDump] NFC: Inline vestigial methods
Stephen Kelly [Wed, 30 Jan 2019 19:41:04 +0000 (19:41 +0000)]
[ASTDump] NFC: Inline vestigial methods

This was a porting aid.

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

5 years ago[ASTDump] Move Decl node dumping to TextNodeDumper
Stephen Kelly [Wed, 30 Jan 2019 19:32:48 +0000 (19:32 +0000)]
[ASTDump] Move Decl node dumping to TextNodeDumper

Reviewers: aaron.ballman

Subscribers: jfb, cfe-commits

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

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

5 years ago[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit
Roman Lebedev [Wed, 30 Jan 2019 15:41:20 +0000 (15:41 +0000)]
[ASTDumper][OpenMP] CapturedDecl has a 'nothrow' bit

Summary:
Was trying to understand how complicated it would be to write
a clang-tidy `openmp-exception-escape`-ish check once D57100 lands.

Just so it happens, all the data is already there,
it is just conveniently omitted from AST dump.

Reviewers: aaron.ballman, steveire, ABataev

Reviewed By: ABataev

Subscribers: ABataev, guansong, cfe-commits

Tags: #openmp, #clang

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

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

5 years ago[clang-format] Fix line parsing for noexcept lambdas
Ben Hamilton [Wed, 30 Jan 2019 13:54:32 +0000 (13:54 +0000)]
[clang-format] Fix line parsing for noexcept lambdas

Summary:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |clang-format

```
int c = [b]() mutable noexcept {
  return [&b] { return b++; }();
}
();
```
with patch:
> $ echo "int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();" |bin/clang-format
```
int c = [b]() mutable noexcept { return [&b] { return b++; }(); }();
```

Contributed by hultman.

Reviewers: benhamilton, jolesiak, klimek, Wizard

Reviewed By: benhamilton

Subscribers: cfe-commits

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

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

5 years ago[HIP] Fix size_t for MSVC environment
Yaxun Liu [Wed, 30 Jan 2019 12:26:54 +0000 (12:26 +0000)]
[HIP] Fix size_t for MSVC environment

In 64 bit MSVC environment size_t is defined as unsigned long long.
In single source language like HIP, data layout should be consistent
in device and host compilation, therefore copy data layout controlling
fields from Aux target for AMDGPU target.

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

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

5 years ago[OpenGL] Fix test on PPC after r352540
Eric Liu [Wed, 30 Jan 2019 11:24:04 +0000 (11:24 +0000)]
[OpenGL] Fix test on PPC after r352540

Summary:
Specify -triple like test/SemaOpenCL/logical-ops.cl. Otherwise, this test fails
on PPC.

Reviewers: bkramer

Subscribers: Anastasia, cfe-commits

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

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

5 years ago[OpenCL] Add generic addr space to the return of implicit assignment.
Anastasia Stulova [Wed, 30 Jan 2019 11:18:08 +0000 (11:18 +0000)]
[OpenCL] Add generic addr space to the return of implicit assignment.

When creating the prototype of implicit assignment operators the
returned reference to the class should be qualified with the same
addr space as 'this' (i.e. __generic in OpenCL).

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

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

5 years ago[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes
Michal Gorny [Wed, 30 Jan 2019 08:20:24 +0000 (08:20 +0000)]
[clang] [Driver] [NetBSD] Append -rpath for shared compiler-rt runtimes

Append appropriate -rpath when using shared compiler-rt runtimes,
e.g. '-fsanitize=address -shared-libasan'.  There's already a similar
logic in CommonArgs.cpp but it uses non-standard arch-suffixed
installation directory while we want our driver to work with standard
installation paths.

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

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

5 years ago[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)
Jonas Devlieghere [Wed, 30 Jan 2019 06:26:26 +0000 (06:26 +0000)]
[ModuleDependencyCollector] Use llvm::sys::fs::real_path (NFC)

Use the real_path implementation from llvm::sys::fs::real_path instead
of having a custom implementation in the ModuleDependencyCollector.

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

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

5 years agoCleanup: replace uses of CallSite with CallBase.
James Y Knight [Wed, 30 Jan 2019 02:54:28 +0000 (02:54 +0000)]
Cleanup: replace uses of CallSite with CallBase.

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

5 years agoSimplify and modernize this code a little.
Richard Smith [Wed, 30 Jan 2019 02:23:34 +0000 (02:23 +0000)]
Simplify and modernize this code a little.

No functionality change intended.

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

5 years ago[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective...
George Karpenkov [Wed, 30 Jan 2019 02:11:04 +0000 (02:11 +0000)]
[analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of Objective-C methods

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

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

5 years ago[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard
Petr Hosek [Wed, 30 Jan 2019 02:06:06 +0000 (02:06 +0000)]
[CMake][Fuchsia] Re-enable iOS runtimes for Fuchsia standard

Turned out this is used by Flutter which uses Fuchsia Clang toolchain.

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

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

5 years ago[CMake][Fuchsia] Enable hermetic static libunwind for Fuchsia
Petr Hosek [Wed, 30 Jan 2019 02:02:25 +0000 (02:02 +0000)]
[CMake][Fuchsia] Enable hermetic static libunwind for Fuchsia

In addition to libc++abi and libc++, we also want to use hermetic
static libunwind on Fuchsia.

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

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

5 years agoFix thread safety tests after r352549
Aaron Puchert [Wed, 30 Jan 2019 00:18:24 +0000 (00:18 +0000)]
Fix thread safety tests after r352549

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

5 years ago[analyzer] NFC: GenericTaintChecker: Revise rule specification mechanisms.
Artem Dergachev [Wed, 30 Jan 2019 00:06:43 +0000 (00:06 +0000)]
[analyzer] NFC: GenericTaintChecker: Revise rule specification mechanisms.

Provide a more powerful and at the same time more readable way of specifying
taint propagation rules for known functions within the checker.

Now it should be possible to specify an unlimited amount of source and
destination parameters for taint propagation.

No functional change intended just yet.

Patch by Gábor Borsik!

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

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

5 years agoNFC: Move GenericSelectionExpr dump to NodeDumper
Stephen Kelly [Tue, 29 Jan 2019 22:58:28 +0000 (22:58 +0000)]
NFC: Move GenericSelectionExpr dump to NodeDumper

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoNFC: Implement GenericSelectionExpr::Association dump with Visitor
Stephen Kelly [Tue, 29 Jan 2019 22:22:55 +0000 (22:22 +0000)]
NFC: Implement GenericSelectionExpr::Association dump with Visitor

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoThread safety analysis: Improve diagnostics for double locking
Aaron Puchert [Tue, 29 Jan 2019 22:11:42 +0000 (22:11 +0000)]
Thread safety analysis: Improve diagnostics for double locking

Summary:
We use the existing diag::note_locked_here to tell the user where we saw
the first locking.

Reviewers: aaron.ballman, delesley

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

5 years agoOpenCL: Try to fix bot test failure
Matt Arsenault [Tue, 29 Jan 2019 21:14:56 +0000 (21:14 +0000)]
OpenCL: Try to fix bot test failure

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

5 years ago[OPENMP]Fix PR40513: lastprivate taskloop counter.
Alexey Bataev [Tue, 29 Jan 2019 21:12:28 +0000 (21:12 +0000)]
[OPENMP]Fix PR40513: lastprivate taskloop counter.

We don't need to use the predetermined data-sharing attributes for the
loop counters if the user explicitly specified correct data-sharing
attributes for such variables.

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

5 years ago[cc1as] Test that -g of empty .s file does something sensible.
Paul Robinson [Tue, 29 Jan 2019 20:57:50 +0000 (20:57 +0000)]
[cc1as] Test that -g of empty .s file does something sensible.

Depends on LLVM r352541.

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

5 years agoOpenCL: Use length modifier for warning on vector printf arguments
Matt Arsenault [Tue, 29 Jan 2019 20:49:54 +0000 (20:49 +0000)]
OpenCL: Use length modifier for warning on vector printf arguments

Re-enable format string warnings on printf.

The warnings are still incomplete. Apparently it is undefined to use a
vector specifier without a length modifier, which is not currently
warned on. Additionally, type warnings appear to not be working with
the hh modifier, and aren't warning on all of the special restrictions
from c99 printf.

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

5 years agoRevert "OpenCL: Extend argument promotion rules to vector types"
Matt Arsenault [Tue, 29 Jan 2019 20:49:47 +0000 (20:49 +0000)]
Revert "OpenCL: Extend argument promotion rules to vector types"

This reverts r348083. This was based on a misreading of the spec
for printf specifiers.

Also revert r343653, as without a subsequent patch, a correctly
specified format for a vector will incorrectly warn.

Fixes bug 40491.

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

5 years agoFix the tests from r350970
Steven Wu [Tue, 29 Jan 2019 20:13:02 +0000 (20:13 +0000)]
Fix the tests from r350970

Relax the tests from r350970 to allow non-standard path for ld.

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

5 years agoFix the behavior of clang's -w flag.
James Y Knight [Tue, 29 Jan 2019 19:33:48 +0000 (19:33 +0000)]
Fix the behavior of clang's -w flag.

It is intended to disable _all_ warnings, even those upgraded to
errors via `-Werror=warningname` or `#pragma clang diagnostic error'

Fixes: https://llvm.org/PR38231
Differential Revision: https://reviews.llvm.org/D53199

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

5 years ago[analyzer] [RetainCountChecker] Track input parameters to the top-level function
George Karpenkov [Tue, 29 Jan 2019 19:29:59 +0000 (19:29 +0000)]
[analyzer] [RetainCountChecker] Track input parameters to the top-level function

Track them for ISL/OS objects by default, and for NS/CF under a flag.

rdar://47536377

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

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

5 years ago[analyzer] [RetainSummaryManager] [NFC] Split one function into two, as it's really...
George Karpenkov [Tue, 29 Jan 2019 19:29:45 +0000 (19:29 +0000)]
[analyzer] [RetainSummaryManager] [NFC] Split one function into two, as it's really doing two things

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

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

5 years ago[analyzer] [ARCMT] [NFC] Unify entry point into RetainSummaryManager
George Karpenkov [Tue, 29 Jan 2019 19:29:33 +0000 (19:29 +0000)]
[analyzer] [ARCMT] [NFC] Unify entry point into RetainSummaryManager

Just use one single entry point, since we have AnyCall utility now.

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

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

5 years agoExtend AnyCall to handle callable declarations without the call expressions
George Karpenkov [Tue, 29 Jan 2019 19:29:19 +0000 (19:29 +0000)]
Extend AnyCall to handle callable declarations without the call expressions

That weakens inner invariants, but allows the class to be more generic,
allowing usage in situations where the call expression is not known (or
should not matter).

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

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

5 years ago[analyzer] [RetainCountChecker] Support 'taggedRetain' and 'taggedRelease'
George Karpenkov [Tue, 29 Jan 2019 19:29:07 +0000 (19:29 +0000)]
[analyzer] [RetainCountChecker] Support 'taggedRetain' and 'taggedRelease'

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

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

5 years ago[OPENMP]Make the loop with unsigned counter countable.
Alexey Bataev [Tue, 29 Jan 2019 18:51:58 +0000 (18:51 +0000)]
[OPENMP]Make the loop with unsigned counter countable.

According to the report, better to keep the original strict compare
operation as the loop condition with unsigned loop counters to make the
loop countable. This allows further loop transformations.

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

5 years agoRollback unwindlib patch.
Sterling Augustine [Tue, 29 Jan 2019 18:27:51 +0000 (18:27 +0000)]
Rollback unwindlib patch.

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

5 years agoAdjust documentation for git migration.
James Y Knight [Tue, 29 Jan 2019 16:37:27 +0000 (16:37 +0000)]
Adjust documentation for git migration.

This fixes most references to the paths:
 llvm.org/svn/
 llvm.org/git/
 llvm.org/viewvc/
 github.com/llvm-mirror/
 github.com/llvm-project/
 reviews.llvm.org/diffusion/

to instead point to https://github.com/llvm/llvm-project.

This is *not* a trivial substitution, because additionally, all the
checkout instructions had to be migrated to instruct users on how to
use the monorepo layout, setting LLVM_ENABLE_PROJECTS instead of
checking out various projects into various subdirectories.

I've attempted to not change any scripts here, only documentation. The
scripts will have to be addressed separately.

Additionally, I've deleted one document which appeared to be outdated
and unneeded:
  lldb/docs/building-with-debug-llvm.txt

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

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

5 years ago[Tooling] Handle #pragma once header guard in include insertion.
Eric Liu [Tue, 29 Jan 2019 14:40:01 +0000 (14:40 +0000)]
[Tooling] Handle #pragma once header guard in include insertion.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

5 years ago[CUDA][HIP] Do not diagnose use of _Float16
Yaxun Liu [Tue, 29 Jan 2019 13:20:23 +0000 (13:20 +0000)]
[CUDA][HIP] Do not diagnose use of _Float16

r352221 caused regressions in CUDA/HIP since device function may use _Float16 whereas host does not support it.
In this case host compilation should not diagnose usage of _Float16 in device functions or variables.

For now just do not diagnose _Float16 for CUDA/HIP. In the future we should have more precise check.

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

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

5 years agoRe-commit "[AST] Introduce GenericSelectionExpr::Association"
Bruno Ricci [Tue, 29 Jan 2019 12:57:11 +0000 (12:57 +0000)]
Re-commit "[AST] Introduce GenericSelectionExpr::Association"

This time with a fix to make gcc 4.8 happy.

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

5 years ago[analyzer] Toning down invalidation a bit
Gabor Horvath [Tue, 29 Jan 2019 10:27:14 +0000 (10:27 +0000)]
[analyzer] Toning down invalidation a bit

When a function takes the address of a field the analyzer will no longer
assume that the function will change other fields of the enclosing structs.

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

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

5 years ago[analyzer] Added a checklist to help checker authors and reviewers
Gabor Horvath [Tue, 29 Jan 2019 10:21:49 +0000 (10:21 +0000)]
[analyzer] Added a checklist to help checker authors and reviewers

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

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

5 years ago[analyzer] Fix a typo in docs
Gabor Horvath [Tue, 29 Jan 2019 10:15:52 +0000 (10:15 +0000)]
[analyzer] Fix a typo in docs

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

5 years ago[AArch64] Update int64_t ACLE builtin arguments
Sam Parker [Tue, 29 Jan 2019 09:04:03 +0000 (09:04 +0000)]
[AArch64] Update int64_t ACLE builtin arguments

Re-applying r351740 with fixes (changing LL to W).

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

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

5 years agoRemove unused variable to silence compiler warning
Mikael Holmen [Tue, 29 Jan 2019 06:53:31 +0000 (06:53 +0000)]
Remove unused variable to silence compiler warning

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

5 years ago[CMake][Fuchsia] Temporarily disable modules for second stage
Petr Hosek [Tue, 29 Jan 2019 03:38:26 +0000 (03:38 +0000)]
[CMake][Fuchsia] Temporarily disable modules for second stage

This is breaking some of builders, disable modules until it's resolved.

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

5 years agoAMDGPU: Add ds append/consume builtins
Matt Arsenault [Mon, 28 Jan 2019 23:59:18 +0000 (23:59 +0000)]
AMDGPU: Add ds append/consume builtins

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

5 years ago[ASTImporter] Fix handling of overriden methods during ASTImport
Shafik Yaghmour [Mon, 28 Jan 2019 21:55:33 +0000 (21:55 +0000)]
[ASTImporter] Fix handling of overriden methods during ASTImport

Summary:
When importing classes we may add a CXXMethodDecl more than once to a CXXRecordDecl when handling overrides. This patch will fix the cases we currently know about and handle the case where we are only dealing with declarations.

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

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

5 years ago[OPENMP][NVPTX]Emit service debug variable for NVPTX.
Alexey Bataev [Mon, 28 Jan 2019 20:03:02 +0000 (20:03 +0000)]
[OPENMP][NVPTX]Emit service debug variable for NVPTX.

In case of the empty module, the ptxas tool may emit error message about
empty debug info sections. This patch fixes this bug.

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

5 years agoCorrect help text for --unwindlib options.
Sterling Augustine [Mon, 28 Jan 2019 18:56:44 +0000 (18:56 +0000)]
Correct help text for --unwindlib options.

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

5 years agoAdd --unwindlib=[libgcc|compiler-rt] to parallel --rtlib=
Sterling Augustine [Mon, 28 Jan 2019 18:56:43 +0000 (18:56 +0000)]
Add --unwindlib=[libgcc|compiler-rt] to parallel --rtlib=

Summary:
"clang++ hello.cc --rtlib=compiler-rt"

now works without specifying additional unwind or exception
handling libraries.

Reviewers: rsmith

Subscribers: srhines, dberris, aheejin, llvm-commits

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

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

5 years agoRevert "[AST] Introduce GenericSelectionExpr::Association"
Bruno Ricci [Mon, 28 Jan 2019 18:40:26 +0000 (18:40 +0000)]
Revert "[AST] Introduce GenericSelectionExpr::Association"

This breaks GCC 4.8.4. Reported by email by Hans Wennborg.

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

5 years agoAdd -fapply-global-visibility-to-externs for -cc1
Scott Linder [Mon, 28 Jan 2019 17:12:19 +0000 (17:12 +0000)]
Add -fapply-global-visibility-to-externs for -cc1

Introduce an option to request global visibility settings be applied to
declarations without a definition or an explicit visibility, rather than
the existing behavior of giving these default visibility. When the
visibility of all or most extern definitions are known this allows for
the same optimisations -fvisibility permits without updating source code
to annotate all declarations.

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

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

5 years ago[clang][OpenMP] OMPFlushClause is synthetic, no such clause exists
Roman Lebedev [Mon, 28 Jan 2019 17:04:11 +0000 (17:04 +0000)]
[clang][OpenMP] OMPFlushClause is synthetic, no such clause exists

Summary:
As discussed in https://reviews.llvm.org/D57112#inline-506781,
'flush' clause does not exist in the OpenMP spec, it can not be
specified, and `OMPFlushClause` class is just a helper class.

Therefore `OPENMP_CLAUSE()` in `clang/Basic/OpenMPKinds.def`
should not contain 'flush' "clause".

I have simply removed the `OPENMP_CLAUSE(flush, OMPFlushClause)`
from `clang/Basic/OpenMPKinds.def`, grepped for `OPENMP_CLAUSE`
and added `OPENMP_CLAUSE(flush, OMPFlushClause)` back to the **every**
place where `OPENMP_CLAUSE` is defined and `clang/Basic/OpenMPKinds.def`
is then included.

So as-is, this patch is a NFC. Possibly, some of these
`OPENMP_CLAUSE(flush, OMPFlushClause)` should be dropped,
i don't really know.

Test plan: `ninja check-clang`

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: guansong, arphaman, cfe-commits

Tags: #openmp

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

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

5 years ago[AST] Introduce GenericSelectionExpr::Association
Bruno Ricci [Mon, 28 Jan 2019 14:18:11 +0000 (14:18 +0000)]
[AST] Introduce GenericSelectionExpr::Association

Introduce a new class GenericSelectionExpr::Association which bundle together
an association expression and its TypeSourceInfo.

An iterator GenericSelectionExpr::AssociationIterator is additionally added to
make it possible to iterate over ranges of Associations. This iterator is a
kind of proxy iterator which abstract over how exactly the expressions and the
TypeSourceInfos are stored.

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

Reviewed By: aaron.ballman

Reviewers: aaron.ballman, steveire, dblaikie, mclow.lists

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

5 years ago[AMDGPU] Add interpolation builtins
Tim Corringham [Mon, 28 Jan 2019 13:50:37 +0000 (13:50 +0000)]
[AMDGPU] Add interpolation builtins

Summary:
Added builtins for the interpolation intrinsics, and related LIT
test.

Reviewers: arsenm, tpr, dstuttard, #amdgpu

Reviewed By: arsenm, #amdgpu

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, cfe-commits

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

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

5 years agoRename getTypeQualifiers to getMethodQualifiers.
Anastasia Stulova [Mon, 28 Jan 2019 11:37:49 +0000 (11:37 +0000)]
Rename getTypeQualifiers to getMethodQualifiers.

Use more descriptive name for the method qualifiers getter.

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

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

5 years ago[AST] Add structural eq tests for template args
Gabor Marton [Mon, 28 Jan 2019 10:01:11 +0000 (10:01 +0000)]
[AST] Add structural eq tests for template args

Summary:
New tests added to verify equivalency of templates when their
parameters are different.

Reviewers: a_sidorin, shafik

Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits

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

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

5 years ago[X86] Add new variadic avx512 compress/expand intrinsics that use vXi1 types for...
Craig Topper [Mon, 28 Jan 2019 07:03:10 +0000 (07:03 +0000)]
[X86] Add new variadic avx512 compress/expand intrinsics that use vXi1 types for the mask argument.

Custom lower the builtins to these intrinsics. This enables the middle end to optimize out bitcasts for the masks.

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

5 years ago[SemaCXX] Fix ICE with structure bindings to members of template
Nicolas Lesser [Sun, 27 Jan 2019 19:19:59 +0000 (19:19 +0000)]
[SemaCXX] Fix ICE with structure bindings to members of template

Summary:
Trying to use structure binding with a structure that doesn't implement
std::tuple_size, should unpack the data members. When the struct is a
template though, clang might hit an assertion (if the type has not been
completed before), because CXXRecordDecl::DefinitionData is nullptr.

This commit fixes the problem by completing the type while trying to
decompose the structured binding.

The ICE happens in real world code, for example, when trying to iterate
a protobuf generated map with a range-based for loop and structure
bindings (because google::protobuf::MapPair is a template and doesn't
support std::tuple_size).

Reported-by: nicholas.sun@nlsun.com
Patch by Daniele Di Proietto

Reviewers: #clang, rsmith

Reviewed By: #clang, rsmith

Subscribers: cpplearner, Rakete1111, cfe-commits

Tags: #clang

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

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

5 years agoRemove Expr sugar decorating the CXXUuidofExpr node.
Bill Wendling [Sun, 27 Jan 2019 07:24:03 +0000 (07:24 +0000)]
Remove Expr sugar decorating the CXXUuidofExpr node.

Summary: Sugar, like ConstantExpr, causes an infinite expansion of the template object.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: riccibruno, aaron.ballman, cfe-commits, tzik, rnk

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

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

5 years ago[FIX] Adjust CXX microsoft abi dynamic cast test to r352293
Johannes Doerfert [Sun, 27 Jan 2019 00:22:10 +0000 (00:22 +0000)]
[FIX] Adjust CXX microsoft abi dynamic cast test to r352293

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

5 years ago[analyzer] Add CheckerManager::getChecker, make sure that a registry function registe...
Kristof Umann [Sat, 26 Jan 2019 21:41:50 +0000 (21:41 +0000)]
[analyzer] Add CheckerManager::getChecker, make sure that a registry function registers no more than 1 checker

This patch effectively fixes the almost decade old checker naming issue.
The solution is to assert when CheckerManager::getChecker is called on an
unregistered checker, and assert when CheckerManager::registerChecker is called
on a checker that is already registered.

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

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

5 years ago[analyzer] Reimplement dependencies between checkers
Kristof Umann [Sat, 26 Jan 2019 20:06:54 +0000 (20:06 +0000)]
[analyzer] Reimplement dependencies between checkers

Unfortunately, up until now, the fact that certain checkers depended on one
another was known, but how these actually unfolded was hidden deep within the
implementation. For example, many checkers (like RetainCount, Malloc or CString)
modelled a certain functionality, and exposed certain reportable bug types to
the user. For example, while MallocChecker models many many different types of
memory handling, the actual "unix.MallocChecker" checker the user was exposed to
was merely and option to this modeling part.

Other than this being an ugly mess, this issue made resolving the checker naming
issue almost impossible. (The checker naming issue being that if a checker
registered more than one checker within its registry function, both checker
object recieved the same name) Also, if the user explicitly disabled a checker
that was a dependency of another that _was_ explicitly enabled, it implicitly,
without "telling" the user, reenabled it.

Clearly, changing this to a well structured, declarative form, where the
handling of dependencies are done on a higher level is very much preferred.

This patch, among the detailed things later, makes checkers declare their
dependencies within the TableGen file Checkers.td, and exposes the same
functionality to plugins and statically linked non-generated checkers through
CheckerRegistry::addDependency. CheckerRegistry now resolves these dependencies,
makes sure that checkers are added to CheckerManager in the correct order,
and makes sure that if a dependency is disabled, so will be every checker that
depends on it.

In detail:

* Add a new field to the Checker class in CheckerBase.td called Dependencies,
which is a list of Checkers.
* Move unix checkers before cplusplus, as there is no forward declaration in
tblgen :/
* Add the following new checkers:
  - StackAddrEscapeBase
  - StackAddrEscapeBase
  - CStringModeling
  - DynamicMemoryModeling (base of the MallocChecker family)
  - IteratorModeling (base of the IteratorChecker family)
  - ValistBase
  - SecuritySyntaxChecker (base of bcmp, bcopy, etc...)
  - NSOrCFErrorDerefChecker (base of NSErrorChecker and  CFErrorChecker)
  - IvarInvalidationModeling (base of IvarInvalidation checker family)
  - RetainCountBase (base of RetainCount and OSObjectRetainCount)
* Clear up and registry functions in MallocChecker, happily remove old FIXMEs.
* Add a new addDependency function to CheckerRegistry.
* Neatly format RUN lines in files I looked at while debugging.

Big thanks to Artem Degrachev for all the guidance through this project!

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

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

5 years ago[analyzer] Fix an bug where statically linked, but not registered checkers weren...
Kristof Umann [Sat, 26 Jan 2019 17:27:40 +0000 (17:27 +0000)]
[analyzer] Fix an bug where statically linked, but not registered checkers weren't recognized

My last patch, D56989, moved the validation of whether a checker exists into
its constructor, but we do support statically linked (and non-plugin) checkers
that were do not have an entry in Checkers.td. However, the handling of this
happens after the creation of the CheckerRegistry object.

This patch fixes this bug by moving even this functionality into
CheckerRegistry's constructor.

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

5 years ago[analyzer][NFC] Keep track of whether enabling a checker was explictly specified...
Kristof Umann [Sat, 26 Jan 2019 16:35:33 +0000 (16:35 +0000)]
[analyzer][NFC] Keep track of whether enabling a checker was explictly specified in command line arguments

I added a new enum to CheckerInfo, so we can easily track whether the check is
explicitly enabled, explicitly disabled, or isn't specified in this regard.
Checkers belonging in the latter category may be implicitly enabled through
dependencies in the followup patch. I also made sure that this is done within
CheckerRegisty's constructor, leading to very significant simplifications in
its query-like methods.

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

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

5 years ago[analyzer][NFC] Supply CheckerRegistry with AnalyzerOptions
Kristof Umann [Sat, 26 Jan 2019 15:59:21 +0000 (15:59 +0000)]
[analyzer][NFC] Supply CheckerRegistry with AnalyzerOptions

Since pretty much all methods of CheckerRegistry has AnalyzerOptions as an
argument, it makes sense to just simply require it in it's constructor.

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

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

5 years ago[analyzer] Split unix.API up to UnixAPIMisuseChecker and UnixAPIPortabilityChecker
Kristof Umann [Sat, 26 Jan 2019 15:56:40 +0000 (15:56 +0000)]
[analyzer] Split unix.API up to UnixAPIMisuseChecker and UnixAPIPortabilityChecker

The actual implementation of unix.API features a dual-checker: two checkers in
one, even though they don't even interact at all. Split them up, as this is a
problem for establishing dependencies.

I added no new code at all, just merely moved it around.

Since the plist files change (and that's a benefit!) this patch isn't NFC.

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

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

5 years ago[analyzer] Supply all checkers with a shouldRegister function
Kristof Umann [Sat, 26 Jan 2019 14:23:08 +0000 (14:23 +0000)]
[analyzer] Supply all checkers with a shouldRegister function

Introduce the boolean ento::shouldRegister##CHECKERNAME(const LangOptions &LO)
function very similarly to ento::register##CHECKERNAME. This will force every
checker to implement this function, but maybe it isn't that bad: I saw a lot of
ObjC or C++ specific checkers that should probably not register themselves based
on some LangOptions (mine too), but they do anyways.

A big benefit of this is that all registry functions now register their checker,
once it is called, registration is guaranteed.

This patch is a part of a greater effort to reinvent checker registration, more
info here: D54438#1315953

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

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

5 years ago[AST] Pack GenericSelectionExpr
Bruno Ricci [Sat, 26 Jan 2019 14:15:10 +0000 (14:15 +0000)]
[AST] Pack GenericSelectionExpr

Store the controlling expression, the association expressions and the
corresponding TypeSourceInfos as trailing objects.

Additionally use the bit-fields of Stmt to store one SourceLocation,
saving one additional pointer. This saves 3 pointers in total per
GenericSelectionExpr.

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

Reviewed By: aaron.ballman

Reviewers: aaron.ballman, steveire

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

5 years ago[AST][NFC] Various cleanups to GenericSelectionExpr
Bruno Ricci [Sat, 26 Jan 2019 13:58:15 +0000 (13:58 +0000)]
[AST][NFC] Various cleanups to GenericSelectionExpr

Various cleanups to GenericSelectionExpr factored out of D57104. In particular:

1. Move the friend declaration to the top.
2. Introduce a constant ResultDependentIndex instead of the magic "-1".
3. clang-format
4. Group the member function together so that they can be removed as one block
   by D57106.

NFC.

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

Reviewed By: aaron.ballman

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

5 years ago[X86] Custom codegen 512-bit cvt(u)qq2tops, cvt(u)qqtopd, and cvt(u)dqtops intrinsics.
Craig Topper [Sat, 26 Jan 2019 02:42:01 +0000 (02:42 +0000)]
[X86] Custom codegen 512-bit cvt(u)qq2tops, cvt(u)qqtopd, and cvt(u)dqtops intrinsics.

Summary:
The 512-bit cvt(u)qq2tops, cvt(u)qqtopd, and cvt(u)dqtops intrinsics all have the possibility of taking an explicit rounding mode argument. If the rounding mode is CUR_DIRECTION we'd like to emit a sitofp/uitofp instruction and a select like we do for 256-bit intrinsics.

For cvt(u)qqtopd and cvt(u)dqtops we do this when the form of the software intrinsics that doesn't take a rounding mode argument is used. This is done by using convertvector in the header with the select builtin. But if the explicit rounding mode form of the intrinsic is used and CUR_DIRECTION is passed, we don't do this. We shouldn't have this inconsistency.

For cvt(u)qqtops nothing is done because we can't use the select builtin in the header without avx512vl. So we need to use custom codegen for this.

Even when the rounding mode isn't CUR_DIRECTION we should also use select in IR for consistency. And it will remove another scalar integer mask from our intrinsics.

To accomplish all of these goals I've taken a slightly unusual approach. I've added two new X86 specific intrinsics for sitofp/uitofp with rounding. These intrinsics are variadic on the input and output type so we only need 2 instead of 6. This avoids the need for a switch to map them in CGBuiltin.cpp. We just need to check signed vs unsigned. I believe other targets also use variadic intrinsics like this.

So if the rounding mode is CUR_DIRECTION we'll use an sitofp/uitofp instruction. Otherwise we'll use one of the new intrinsics. After that we'll emit a select instruction if needed.

Reviewers: RKSimon, spatel

Reviewed By: RKSimon

Subscribers: cfe-commits

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

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

5 years agoAttempt to fix build on Windows with LLVM_ENABLE_PIC=OFF
Nico Weber [Fri, 25 Jan 2019 23:37:57 +0000 (23:37 +0000)]
Attempt to fix build on Windows with LLVM_ENABLE_PIC=OFF

libclang can be built in shared or static mode. On Windows, with
LLVM_ENABLE_PIC=OFF, it was built in neither mode, leading to clients of
libclang (c-index-test, c-arcmt-test) failing to link with it set.

Since PIC isn't really a thing on Windows, build libclang in shared mode when
LLVM_ENABLE_PIC=OFF there. This is also somewhat symmetric with the existing
ENABLE_STATIC a few lines down.

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

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

5 years agoFixed frontend clang tests in windows read-only container
Stella Stamenova [Fri, 25 Jan 2019 23:03:12 +0000 (23:03 +0000)]
Fixed frontend clang tests in windows read-only container

Summary:
When mounting LLVM source into a windows container in read-only mode, certain tests fail. Ideally, we want all these tests to pass so that developers can mount the same source folder into multiple (windows) containers simultaneously, allowing them to build/test the same source code using various different configurations simultaneously.

**Fix**: I've found that when attempting to open a file for writing on windows, if you don't have the correct permissions (trying to open a file for writing in a read-only folder), you get [Access is denied](https://support.microsoft.com/en-us/help/2623670/access-denied-or-other-errors-when-you-access-or-work-with-files-and-f). In llvm, we map this error message to a linux based error, see: https://github.com/llvm-mirror/llvm/blob/master/lib/Support/ErrorHandling.cpp

This is why we see "Permission denied" in our output as opposed to the expected "No such file or directory", thus causing the tests to fail.

I've changed the test locally to instead point to the root drive so that they can successfully bypass the Access is denied error when LLVM is mounted in as a read-only directory. This way, the test operate exactly the same, but we can get around the windows-complications of what error to expect in a read-only directory.

Patch By: justice_adams

Reviewers: rsmith, zturner, MatzeB, stella.stamenova

Reviewed By: stella.stamenova

Subscribers: ormris, cfe-commits

Tags: #clang

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

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

5 years ago[Sema] Improve a -Warray-bounds diagnostic
Erik Pilkington [Fri, 25 Jan 2019 20:52:45 +0000 (20:52 +0000)]
[Sema] Improve a -Warray-bounds diagnostic

Fix a bug where we would compare array sizes with incompatible
element types, and look through explicit casts.

rdar://44800168

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

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

5 years ago[CodeGen] Implement isTriviallyRecursive with StmtVisitor instead of RecursiveASTVisitor
Reid Kleckner [Fri, 25 Jan 2019 19:18:40 +0000 (19:18 +0000)]
[CodeGen] Implement isTriviallyRecursive with StmtVisitor instead of RecursiveASTVisitor

This code doesn't need to traverse types, lambdas, template arguments,
etc to detect trivial recursion. We can do a basic statement traversal
instead. This reduces the time spent compiling CodeGenModule.cpp, the
object file size (mostly reduced debug info), and the final executable
size by a small amount. I measured the exe mostly to check how much of
the overhead is from debug info, object file section headers, etc, vs
actual code.

metric   | before | after | diff
time (s) | 47.4   | 38.5  | -8.9
obj (kb) | 12888  | 12012 | -876
exe (kb) | 86072  | 85996 | -76

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

5 years agoRemove F16 literal support based on Float16 support.
Erich Keane [Fri, 25 Jan 2019 18:36:20 +0000 (18:36 +0000)]
Remove F16 literal support based on Float16 support.

Float16 support was disabled recently on many platforms, however that
commit still allowed literals of Float16 type to work.  This commit
removes those based on the same logic as Float16 disable.

Change-Id: I72243048ae2db3dc47bd3d699843e3edf9c395ea

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

5 years agoFix incorrect indent from r352221
Erich Keane [Fri, 25 Jan 2019 17:39:57 +0000 (17:39 +0000)]
Fix incorrect indent from r352221

Change-Id: I0a7b1443eb6912ef7bea1a4cf2f696fc01726557

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

5 years agoDisable _Float16 for non ARM/SPIR Targets
Erich Keane [Fri, 25 Jan 2019 17:27:57 +0000 (17:27 +0000)]
Disable _Float16 for non ARM/SPIR Targets

As Discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2019-January/129543.html

There are problems exposing the _Float16 type on architectures that
haven't defined the ABI/ISel for the type yet, so we're temporarily
disabling the type and making it opt-in.

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

Change-Id: I5db7366dedf1deb9485adb8948b1deb7e612a736

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

5 years agoAllow 'static' storage specifier on an out-of-line member function template
Erich Keane [Fri, 25 Jan 2019 17:01:42 +0000 (17:01 +0000)]
Allow 'static' storage specifier on an out-of-line member function template
declaration in MSVCCompat mode

Microsoft compiler permits the use of 'static' storage specifier outside
of a class definition if it's on an out-of-line member function template
declaration.

This patch allows 'static' storage specifier on an out-of-line member
function template declaration with a warning in Clang (To be compatible
with Microsoft).

Intel C/C++ compiler allows the 'static' keyword with a warning in
Microsoft mode. GCC allows this with -fpermissive.

Patch By: Manna

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

Change-Id: I97b2d9e9d57cecbcd545d17e2523142a85ca2702

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

5 years ago[NFC][Clang] Add driver tests for sb and predres
Diogo N. Sampaio [Fri, 25 Jan 2019 14:57:22 +0000 (14:57 +0000)]
[NFC][Clang] Add driver tests for sb and predres

Add tests that arguments for enabling/disabling
sb and predres are correctly being or not passed
by the driver.

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

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

5 years agoFix "control reaches end of non-void function" warning. NFCI.
Simon Pilgrim [Fri, 25 Jan 2019 11:36:51 +0000 (11:36 +0000)]
Fix "control reaches end of non-void function" warning. NFCI.

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

5 years agoRevert r352181 as it's breaking the bots
Anton Korobeynikov [Fri, 25 Jan 2019 10:35:35 +0000 (10:35 +0000)]
Revert r352181 as it's breaking the bots

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

5 years agoDisable PIC/PIE for MSP430 target by default.
Anton Korobeynikov [Fri, 25 Jan 2019 09:41:20 +0000 (09:41 +0000)]
Disable PIC/PIE for MSP430 target by default.

Relocatable code generation is meaningless on MSP430, as the platform is too small to use shared libraries.

Patch by Dmitry Mikushev!

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

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

5 years ago[MSP430] Ajust f32/f64 alignment according to MSP430 EABI
Anton Korobeynikov [Fri, 25 Jan 2019 08:51:53 +0000 (08:51 +0000)]
[MSP430] Ajust f32/f64 alignment according to MSP430 EABI

Patch by Kristina Bessonova!

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

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

5 years ago[X86] Remove mask and passthru arguments from vpconflict builtins. Use select in...
Craig Topper [Fri, 25 Jan 2019 07:08:22 +0000 (07:08 +0000)]
[X86] Remove mask and passthru arguments from vpconflict builtins. Use select in IR instead.

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

5 years ago[AArch64] Make the test for rsr and rsr64 stricter
Petr Hosek [Fri, 25 Jan 2019 02:42:30 +0000 (02:42 +0000)]
[AArch64] Make the test for rsr and rsr64 stricter

ACLE specifies that return type for rsr and rsr64 is uint32_t and
uint64_t respectively. D56852 change the return type of rsr64 from
unsigned long to unsigned long long which at least on Linux doesn't
match uint64_t, but the test isn't strict enough to detect that
because compiler implicitly converts unsigned long long to uint64_t,
but it breaks other uses such as printf with PRIx64 type specifier.
This change makes the test stricter enforcing that the return type
of rsr and rsr64 builtins is what is actually specified in ACLE.

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

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

5 years agoRevert "[AArch64] Use LL for 64-bit intrinsic arguments"
Petr Hosek [Fri, 25 Jan 2019 02:16:29 +0000 (02:16 +0000)]
Revert "[AArch64] Use LL for 64-bit intrinsic arguments"

This reverts commit r351740: this broke on platforms where unsigned long
long isn't the same as uint64_t which is what ACLE specifies for the
return value of rsr64.

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

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