Commit Graph

27068 Commits

Author SHA1 Message Date
David Majnemer 0b996dd634 [MS ABI] Add a mangling for _Complex
MSVC doesn't implement a mangling for C99's _Complex so we must invent
our own.

For now, treating it like a class type called _Complex in the __clang
namespace.

This means that 'void f(__Complex int))'
will demangle as: 'void f(struct __clang::_Complex<int>)'

llvm-svn: 256583
2015-12-29 22:02:15 +00:00
Richard Smith de6d6c4860 Teach typo correction to properly handle mapping declarations to their
underlying decls. Preserve the found declaration throughout, and only map to
the underlying declaration when we want to check whether it's the right kind.
This allows us to provide the right source location for the found declaration,
and prepares for the possibility of underlying decls with a different name
from the found decl.

llvm-svn: 256575
2015-12-29 19:43:10 +00:00
Devin Coughlin 755baa4050 [analyzer] Nullability: allow cast to _Nonnull to suppress warning about returning nil.
The nullability checker currently allows casts to suppress warnings when a nil
literal is passed as an argument to a parameter annotated as _Nonnull:

  foo((NSString * _Nonnull)nil); // no-warning

It does so by suppressing the diagnostic when the *type* of the argument expression
is _Nonnull -- even when the symbolic value returned is known to be nil.

This commit updates the nullability checker to similarly honor such casts in the analogous
scenario when nil is returned from a function with a _Nonnull return type:

  return (NSString * _Nonnull)nil; // no-warning

This commit also normalizes variable naming between the parameter and return cases and
adds several tests demonstrating the limitations of this suppression mechanism (such as
when nil is cast to _Nonnull and then stored into a local variable without a nullability
qualifier). These tests are marked with FIXMEs.

rdar://problem/23176782

llvm-svn: 256567
2015-12-29 17:40:49 +00:00
David Majnemer 3421fb69c6 [MS ABI] Implement a mangling for _Atomic types
MSVC doesn't implement a mangling for C11's _Atomic so we must invent
our own.

For now, treating it like a class type called _Atomic in the __clang
namespace.

This means that 'void f(__Atomic(int))'
will demangle as: 'void f(struct __clang::_Atomic<int>)'

llvm-svn: 256557
2015-12-29 11:46:00 +00:00
David Majnemer 0a29fed31f [MS ABI] Cleanup our mangling of vector types
We used to produce a type which demangled to:
union __clang_vec8_F

That 'F' is the mangling for 'short' but it is present in the mangled
name in an inappropriate place, leading to it not getting demangled.

Instead, create a synthetic class type in a synthetic namespace called
__clang. With this, it now demangles to:
union __clang::__vector<short,8>

llvm-svn: 256556
2015-12-29 11:45:58 +00:00
Marina Yatsina afb72f38f8 [ms inline asm] Add support for label names with '$' chars
In MS inline asm syntax a label with '$' char produces an error, while in AT&T it does not.
In AT&T inline asm syntax Clang escapes the '$' char and replaces it with "$$". Adopted same approach for MS syntax.

Differential Revision: http://reviews.llvm.org/D15795

llvm-svn: 256545
2015-12-29 08:49:34 +00:00
Eric Christopher 3cb592d6b6 We check for dwarf 5 in the backend, so go ahead and pass it along via
the front end as well.

Note that DWARF5 isn't finalized and any feature support is subject to
change and accepting of the option doesn't mean we're supporting the
full range of the current standard.

llvm-svn: 256516
2015-12-28 19:58:44 +00:00
Serge Pavlov 5c49e1a349 Do not crash if class is defined in wrong scope.
This patch fixes PR16677. The latter represents the case when due to
misprinted character class definition occurs in the scope of template
arguments. Base class of this class depends on the template parameter in the
same scope and cannot be resolved, it causes crash. Right behavior is to
make semantic processing even if the definition is wrong, as the code
that emits appropriate message is called after the processing.

llvm-svn: 256511
2015-12-28 19:40:14 +00:00
Michael Kuperstein f3163dc461 [X86] Better support for the MCU psABI (clang part)
This adds support for the MCU psABI in a way different from r251223 and r251224,
basically reverting most of these two patches. The problem with the approach
taken in r251223/4 is that it only handled libcalls that originated from the backend.
However, the mid-end also inserts quite a few libcalls and assumes these use the
platform's default calling convention.

The previous patch tried to insert inregs when necessary both in the FE and,
somewhat hackily, in the CG. Instead, we now define a new default calling convention
for the MCU, which doesn't use inreg marking at all, similarly to what x86-64 does.

Differential Revision: http://reviews.llvm.org/D15055

llvm-svn: 256495
2015-12-28 14:39:54 +00:00
Alexey Bataev 6402bcad71 [OPENMP 4.5] Sema/parsing support for extended format of 'schedule' clause.
OpenMP 4.0-3.1 supports the next format of ‘schedule’ clause: schedule(kind[, chunk_size])
Where kind can be one of ‘static’, ‘dynamic’, ‘guided’, ‘auto’ or ‘runtime’.
OpenMP 4.5 defines the format: schedule([modifier [, modifier]:]kind[, chunk_size])
Modifier can be one of ‘monotonic’, ‘nonmonotonic’ or ‘simd’.

llvm-svn: 256487
2015-12-28 07:25:51 +00:00
Alexey Bataev 993d28073c [OPENMP 4.5] Do not allow 'linear' clause along with 'ordered(expr)' clause.
According to OpenMP 4.5 "A linear clause or an ordered clause with a parameter can be specified on a loop directive but not both.""

llvm-svn: 256485
2015-12-28 06:23:08 +00:00
Dimitry Andric 46f338ce7f On {mips,mipsel,mips64,mips64el}-freebsd, we need to pass any -G option to the assembler.
Summary:
See also:
https://sourceware.org/binutils/docs/as/MIPS-Options.html#index-g_t_0040code_007b_002dG_007d-option-_0028MIPS_0029-1392

Reviewers: theraven, atanasyan, brooks, emaste

Subscribers: rnk, emaste, cfe-commits, seanbruno, dim

Differential Revision: http://reviews.llvm.org/D10137

llvm-svn: 256468
2015-12-27 10:36:44 +00:00
Dimitry Andric f59a2b3901 Fix C++ support on recent DragonFly BSD releases
Summary:
[ Copied from https://llvm.org/bugs/show_bug.cgi?id=25597 ]

Clang support for DragonFly BSD is lagging a bit, resulting in poor
support for c++.

DragonFlyBSD is unique in that it has two base compilers.  At the time
of the last Clang update for DragonFly, these compilers were GCC 4.4 and
GCC 4.7 (default).

With DragonFly Release 4.2, GCC 4.4 was replaced with GCC 5.0, partially
because the C++11 support of GCC 4.7 was incomplete.  The DragonFly
project will Release version 4.4 soon.

This patch updates the Clang driver to use libstdc++ from GCC 5.2 The
support for falling back to the alternate compiler was removed for two
reasons:

1) The last release to use GCC 4.7 is DF 4.0 which has already reached EOL
2) GCC 4.7 libstdc++ is insufficient for many "ports"

Therefore, I think it is reasonable that the development version of
clang expects GCC 5.2 to be in place and not try to fall back to another
compiler.

The attached patch will do this.  The Tools.cpp file was signficantly
modified to fix the linking which had been changed somewhere along the
line.  The rest of the changes should be self-explanatory.

Reviewers: joerg, rsmith, davide

Subscribers: jrmarino, davide, cfe-commits

Differential Revision: http://reviews.llvm.org/D15166

llvm-svn: 256467
2015-12-27 10:01:44 +00:00
Dimitry Andric 904895f0ff For FreeBSD on mips, pass -G options to the linker
Summary:
On {mips,mipsel,mips64,mips64el}-freebsd, we need to pass any -G option to the linker.  See also:

https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html#index-G-2007

This has been adapted from https://reviews.freebsd.org/D1190, with an added test case.

Reviewers: theraven, atanasyan, emaste

Subscribers: brooks, tomatabacu, cfe-commits, seanbruno, emaste

Differential Revision: http://reviews.llvm.org/D9114

llvm-svn: 256461
2015-12-27 06:47:09 +00:00
NAKAMURA Takumi c86e9b79b8 Prune the feature "tls". No one is using it since TLS is enabled for Cygwin.
llvm-svn: 256457
2015-12-27 06:14:33 +00:00
Alexey Bataev e648e80fbf [OPENMP] Do not allow to use threadprivate or thread local variables as loop iteration variables.
According to OpenMP the loop iteration variable may not appear in a threadprivate directive.

llvm-svn: 256417
2015-12-25 13:38:08 +00:00
Sanjay Patel b28ca3f118 fix test that depends on LLVM optimizations
llvm-svn: 256395
2015-12-24 21:53:40 +00:00
Marina Yatsina 59d35f1415 [X86][ms-inline asm] Test case for adding support for memory operands that include structs
Test case for commit 256381

Differential Revision: http://reviews.llvm.org/D15749

llvm-svn: 256382
2015-12-24 12:11:40 +00:00
Alexey Bataev a636c7f9b9 [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause.

llvm-svn: 256330
2015-12-23 10:27:45 +00:00
Nico Weber 54bfae8f52 Make wasm-toolchain.c test pass on Windows.
llvm-svn: 256286
2015-12-22 22:30:14 +00:00
Anastasia Stulova 76fd1052fd [OpenCL] Fix atomic Builtins check for address spaces of non-atomic pointer
If there are two pointers passed to an atomic Builtin, 
Clang doesn't allow the second (non-atomic) one to be qualified
with an address space.

Remove this restriction by recording the address space of passed pointers
in atomics type diagnostics.

llvm-svn: 256243
2015-12-22 15:14:54 +00:00
Daniel Sanders 5176f7ea6b [mips] Add _GCC_HAVE_SYNC_COMPARE_AND_SWAP macros.
This fixes the 'pure virtual function called' failure with ThreadPool in a
clang-built clang. This fixes the llvm-mips-linux builder.

llvm-svn: 256240
2015-12-22 12:59:30 +00:00
Alexey Bataev 29c9209357 [OPENMP] Revert r256238 to fix the problem with tests on Linux.
llvm-svn: 256239
2015-12-22 12:44:46 +00:00
Alexey Bataev ef4c5584d5 [OPENMP 4.5] Parsing/sema for 'depend(sink:vec)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(sink:vec)' in 'ordered' directive for doacross loop synchronization. Patch adds parsing and semantic analysis for this clause.

llvm-svn: 256238
2015-12-22 12:21:47 +00:00
Eric Christopher 0746adeb86 Use -no-canonical-prefixes to make sure binaries names are easier to match.
llvm-svn: 256228
2015-12-22 01:45:45 +00:00
Dan Gohman f4b4e08db0 [WebAssembly] Remove the -target command-line flag from the ld commandline.
This flag isn't needed, or permitted, with the "ld" flavor of lld.

Also, add a basic ld commandline test.

llvm-svn: 256216
2015-12-21 23:30:41 +00:00
David Majnemer 2b9349db38 [clang-cl] Add support for /Brepro
The /Brepro flag controls whether or not the compiler should embed
timestamps into the object file.  Object files which do not embed
timestamps are not suitable for incremental linking but are suitable for
hermetic build systems and staged self-hosts of clang.

A normal clang spelling of this flag has been added,
-mincremental-linker-compatible.

llvm-svn: 256204
2015-12-21 22:09:34 +00:00
James Y Knight 51a62f15d8 Tweak myriad-toolchain test.
The test failed when run on a SPARC host, since it was finding the
native gcc installation by accident.

llvm-svn: 256191
2015-12-21 20:30:49 +00:00
Vedant Kumar 2f5bb1150d Reapply "[CodeGen] Fix assignments of inline layouts into the byref structure"
When using blocks, a byref structure is created to represent the
closure. The "byref.layout" field of this structure is an i8*. However,
some 'inline' layouts are represented as i64's, not i8*'s.

Prior to r246985 we cast the i64 'inline' layout to an i8* before
assigning it into the byref structure. This patch brings the cast back
and adds a regression test.

The original version of this patch was too invasive. This version only adds the
cast to BuildByrefLayout.

Differential Revision: http://reviews.llvm.org/D15674

rdar://23713871

llvm-svn: 256190
2015-12-21 20:21:15 +00:00
Vedant Kumar 3ed0df070e Revert "[CodeGen] Fix assignments of inline layouts into the byref structure"
This reverts commit r256185. It breaks CodeGenObjC/fragile-arc.m.

llvm-svn: 256186
2015-12-21 19:43:25 +00:00
Vedant Kumar eb37ec87e4 [CodeGen] Fix assignments of inline layouts into the byref structure
When using blocks, a byref structure is created to represent the
closure. The "byref.layout" field of this structure is an i8*. However,
some 'inline' layouts are represented as i64's, not i8*'s.

Prior to r246985 we cast the i64 'inline' layout to an i8* before
assigning it into the byref structure. This patch brings the cast back
and adds a regression test.

rdar://23713871

llvm-svn: 256185
2015-12-21 19:30:37 +00:00
James Molloy f97fdae4d0 [Driver] Pass -O* to the gold plugin via -plugin-opt
The gold plugin understands -O0..-O3, but these are not currently being passed to it.

llvm-svn: 256146
2015-12-21 10:44:36 +00:00
NAKAMURA Takumi 9ec6a826dd [Cygwin] Enable TLS as emutls.
It resolves clang selfhosting with std::once() for Cygwin.

FIXME: It may be EmulatedTLS-generic also for X86-Android.
FIXME: Pass EmulatedTLS to LLVM CodeGen from Clang with -femulated-tls.
llvm-svn: 256134
2015-12-21 02:37:23 +00:00
Michael Kuperstein 591278c08d [X86] Add missing m64/int64 conversions
Define the 64-bit equivalents of _m_to_int and _m_from_int.

Differential Revision: http://reviews.llvm.org/D15572

llvm-svn: 256122
2015-12-20 12:37:18 +00:00
Michael Kuperstein beae026738 [X86] Add signed aliases for popcnt intrinsics
The Intel manual documents both an unsigned form (_mm_popcnt_u32)
and a signed form (_popcnt32) of the intrinsic. Add the missing signed form.

Differential Revision: http://reviews.llvm.org/D15568

llvm-svn: 256121
2015-12-20 12:35:35 +00:00
Paul Robinson 0334a047df Driver part of debugger tuning.
Adds driver options named -glldb and -gsce to mean -g plus tuning for
lldb and SCE debuggers respectively; the existing -ggdb option does
the same for gdb. Existing options -ggdb0, -ggdb1 etc. unpack into
-ggdb -g<N>.  (There will not be -glldb<N> or -gsce<N> options.) The
tuning gets a target-specific default in the driver, and is passed
into cc1 with the new -debugger-tuning option.

As fallout, fixes where '-gsplit-dwarf -g0' would ignore the -g0 part
on Linux.

Differential Revision: http://reviews.llvm.org/D15651

llvm-svn: 256104
2015-12-19 19:41:48 +00:00
Richard Smith ac9f5a9c14 Test for diagnostic quality improvement in r256049.
llvm-svn: 256083
2015-12-19 03:12:14 +00:00
Richard Smith d63db6ef1f Fix crash-on-invalid if a :: is followed by two or more open parentheses (and then something else).
llvm-svn: 256080
2015-12-19 02:40:19 +00:00
Richard Smith db0ac5572f Split RequireCompleteType into a function that actually requires that the type
is complete (with an error produced if not) and a function that merely queries
whether the type is complete. Either way we'll trigger instantiation if
necessary, but only the former will diagnose and recover from missing module
imports.

The intent of this change is to prevent a class of bugs where code would call
RequireCompleteType(..., 0) and then ignore the result. With modules, we must
check the return value and use it to determine whether the definition of the
type is visible.

This also fixes a debug info quality issue: calls to isCompleteType do not
trigger the emission of debug information for a type in limited-debug-info
mode. This allows us to avoid emitting debug information for type definitions
in more cases where we believe it is safe to do so.

llvm-svn: 256049
2015-12-18 22:40:25 +00:00
Richard Smith 82b8d4e6fd [modules] Don't try to use the definition of a class if
RequireCompleteType(..., 0) says we're not permitted to do so. The definition
might not be visible, even though we know what it is.

llvm-svn: 256045
2015-12-18 22:19:11 +00:00
Bob Wilson 2b2a0ae76d PIC should not be enabled by default on Darwin with -static.
r245667 changed -static so that it doesn't override an explicit -fPIC
option, but -static should still change the default for Darwin for -fno-PIC.
This matches longstanding GCC and Clang behavior on Darwin and changing it
would be disruptive, with no significant benefit.
http://reviews.llvm.org/D15455
rdar://problem/23811045

llvm-svn: 256026
2015-12-18 20:37:54 +00:00
Alexey Bataev 6f531ec0a2 [OPENMP] Remove explicit call for implicit barrier
#pragma omp parallel needs an implicit barrier that is currently done by an explicit call to __kmpc_barrier. However, the runtime already ensures a barrier in __kmpc_fork_call which currently leads to two barriers per region per thread.
Differential Revision: http://reviews.llvm.org/D15561

llvm-svn: 255992
2015-12-18 10:24:53 +00:00
Alexey Bataev 8ef3141127 [OPENMP] Fix for http://llvm.org/PR25878: Error compiling an OpenMP program
OpenMP codegen tried to emit the code for its constructs even if it was detected as a dead-code. Added checks to ensure that the code is emitted if the code is not dead.

llvm-svn: 255990
2015-12-18 07:58:25 +00:00
Alexey Bataev eb48235033 [OPENMP 4.5] Parsing/sema analysis for 'depend(source)' clause in 'ordered' directive.
OpenMP 4.5 adds 'depend(source)' clause for 'ordered' directive to support cross-iteration dependence. Patch adds parsing and semantic analysis for this construct.

llvm-svn: 255986
2015-12-18 05:05:56 +00:00
Douglas Gregor 0253543c92 ObjC properties: consider ownership of properties from protocols when synthesizing.
When determining whether ownership was explicitly written for a
property when it is being synthesized, also consider that the original
property might have come from a protocol. Fixes rdar://problem/23931441.

llvm-svn: 255943
2015-12-18 00:52:31 +00:00
Easwaran Raman 695890c971 Attach maximum function count to Module when using PGO mode.
This sets the maximum entry count among all functions in the program to the module using module flags. This allows the optimizer to use this information.

Differential Revision: http://reviews.llvm.org/D15163

llvm-svn: 255918
2015-12-17 19:14:27 +00:00
Chad Rosier 803f43bf6d [x86] Filecheck is case sensitive. Capitalize directives.
llvm-svn: 255916
2015-12-17 19:01:55 +00:00
Chad Rosier 0df679e450 [x86] Filecheck is case sensitive. Capitalize directives.
llvm-svn: 255915
2015-12-17 18:54:42 +00:00
Artem Belevich 9b9294674b [CUDA] Make vtable construction aware of host/device side of CUDA compilation.
C++ emits vtables for classes that have key function present in the
current TU. While we compile CUDA the fact that key function was found
in this TU does not mean that we are going to generate code for it. E.g.
vtable for a class with host-only methods should not (and can not) be
generated on device side, because we'll never generate code for them
during device-side compilation.

This patch adds an extra CUDA-specific check during key method computation
and filters out potential key methods that are not suitable for this side
of CUDA compilation.

When we codegen vtable, entries for unsuitable methods are set to null.

Differential Revision: http://reviews.llvm.org/D15309

llvm-svn: 255911
2015-12-17 18:12:36 +00:00
Marina Yatsina 71ebc691f6 [ms-inline-asm] Add support for composite structs in MS inline asm
Add MS inline asm support for structs that contain fields that are also structs.

Differential Revision: http://reviews.llvm.org/D15578

llvm-svn: 255890
2015-12-17 12:51:51 +00:00