Commit Graph

59100 Commits

Author SHA1 Message Date
Yaron Keren 2ffb36e829 Add support for -fuse-ld= in the mingw toolchain driver.
We will still default to ld until such a time lld become a 
stable release. lld supports arm NT under the machine name "thumb2pe".

http://reviews.llvm.org/D11088

Patch by Martell Malone
Reviewed by Reid Kleckner

llvm-svn: 242121
2015-07-14 05:23:34 +00:00
NAKAMURA Takumi bbfa514f5b Mark clang/test/PCH/chain-openmp-threadprivate.cpp as REQUIRES:tls.
llvm-svn: 242116
2015-07-14 04:00:18 +00:00
NAKAMURA Takumi c5e50734e8 clang/test/lit.cfg: Introduce the feature "tls", for targeting cygwin.
Thread local storage is not implemented for targeting cygwin.

llvm-svn: 242115
2015-07-14 03:57:11 +00:00
Richard Smith 8a53a0ddbd Add file missed from r242105.
llvm-svn: 242109
2015-07-14 02:40:33 +00:00
Richard Smith ae6df27ef4 [modules] When diagnosing errors in module map files found by 'extern module' declarations, show how we got to that module map file.
llvm-svn: 242105
2015-07-14 02:06:01 +00:00
Adrian Prantl 5fe5b90b18 Remove a completely redundant initialization of llvm::TimePassesIsEnabled,
which is actually the variable backing up the llvm -time-passes command
line argument.
llvm::TimePassesIsEnabled is actually being initialized in CodeGenAction.

llvm-svn: 242099
2015-07-14 01:04:40 +00:00
Evgeniy Stepanov 7cacbe4d9e Basic code generation for MSan use-after-dtor.
Under the -fsanitize-memory-use-after-dtor (disabled by default) insert
an MSan runtime library call at the end of every destructor.

Patch by Naomi Musgrave.

llvm-svn: 242097
2015-07-14 00:34:50 +00:00
Richard Smith ce18a187f7 Extend -ftime-report to give more information about time spent reading module files.
llvm-svn: 242094
2015-07-14 00:26:00 +00:00
Samuel Antao 3e1ccbe8ba [OpenMP] Add REQUIRES pragma to threadprivate regression tests.
llvm-svn: 242090
2015-07-14 00:09:50 +00:00
David Majnemer e0b863f4c7 [Intrin.h] Use __ATOMIC_SEQ_CST instead of '5'
No functionality change is intended.

llvm-svn: 242087
2015-07-13 23:39:37 +00:00
David Majnemer 56e466745d [Intrin.h] Make the variable names more consistent
No functionality change intended.

llvm-svn: 242086
2015-07-13 23:38:56 +00:00
Artem Belevich 0ff05cd165 [cuda] Driver changes to compile and stitch together host and device-side CUDA code.
NOTE: reverts r242077 to reinstate r242058, r242065, 242067
        and includes fix for OS X test failures.

  - Changed driver pipeline to compile host and device side of CUDA
    files and incorporate results of device-side compilation into host
    object file.

  - Added a test for cuda pipeline creation in clang driver.

  New clang options:
  --cuda-host-only   - Do host-side compilation only.
  --cuda-device-only - Do device-side compilation only.

  --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
    compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
    than once in which case one device-compilation will be done per
    unique specified GPU architecture.

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

llvm-svn: 242085
2015-07-13 23:27:56 +00:00
Samuel Antao f8b5012dfb [OpenMP] Add TLS-based implementation for threadprivate directive.
llvm-svn: 242080
2015-07-13 22:54:53 +00:00
Rafael Espindola abbd6d6824 This reverts commit r242058, r242065, r242067.
The tests were failing on OS X.

Revert "[cuda] Driver changes to compile and stitch together host and device-side CUDA code."
Revert "Fixed regex to properly match '64' in the test case."
Revert "clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least."

llvm-svn: 242077
2015-07-13 22:26:30 +00:00
NAKAMURA Takumi 7227a88f23 clang/test/Driver/cuda-options.cu REQUIRES clang-driver, at least.
llvm-svn: 242067
2015-07-13 21:18:53 +00:00
Artem Belevich e9a400e065 Fixed regex to properly match '64' in the test case.
llvm-svn: 242065
2015-07-13 20:49:50 +00:00
Benjamin Kramer 8b851d0786 Move class into an anonymous namespace. NFC.
llvm-svn: 242064
2015-07-13 20:42:13 +00:00
Artem Belevich cd42e7f77a [cuda] Driver changes to compile and stitch together host and device-side CUDA code.
- Changed driver pipeline to compile host and device side of CUDA
    files and incorporate results of device-side compilation into host
    object file.

  - Added a test for cuda pipeline creation in clang driver.

  New clang options:
  --cuda-host-only   - Do host-side compilation only.
  --cuda-device-only - Do device-side compilation only.

  --cuda-gpu-arch=<ARCH> - specify GPU architecture for device-side
    compilation. E.g. sm_35, sm_30. Default is sm_20. May be used more
    than once in which case one device-compilation will be done per
    unique specified GPU architecture.

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

llvm-svn: 242058
2015-07-13 20:21:06 +00:00
Ben Langmuir 75a7e43581 [Modules] Allow missing header before a missing requirement
And make the module unavailable without breaking any parent modules.

If there's a missing requirement after we've already seen a missing
header, still update the IsMissingRequiement bit correctly.  Also,
diagnose missing requirements before missing headers, since the
existence of the header is moot if there are missing requirements.

llvm-svn: 242055
2015-07-13 19:48:52 +00:00
Nico Weber 0ccb1f2ee4 clang-cl: For files setting output names, mention which flags they belong to.
It always takes me a while to figure out how to say "preprocess to file
foo.txt" with clang-cl. With this, it might be easier.
http://reviews.llvm.org/D10890

llvm-svn: 242051
2015-07-13 18:54:56 +00:00
Mark Heffernan 7ccb5e2316 Update documentation for unroll pragmas on loops with runtime trip counts.
This change updates the documentation for the loop unrolling pragma behavior
change in r242047. Specifically, with that change "#pragma unroll" will not
unroll loops with a runtime trip count.

llvm-svn: 242048
2015-07-13 18:31:37 +00:00
Birunthan Mohanathas 67d81c8a77 clang-format: Print token type name instead of number in -debug output
Differential Revision: http://reviews.llvm.org/D11125

llvm-svn: 242039
2015-07-13 16:19:34 +00:00
Ulrich Weigand ef5aa29e12 Support alternate attribute spelling __enable_if__
Attribute names usually support an alternate spelling that uses double
underscores before and after the attribute name, like e.g. attribute
((__aligned__)) for attribute ((aligned)). This is necessary to allow
use of attributes in system headers without polluting the name space.

However, for attribute ((enable_if)) that alternate spelling does not
work correctly. This is because of code in Parser::ParseGNUAttributeArgs
(ParseDecl.cpp) that specifically checks for the "enable_if" spelling
without allowing the alternate spelling.

Similar code in ParseDecl.cpp uses the normalizeAttrName helper to allow
both spellings. This patch adds use of that helper for the "enable_if"
check as well, which fixes attribute ((__enable_if__)).

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

llvm-svn: 242029
2015-07-13 14:13:01 +00:00
Ulrich Weigand 73263d72d3 Update comment
As noticed by David Majnemer, update an out-of-date comment in
CGClass.cpp after the r241916 commit.

llvm-svn: 242021
2015-07-13 11:52:14 +00:00
Rafael Espindola d6e669458c Set the linkage before setting the visibility.
Otherwise the visibility setting code would not know that a given
function was available_externally.

Fixes PR24097.

llvm-svn: 242012
2015-07-13 06:07:58 +00:00
David Majnemer 8dadce78ed Intrin.h: Don't invade the program's namespace
The program is permitted to have stuff like '#define x' in it so avoid
using identifiers not reserved for the implementation.

llvm-svn: 242010
2015-07-13 02:53:23 +00:00
David Majnemer 3c8ea5f3f8 Intrin.h: Clean up our atomic intrinsics
Three things:
- The atomic intrinsics mandate memory barriers, let's start emitting
  some.
- We don't need to manually create RMW operations, we can just do
  __atomic_fetch_foo instead of performing __atomic_foo_fetch and
  undoing foo.
- Don't use inline assembly, we don't need it for these intrinsics.

This fixes PR24101.

llvm-svn: 242009
2015-07-13 02:53:19 +00:00
NAKAMURA Takumi b5785e07c4 Fix clang/unittests/ASTMatchers/Dynamic/Makefile. clangDynamicASTMatchers should be linked in advance of clangAST and clangASTMatchers.
llvm-svn: 242005
2015-07-13 00:52:19 +00:00
Richard Smith bcda1a9492 Minor simplification, no functionality change.
llvm-svn: 242001
2015-07-12 23:51:20 +00:00
Richard Smith 5fc18a9a1f [modules] Improve performance when there is a local declaration of an entity
before the first imported declaration.

We don't need to track all formerly-canonical declarations of an entity; it's sufficient to track those ones for which no other formerly-canonical declaration was imported into the same module. We call those ones "key declarations", and use them as our starting points for collecting redeclarations and performing namespace lookups.

llvm-svn: 241999
2015-07-12 23:43:21 +00:00
Davide Italiano a2275910a7 [Sema] If lvalue to rvalue reference cast is valid don't emit diagnostic.
In the test, y1 is not reference compatible to y2 and we currently assume
the cast is ill-formed so we emit a diagnostic. Instead, in order to honour
the standard, if y1 it's not reference-compatible to y2 then it can't be
converted using a static_cast, and a reinterpret_cast should be tried instead.
Richard Smith provided the correct interpretation of the standard and
explanation about the subtle difference between "can't be cast" and "the cast
is ill-formed". The former applies in this case.

PR:		23802
llvm-svn: 241998
2015-07-12 22:10:56 +00:00
NAKAMURA Takumi 146d5efa4e Tweak libclang's users, c-arcmt-test, c-index-test and libclangTests to satisfy LDFLAGS=-static.
llvm-svn: 241992
2015-07-12 12:17:55 +00:00
NAKAMURA Takumi 0089e4dc09 Reformat Makefile.
llvm-svn: 241991
2015-07-12 12:14:39 +00:00
Birunthan Mohanathas 305fa9c2bf clang-format: Add Mozilla brace breaking style
Differential Revision: http://reviews.llvm.org/D10883

llvm-svn: 241986
2015-07-12 03:13:54 +00:00
Daniel Jasper 1a5ea6eb20 clang-format: Extend vim integration so that a line range can be passed in.
llvm-svn: 241976
2015-07-11 06:46:26 +00:00
Justin Bogner c6ecb7c693 Sema: Allow null names to be passed in to isAcceptableTagRedeclaration
It's possible for TagRedeclarations to involve decls without a name,
ie, anonymous enums. We hit some undefined behaviour if we bind these
null names to the reference here.

We never dereference the name, so it's harmless if it's null - make it
a pointer to allow that.

Fixes the Modules/submodules-merge-defs.cpp test under ubsan.

llvm-svn: 241963
2015-07-10 23:05:47 +00:00
Richard Smith e70dadd67b [modules] When checking the include guard for a header, check whether it's
visible in the module we're considering entering. Previously we assumed that if
we knew the include guard for a modular header, we'd already parsed it, but
that need not be the case if a header is present in the current module and one
of its dependencies; the result of getting this wrong was that the current
module's submodule for the header would end up empty.

llvm-svn: 241953
2015-07-10 22:27:17 +00:00
Reid Kleckner 0bb1fc410b Disable C++ EH by default for clang-cl and MSVC environments
We don't need any more bug reports from users telling us that MSVC-style
C++ exceptions are broken. Developers and adventurous users can still
test the existing functionality by passing along -fexceptions to either
clang or clang-cl.

llvm-svn: 241952
2015-07-10 22:25:44 +00:00
Jordan Rose 9503501dae [analyzer] When forced to fake a block type, do it correctly.
BlockDecl has a poor AST representation because it doesn't carry its type
with it. Instead, the containing BlockExpr has the full type. This almost
never matters for the analyzer, but if the block decl contains static
local variables we need to synthesize a region to put them in, and this
region will necessarily not have the right type.

Even /that/ doesn't matter, unless

(1) the block calls the function or method containing the block, and
(2) the value of the block expr is used in some interesting way.

In this case, we actually end up needing the type of the block region,
and it will be set to our synthesized type. It turns out we've been doing
a terrible job faking that type -- it wasn't a block pointer type at all.
This commit fixes that to at least guarantee a block pointer type, using
the signature written by the user if there is one.

This is not really a correct answer because the block region's type will
/still/ be wrong, but further efforts to make this right in the analyzer
would probably be silly. We should just change the AST.

rdar://problem/21698099

llvm-svn: 241944
2015-07-10 21:41:59 +00:00
David Majnemer c0c42f3dea [MS ABI] Don't generates code for unreferenced inline definitions of library builtins
We should only consider declarations which were written, implicit
declarations shouldn't be considered.

This fixes PR24084.

llvm-svn: 241941
2015-07-10 20:55:38 +00:00
Richard Smith 8692a4d199 [modules] Fix "prefer own module over others" rule when selecting a module for a header to work in the presence of module hierarchy.
llvm-svn: 241936
2015-07-10 20:09:49 +00:00
Evgeniy Stepanov 45be9e0d24 Add an experimental flag -fsanitize-memory-use-after-dtor.
This flag will enable detection of use-after-destructor (but before
memory deallocation) bugs. No actual functionality yet.

https://code.google.com/p/address-sanitizer/issues/detail?id=73

Patch by Naomi Musgrave.

llvm-svn: 241935
2015-07-10 20:07:16 +00:00
Artem Belevich 959e0542b8 Changed Driver::getToolChain() to use Triple as an argument.
Differential Revision: http://reviews.llvm.org/D11105

llvm-svn: 241934
2015-07-10 19:47:55 +00:00
Akira Hatanaka 10bdb2b144 [inlineasm] Attach readonly and readnone to inline-asm instructions.
Previously, clang/llvm treated inline-asm instructions conservatively,
choosing not to eliminate the instructions or hoisting them out of a loop
even when it was safe to do so. This commit makes changes to attach a
readonly or readnone attribute to an inline-asm instruction, which enables
passes such as LICM and EarlyCSE to move or optimize away the instruction.

rdar://problem/11358192

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

llvm-svn: 241930
2015-07-10 18:44:40 +00:00
Yaron Keren 425b1a5106 Teach clang that -no-pthread is a valid command line option
The winpthreads library in mingw-w64 passes -no-pthread when building
since pthreads is not available to build itself and pthreads it is linked 
by default. clang does not link to pthreads by default but did error on 
unknown -no-pthread option thus stopping the winpthreads build.

http://reviews.llvm.org/D11087

Patch by Martell Malone.

llvm-svn: 241929
2015-07-10 18:42:13 +00:00
Eric Christopher 71e5e3defe Refactor PPC ABI handling to accept and silently ignore -mabi=altivec.
All of the ABIs we support are altivec style anyhow and so the option
doesn't make much sense with the modern ABIs. We could make this a more
noisy ignore, but it would break builds for projects that just pass
it along by default because of historical reasons.

llvm-svn: 241925
2015-07-10 18:25:54 +00:00
Eric Christopher e6b7cf4787 Fix a couple of typos: specifc->specific.
llvm-svn: 241924
2015-07-10 18:25:52 +00:00
Diego Novillo a05459691f Factor PGO and coverage flag processing out of Clang::ConstructJob
The function is massively large and GCC is emitting stack overflow
errors when building it (stack, as counted by the compiler, grows to
more than 16Kb).

The new flag processing logic added in r241825 took it over the limit.

llvm-svn: 241918
2015-07-10 18:00:07 +00:00
Ulrich Weigand 03ce2a16bf Respect alignment of nested bitfields
tools/clang/test/CodeGen/packed-nest-unpacked.c contains this test:

struct XBitfield {
  unsigned b1 : 10;
  unsigned b2 : 12;
  unsigned b3 : 10;
};
struct YBitfield {
  char x;
  struct XBitfield y;
} __attribute((packed));
struct YBitfield gbitfield;

unsigned test7() {
  // CHECK: @test7
  // CHECK: load i32, i32* getelementptr inbounds (%struct.YBitfield, %struct.YBitfield* @gbitfield, i32 0, i32 1, i32 0), align 4
  return gbitfield.y.b2;
}

The "align 4" is actually wrong.  Accessing all of "gbitfield.y" as a single
i32 is of course possible, but that still doesn't make it 4-byte aligned as
it remains packed at offset 1 in the surrounding gbitfield object.

This alignment was changed by commit r169489, which also introduced changes
to bitfield access code in CGExpr.cpp.  Code before that change used to take
into account *both* the alignment of the field to be accessed within the
current struct, *and* the alignment of that outer struct itself; this logic
was removed by the above commit.

Neglecting to consider both values can cause incorrect code to be generated
(I've seen an unaligned access crash on SystemZ due to this bug).

In order to always use the best known alignment value, this patch removes
the CGBitFieldInfo::StorageAlignment member and replaces it with a
StorageOffset member specifying the offset from the start of the surrounding
struct to the bitfield's underlying storage.  This offset can then be combined
with the best-known alignment for a bitfield access lvalue to determine the
alignment to use when accessing the bitfield's storage.

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

llvm-svn: 241916
2015-07-10 17:30:00 +00:00
Adrian Prantl 9b82de78fd Add a missing dependency to unittests/Frontend.
PR24067.

llvm-svn: 241915
2015-07-10 15:47:36 +00:00