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

5 years ago[clang-cl] support /Oy- on aarch64
Martin Storsjo [Thu, 7 Feb 2019 12:46:49 +0000 (12:46 +0000)]
[clang-cl] support /Oy- on aarch64

MSVC supports /Oy- on aarch64, so clang-cl should too.

Patch by Nathan Froyd!

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

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

5 years agoTypo: s/follwing/following
Hans Wennborg [Thu, 7 Feb 2019 11:13:28 +0000 (11:13 +0000)]
Typo: s/follwing/following

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

5 years agoMove the SMT API to LLVM
Mikhail R. Gadelha [Thu, 7 Feb 2019 03:19:45 +0000 (03:19 +0000)]
Move the SMT API to LLVM

Moved everything SMT-related to LLVM and updated the cmake scripts.

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

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

5 years agoMoved the whole SMT API to a single file. NFC.
Mikhail R. Gadelha [Thu, 7 Feb 2019 03:18:21 +0000 (03:18 +0000)]
Moved the whole SMT API to a single file. NFC.

There is no advantage in having them in separate files, I doubt some will ever use them separately.

This also makes it easier to move the API to LLVM.

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

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

5 years agoGot rid of the `Z3ConstraintManager` class
Mikhail R. Gadelha [Thu, 7 Feb 2019 03:18:10 +0000 (03:18 +0000)]
Got rid of the `Z3ConstraintManager` class

Now, instead of passing the reference to a shared_ptr, we pass the shared_ptr instead.

I've also removed the check if Z3 is present in CreateZ3ConstraintManager as this function already calls CreateZ3Solver that performs the exactly same check.

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

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

5 years agoGeneralised the SMT state constraints
Mikhail R. Gadelha [Thu, 7 Feb 2019 03:17:36 +0000 (03:17 +0000)]
Generalised the SMT state constraints

This patch moves the ConstraintSMT definition to the SMTConstraintManager header to make it easier to move the Z3 backend around.

We achieve this by not using shared_ptr  anymore, as llvm::ImmutableSet doesn't seem to like it.

The solver specific exprs and sorts are cached in the Z3Solver object now and we move pointers to those objects around.

As a nice side-effect, SMTConstraintManager doesn't have to be a template anymore. Yay!

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

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

5 years ago[opaque pointer types] Make EmitCall pass Function Types to
James Y Knight [Thu, 7 Feb 2019 01:15:41 +0000 (01:15 +0000)]
[opaque pointer types] Make EmitCall pass Function Types to
CreateCall/Invoke.

Also, remove the getFunctionType() function from CGCallee, since it
accesses the pointee type of the value. The only use was in EmitCall,
so just inline it into the debug assertion.

This is the last of the changes for Call and Invoke in clang.

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

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

5 years ago[opaque pointer types] Pass through function types for TLS
James Y Knight [Thu, 7 Feb 2019 01:14:17 +0000 (01:14 +0000)]
[opaque pointer types] Pass through function types for TLS
initialization and global destructor calls.

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

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

5 years ago[analyzer] Canonicalize declarations within variable regions.
Artem Dergachev [Thu, 7 Feb 2019 00:30:20 +0000 (00:30 +0000)]
[analyzer] Canonicalize declarations within variable regions.

Memory region that correspond to a variable is identified by the variable's
declaration and, in case of local variables, the stack frame it belongs to.

The declaration needs to be canonical, otherwise we'd have two different
memory regions that correspond to the same variable.

Fix such bug for global variables with forward declarations and assert
that no other problems of this kind happen.

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

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

5 years agoRevert "[analyzer] Remove the "postponed" hack, deal with derived symbols..."
Artem Dergachev [Wed, 6 Feb 2019 23:56:43 +0000 (23:56 +0000)]
Revert "[analyzer] Remove the "postponed" hack, deal with derived symbols..."

This reverts commit r341722.

The "postponed" mechanism turns out to be necessary in order to handle
situations when a symbolic region is only kept alive by implicit bindings
in the Store. Otherwise the region is never scanned by the Store's worklist
and the binding gets dropped despite being live, as demonstrated
by the newly added tests.

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

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

5 years ago[COFF, ARM64] Add ARM64 support for MS intrinsic _fastfail
Tom Tan [Wed, 6 Feb 2019 20:08:26 +0000 (20:08 +0000)]
[COFF, ARM64] Add ARM64 support for MS intrinsic _fastfail

The MSDN document was also updated to reflect this, but it probably will take a few days to show in below link.

https://docs.microsoft.com/en-us/cpp/intrinsics/fastfail

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

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

5 years agoTest commit. NFC
Patrick Lyster [Wed, 6 Feb 2019 18:18:02 +0000 (18:18 +0000)]
Test commit. NFC

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

5 years agoSwitch to cantFail(), since it does the same assertion.
Stephen Hines [Wed, 6 Feb 2019 17:59:39 +0000 (17:59 +0000)]
Switch to cantFail(), since it does the same assertion.

Reviewers: cfe-commits, lhames

Reviewed By: lhames

Subscribers: hintonda, klimek, pirama

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

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

5 years ago[CMake] Unify scripts for generating VCS headers
Petr Hosek [Wed, 6 Feb 2019 03:51:00 +0000 (03:51 +0000)]
[CMake] Unify scripts for generating VCS headers

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

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

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

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

5 years ago[WebAssembly] Add atomics target option
Heejin Ahn [Wed, 6 Feb 2019 01:41:26 +0000 (01:41 +0000)]
[WebAssembly] Add atomics target option

Reviewers: tlively

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

Tags: #clang

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

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

5 years agoFix MSVC constructor call extension after b92d290e48e9 (r353181).
James Y Knight [Wed, 6 Feb 2019 00:06:03 +0000 (00:06 +0000)]
Fix MSVC constructor call extension after b92d290e48e9 (r353181).

The assert added to EmitCall there was triggering in Windows Chromium
builds, due to a mismatch of the return type.

The MSVC constructor call extension (`this->Foo::Foo()`) was emitting
the constructor call from 'EmitCXXMemberOrOperatorMemberCallExpr' via
calling 'EmitCXXMemberOrOperatorCall', instead of
'EmitCXXConstructorCall'. On targets where HasThisReturn is true, that
was failing to set the proper return type in the call info.

Switching to calling EmitCXXConstructorCall also allowed removing some
code e.g. the trivial copy/move support, which is already handled in
EmitCXXConstructorCall.

Ref: https://bugs.chromium.org/p/chromium/issues/detail?id=928861
Differential Revision: https://reviews.llvm.org/D57794

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

5 years ago[modules] Fix handling of initializers for templated global variables.
Richard Smith [Tue, 5 Feb 2019 23:37:13 +0000 (23:37 +0000)]
[modules] Fix handling of initializers for templated global variables.

For global variables with unordered initialization that are instantiated
within a module, we previously did not emit the global (or its
initializer) at all unless it was used in the importing translation unit
(and sometimes not even then!), leading to misbehavior and link errors.

We now emit the initializer for an instantiated global variable with
unordered initialization with side-effects in a module into every
translation unit that imports the module. This is unfortunate, but
mostly matches the behavior of a non-modular compilation and seems to be
the best that we can reasonably do.

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

5 years agoBasic CUDA-10 support.
Artem Belevich [Tue, 5 Feb 2019 22:38:58 +0000 (22:38 +0000)]
Basic CUDA-10 support.

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

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

5 years ago[Preprocessor] Add a note with framework location for "file not found" error.
Volodymyr Sapsai [Tue, 5 Feb 2019 22:34:55 +0000 (22:34 +0000)]
[Preprocessor] Add a note with framework location for "file not found" error.

When a framework with the same name is available at multiple framework
search paths, we use the first matching location. If a framework at this
location doesn't have all the headers, it can be confusing for
developers because they see only an error `'Foo/Foo.h' file not found`,
can find the complete framework with required header, and don't know the
incomplete framework was used instead.

Add a note explaining a framework without required header was found.
Also mention framework directory path to make it easier to find the
incomplete framework.

rdar://problem/39246514

Reviewers: arphaman, erik.pilkington, jkorous

Reviewed By: jkorous

Subscribers: jkorous, dexonsmith, cfe-commits

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

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

5 years ago[analyzer] Document RetainCountChecker behavior and annotations
George Karpenkov [Tue, 5 Feb 2019 22:27:10 +0000 (22:27 +0000)]
[analyzer] Document RetainCountChecker behavior and annotations

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

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

5 years ago[analyzer] [testing] Inside CmpRuns.py output also print the filename of the first...
George Karpenkov [Tue, 5 Feb 2019 22:26:57 +0000 (22:26 +0000)]
[analyzer] [testing] Inside CmpRuns.py output also print the filename of the first item in the path

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

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

5 years ago[analyzer] [RetainCountChecker] Bugfix: in non-OSObject-mode, do not track CXX method...
George Karpenkov [Tue, 5 Feb 2019 22:26:44 +0000 (22:26 +0000)]
[analyzer] [RetainCountChecker] Bugfix: in non-OSObject-mode, do not track CXX method calls

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

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

5 years agoFix a missing word in comment
Adrian Prantl [Tue, 5 Feb 2019 21:21:01 +0000 (21:21 +0000)]
Fix a missing word in comment

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

5 years ago[DOCS]Support for emission of the debug info for the Cuda devices, NFC.
Alexey Bataev [Tue, 5 Feb 2019 20:38:36 +0000 (20:38 +0000)]
[DOCS]Support for emission of the debug info for the Cuda devices, NFC.

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

5 years agoDo not use frame pointer by default for MSP430
Anton Korobeynikov [Tue, 5 Feb 2019 20:15:03 +0000 (20:15 +0000)]
Do not use frame pointer by default for MSP430

This is suggested by 3.3.9 of MSP430 EABI document.
We do allow user to manually enable frame pointer. GCC toolchain uses the same behavior.

Patch by Dmitry Mikushev!

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

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

5 years ago[DEBUG_INFO][NVPTX] Generate correct data about variable address class.
Alexey Bataev [Tue, 5 Feb 2019 19:45:57 +0000 (19:45 +0000)]
[DEBUG_INFO][NVPTX] Generate correct data about variable address class.

Summary:
Added ability to generate correct debug info data about the variable
address class. Currently, for all the locals and globals the default
values are used, ADDR_local_space(6) for locals and ADDR_global_space(5)
for globals. The values are taken from the table in
  https://docs.nvidia.com/cuda/archive/10.0/ptx-writers-guide-to-interoperability/index.html#cuda-specific-dwarf.
  We need to emit correct data for address classes of, at least, shared
  and constant globals. Currently, all these variables are treated by
  the cuda-gdb debugger as the variables in the global address space
  and, thus, it require manual data type casting.

Reviewers: echristo, probinson

Subscribers: jholewinski, aprantl, cfe-commits

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

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

5 years ago[opaque pointer types] More trivial changes to pass FunctionType to CallInst.
James Y Knight [Tue, 5 Feb 2019 19:17:50 +0000 (19:17 +0000)]
[opaque pointer types] More trivial changes to pass FunctionType to CallInst.

Change various functions to use FunctionCallee or Function*.

Pass function type through __builtin_dump_struct's dumpRecord helper.

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

5 years agoMinor cleanup: remove CGBuild::CreateConst*ByteGEP overloads taking a Value*.
James Y Knight [Tue, 5 Feb 2019 19:01:33 +0000 (19:01 +0000)]
Minor cleanup: remove CGBuild::CreateConst*ByteGEP overloads taking a Value*.

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

5 years ago[OPENMP] issue error messages for multiple teams contructs in a target construct
Kelvin Li [Tue, 5 Feb 2019 16:43:00 +0000 (16:43 +0000)]
[OPENMP] issue error messages for multiple teams contructs in a target construct

The fix is to issue error messages if there are more than one
teams construct inside a target constructs.

#pragma omp target
{
  #pragma omp teams
  {  ...  }

  #pragma omp teams
  { ... }
}

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

5 years ago[opaque pointer types] Pass function types for runtime function calls.
James Y Knight [Tue, 5 Feb 2019 16:42:33 +0000 (16:42 +0000)]
[opaque pointer types] Pass function types for runtime function calls.

Emit{Nounwind,}RuntimeCall{,OrInvoke} have been modified to take a
FunctionCallee as an argument, and CreateRuntimeFunction has been
modified to return a FunctionCallee. All callers have been updated.

Additionally, CreateBuiltinFunction is removed, as it was redundant
with CreateRuntimeFunction after some previous changes.

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

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

5 years ago[opaque pointer types] Fix the CallInfo passed to EmitCall in some
James Y Knight [Tue, 5 Feb 2019 16:05:50 +0000 (16:05 +0000)]
[opaque pointer types] Fix the CallInfo passed to EmitCall in some
edge cases.

Currently, EmitCall emits a call instruction with a function type
derived from the pointee-type of the callee. This *should* be the same
as the type created from the CallInfo parameter, but in some cases an
incorrect CallInfo was being passed.

All of these fixes were discovered by the addition of the assert in
EmitCall which verifies that the passed-in CallInfo matches the
Callee's function type.

As far as I know, these issues caused no bugs at the moment, as the
correct types were ultimately being emitted. But, some would become
problematic when pointee types are removed.

List of fixes:

* arrangeCXXConstructorCall was passing an incorrect value for the
  number of Required args, when calling an inheriting constructor
  where the inherited constructor is variadic. (The inheriting
  constructor doesn't actually get passed any of the user's args, but
  the code was calculating it as if it did).

* arrangeFreeFunctionLikeCall was not including the count of the
  pass_object_size arguments in the count of required args.

* OpenCL uses other address spaces for the "this" pointer. However,
  commonEmitCXXMemberOrOperatorCall was not annotating the address
  space on the "this" argument of the call.

* Destructor calls were being created with EmitCXXMemberOrOperatorCall
  instead of EmitCXXDestructorCall in a few places. This was a problem
  because the calling convention sometimes has destructors returning
  "this" rather than void, and the latter function knows about that,
  and sets up the types properly (through calling
  arrangeCXXStructorDeclaration), while the former does not.

* generateObjCGetterBody: the 'objc_getProperty' function returns type
  'id', but was being called as if it returned the particular
  property's type. (That is of course the *dynamic* return type, and
  there's a downcast immediately after.)

* OpenMP user-defined reduction functions (#pragma omp declare
  reduction) can be called with a subclass of the declared type. In
  such case, the call was being setup as if the function had been
  actually declared to take the subtype, rather than the base type.

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

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

5 years ago[NFC] Explicitly add -std=c++14 option to tests that rely on the C++14 default
Nemanja Ivanovic [Tue, 5 Feb 2019 12:05:53 +0000 (12:05 +0000)]
[NFC] Explicitly add -std=c++14 option to tests that rely on the C++14 default

When Clang/LLVM is built with the CLANG_DEFAULT_STD_CXX CMake macro that sets
the default standard to something other than C++14, there are a number of lit
tests that fail as they rely on the C++14 default.
This patch just adds the language standard option explicitly to such test cases.

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

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

5 years agoFix ICE on reference binding with mismatching addr spaces.
Anastasia Stulova [Tue, 5 Feb 2019 11:32:58 +0000 (11:32 +0000)]
Fix ICE on reference binding with mismatching addr spaces.

When we attempt to add an addr space qual to a type already
qualified by an addr space ICE is triggered. Before creating
a type with new address space, remove the old addr space.

Fixing PR38614!

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

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

5 years agoFix the sphinx buildbot after D54429
Kristof Umann [Tue, 5 Feb 2019 10:19:39 +0000 (10:19 +0000)]
Fix the sphinx buildbot after D54429

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

5 years ago[X86] Change MS inline asm clobber list filter to check for 'fpsr' instead of 'fpsw...
Craig Topper [Tue, 5 Feb 2019 06:13:14 +0000 (06:13 +0000)]
[X86] Change MS inline asm clobber list filter to check for 'fpsr' instead of 'fpsw' after D57641.

Summary: The backend used to print the x87 FPSW register as 'fpsw', but gcc inline asm uses 'fpsr'. After D57641, the backend now uses 'fpsr' to match.

Reviewers: rnk

Reviewed By: rnk

Subscribers: eraman, cfe-commits, llvm-commits

Tags: #clang

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

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