]> granicus.if.org Git - clang/log
clang
6 years agoThread safety analysis: Handle conditional expression in getTrylockCallExpr
Aaron Puchert [Sat, 6 Oct 2018 01:09:28 +0000 (01:09 +0000)]
Thread safety analysis: Handle conditional expression in getTrylockCallExpr

Summary:
We unwrap conditional expressions containing try-lock functions.

Additionally we don't acquire on conditional expression branches, since
that is usually not helpful. When joining the branches we would almost
certainly get a warning then.

Hopefully fixes an issue that was raised in D52398.

Reviewers: aaron.ballman, delesley, hokein

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[COFF, ARM64] Add _InterlockedAdd intrinsic
Mandeep Singh Grang [Fri, 5 Oct 2018 21:57:41 +0000 (21:57 +0000)]
[COFF, ARM64] Add _InterlockedAdd intrinsic

Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, javed.absar, efriedma

Reviewed By: efriedma

Subscribers: efriedma, kristof.beyls, chrib, jfb, cfe-commits

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

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

6 years agoEmit CK_NoOp casts in C mode, not just C++.
James Y Knight [Fri, 5 Oct 2018 21:53:51 +0000 (21:53 +0000)]
Emit CK_NoOp casts in C mode, not just C++.

Previously, it had been using CK_BitCast even for casts that only
change const/restrict/volatile. Now it will use CK_Noop where
appropriate.

This is an alternate solution to r336746.

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

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

6 years ago[llvm-nm] Write "no symbol" output to stderr
Petr Hosek [Fri, 5 Oct 2018 21:10:03 +0000 (21:10 +0000)]
[llvm-nm] Write "no symbol" output to stderr

This matches the output of binutils' nm and ensures that any scripts
or tools that use nm and expect empty output in case there no symbols
don't break.

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

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

6 years ago[DebugInfo] Add support for DWARF5 call site-related attributes
Vedant Kumar [Fri, 5 Oct 2018 20:37:17 +0000 (20:37 +0000)]
[DebugInfo] Add support for DWARF5 call site-related attributes

DWARF v5 introduces DW_AT_call_all_calls, a subprogram attribute which
indicates that all calls (both regular and tail) within the subprogram
have call site entries. The information within these call site entries
can be used by a debugger to populate backtraces with synthetic tail
call frames.

Tail calling frames go missing in backtraces because the frame of the
caller is reused by the callee. Call site entries allow a debugger to
reconstruct a sequence of (tail) calls which led from one function to
another. This improves backtrace quality. There are limitations: tail
recursion isn't handled, variables within synthetic frames may not
survive to be inspected, etc. This approach is not novel, see:

  https://gcc.gnu.org/wiki/summit2010?action=AttachFile&do=get&target=jelinek.pdf

This patch adds an IR-level flag (DIFlagAllCallsDescribed) which lowers
to DW_AT_call_all_calls. It adds the minimal amount of DWARF generation
support needed to emit standards-compliant call site entries. For easier
deployment, when the debugger tuning is LLDB, the DWARF requirement is
adjusted to v4.

Testing: Apart from check-{llvm, clang}, I built a stage2 RelWithDebInfo
clang binary. Its dSYM passed verification and grew by 1.4% compared to
the baseline. 151,879 call site entries were added.

rdar://42001377

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

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

6 years ago[COFF, ARM64] Add _InterlockedCompareExchangePointer_nf intrinsic
Mandeep Singh Grang [Fri, 5 Oct 2018 19:49:36 +0000 (19:49 +0000)]
[COFF, ARM64] Add _InterlockedCompareExchangePointer_nf intrinsic

Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, efriedma

Reviewed By: efriedma

Subscribers: efriedma, kristof.beyls, chrib, jfb, cfe-commits

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

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

6 years ago[CUDA] Use all 64 bits of GUID in __nv_module_id
Artem Belevich [Fri, 5 Oct 2018 18:39:58 +0000 (18:39 +0000)]
[CUDA] Use all 64 bits of GUID in __nv_module_id

getGUID() returns an uint64_t and "%x" only prints 32 bits of it.
Use PRIx64 format string to print all 64 bits.

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

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

6 years agoclang-format: Don't insert spaces in front of :: for Java 8 Method References.
Nico Weber [Fri, 5 Oct 2018 18:22:21 +0000 (18:22 +0000)]
clang-format: Don't insert spaces in front of :: for Java 8 Method References.

The existing code kept the space if it was there for identifiers, and it didn't
handle `this`. After this patch, for Java `this` is handled in addition to
identifiers, and existing space is always stripped between identifier and `::`.

Also accept `::` in addition to `.` in front of `<` in `foo::<T>bar` generic
calls.

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

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

6 years agoEmit diagnostic note when calling an invalid function declaration.
James Y Knight [Fri, 5 Oct 2018 17:49:48 +0000 (17:49 +0000)]
Emit diagnostic note when calling an invalid function declaration.

The comment said it was intentionally not emitting any diagnostic
because the declaration itself was already diagnosed. However,
everywhere else that wants to not emit a diagnostic without an extra
note emits note_invalid_subexpr_in_const_expr instead, which gets
suppressed later.

This was the only place which did not emit a diagnostic note.

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

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

6 years ago[clang-format] Java import sorting in clang-format
Krasimir Georgiev [Fri, 5 Oct 2018 17:19:26 +0000 (17:19 +0000)]
[clang-format] Java import sorting in clang-format

Contributed by SamMaier!

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

6 years ago[OPENMP][NVPTX] Fix emission of __kmpc_global_thread_num() for non-SPMD
Alexey Bataev [Fri, 5 Oct 2018 15:27:47 +0000 (15:27 +0000)]
[OPENMP][NVPTX] Fix emission of __kmpc_global_thread_num() for non-SPMD
mode.

__kmpc_global_thread_num() should be called before initialization of the
runtime.

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

6 years ago[OPENMP] Fix emission of the __kmpc_global_thread_num.
Alexey Bataev [Fri, 5 Oct 2018 15:08:53 +0000 (15:08 +0000)]
[OPENMP] Fix emission of the __kmpc_global_thread_num.

Fixed emission of the __kmpc_global_thread_num() so that it is not
messed up with alloca instructions anymore. Plus, fixes emission of the
__kmpc_global_thread_num() functions in the target outlined regions so
that they are not called before runtime is initialized.

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

6 years agoFix llvm-clang-x86_64-expensive-checks-win build by setting bigobj flag.
Simon Pilgrim [Fri, 5 Oct 2018 12:33:57 +0000 (12:33 +0000)]
Fix llvm-clang-x86_64-expensive-checks-win build by setting bigobj flag.

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

6 years ago[AArch64] Use filecheck captures for metadata node numbers in test. NFC
David Green [Fri, 5 Oct 2018 10:21:25 +0000 (10:21 +0000)]
[AArch64] Use filecheck captures for metadata node numbers in test. NFC

Just a quick fix for cases where extra metadata members are present.

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

6 years ago[WebAssembly] abs and sqrt builtins
Thomas Lively [Fri, 5 Oct 2018 01:02:54 +0000 (01:02 +0000)]
[WebAssembly] abs and sqrt builtins

Summary: Depends on D52910.

Reviewers: aheejin, dschuff, craig.topper

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

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

6 years ago[WebAssembly] any_true and all_true builtins
Thomas Lively [Fri, 5 Oct 2018 00:59:37 +0000 (00:59 +0000)]
[WebAssembly] any_true and all_true builtins

Summary: Depends on D52858.

Reviewers: aheejin, dschuff, craig.topper

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

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

6 years ago[WebAssembly] saturating arithmetic builtins
Thomas Lively [Fri, 5 Oct 2018 00:58:56 +0000 (00:58 +0000)]
[WebAssembly] saturating arithmetic builtins

Summary: Depends on D52856.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

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

6 years ago[WebAssembly] __builtin_wasm_replace_lane_* builtins
Thomas Lively [Fri, 5 Oct 2018 00:58:07 +0000 (00:58 +0000)]
[WebAssembly] __builtin_wasm_replace_lane_* builtins

Summary: Depends on D52852.

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

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

6 years ago[WebAssembly] __builtin_wasm_extract_lane_* builtins
Thomas Lively [Fri, 5 Oct 2018 00:54:44 +0000 (00:54 +0000)]
[WebAssembly] __builtin_wasm_extract_lane_* builtins

Reviewers: aheejin, dschuff

Subscribers: sbc100, jgravelle-google, sunfish, kristina, cfe-commits

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

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

6 years agoThread safety analysis: Examine constructor arguments
Aaron Puchert [Thu, 4 Oct 2018 23:51:14 +0000 (23:51 +0000)]
Thread safety analysis: Examine constructor arguments

Summary:
Instead of only examining call arguments, we also examine constructor
arguments applying the same rules.

That was an opportunity for refactoring the examination procedure to
work with iterators instead of integer indices. For the case of
CallExprs no functional change is intended.

Reviewers: aaron.ballman, delesley

Reviewed By: delesley

Subscribers: JonasToth, cfe-commits

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

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

6 years ago[COFF, ARM64] Add __getReg intrinsic
Mandeep Singh Grang [Thu, 4 Oct 2018 22:32:42 +0000 (22:32 +0000)]
[COFF, ARM64] Add __getReg intrinsic

Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, javed.absar, efriedma

Reviewed By: efriedma

Subscribers: peter.smith, efriedma, kristof.beyls, chrib, cfe-commits

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

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

6 years agoUpdate Clang Windows getting started docs
Reid Kleckner [Thu, 4 Oct 2018 20:34:52 +0000 (20:34 +0000)]
Update Clang Windows getting started docs

Summary:
- Update the example VS project generation to use VS2017.
- Add docs for generating ninja build files, since they are popular.
- Remove reference to "make update" which no longer exists. Mention the
  monorepo instead.
- Try to explain gnuwin32/coreutils requirements better.
- Use https:// links where possible

Reviewers: zturner, STL_MSFT

Subscribers: jfb, cfe-commits

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

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

6 years ago[AST] Revert mangling changes from r339428
Shoaib Meenai [Thu, 4 Oct 2018 19:50:14 +0000 (19:50 +0000)]
[AST] Revert mangling changes from r339428

As discussed in https://reviews.llvm.org/D50144, we want Obj-C classes
to have the same mangling as C++ structs, to support headers like the
following:

```
@class I;
struct I;

void f(I *);
```

since the header can be used from both C++ and Obj-C++ TUs, and we want
a consistent mangling across the two to prevent link errors. Itanium
mangles both the same way, and so should the MS ABI.

The main concern with having the same mangling for C++ structs and Obj-C
classes was that we want to treat them differently for the purposes of
exception handling, e.g. we don't want a C++ catch statement for a
struct to be able to catch an Obj-C class with the same name as the
struct. We can accomplish this by mangling Obj-C class names differently
in their RTTI, which I'll do in a follow-up patch.

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

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

6 years ago[NestedNameSpecifier] Add missing stream-specific dump methods
Stephen Kelly [Thu, 4 Oct 2018 19:22:00 +0000 (19:22 +0000)]
[NestedNameSpecifier] Add missing stream-specific dump methods

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[clang] Add the exclude_from_explicit_instantiation attribute
Louis Dionne [Thu, 4 Oct 2018 15:49:42 +0000 (15:49 +0000)]
[clang] Add the exclude_from_explicit_instantiation attribute

Summary:
This attribute allows excluding a member of a class template from being part
of an explicit template instantiation of that class template. This also makes
sure that code using such a member will not take for granted that an external
instantiation exists in another translation unit. The attribute was discussed
on cfe-dev at [1] and is primarily motivated by the removal of always_inline
in libc++ to control what's part of the ABI (see links in [1]).

[1]: http://lists.llvm.org/pipermail/cfe-dev/2018-August/059024.html

rdar://problem/43428125

Reviewers: rsmith

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[Index] Respect "IndexFunctionLocals" option for type loc.
Haojian Wu [Thu, 4 Oct 2018 11:03:55 +0000 (11:03 +0000)]
[Index] Respect "IndexFunctionLocals" option for type loc.

Summary:
Previously, clang index ignored local symbols defined in the function body even
IndexFunctionLocals is true.

Reviewers: sammccall

Reviewed By: sammccall

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

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

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

6 years ago[constexpr] Fix ICE when memcpy() is given a pointer to an incomplete array
Petr Pavlu [Thu, 4 Oct 2018 09:25:44 +0000 (09:25 +0000)]
[constexpr] Fix ICE when memcpy() is given a pointer to an incomplete array

Fix code for constant evaluation of __builtin_memcpy() and
__builtin_memmove() that would attempt to divide by zero when given two
pointers to an incomplete array.

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

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

6 years ago[AArch64][ARM] Context sensitive meaning of crypto
Sjoerd Meijer [Thu, 4 Oct 2018 07:38:53 +0000 (07:38 +0000)]
[AArch64][ARM] Context sensitive meaning of crypto

For AArch64, crypto means:
- sm4 + sha3 + sha2 + aes for Armv8.4-A and up, and
- sha2 + aes for Armv8.3-A and earlier.

For AArch32:
Crypto means sha2 + aes, because the Armv8.2-A crypto instructions
were added to AArch64 only.

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

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

6 years ago[analyzer] [quickfix] Temporarily disabling a failing test.
George Karpenkov [Thu, 4 Oct 2018 00:07:45 +0000 (00:07 +0000)]
[analyzer] [quickfix] Temporarily disabling a failing test.

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

6 years ago[llvm-nm] Update clang tests based on changed llvm-nm output
Jordan Rupprecht [Wed, 3 Oct 2018 23:40:04 +0000 (23:40 +0000)]
[llvm-nm] Update clang tests based on changed llvm-nm output

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

6 years ago[SEMA] split ExtWarn dupl-decl-spec's into Extension and ExtWarn
Nick Desaulniers [Wed, 3 Oct 2018 23:09:29 +0000 (23:09 +0000)]
[SEMA] split ExtWarn dupl-decl-spec's into Extension and ExtWarn

Summary:
For types deduced from typedef's and typeof's, don't warn for duplicate
declaration specifiers in C90 unless -pedantic.

Create a third diagnostic type for duplicate declaration specifiers.
Previously, we had an ExtWarn and a Warning. This change adds a third,
Extension, which only warns when -pedantic is set, staying silent
otherwise.

Fixes PR32985.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: srhines, cfe-commits

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

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

6 years agoRevert "[ASTMatchers] Fix DynamicASTMatchersTests again"
Fangrui Song [Wed, 3 Oct 2018 22:56:26 +0000 (22:56 +0000)]
Revert "[ASTMatchers] Fix DynamicASTMatchersTests again"

This reverts commit 8a6631a983ec9c1d22cc77c5f55a524a651740f0.

The last fix seems good in Debug mode.

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

6 years ago[analyzer] [tests] [quickfix] Make more test more resilient for non-defaut -std.
Artem Dergachev [Wed, 3 Oct 2018 22:48:00 +0000 (22:48 +0000)]
[analyzer] [tests] [quickfix] Make more test more resilient for non-defaut -std.

It is important to specify the version of the standard because tests should
test the same thing regardless of the current default version of the standard.

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

6 years ago[analyzer] Do not crash if the assumption added in TrustNonNullChecker is enough...
George Karpenkov [Wed, 3 Oct 2018 22:31:09 +0000 (22:31 +0000)]
[analyzer] Do not crash if the assumption added in TrustNonNullChecker is enough to make the state unfeasible

rdar://43541814

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

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

6 years ago[ASTMatchers] Fix DynamicASTMatchersTests again
Fangrui Song [Wed, 3 Oct 2018 21:00:44 +0000 (21:00 +0000)]
[ASTMatchers] Fix DynamicASTMatchersTests again

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

6 years ago[test] Fix -Wunused-variable in rC343665
Fangrui Song [Wed, 3 Oct 2018 20:53:53 +0000 (20:53 +0000)]
[test] Fix -Wunused-variable in rC343665

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

6 years agoRemove stray character from docs
Stephen Kelly [Wed, 3 Oct 2018 20:53:02 +0000 (20:53 +0000)]
Remove stray character from docs

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

6 years agoUpdate documentation for correctness
Stephen Kelly [Wed, 3 Oct 2018 20:52:57 +0000 (20:52 +0000)]
Update documentation for correctness

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

6 years agoAdd matchers missing from dynamic AST registry
Stephen Kelly [Wed, 3 Oct 2018 20:52:51 +0000 (20:52 +0000)]
Add matchers missing from dynamic AST registry

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

6 years agoSort list of matchers
Stephen Kelly [Wed, 3 Oct 2018 20:52:45 +0000 (20:52 +0000)]
Sort list of matchers

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

6 years ago[analyzer] [tests] [quickfix] Make the test more resilient for a non-defaut std confi...
George Karpenkov [Wed, 3 Oct 2018 20:46:50 +0000 (20:46 +0000)]
[analyzer] [tests] [quickfix] Make the test more resilient for a non-defaut std configuration

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

6 years ago[OPENMP] Add reverse_offload clause to requires directive
Patrick Lyster [Wed, 3 Oct 2018 20:07:58 +0000 (20:07 +0000)]
[OPENMP] Add reverse_offload clause to requires directive

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

6 years agoAdd template type and value parameter metadata nodes to template variable specializations
Matthew Voss [Wed, 3 Oct 2018 18:45:04 +0000 (18:45 +0000)]
Add template type and value parameter metadata nodes to template variable specializations

Summary: Add an optional attribute referring to a tuple of type and value template parameter nodes to the DIGlobalVariable node. This allows us to record the parameters of template variable specializations.

Reviewers: dblaikie, aprantl, probinson, JDevlieghere, clayborg, jingham

Reviewed By: JDevlieghere

Subscribers: cfe-commits

Tags: #debug-info

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

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

6 years ago[test] Use --sysroot instead of -B in print-multi-directory.c
Martin Storsjo [Wed, 3 Oct 2018 18:24:05 +0000 (18:24 +0000)]
[test] Use --sysroot instead of -B in print-multi-directory.c

This avoids finding a similar matching GCC installation outside
of the test directory tree in the surrounding environment, which
would make the test fail. (This happened on Ubuntu 16.04.)

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

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

6 years ago[COFF, ARM64] Add _ReadWriteBarrier intrinsic
Mandeep Singh Grang [Wed, 3 Oct 2018 17:24:21 +0000 (17:24 +0000)]
[COFF, ARM64] Add _ReadWriteBarrier intrinsic

Reviewers: rnk, mstorsjo, compnerd, TomTan, haripul, javed.absar

Reviewed By: rnk

Subscribers: kristof.beyls, chrib, jfb, cfe-commits

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

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

6 years agoThread safety analysis: Unwrap __builtin_expect in getTrylockCallExpr
Aaron Puchert [Wed, 3 Oct 2018 11:58:19 +0000 (11:58 +0000)]
Thread safety analysis: Unwrap __builtin_expect in getTrylockCallExpr

Summary:
When people are really sure they'll get the lock they sometimes use
__builtin_expect. It's also used by some assertion implementations.
Asserting that try-lock succeeded is basically the same as asserting
that the lock is not held by anyone else (and acquiring it).

Reviewers: aaron.ballman, delesley

Reviewed By: aaron.ballman

Subscribers: kristina, cfe-commits

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

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

6 years agoAllow comments with '#' in dynamic AST Matchers
Stephen Kelly [Wed, 3 Oct 2018 07:56:43 +0000 (07:56 +0000)]
Allow comments with '#' in dynamic AST Matchers

Summary: This is necessary for clang-query to be able to handle comments.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[Frontend] Delete -print-decl-contexts
Fangrui Song [Wed, 3 Oct 2018 03:50:44 +0000 (03:50 +0000)]
[Frontend] Delete -print-decl-contexts

Summary: Its job is covered by -ast-dump. The option is rarely used and lacks many AST nodes which will lead to llvm_unreachable() crash.

Reviewers: rsmith, arphaman

Reviewed By: rsmith

Subscribers: jfb, cfe-commits

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

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

6 years agoOpenCL: Mark printf format string argument
Matt Arsenault [Wed, 3 Oct 2018 02:01:19 +0000 (02:01 +0000)]
OpenCL: Mark printf format string argument

Fixes not warning on format string errors.

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

6 years ago[CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain
Petr Hosek [Wed, 3 Oct 2018 01:27:00 +0000 (01:27 +0000)]
[CMake][Fuchsia] Use libc++ ABIv2 for Fuchsia toolchain

We don't need to provide stable ABI and hence we can use the v2.

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

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

6 years ago[analyzer] [tests] Hotfix: missing space
George Karpenkov [Tue, 2 Oct 2018 22:31:44 +0000 (22:31 +0000)]
[analyzer] [tests] Hotfix: missing space

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

6 years agoRemove spurious assertion in -Wdocumentation
Reid Kleckner [Tue, 2 Oct 2018 22:23:27 +0000 (22:23 +0000)]
Remove spurious assertion in -Wdocumentation

Some code in OpenCV uses interesting doxygen directives that make it so
we don't see any tokens inside a @note, despite there definitely being
non-whitespace characters there. The consistency check isn't needed.
ParagraphComment supports receiving an empty list of comments.

Fixes PR39007

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

6 years ago[analyzer] [tests] Allow specifying entire -analyze-config on the command line, make...
George Karpenkov [Tue, 2 Oct 2018 21:19:23 +0000 (21:19 +0000)]
[analyzer] [tests] Allow specifying entire -analyze-config on the command line, make sure it's always propagated

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

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

6 years ago[analyzer] Fix crash in exploded graph dumping
George Karpenkov [Tue, 2 Oct 2018 21:19:01 +0000 (21:19 +0000)]
[analyzer] Fix crash in exploded graph dumping

By allocating new DeclStmt to ASTContext

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

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

6 years ago[analyzer] Promote StdCLibraryFunctionsChecker to the apiModeling category.
Artem Dergachev [Tue, 2 Oct 2018 20:50:40 +0000 (20:50 +0000)]
[analyzer] Promote StdCLibraryFunctionsChecker to the apiModeling category.

Because all our languages are C-based, there's no reason to
enable this checker only on UNIX targets.

Patch by Donát Nagy!

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

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

6 years ago[analyzer] Fix symbol discovery in nonloc::LocAsInteger values.
Artem Dergachev [Tue, 2 Oct 2018 20:48:12 +0000 (20:48 +0000)]
[analyzer] Fix symbol discovery in nonloc::LocAsInteger values.

Doesn't do much despite sounding quite bad, but fixes an exotic test case where
liveness of a nonloc::LocAsInteger array index is now evaluated correctly.

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

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

6 years ago[cl-compat] Change /JMC from unsupported to ignored.
Zachary Turner [Tue, 2 Oct 2018 20:42:36 +0000 (20:42 +0000)]
[cl-compat] Change /JMC from unsupported to ignored.

A tracking bug for actually implementing this in clang-cl is at
https://bugs.llvm.org/show_bug.cgi?id=39156.

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

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

6 years ago[analyzer][NFC] Refactor functions in PlistDiagnostics to take AnalyzerOptions as...
Kristof Umann [Tue, 2 Oct 2018 19:27:34 +0000 (19:27 +0000)]
[analyzer][NFC] Refactor functions in PlistDiagnostics to take AnalyzerOptions as parameter

I intend to add a new flag macro-expnasions-as-events, and unfortunately
I'll only be able to convert the macro piece into an event one once I'm
about to emit it, due to the lack of an avaible Preprocessor object in
the BugReporter.

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

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

6 years ago[OpenMP][NVPTX] Simplify codegen for orphaned parallel, NFCI.
Jonas Hahnfeld [Tue, 2 Oct 2018 19:12:54 +0000 (19:12 +0000)]
[OpenMP][NVPTX] Simplify codegen for orphaned parallel, NFCI.

Worker threads fork off to the compiler generated worker function
directly after entering the kernel function. Hence, there is no
need to check whether the current thread is the master if we are
outside of a parallel region (neither SPMD nor parallel_level > 0).

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

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

6 years ago[OpenMP] Simplify code for reductions on distribute directives, NFC.
Jonas Hahnfeld [Tue, 2 Oct 2018 19:12:47 +0000 (19:12 +0000)]
[OpenMP] Simplify code for reductions on distribute directives, NFC.

Only need to care about the 'distribute simd' case, all other composite
directives are handled elsewhere. This was already reflected in the
outer 'if' condition, so all other inner conditions could never be true.

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

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

6 years ago[HIP] Support early finalization of device code for -fno-gpu-rdc
Yaxun Liu [Tue, 2 Oct 2018 17:48:54 +0000 (17:48 +0000)]
[HIP] Support early finalization of device code for -fno-gpu-rdc

This patch renames -f{no-}cuda-rdc to -f{no-}gpu-rdc and keeps the original
options as aliases. When -fgpu-rdc is off,
clang will assume the device code in each translation unit does not call
external functions except those in the device library, therefore it is possible
to compile the device code in each translation unit to self-contained kernels
and embed them in the host object, so that the host object behaves like
usual host object which can be linked by lld.

The benefits of this feature is: 1. allow users to create static libraries which
can be linked by host linker; 2. amortized device code linking time.

This patch modifies HIP action builder to insert actions for linking device
code and generating HIP fatbin, and pass HIP fatbin to host backend action.
It extracts code for constructing command for generating HIP fatbin as
a function so that it can be reused by early finalization. It also modifies
codegen of HIP host constructor functions to embed the device fatbin
when it is available.

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

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

6 years agoclang-format: better handle statement macros
Francois Ferrand [Tue, 2 Oct 2018 16:37:51 +0000 (16:37 +0000)]
clang-format: better handle statement macros

Summary:
Some macros are used in the body of function, and actually contain the trailing semicolon: they should thus be automatically followed by a new line, and not get merged with the next line. This is for example the case with Qt's Q_UNUSED macro:

  void foo(int a, int b) {
    Q_UNUSED(a)
    return b;
  }

This patch deals with these cases by introducing a new option to specify list of statement macros. This re-uses the system already in place for foreach macros, to ensure there is no impact on performance.

Reviewers: krasimir, djasper, klimek

Reviewed By: krasimir

Subscribers: acoomans, mgrang, alexfh, klimek, cfe-commits

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

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

6 years ago[Preprocesssor] Filename should fall back to the written name when typo correction...
Haojian Wu [Tue, 2 Oct 2018 14:42:51 +0000 (14:42 +0000)]
[Preprocesssor] Filename should fall back to the written name when typo correction fails.

Summary:
The test is added in  Testcase is at https://reviews.llvm.org/D52775. I tried to add the test to clang's code
completion test, it doesn't reproduce the crash.

Reviewers: sammccall, kristina

Reviewed By: sammccall

Subscribers: kristina, ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits

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

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

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