Commit Graph

41617 Commits

Author SHA1 Message Date
Richard Smith 42fd9efa38 Revert r107690 (for PR7417) and add a testcase that it breaks. The approach of
that change turns out to not be reasonable: mutating the AST of a parsed
template during instantiation is not a sound thing to do, does not work across
chained PCH / modules builds, and is in any case a special-case workaround to a
more general problem that should be solved centrally.

llvm-svn: 249342
2015-10-05 20:05:21 +00:00
Adhemerval Zanella bffb20d0c2 [sanitizer] Enable lsan for AArch64
llvm-svn: 249338
2015-10-05 19:16:42 +00:00
Adrian Prantl 9641ae3746 Re-introduce the unique_ptr removed in r249328 and just make
~CodeGenABITypes out-of-line, which should have the same effect.

Thanks to David Blaikie for pointing this out!

llvm-svn: 249336
2015-10-05 18:54:30 +00:00
Adrian Prantl 83fde4bfc1 Undo the unique_ptr'fication of CodeGenABITypes::CGM introduced in r248762.
include/clang/CodeGenABITypes.h is in meant to be included by external
users, but using a unique_ptr on the private CodeGenModule introduces a
dependency on the type definition that prevents such a use.

NFC

llvm-svn: 249328
2015-10-05 17:41:16 +00:00
Aaron Ballman 3fd6c110be Adding a narrowing AST matcher for FunctionDecl::isVariadic(), plus tests and documentation.
llvm-svn: 249321
2015-10-05 14:41:27 +00:00
Benjamin Kramer d6bbee73ee [VFS] Fix the windows build by including the right headers.
llvm-svn: 249319
2015-10-05 14:06:36 +00:00
Benjamin Kramer 6b61805ebd [VFS] Fix compilation on systems where time_t is not int64_t.
No functional change intended.

llvm-svn: 249318
2015-10-05 14:02:15 +00:00
Benjamin Kramer 7708b2a4b6 [VFS] Add working directories to every virtual file system.
For RealFileSystem this is getcwd()/chdir(), the synthetic file systems can
make up one for themselves. OverlayFileSystem now synchronizes the working
directories when a new FS is added to the overlay or the overlay working
directory is set. This allows purely artificial file systems that have zero
ties to the underlying disks.

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

llvm-svn: 249316
2015-10-05 13:55:20 +00:00
Benjamin Kramer a25dcfd906 [VFS] Add an in-memory file system implementation.
This is a simple file system tree of memory buffers that can be filled by a
client. In conjunction with an OverlayFS it can be used to make virtual
files accessible right next to physical files. This can be used as a
replacement for the virtual file handling in FileManager and which I intend
to remove eventually.

llvm-svn: 249315
2015-10-05 13:55:14 +00:00
Benjamin Kramer 5532ef1a5d [VFS] Move class out of method so it looks less like Java.
No functionality change.

llvm-svn: 249314
2015-10-05 13:55:09 +00:00
Benjamin Kramer 268b51a188 [VFS] Remove setName from the file interface.
This streamlines the interface a bit and makes Status more immutable.
No functional change intended.

llvm-svn: 249310
2015-10-05 13:15:33 +00:00
Alexandros Lamprineas eda554a9b4 The Driver does not set the +strict-align flag when targeting
[ARM] armv6m + netbsd. Tests are misssing for armv6m + darwin as well.

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

llvm-svn: 249308
2015-10-05 12:45:10 +00:00
Daniel Sanders ff9525817b [mips][p5600] Add -mcpu=p5600 option.
Summary:

Reviewers: vkalintiris, atanasyan

Subscribers: cfe-commits

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

llvm-svn: 249306
2015-10-05 12:24:30 +00:00
Rafael Espindola ee4e08ba94 Use llvm::errc instead of std::errc.
llvm-svn: 249302
2015-10-05 11:49:35 +00:00
Anastasia Stulova b02e7835c5 [OpenCL] Fix casting a true boolean to an integer vector.
OpenCL v1.1 s6.2.2: for the boolean value true, every bit in the result vector should be set.

This change treats the i1 value as signed for the purposes of performing the cast to integer,
and therefore sign extend into the result.

Patch by Neil Hickey!

http://reviews.llvm.org/D13349

llvm-svn: 249301
2015-10-05 11:27:41 +00:00
Vasileios Kalintiris fdfc010e84 Remove support for the mips-mti-linux toolchain.
There are two remaining buildbot failures that we'll have to
investigate before submitting this again.

llvm-svn: 249298
2015-10-05 10:34:46 +00:00
Vasileios Kalintiris 6967527441 Re-commit "Add support for the new mips-mti-linux toolchain."
r249137 added support for the new mips-mti-linux toolchain. However,
the new tests of that commit, broke some buildbots because they didn't use
the correct regular expressions to capture the filename of Clang & LLD.

This commit re-applies the changes of r249137 and fixes the tests in
r249137 in order to match the filenames of the Clang and LLD executable.

llvm-svn: 249294
2015-10-05 09:12:36 +00:00
Adrian Prantl f0cd677b17 Module Debugging: Emit (ObjC) function declarations in the module scope
when building a module.

llvm-svn: 249282
2015-10-04 23:23:04 +00:00
Saleem Abdulrasool d170c4b57a Add -f[no-]declspec to control recognition of __declspec as a keyword
In versions of clang prior to r238238, __declspec was recognized as a keyword in
all modes.  It was then changed to only be enabled when Microsoft or Borland
extensions were enabled (and for CUDA, as a temporary measure).  There is a
desire to support __declspec in Playstation code, and possibly other
environments.  This commit adds a command-line switch to allow explicit
enabling/disabling of the recognition of __declspec as a keyword.  Recognition
is enabled by default in Microsoft, Borland, CUDA, and PS4 environments, and
disabled in all other environments.

Patch by Warren Ristow!

llvm-svn: 249279
2015-10-04 17:51:05 +00:00
Craig Topper e335f25949 SourceRanges are small and trivially copyable, don't them by reference.
llvm-svn: 249259
2015-10-04 04:53:55 +00:00
Eric Fiselier a3a7c56143 Diagnose const atomics in __atomic builtins.
Diagnose when a pointer to const T is used as the first argument in at atomic
builtin unless that builtin is a load operation. This is already checked for
C11 atomics builtins but not for __atomic ones.

This patch was given the LGTM by rsmith when it was part
of a larger review. (See http://reviews.llvm.org/D10407)

llvm-svn: 249252
2015-10-04 00:11:02 +00:00
Yaron Keren 8b563665c3 Replace double negation of !FileID.isInvalid() with FileID.isValid().
+couple more of double-negated !SourceLocation.isInvalid() unfixed in r249228.

llvm-svn: 249235
2015-10-03 10:46:20 +00:00
Yaron Keren ed1fe5d093 Replace double-negated !SourceLocation.isInvalid() with SourceLocation.isValid().
llvm-svn: 249228
2015-10-03 05:15:57 +00:00
Saleem Abdulrasool a8180a238c Driver: follow WoA ABI recommendations
The Windows on ARM ABI recommends that FPO be disabled.  This is since the
Windows on ARM ABI uses the FP for fast stack walking.  By paying the slight
cost of the loss of registers, a much faster backtrace is possible by using the
frame pointer since the pdata need not be consulted.  Furthermore, even if pdata
is not available, you can still more easily reconstruct the stack.

llvm-svn: 249227
2015-10-03 03:39:28 +00:00
Ahmed Bougacha 7dfaaf3891 [Headers][X86] Fix stream_load (movntdqa) to accept const*.
Per Intel intrinsics guide:
- _mm256_stream_load_si256 takes `__m256i const *'
- _mm_stream_load_si128 takes `__m128i *', for no good reason.

Let's accept const* for both.

llvm-svn: 249213
2015-10-02 23:29:26 +00:00
Ahmed Bougacha a3df87b5a9 Don't nil check non-nil class receiver of AArch64 stret calls.
I randomly came across this difference between AArch64 and other targets:
on the latter, we don't emit nil checks for known non-nil class method
calls thanks to r247350, but we still do for AArch64 stret calls.

They use different code paths, because those are special, as they go
through the regular msgSend, not the msgSend*_stret variants.

llvm-svn: 249205
2015-10-02 22:41:59 +00:00
Piotr Padlewski 276a78d860 Emiting invariant.group.barrier for ctors bugfix
Ensure that the vptr store in the most-derived constructor is not behind
an invariant group barrier. Previously, the base-most vptr store would
be the one behind no barrier, and that could result in the creator of
the object thinking it had the base-most vtable.
This bug caused clang call pure virtual functions when called from
constructor body.

http://reviews.llvm.org/D13373

llvm-svn: 249197
2015-10-02 22:12:40 +00:00
Dan Gohman 266b38ab56 [WebAssembly] Add a __builtin_wasm_resize_memory() intrinsic.
llvm-svn: 249179
2015-10-02 20:20:01 +00:00
Dan Gohman d4c5fb597d [WebAssembly] Add a __builtin_wasm_memory_size() intrinsic.
llvm-svn: 249176
2015-10-02 19:38:47 +00:00
Douglas Katzman 9e31cb9ea7 [Myriad]: Accept '-nostdlib' option
llvm-svn: 249166
2015-10-02 18:39:08 +00:00
Adrian Prantl 335f5c7e3e Module debugging: Don't emit forward declarations in module scopes.
A forward declaration inside a module header does not belong to the module.

llvm-svn: 249157
2015-10-02 17:36:14 +00:00
Adrian Prantl 7f30b4a14e Remove unused variable.
llvm-svn: 249155
2015-10-02 17:36:03 +00:00
Samuel Antao 4be30e92dc [OpenMP] Capture global variables in target regions.
All global variables that are not enclosed in a declare target region 
must be captured in the target region as local variables do. Currently, 
there is no support for declare target, so this patch adds support for 
capturing all the global variables used in a the target region.

llvm-svn: 249154
2015-10-02 17:14:03 +00:00
Samuel Antao bed3c46632 [OpenMP] Target directive host codegen.
This patch implements the outlining for offloading functions for code 
annotated with the OpenMP target directive. It uses a temporary naming 
of the outlined functions that will have to be updated later on once 
target side codegen and registration of offloading libraries is 
implemented - the naming needs to be made unique in the produced 
library.

llvm-svn: 249148
2015-10-02 16:14:20 +00:00
Bruno Cardoso Lopes a5efe3a66b [DarwinDriver] Reapply: Use -lto_library to specify the path for libLTO.dylib
Reapply r248935.

Usually, when using LTO with a clang installation newer than the
system's one, there's a libLTO.dylib version mismatch and LTO fails. One
solution to this is to make ld point to the right libLTO.dylib by
changing DYLD_LIBRARY_PATH.

However, ld64 supports specifying the complete path to the desired
libLTO.dylib through the -lto_library option. This commit adds support
for the clang driver to use this option whenever it's capable of finding
a libLTO.dylib in clang's installed library directory. This way, we
don't need to rely on DYLD_LIBRARY_PATH nor get caught by version
mismatches.

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

rdar://problem/7363476

llvm-svn: 249143
2015-10-02 15:10:33 +00:00
Vasileios Kalintiris ddb517da7c Revert "Add support for the new mips-mti-linux toolchain."
This reverts commit r249137 because it broke the Windows buildbots and
a Linux buildbot for LLD.

llvm-svn: 249141
2015-10-02 15:00:55 +00:00
Alexandros Lamprineas f5a8e6c5ab Implement ACLE 2.0 macros of chapters 6.6 and 6.7 for [ARM] and [Aarch64] targets.
Differential Revision: http://reviews.llvm.org/D12633

llvm-svn: 249140
2015-10-02 14:56:37 +00:00
Douglas Katzman 9dc81a4d0d Fix bogus comment.
llvm-svn: 249138
2015-10-02 14:41:38 +00:00
Vasileios Kalintiris 712f0887f6 Add support for the new mips-mti-linux toolchain.
Summary:
This new toolchain uses primarily LLVM-based tools, eg. compiler-rt, lld,
libcxx, etc. Because of this, it doesn't require neither an existing GCC
installation nor a GNU environment. Ideally, in a follow-up patch we
would like to add a new --{llvm|clang}-toolchain option (similar to
--gcc-toolchain) in order to allow the use of this toolchain with
independent Clang builds. For the time being, we use the --sysroot
option just to test the correctness of the paths generated by the
driver.

Reviewers: atanasyan, dsanders, rsmith

Subscribers: jfb, tberghammer, danalbert, srhines, dschuff, cfe-commits

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

llvm-svn: 249137
2015-10-02 14:38:23 +00:00
James Y Knight b8bfd96a10 Move functions declared in Stmt{ObjC,CXX}.h and OpenMPClause.h into
their associated .cpp file.

Previous refactorings long long ago had split out the above categories
of classes from Stmt.h into their own header files, but failed to also
split the Stmt.cpp implementation file similarly. Do so for
readability's sake.

llvm-svn: 249131
2015-10-02 13:41:04 +00:00
Bob Wilson 7e9fd56b26 Be slightly more permissive when checking for type-erased blocks.
This is a patch from Doug that was inadvertently omitted from r241543.

llvm-svn: 249116
2015-10-02 01:05:29 +00:00
Richard Smith 7d3c3efae4 PR24921: checking explicitly-specified template arguments when matching a
partial specialization can perform conversions on the argument. Be sure we
start again from the original argument when checking each possible template.

llvm-svn: 249114
2015-10-02 00:49:37 +00:00
Chandler Carruth cbe6411401 Fix the SSE4 byte sign extension in a cleaner way, and more thoroughly
test that our intrinsics behave the same under -fsigned-char and
-funsigned-char.

This further testing uncovered that AVX-2 has a broken cmpgt for 8-bit
elements, and has for a long time. This is fixed in the same way as
SSE4 handles the case.

The other ISA extensions currently work correctly because they use
specific instruction intrinsics. As soon as they are rewritten in terms
of generic IR, they will need to add these special casts. I've added the
necessary testing to catch this however, so we shouldn't have to chase
it down again.

I considered changing the core typedef to be signed, but that seems like
a bad idea. Notably, it would be an ABI break if anyone is reaching into
the innards of the intrinsic headers and passing __v16qi on an API
boundary. I can't be completely confident that this wouldn't happen due
to a macro expanding in a lambda, etc., so it seems much better to leave
it alone. It also matches GCC's behavior exactly.

A fun side note is that for both GCC and Clang, -funsigned-char really
does change the semantics of __v16qi. To observe this, consider:

  % cat x.cc
  #include <smmintrin.h>
  #include <iostream>

  int main() {
    __v16qi a = { 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    __v16qi b = _mm_set1_epi8(-1);
    std::cout << (int)(a / b)[0] << ", " << (int)(a / b)[1] << '\n';
  }
  % clang++ -o x x.cc && ./x
  -1, 1
  % clang++ -funsigned-char -o x x.cc && ./x
  0, 1

However, while this may be surprising, both Clang and GCC agree.

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

llvm-svn: 249097
2015-10-01 23:40:12 +00:00
Kaelyn Takata 2648702e92 Don't try to get a CXXRecordDecl from a non-class TemplateSpecializationType.
With -fms-extensions it is possible to have a non-class record that is a
template specialization cause an assertion failure via the call to
Type::getAsCXXRecordDecl. Fixes PR 24246.

llvm-svn: 249090
2015-10-01 22:38:51 +00:00
Zachary Turner f686a445db Don't adjust field offsets when using external record layout.
This was already being done when injecting the VBPtr, but not
when injecting the VFPtr.  This fixes a number of tests in LLDB's
test suite.

Reviewed by: David Majnemer
Differential Revision: http://reviews.llvm.org/D13276

llvm-svn: 249085
2015-10-01 22:08:02 +00:00
Douglas Gregor a602a153de Perform Objective-C lifetime adjustments before comparing deduced lambda result types.
Objective-C ARC lifetime qualifiers are dropped when canonicalizing
function types. Perform the same adjustment before comparing the
deduced result types of lambdas. Fixes rdar://problem/22344904.

llvm-svn: 249065
2015-10-01 20:20:47 +00:00
Devin Coughlin 195b3b0074 [analyzer] Add TK_EntireMemSpace invalidation trait.
This commit supports Sean Eveson's work on loop widening. It is NFC for now.
It adds a new TK_EntireMemSpace invalidation trait that, when applied to a
MemSpaceRegion, indicates that the entire memory space should be invalidated.

Clients can add this trait before invalidating. For example:

RegionAndSymbolInvalidationTraits ITraits;
ITraits.setTrait(MRMgr.getStackLocalsRegion(STC),
                 RegionAndSymbolInvalidationTraits::TK_EntireMemSpace);

This commit updates the existing logic invalidating global memspace regions for
calls to additionally handle arbitrary memspaces. When generating initial
clusters during cluster analysis we now add a cluster to the worklist if
the memspace for its base is marked with TK_EntireMemSpace.

This also moves the logic for invalidating globals from ClusterAnalysis to
invalidateRegionsWorker so that it is not shared with removeDeadBindingsWorker.

There are no explicit tests with this patch -- but when applied to Sean's patch
for loop widening in http://reviews.llvm.org/D12358 and after updating his code
to set the trait, the failing tests in that patch now pass.

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

llvm-svn: 249063
2015-10-01 20:09:11 +00:00
Douglas Gregor 6032d5b332 Simplify Sema::DeduceFunctionTypeFromReturnExpr and eliminae a redundant check.
NFC

llvm-svn: 249060
2015-10-01 19:52:44 +00:00
George Burgess IV ced56e6eca Teach -Wtautological-overlap-compare about enums
Prior to this patch, -Wtautological-overlap-compare would only warn us
if there was a sketchy logical comparison between variables and
IntegerLiterals. This patch makes -Wtautological-overlap-compare aware
of EnumConstantDecls, so it can apply the same logic to them.

llvm-svn: 249053
2015-10-01 18:47:52 +00:00
Adrian Prantl 42ce2d3ba3 Module debugging: Also emit Objective-C interfaces forward declarations
in their module scope when building a clang module.

llvm-svn: 249031
2015-10-01 16:57:02 +00:00