]> granicus.if.org Git - clang/log
clang
5 years agoFurther relax restriction in tests to include where "-E" and "-S" must appear.
Douglas Yung [Thu, 14 Feb 2019 21:37:19 +0000 (21:37 +0000)]
Further relax restriction in tests to include where "-E" and "-S" must appear.

Also updated a few instances of "-emit-llvm-bc" and "-emit-obj" that were missed in the previous change.

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

5 years ago[CodeGenObjC] Emit [[X alloc] init] as objc_alloc_init(X) when available
Erik Pilkington [Thu, 14 Feb 2019 19:58:37 +0000 (19:58 +0000)]
[CodeGenObjC] Emit [[X alloc] init] as objc_alloc_init(X) when available

This provides a code size win on the caller side, since the init
message send is done in the runtime function.

rdar://44987038

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

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

5 years ago[X86] Add clang support for X86 flag output parameters.
Nirav Dave [Thu, 14 Feb 2019 19:27:25 +0000 (19:27 +0000)]
[X86] Add clang support for X86 flag output parameters.

Summary:
Add frontend support and expected flags for X86 inline assembly flag
parameters.

Reviewers: craig.topper, rnk, echristo

Subscribers: eraman, nickdesaulniers, void, llvm-commits

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

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

5 years ago[Sema] Fix a regression introduced in "[AST][Sema] Remove CallExpr::setNumArgs"
Bruno Ricci [Thu, 14 Feb 2019 15:43:17 +0000 (15:43 +0000)]
[Sema] Fix a regression introduced in "[AST][Sema] Remove CallExpr::setNumArgs"

D54902 removed CallExpr::setNumArgs in preparation of tail-allocating the
arguments of CallExpr. It did this by allocating storage for
max(number of arguments, number of parameters in the prototype). The
temporarily nulled arguments however causes issues in BuildResolvedCallExpr
when typo correction is done just after the creation of the call expression.

This was unfortunately missed by the tests /:

To fix this, delay setting the number of arguments to
max(number of arguments, number of parameters in the prototype) until we are
ready for it. It would be nice to have this encapsulated in CallExpr but this
is the best I can come up with under the constraint that we cannot add
anything the CallExpr.

Fixes PR40286.

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

Reviewed By: aaron.ballman

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

5 years ago[ASTImporter] Check visibility/linkage of functions and variables
Gabor Marton [Thu, 14 Feb 2019 13:07:03 +0000 (13:07 +0000)]
[ASTImporter] Check visibility/linkage of functions and variables

Summary:
During import of a global variable with external visibility the lookup
will find variables (with the same name) but with static visibility.
Clearly, we cannot put them into the same redecl chain.  The same is
true in case of functions.  In this fix we filter the lookup results and
consider only those which have the same visibility as the decl we
currently import.

We consider two decls in two anonymous namsepaces to have the same
visibility only if they are imported from the very same translation
unit.

Reviewers: a_sidorin, shafik, a.sidorin

Reviewed By: shafik

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

Tags: #clang

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

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

5 years ago[Builtins] Treat `bcmp` as a builtin.
Clement Courbet [Thu, 14 Feb 2019 12:00:34 +0000 (12:00 +0000)]
[Builtins] Treat `bcmp` as a builtin.

Summary:
This makes it consistent with `memcmp` and `__builtin_bcmp`.

Also see the discussion in https://reviews.llvm.org/D56593.

Reviewers: jyknight

Subscribers: kristina, cfe-commits

Tags: #clang

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

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

5 years agoPrint a note to the called macro when diagnosing err_embedded_directive
Nico Weber [Thu, 14 Feb 2019 04:13:17 +0000 (04:13 +0000)]
Print a note to the called macro when diagnosing err_embedded_directive

Fixes PR40713, see there for the motivation for this.

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

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

5 years ago[NewPM] Add explicit triple to test
Francis Visoiu Mistrih [Thu, 14 Feb 2019 04:13:00 +0000 (04:13 +0000)]
[NewPM] Add explicit triple to test

This prevents warnings like:

> warning: overriding the module target triple with x86_64-apple-darwin

on macOS.

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

5 years ago[CUDA][HIP] Use device side kernel and variable names when registering them
Yaxun Liu [Thu, 14 Feb 2019 02:00:09 +0000 (02:00 +0000)]
[CUDA][HIP] Use device side kernel and variable names when registering them

__hipRegisterFunction and __hipRegisterVar need to accept device side kernel and variable names
so that HIP runtime can associate kernel stub functions in host code with kernel symbols in fat binaries,
and associate shadow variables in host code with device variables in fat binaries.

Currently, clang assumes kernel functions and device variables have the same name as the kernel
stub functions and shadow variables. However, when host is compiled in windows with MSVC C++
ABI and device is compiled with Itanium C++ ABI (e.g. AMDGPU), kernels and device symbols in fat
binary are mangled differently than host.

This patch gets the device side kernel and variable name by mangling them in the mangle context
of aux target.

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

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

5 years agoRelax restriction in tests to where "-emit-llvm-bc" and "-emit-obj" must appear.
Douglas Yung [Thu, 14 Feb 2019 01:11:32 +0000 (01:11 +0000)]
Relax restriction in tests to where "-emit-llvm-bc" and "-emit-obj" must appear.

The CHECK lines as structured were requiring them to appear only in a certain
position while all that is really needed is to check that they are present.

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

5 years agoFix for asan bots
Leonard Chan [Thu, 14 Feb 2019 01:07:47 +0000 (01:07 +0000)]
Fix for asan bots

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

5 years ago[HWASAN] Updated HWASAN design document to better portray the chance of missing a...
Mitch Phillips [Wed, 13 Feb 2019 23:14:54 +0000 (23:14 +0000)]
[HWASAN] Updated HWASAN design document to better portray the chance of missing a bug.

Summary: Provided rule of thumb percentage chances of miss for 4 and 8 bit tag sizes.

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[NewPM] Second attempt at porting ASan
Leonard Chan [Wed, 13 Feb 2019 22:22:48 +0000 (22:22 +0000)]
[NewPM] Second attempt at porting ASan

This is the second attempt to port ASan to new PM after D52739. This takes the
initialization requried by ASan from the Module by moving it into a separate
class with it's own analysis that the new PM ASan can use.

Changes:
- Split AddressSanitizer into 2 passes: 1 for the instrumentation on the
  function, and 1 for the pass itself which creates an instance of the first
  during it's run. The same is done for AddressSanitizerModule.
- Add new PM AddressSanitizer and AddressSanitizerModule.
- Add legacy and new PM analyses for reading data needed to initialize ASan with.
- Removed DominatorTree dependency from ASan since it was unused.
- Move GlobalsMetadata and ShadowMapping out of anonymous namespace since the
  new PM analysis holds these 2 classes and will need to expose them.

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

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

5 years agoRestore Check for Unreachable Exit Block in -Winfinite-recursion
Robert Widmann [Wed, 13 Feb 2019 22:22:23 +0000 (22:22 +0000)]
Restore Check for Unreachable Exit Block in -Winfinite-recursion

Summary:
When this was rewritten in D43737, the logic changed to better explore infinite loops. The check for a reachable exit block was deleted which accidentally introduced false positives in case the exit node was unreachable.

We were testing for cases like this, but @steven_wu provided an additional test case that I've included in the regression tests for this patch.

Reviewers: steven_wu, rtrieu

Reviewed By: steven_wu, rtrieu

Subscribers: cfe-commits, steven_wu

Tags: #clang

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

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

5 years ago[WebAssembly] Bulk memory intrinsics and builtins
Thomas Lively [Wed, 13 Feb 2019 22:11:16 +0000 (22:11 +0000)]
[WebAssembly] Bulk memory intrinsics and builtins

Summary:
implements llvm intrinsics and clang intrinsics for
memory.init and data.drop.

Reviewers: aheejin

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits

Tags: #clang

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

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

5 years ago[Sema] Delay checking whether objc_designated_initializer is being applied to an...
Erik Pilkington [Wed, 13 Feb 2019 20:32:37 +0000 (20:32 +0000)]
[Sema] Delay checking whether objc_designated_initializer is being applied to an init method

This fixes a regression that was caused by r335084, which reversed
the order that attributes are applied. objc_method_family can change
whether a method is an init method, so the order that these
attributes are applied matters. The commit fixes this by delaying the
init check until after all attributes have been applied.

rdar://47829358

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

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

5 years ago[PowerPC] Stop defining _ARCH_PWR6X on POWER7 and up
Hubert Tong [Wed, 13 Feb 2019 20:17:13 +0000 (20:17 +0000)]
[PowerPC] Stop defining _ARCH_PWR6X on POWER7 and up

Summary:
The predefined macro `_ARCH_PWR6X` is associated with GCC's
`-mcpu=power6x` option, which enables generation of P6 "raw mode"
instructions such as `mftgpr`.

Later POWER processors build upon the "architected mode", not the raw
one. `_ARCH_PWR6X` should not be defined for these later processors.

Fixes PR#40236.

Reviewers: echristo, hfinkel, kbarton, nemanjai, wschmidt

Reviewed By: hfinkel

Subscribers: jsji, cfe-commits

Tags: #clang

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

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

5 years ago[clang] Make sure C99/C11 features in <float.h> are provided in C++11
Louis Dionne [Wed, 13 Feb 2019 19:08:01 +0000 (19:08 +0000)]
[clang] Make sure C99/C11 features in <float.h> are provided in C++11

Summary:
Previously, those #defines were only provided in C or when GNU extensions were
enabled. We need those #defines in C++11 and above, too.

Reviewers: jfb, eli.friedman

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years agoRe-enable the test disabled in r353836 and hopefully make it pass in gcc builds
Nico Weber [Wed, 13 Feb 2019 19:04:26 +0000 (19:04 +0000)]
Re-enable the test disabled in r353836 and hopefully make it pass in gcc builds

Argument evaluation order is different between gcc and clang, so pull out
the Builder calls to make the generated IR independent of the host compiler's
argument evaluation order.  Thanks to rnk for reminding me of this clang/gcc
difference.

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

5 years ago[Headers][mips] Add `__attribute__((__mode__(__unwind_word__)))` to the _Unwind_Word...
Simon Atanasyan [Wed, 13 Feb 2019 18:27:09 +0000 (18:27 +0000)]
[Headers][mips] Add `__attribute__((__mode__(__unwind_word__)))` to the _Unwind_Word / _Unwind_SWord definitions

The rationale of this change is to fix _Unwind_Word / _Unwind_SWord
definitions for MIPS N32 ABI. This ABI uses 32-bit pointers,
but _Unwind_Word and _Unwind_SWord types are eight bytes long.

 # The __attribute__((__mode__(__unwind_word__))) is added to the type
   definitions. It makes them equal to the corresponding definitions used
   by GCC and allows to override types using `getUnwindWordWidth` function.
 # The `getUnwindWordWidth` virtual function override in the `MipsTargetInfo`
   class and provides correct type size values.

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

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

5 years ago[Driver] Pass +reserve-x25 to backend if -ffixed-x25 is specified
Petr Hosek [Wed, 13 Feb 2019 18:01:23 +0000 (18:01 +0000)]
[Driver] Pass +reserve-x25 to backend if -ffixed-x25 is specified

This was accidentally omitted in r353957 breaking the Clang test.

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

5 years ago[AArch64] Support reserving arbitrary general purpose registers
Petr Hosek [Wed, 13 Feb 2019 17:28:47 +0000 (17:28 +0000)]
[AArch64] Support reserving arbitrary general purpose registers

This is a follow up to D48580 and D48581 which allows reserving
arbitrary general purpose registers with the exception of registers
with special purpose (X8, X16-X18, X29, X30) and registers used by LLVM
(X0, X19). This change also generalizes some of the existing logic to
rely entirely on values generated from tablegen.

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

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

5 years ago[HIP] Handle compile -m options and propagate into LLC
Aaron Enye Shi [Wed, 13 Feb 2019 16:12:16 +0000 (16:12 +0000)]
[HIP] Handle compile -m options and propagate into LLC

Allow the compile options for -m such as -mxnack/-mno-xnack, -msram-ecc/-mno-sram-ecc, -mcode-object-v3/-mno-code-object-v3 to propagate into LLC args. Fix an issue where -mattr was pushed even when it was empty.

Also add lit tests to verify features are properly passed.

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

Reviewers: yaxunl, kzhuravl

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

5 years ago[test] Tweak driver test from r353917 and r353922 to pass with a nondefault CLANG_DEF...
Martin Storsjo [Wed, 13 Feb 2019 13:13:45 +0000 (13:13 +0000)]
[test] Tweak driver test from r353917 and r353922 to pass with a nondefault CLANG_DEFAULT_LINKER

Force -fuse-ld=ld, as some other tests in the same file do.

Loosen the regex matching the linker tool name as well, as this
can end up being <triple>-ld in case such a named tool exists.

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

5 years ago[Analyzer] Crash fix for FindLastStoreBRVisitor
Adam Balogh [Wed, 13 Feb 2019 12:25:47 +0000 (12:25 +0000)]
[Analyzer] Crash fix for FindLastStoreBRVisitor

FindLastStoreBRVisitor tries to find the first node in the exploded graph where
the current value was assigned to a region. This node is called the "store
site". It is identified by a pair of Pred and Succ nodes where Succ already has
the binding for the value while Pred does not have it. However the visitor
mistakenly identifies a node pair as the store site where the value is a
`LazyCompoundVal` and `Pred` does not have a store yet but `Succ` has it. In
this case the `LazyCompoundVal` is different in the `Pred` node because it also
contains the store which is different in the two nodes. This error may lead to
crashes (a declaration is cast to a parameter declaration without check) or
misleading bug path notes.

In this patch we fix this problem by checking for unequal `LazyCompoundVals`: if
their region is equal, and their store is the same as the store of their nodes
we consider them as equal when looking for the "store site". This is an
approximation because we do not check for differences of the subvalues
(structure members or array elements) in the stores.

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

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

5 years agoLook through typedefs in getFunctionTypeWithExceptionSpec
Stephan Bergmann [Wed, 13 Feb 2019 09:39:17 +0000 (09:39 +0000)]
Look through typedefs in getFunctionTypeWithExceptionSpec

Fixes https://bugs.llvm.org/show_bug.cgi?id=40658

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

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

5 years ago[test] Fix the test from SVN r353917 when running without lld available
Martin Storsjo [Wed, 13 Feb 2019 07:50:21 +0000 (07:50 +0000)]
[test] Fix the test from SVN r353917 when running without lld available

These tests still relies on the default linker not to be overridden
via e.g. CLANG_DEFAULT_LINKER in cmake.

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

5 years ago[MinGW] Add the profiling library when necessary
Martin Storsjo [Wed, 13 Feb 2019 07:26:54 +0000 (07:26 +0000)]
[MinGW] Add the profiling library when necessary

Profiling still doesn't seem to work properly, but this at least
hooks up the library and eases completing whatever is missing.

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

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

5 years agoRevert r353880 "[HIP] Handle compile -m options and propagate into LLC"
Reid Kleckner [Tue, 12 Feb 2019 22:51:54 +0000 (22:51 +0000)]
Revert r353880 "[HIP] Handle compile -m options and propagate into LLC"

This was still causing test failures in the clang test suite.

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

5 years agodocs: Update the ShadowCallStack documentation.
Peter Collingbourne [Tue, 12 Feb 2019 22:45:23 +0000 (22:45 +0000)]
docs: Update the ShadowCallStack documentation.

- Remove most of the discussion of the x86_64 implementation;
  link to an older version of the documentation for details of
  that implementation.
- Add description of the compatibility and security issues discovered
  during the development of the aarch64 implementation for Android.

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

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

5 years ago[X86] Follow up to r353878, add MSVC compatibility command lines to other intrinsic...
Craig Topper [Tue, 12 Feb 2019 22:12:19 +0000 (22:12 +0000)]
[X86] Follow up to r353878, add MSVC compatibility command lines to other intrinsic tests that uses packed structs to control alignment.

r353878 fixed a bug in _mm_loadu_ps and added a command line to catch it. Adding additional command lines to prevent breaking other intrinsics in the future.

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

5 years ago[HIP] Fix hip-toolchain-rdc tests
Aaron Enye Shi [Tue, 12 Feb 2019 22:01:19 +0000 (22:01 +0000)]
[HIP] Fix hip-toolchain-rdc tests

Since we removed changed the way HIP Toolchain will propagate -m options into LLC, we need to remove from these older tests.

This is related to rC353880.

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

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

5 years agoMake ModuleDependencyCollector's method virtual (NFC)
Jonas Devlieghere [Tue, 12 Feb 2019 21:45:14 +0000 (21:45 +0000)]
Make ModuleDependencyCollector's method virtual (NFC)

For reproducers in LLDB we want to hook up into the existing clang
infrastructure. To make that happen we need to be able to override the
ModuleDependencyCollector's methods.

The alternative was to inherit from the DependencyCollector directly,
but that would mean re-implementing the ModuleDependencyListener and the
ModuleDependencyPPCallbacks and ModuleDependencyMMCallbacks.

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

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

5 years ago[HIP] Handle compile -m options and propagate into LLC
Aaron Enye Shi [Tue, 12 Feb 2019 21:21:06 +0000 (21:21 +0000)]
[HIP] Handle compile -m options and propagate into LLC

Allow the compile options for -m such as -mxnack/-mno-xnack, -msram-ecc/-mno-sram-ecc, -mcode-object-v3/-mno-code-object-v3 to propagate into LLC args.

Also add lit tests to verify features are properly passed.

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

Reviewers: yaxunl, kzhuravl

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

5 years ago[X86] Use __m128_u for _mm_loadu_ps after r353555
Reid Kleckner [Tue, 12 Feb 2019 21:04:21 +0000 (21:04 +0000)]
[X86] Use __m128_u for _mm_loadu_ps after r353555

Add secondary triple to existing SSE test for it.  I audited other uses
of __attribute__((__packed__)) in the intrinsic headers, and this seemed
to be the only missing one.

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

5 years agoDisable PIC/PIE for MSP430 target
Anton Korobeynikov [Tue, 12 Feb 2019 20:46:00 +0000 (20:46 +0000)]
Disable PIC/PIE for MSP430 target

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@353877 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[NFC] typo
JF Bastien [Tue, 12 Feb 2019 20:19:16 +0000 (20:19 +0000)]
[NFC] typo

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

5 years ago[AMDGPU] Require at least protected visibility for certain symbols
Scott Linder [Tue, 12 Feb 2019 18:30:38 +0000 (18:30 +0000)]
[AMDGPU] Require at least protected visibility for certain symbols

This allows the global visibility controls to be restrictive while still
populating the dynamic symbol table where required.

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

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

5 years ago[CMake][Fuchsia] Pass -ldl -lpthread LDFLAGS to second stage
Petr Hosek [Tue, 12 Feb 2019 16:24:46 +0000 (16:24 +0000)]
[CMake][Fuchsia] Pass -ldl -lpthread LDFLAGS to second stage

We're using static libc++ for the second stage which requires explicitly
linking -ldl and -lpthread.

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

5 years ago[Sema] Fix a crash in access checking for deduction guides
Ilya Biryukov [Tue, 12 Feb 2019 14:21:44 +0000 (14:21 +0000)]
[Sema] Fix a crash in access checking for deduction guides

Summary: See the added test for a repro.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRenaming yet another diagnostic to not conflict; NFC.
Aaron Ballman [Tue, 12 Feb 2019 13:19:02 +0000 (13:19 +0000)]
Renaming yet another diagnostic to not conflict; NFC.

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

5 years agoRenaming this diagnostic to not conflict with another; NFC.
Aaron Ballman [Tue, 12 Feb 2019 13:13:35 +0000 (13:13 +0000)]
Renaming this diagnostic to not conflict with another; NFC.

Amends r353837 which renamed the diagnostics to conflict.

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

5 years agoFixing a typo; NFC.
Aaron Ballman [Tue, 12 Feb 2019 13:04:11 +0000 (13:04 +0000)]
Fixing a typo; NFC.

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

5 years agoDisable test after r353718, r353725, r353729 while I investigate
Nico Weber [Tue, 12 Feb 2019 12:40:56 +0000 (12:40 +0000)]
Disable test after r353718, r353725, r353729 while I investigate

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

5 years ago[X86] Use the new unaligned vector typedefs for the loadu/storeu intrinsics pointer...
Craig Topper [Tue, 12 Feb 2019 07:44:40 +0000 (07:44 +0000)]
[X86] Use the new unaligned vector typedefs for the loadu/storeu intrinsics pointer arguments.

This matches what gcc does and what was suggested by rnk in PR20670.

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

5 years agoFix VS2015 build problem introduced by r353370.
Douglas Yung [Tue, 12 Feb 2019 02:17:51 +0000 (02:17 +0000)]
Fix VS2015 build problem introduced by r353370.

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

5 years agoAdd a new attribute, fortify_stdlib
Erik Pilkington [Mon, 11 Feb 2019 23:21:39 +0000 (23:21 +0000)]
Add a new attribute, fortify_stdlib

This attribute applies to declarations of C stdlib functions
(sprintf, memcpy...) that have known fortified variants
(__sprintf_chk, __memcpy_chk, ...). When applied, clang will emit
calls to the fortified variant functions instead of calls to the
defaults.

In GCC, this is done by adding gnu_inline-style wrapper functions,
but that doesn't work for us for variadic functions because we don't
support __builtin_va_arg_pack (and have no intention to).

This attribute takes two arguments, the first is 'type' argument
passed through to __builtin_object_size, and the second is a flag
argument that gets passed through to the variadic checking variants.

rdar://47905754

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

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

5 years ago[Sema] Mark GNU compound literal array init as an rvalue.
Eli Friedman [Mon, 11 Feb 2019 22:54:27 +0000 (22:54 +0000)]
[Sema] Mark GNU compound literal array init as an rvalue.

Basically the same issue as string init, except it didn't really have
any visible consequences before I removed the implicit lvalue-to-rvalue
conversion from CodeGen.

While I'm here, a couple minor drive-by cleanups: IgnoreParens never
returns a ConstantExpr, and there was a potential crash with string init
involving a ChooseExpr.

The analyzer test change maybe indicates we could simplify the analyzer
code a little with this fix?  Apparently a hack was added to support
lvalues in initializers in r315750, but I'm not really familiar with the
relevant code.

Fixes regression reported in the kernel build at
https://bugs.llvm.org/show_bug.cgi?id=40430#c6 .

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

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

5 years ago[WebAssembly] Make thread-related options consistent
Heejin Ahn [Mon, 11 Feb 2019 22:47:50 +0000 (22:47 +0000)]
[WebAssembly] Make thread-related options consistent

Summary:
There have been three options related to threads and users had to set
all three of them separately to get the correct compilation results.
This makes sure the relationship between the options makes sense and
sets necessary options for users if only part of the necessary options
are specified. This does:

- Remove `-matomics`; this option alone does not enable anything, so
  removed it to not confuse users.
- `-mthread-model posix` sets `-target-feature +atomics`
- `-pthread` sets both `-target-feature +atomics` and
  `-mthread-model posix`
Also errors out when explicitly given options don't match, such as
`-pthread` is given with `-mthread-model single`.

Reviewers: dschuff, sbc100, tlively, sunfish

Subscribers: jgravelle-google, jfb, cfe-commits

Tags: #clang

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

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

5 years agoFix a few tests that were missing ':' on CHECK lines and weren't testing anything.
Nico Weber [Mon, 11 Feb 2019 20:33:22 +0000 (20:33 +0000)]
Fix a few tests that were missing ':' on CHECK lines and weren't testing anything.

Found by `git grep '\/\/ CHECK-[^: ]* ' clang/test/ | grep -v RUN:`.

Also tweak CodeGenCXX/arm-swiftcall.cpp to still pass now that it checks more.

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

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

5 years ago[CodeGen] Set construction vtable visibility after creating initializer
Petr Hosek [Mon, 11 Feb 2019 20:13:42 +0000 (20:13 +0000)]
[CodeGen] Set construction vtable visibility after creating initializer

We must only set the construction vtable visibility after we create the
vtable initializer, otherwise the global value will be treated as
declaration rather than definition and the visibility won't be set.

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

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

5 years ago[COFF, ARM64] Remove definitions for _byteswap library functions
Tom Tan [Mon, 11 Feb 2019 20:04:02 +0000 (20:04 +0000)]
[COFF, ARM64] Remove definitions for _byteswap library functions

_byteswap_* functions are are implemented in below file as normal function
from libucrt.lib and declared in stdlib.h. Define them in intrin.h triggers
lld error "conflicting comdat type" and "duplicate symbols" which was just
added to LLD (https://reviews.llvm.org/D57324).

C:\Program Files (x86)\Windows Kits\10\Source\10.0.17763.0\ucrt\stdlib\byteswap.cpp

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

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

5 years agoAttempt to pacify bots more after r353718 and r353725
Nico Weber [Mon, 11 Feb 2019 18:01:27 +0000 (18:01 +0000)]
Attempt to pacify bots more after r353718 and r353725

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

5 years agoAttempt to pacify bots after r353718
Nico Weber [Mon, 11 Feb 2019 17:30:25 +0000 (17:30 +0000)]
Attempt to pacify bots after r353718

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

5 years agoMake test actually test something (colons were missing)
Nico Weber [Mon, 11 Feb 2019 16:37:02 +0000 (16:37 +0000)]
Make test actually test something (colons were missing)

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

5 years agoFixed header underline in docs.
Alexander Kornienko [Mon, 11 Feb 2019 15:17:13 +0000 (15:17 +0000)]
Fixed header underline in docs.

+ Removed trailing whitespace.

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

5 years ago[tools] Fix python DeprecationWarning: invalid escape sequence
Serge Guelton [Mon, 11 Feb 2019 15:03:17 +0000 (15:03 +0000)]
[tools] Fix python DeprecationWarning: invalid escape sequence

The python documentation says "it’s highly recommended that you use raw strings for all but the simplest expressions." (https://docs.python.org/3/library/re.html)

So do that with the attached patch generated by

    sed -i -e "s/re.search('/re.search(r'/g" $(git grep -l 're.search(')

The warning can be seen in e.g. python3.7:

    $ python3.7 -Wd
    >>> import re; re.search('\s', '')
    <stdin>:1: DeprecationWarning: invalid escape sequence \s

Commited on behalf of Marco Falke.
Differential Revision: https://reviews.llvm.org/D57528

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

5 years agoMake some helper functions static. NFC.
Benjamin Kramer [Mon, 11 Feb 2019 14:52:15 +0000 (14:52 +0000)]
Make some helper functions static. NFC.

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

5 years ago[analyzer] New checker for detecting usages of unsafe I/O functions
Kristof Umann [Mon, 11 Feb 2019 13:46:43 +0000 (13:46 +0000)]
[analyzer] New checker for detecting usages of unsafe I/O functions

There are certain unsafe or deprecated (since C11) buffer handling
functions which should be avoided in safety critical code. They
could cause buffer overflows. A new checker,
'security.insecureAPI.DeprecatedOrUnsafeBufferHandling' warns for
every occurrence of such functions (unsafe or deprecated printf,
scanf family, and other buffer handling functions, which now have
a secure variant).

Patch by Dániel Kolozsvári!

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

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

5 years agoFormat isInSystemMacro after D55782
Fangrui Song [Mon, 11 Feb 2019 13:30:04 +0000 (13:30 +0000)]
Format isInSystemMacro after D55782

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

5 years ago[clang][Index] Add a knob to index function parameters in declarations
Kadir Cetinkaya [Mon, 11 Feb 2019 13:02:21 +0000 (13:02 +0000)]
[clang][Index] Add a knob to index function parameters in declarations

Summary:
Parameters in declarations are useful for clangd, so that we can
provide symbol information for them as well. It also helps clangd to be
consistent whether a function's definition is accessible or not.

Reviewers: hokein, akyrtzi

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

Tags: #clang

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

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

5 years ago[libclang] Add attribute support for 'convergent'.
Sven van Haastregt [Mon, 11 Feb 2019 11:00:56 +0000 (11:00 +0000)]
[libclang] Add attribute support for 'convergent'.

This bumps CINDEX_VERSION_MINOR up (to 51).

Patch by Hsin-Hsiao Lin.

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

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

5 years ago[ASTImporter] Add test RedeclChainShouldBeCorrectAmongstNamespaces
Gabor Marton [Mon, 11 Feb 2019 10:27:58 +0000 (10:27 +0000)]
[ASTImporter] Add test RedeclChainShouldBeCorrectAmongstNamespaces

Summary:
We add a new test to show that redecl chains are not handled properly
amongst namespaces. We cannot pass this test now, so this is disabled.
Subsequent patches will make this test pass.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years ago[CMake][Fuchsia] Drop libclang.so from distribution
Petr Hosek [Mon, 11 Feb 2019 05:38:01 +0000 (05:38 +0000)]
[CMake][Fuchsia] Drop libclang.so from distribution

This is no longer needed now that all users have switched to clangd.

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

5 years agolong double is double on OpenBSD/NetBSD/PPC.
Brad Smith [Mon, 11 Feb 2019 02:53:16 +0000 (02:53 +0000)]
long double is double on OpenBSD/NetBSD/PPC.

Patch by George Koehler.

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

5 years agoFix test to pass on LLP64 targets
Reid Kleckner [Sun, 10 Feb 2019 20:20:26 +0000 (20:20 +0000)]
Fix test to pass on LLP64 targets

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

5 years agoFix clang tests broken by r353547 that depend on InstrProf
Reid Kleckner [Sun, 10 Feb 2019 20:17:07 +0000 (20:17 +0000)]
Fix clang tests broken by r353547 that depend on InstrProf

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

5 years agoUse llvm::is_contained. NFC
Fangrui Song [Sun, 10 Feb 2019 05:54:57 +0000 (05:54 +0000)]
Use llvm::is_contained. NFC

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

5 years ago[opaque pointer types] Cleanup CGBuilder's Create*GEP.
James Y Knight [Sat, 9 Feb 2019 22:22:28 +0000 (22:22 +0000)]
[opaque pointer types] Cleanup CGBuilder's Create*GEP.

The various EltSize, Offset, DataLayout, and StructLayout arguments
are all computable from the Address's element type and the DataLayout
which the CGBuilder already has access to.

After having previously asserted that the computed values are the same
as those passed in, now remove the redundant arguments from
CGBuilder's Create*GEP functions.

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

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

5 years ago[StaticAnalyzer] Add missing include to SMTAPI.h. [NFC]
David L. Jones [Sat, 9 Feb 2019 02:41:55 +0000 (02:41 +0000)]
[StaticAnalyzer] Add missing include to SMTAPI.h. [NFC]

This include is needed for types within SMTAPI.h. (It's very possible that
compilation would succeed without it, but that's only by chance.)

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

5 years agoFix buildbot failure from r353569.
Eli Friedman [Sat, 9 Feb 2019 02:22:17 +0000 (02:22 +0000)]
Fix buildbot failure from r353569.

I assumed lvalue-to-rvalue conversions of array type would never
happen, but apparently clang-tidy tries in some cases.

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

5 years ago[analyzer] Add a comment that FunctionCodeRegions may also need canonicalization
Artem Dergachev [Sat, 9 Feb 2019 01:00:32 +0000 (01:00 +0000)]
[analyzer] Add a comment that FunctionCodeRegions may also need canonicalization

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

5 years agoThis reverts commit 1440a848a635849b97f7a5cfa0ecc40d37451f5b.
Mikhail R. Gadelha [Sat, 9 Feb 2019 00:46:12 +0000 (00:46 +0000)]
This reverts commit 1440a848a635849b97f7a5cfa0ecc40d37451f5b.
and commit a1853e834c65751f92521f7481b15cf0365e796b.

They broke arm and aarch64

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

5 years ago[AMDGPU] Split dot-insts feature
Stanislav Mekhanoshin [Sat, 9 Feb 2019 00:34:41 +0000 (00:34 +0000)]
[AMDGPU] Split dot-insts feature

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

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

5 years ago[analyzer] CStringSyntaxChecks: Fix an off-by-one error in the strlcat() check.
Artem Dergachev [Fri, 8 Feb 2019 23:59:52 +0000 (23:59 +0000)]
[analyzer] CStringSyntaxChecks: Fix an off-by-one error in the strlcat() check.

oth strlcat and strlcpy cut off their safe bound for the argument value
at sizeof(destination). There's no need to subtract 1 in only one
of these cases.

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

rdar://problem/47873212

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

5 years ago-gmodules: Don't emit incomplete breadcrumbs pointing to nonexistant PCM files.
Adrian Prantl [Fri, 8 Feb 2019 23:15:42 +0000 (23:15 +0000)]
-gmodules: Don't emit incomplete breadcrumbs pointing to nonexistant PCM files.

When a module name is specified as -fmodule-name, that module gets a
clang::Module object, but it won't actually be built or imported; it
will be textual. CGDebugInfo wouldn't detect this and them emit a
DICompileUnit that had a hash but no name and that confused both
dsymutil, LLDB, and myself.

rdar://problem/47926508

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

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

5 years ago[CodeGen][ObjC] Fix assert on calling `__builtin_constant_p` with ObjC objects.
Volodymyr Sapsai [Fri, 8 Feb 2019 23:02:13 +0000 (23:02 +0000)]
[CodeGen][ObjC] Fix assert on calling `__builtin_constant_p` with ObjC objects.

When we are calling `__builtin_constant_p` with ObjC objects of
different classes, we hit the assertion

> Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file include/llvm/Support/Casting.h, line 254.

It happens because LLVM types for `ObjCInterfaceType` are opaque and
have no name (see `CodeGenTypes::ConvertType`). As the result, for
different ObjC classes we have different `is_constant` intrinsics with
the same name `llvm.is.constant.p0s_s`. When we try to reuse an
intrinsic with the same name, we fail because of type mismatch.

Fix by bitcasting `ObjCObjectPointerType` to `id` prior to passing as an
argument to `__builtin_constant_p`. This results in using intrinsic
`llvm.is.constant.p0i8` and correct types.

rdar://problem/47499250

Reviewers: rjmccall, ahatanak, void

Reviewed By: void, ahatanak

Subscribers: ddunbar, jkorous, hans, dexonsmith, cfe-commits

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

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

5 years ago[CodeGen][NFC] Update comments in CGExprConstant.cpp.
Eli Friedman [Fri, 8 Feb 2019 21:36:04 +0000 (21:36 +0000)]
[CodeGen][NFC] Update comments in CGExprConstant.cpp.

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

5 years ago[Sema] Make string literal init an rvalue.
Eli Friedman [Fri, 8 Feb 2019 21:18:46 +0000 (21:18 +0000)]
[Sema] Make string literal init an rvalue.

This allows substantially simplifying the expression evaluation code,
because we don't have to special-case lvalues which are actually string
literal initialization.

This currently throws away an optimization where we would avoid creating
an array APValue for string literal initialization.  If we really want
to optimize this case, we should fix APValue so it can store simple
arrays more efficiently, like llvm::ConstantDataArray.  This shouldn't
affect the memory usage for other string literals.  (Not sure if this is
a blocker; I don't think string literal init is common enough for this
to be a serious issue, but I could be wrong.)

The change to test/CodeGenObjC/encode-test.m is a weird side-effect of
these changes: we currently don't constant-evaluate arrays in C, so the
strlen call shouldn't be folded, but lvalue string init managed to get
around that check.  I this this is fine.

Fixes https://bugs.llvm.org/show_bug.cgi?id=40430 .

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

5 years agoFix typo
Adrian Prantl [Fri, 8 Feb 2019 21:13:25 +0000 (21:13 +0000)]
Fix typo

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

5 years ago[analyzer] Opt-in C Style Cast Checker for OSObject pointers
George Karpenkov [Fri, 8 Feb 2019 21:09:00 +0000 (21:09 +0000)]
[analyzer] Opt-in C Style Cast Checker for OSObject pointers

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

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

5 years agoPass the base element type of an array type to the visit method instead
Akira Hatanaka [Fri, 8 Feb 2019 19:46:53 +0000 (19:46 +0000)]
Pass the base element type of an array type to the visit method instead
of the array type itself.

This fixes a bug found by inspection that was introduced in r353459. I
don't have a test case for this since we don't yet have types that would
make the containing C struct non-trivial to copy/move but wouldn't make
it non-trivial to default-initialize or destruct.

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

5 years ago[X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of...
Craig Topper [Fri, 8 Feb 2019 19:45:08 +0000 (19:45 +0000)]
[X86] Add explicit alignment to __m128/__m128i/__m128d/etc. to allow matching of MSVC behavior with #pragma pack.

Summary:
With MSVC, #pragma pack is ignored when there is explicit alignment. This differs from gcc. Clang emulates this difference when compiling for Windows.

It appears that MSVC and its headers consider the __m128/__m128i/__m128d/etc. types to be explicitly aligned and ignores #pragma pack for them. Since we don't have explicit alignment on them in our headers, we don't match the MSVC behavior here.

This patch adds explicit alignment to match this behavior. I'm hoping this won't cause any problems when we're not emulating MSVC. But if someone knows of something that would be different we can swith to conditionally adding the alignment based on _MSC_VER.

I had to add explicitly unaligned types as well so we could use them in the loadu/storeu intrinsics which use __attribute__(__packed__). Using the now explicitly aligned types wouldn't produce align 1 accesses when targeting Windows.

Reviewers: rnk, erichkeane, spatel, RKSimon

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Delay emission of the error messages for the exceptions.
Alexey Bataev [Fri, 8 Feb 2019 18:02:25 +0000 (18:02 +0000)]
[OPENMP]Delay emission of the error messages for the exceptions.

Fixed diagnostic emission for the exceptions support in case of the
compilation of OpenMP code for the devices. From now on, it uses delayed
diagnostics mechanism, previously used for CUDA only. It allow to
diagnose not allowed used of exceptions only in functions that are going
to be codegen'ed.

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

5 years agoRevert "[OPENMP]Initial support for the delayed diagnostics."
Alexey Bataev [Fri, 8 Feb 2019 17:42:00 +0000 (17:42 +0000)]
Revert "[OPENMP]Initial support for the delayed diagnostics."

This reverts commit r353540. Erroneously committed, need to fix the
message and description.

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

5 years ago[OPENMP]Initial support for the delayed diagnostics.
Alexey Bataev [Fri, 8 Feb 2019 17:38:09 +0000 (17:38 +0000)]
[OPENMP]Initial support for the delayed diagnostics.

It is important to delay the emission of the diagnostic messages for the
functions unless it is proved that the function is going to be used on
the device side. It is required to support compilation with some of the
target-specific system headers.

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

5 years ago[ASTMatchers][NFC] Update comments on assorted `CXXMemberCallExpr` matchers.
Yitzhak Mandelbaum [Fri, 8 Feb 2019 16:00:44 +0000 (16:00 +0000)]
[ASTMatchers][NFC] Update comments on assorted `CXXMemberCallExpr` matchers.

Specifically:

* fixes the comments on `hasObjectExpression`,
* clarifies comments on `thisPointerType` and `on`,
* adds comments to `onImplicitObjectArgument`.

It also updates associated reference docs (using the doc tool).

Reviewers: alexfh, steveire, aaron.ballman

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

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

5 years ago[Format/ObjC] Fix [foo bar]->baz formatting as lambda arrow
Ben Hamilton [Fri, 8 Feb 2019 15:55:18 +0000 (15:55 +0000)]
[Format/ObjC] Fix [foo bar]->baz formatting as lambda arrow

Summary:
Currently, `UnwrappedLineParser` thinks an arrow token after
an ObjC method expression is a C++ lambda arrow, so it formats:

```
[foo bar]->baz
```

as:

```
[foo bar] -> baz
```

Because `UnwrappedLineParser` runs before `TokenAnnotator`, it can't
know if the arrow token is after an ObjC method expression or not.

This diff makes `TokenAnnotator` remove the TT_LambdaArrow on
the arrow token if it follows an ObjC method expression.

Test Plan: New test added. Ran test with:
  % ninja FormatTests && ./tools/clang/unittests/Format/FormatTests
  Confirmed test failed before diff and passed after diff.

Reviewers: krasimir, djasper, sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[opaque pointer types] Cleanup CGBuilder's Create*GEP.
James Y Knight [Fri, 8 Feb 2019 15:34:12 +0000 (15:34 +0000)]
[opaque pointer types] Cleanup CGBuilder's Create*GEP.

Some of these functions take some extraneous arguments, e.g. EltSize,
Offset, which are computable from the Type and DataLayout.

Add some asserts to ensure that the computed values are consistent
with the passed-in values, in preparation for eliminating the
extraneous arguments. This also asserts that the Type is an Array for
the calls named "Array" and a Struct for the calls named "Struct".

Then, correct a couple of errors:

1. Using CreateStructGEP on an array type. (this causes the majority
   of the test differences, as struct GEPs are created with i32
   indices, while array GEPs are created with i64 indices)

2. Passing the wrong Offset to CreateStructGEP in TargetInfo.cpp on
   x86-64 NACL (which uses 32-bit pointers).

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

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

5 years ago[ASTImporter][ASTImporterSpecificLookup] Add test for different operators
Gabor Marton [Fri, 8 Feb 2019 09:19:34 +0000 (09:19 +0000)]
[ASTImporter][ASTImporterSpecificLookup] Add test for different operators

Summary:
This is to check that operators are handled properly in
`ASTImporterSpecificLookup`.  Note, this lookup table is not used in LLDB, only
in CTU.

Reviewers: a_sidorin, shafik, a.sidorin

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

Tags: #clang

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

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

5 years ago[AST] Fix structural inequivalence of operators
Gabor Marton [Fri, 8 Feb 2019 08:55:32 +0000 (08:55 +0000)]
[AST] Fix structural inequivalence of operators

Summary: Operators kind was not checked, so we reported e.g. op- to be equal with op+

Reviewers: shafik, a_sidorin, aaron.ballman

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

Tags: #clang

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

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

5 years agoVariable auto-init: fix __block initialization
JF Bastien [Fri, 8 Feb 2019 01:29:17 +0000 (01:29 +0000)]
Variable auto-init: fix __block initialization

Summary:
Automatic initialization [1] of __block variables was trampling over the block's
headers after they'd been initialized, which caused self-init usage to crash,
such as here:

  typedef struct XYZ { void (^block)(); } *xyz_t;
  __attribute__((noinline))
  xyz_t create(void (^block)()) {
    xyz_t myself = malloc(sizeof(struct XYZ));
    myself->block = block;
    return myself;
  }
  int main() {
    __block xyz_t captured = create(^(){ (void)captured; });
  }

This type of code shouldn't be broken by variable auto-init, even if it's
sketchy.

[1] With -ftrivial-auto-var-init=pattern

<rdar://problem/47798396>

Reviewers: rjmccall, pcc, kcc

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[COFF, ARM64] Fix types for _ReadStatusReg, _WriteStatusReg
Eli Friedman [Fri, 8 Feb 2019 01:17:49 +0000 (01:17 +0000)]
[COFF, ARM64] Fix types for _ReadStatusReg, _WriteStatusReg

r344765 added those intrinsics, but used the wrong types.

Patch by Mike Hommey

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

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

5 years ago[NFC] Variable auto-init: use getAsVariableArrayType helper
JF Bastien [Fri, 8 Feb 2019 00:51:05 +0000 (00:51 +0000)]
[NFC] Variable auto-init: use getAsVariableArrayType helper

As suggested by @rjmccall in D57797.

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

5 years agobpf: teach BPF driver about the new CPU "v3"
Jiong Wang [Thu, 7 Feb 2019 22:51:56 +0000 (22:51 +0000)]
bpf: teach BPF driver about the new CPU "v3"

This patch simply teach BPF driver about the new CPU "v3" introduced in
LLVM backend.

Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353479 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[Sema][ObjC] Disallow non-trivial C struct fields in unions.
Akira Hatanaka [Thu, 7 Feb 2019 20:21:46 +0000 (20:21 +0000)]
[Sema][ObjC] Disallow non-trivial C struct fields in unions.

This patch fixes a bug where clang doesn’t reject union fields of
non-trivial C struct types. For example:

```
// This struct is non-trivial under ARC.
struct S0 {
  id x;
};

union U0 {
  struct S0 s0; // clang should reject this.
  struct S0 s1; // clang should reject this.
};

void test(union U0 a) {
  // Previously, both 'a.s0.x' and 'a.s1.x' were released in this
  // function.
}
```

rdar://problem/46677858

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

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

5 years ago[SEMA]Generalize deferred diagnostic interface, NFC.
Alexey Bataev [Thu, 7 Feb 2019 19:46:42 +0000 (19:46 +0000)]
[SEMA]Generalize deferred diagnostic interface, NFC.

Summary:
Deferred diagnostic interface is going to be used for OpenMP device
compilation. Generalized previously existed deferred diagnostic
interface for CUDA to be used with OpenMP and, possibly, other models.

Reviewers: rjmccall, tra

Subscribers: caomhin, cfe-commits, kkwli0

Tags: #clang

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

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

5 years ago[OpenCL][PR40603] In C++ preserve compatibility with OpenCL C v2.0
Anastasia Stulova [Thu, 7 Feb 2019 17:32:37 +0000 (17:32 +0000)]
[OpenCL][PR40603] In C++ preserve compatibility with OpenCL C v2.0

Valid OpenCL C code should still compile in C++ mode.

This change enables extensions and OpenCL types.

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

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

5 years ago[ASTImporter] Refactor unittests to be able to parameterize them in a more flexible way
Gabor Marton [Thu, 7 Feb 2019 16:52:48 +0000 (16:52 +0000)]
[ASTImporter] Refactor unittests to be able to parameterize them in a more flexible way

Summary:
Currently `TestImportBase` is derived from `ParameterizedTestsFixture`
which explicitly states that the gtest parameter can be only an
`ArgVector`. This is a limitation when we want to create tests which may
have different parameters.
E.g. we would like to create tests where we can combine different test
parameters. So, for example we'd like gtest to be able to provide
parameters of `<std::tuple<ArgVector, const char *>` instead of a simple
`ArgVector`.

Reviewers: a_sidorin, shafik, a.sidorin

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

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

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

5 years agoFix r350643 to limit COFF emission to <= 32 BYTES instead of BITS.
Erich Keane [Thu, 7 Feb 2019 15:14:11 +0000 (15:14 +0000)]
Fix r350643 to limit COFF emission to <= 32 BYTES instead of BITS.

The patch in r350643 incorrectly sets the COFF emission based on bits
instead of bytes. This patch converts the 32 via CharUnits to bits to
compare the correct values.

Change-Id: Icf38a16470ad5ae3531374969c033557ddb0d323

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